mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
. First cut of the Externalised UI Actions
- XML Config for UI actions: web-client-config-actions.xml - commented examples are included in the config, I will write up a Wiki page to document it properly :) - Named groups of actions can also be reused across screens (where as previously individual ActionLink components had to be coded up for each screen by hand in the JSP) - Individual Actions can be reused across action groups or defined against a specific action group - UI actions for Browse (Create, More, Document and Space actions), Document and Space details pages now externalised into config - Refactoring of other JSPs to use externalised config - big reduction in hand coded JSF tags and code duplication between pages . Document Details and Space Details pages now have Actions panel on the right hand side instead of an Actions drop-down menu . Several unreported minor bugs fixed where actions conditions or listeners were inconsistent between browse and details pages git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2553 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -27,6 +27,7 @@ import javax.faces.event.ActionEvent;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
import org.alfresco.web.ui.common.component.UIMenu;
|
||||
import org.alfresco.web.ui.repo.component.UIActions;
|
||||
|
||||
/**
|
||||
* @author kevinr
|
||||
@@ -78,10 +79,17 @@ public class ActionLinkRenderer extends BaseRenderer
|
||||
|
||||
UIActionLink link = (UIActionLink)component;
|
||||
|
||||
if (isInMenu(link) == true)
|
||||
UIComponent verticalContiner = getVerticalContainer(link);
|
||||
if (verticalContiner != null)
|
||||
{
|
||||
// render as menu item
|
||||
out.write( renderMenuAction(context, link) );
|
||||
int padding = link.getPadding();
|
||||
|
||||
if (verticalContiner instanceof UIActions)
|
||||
{
|
||||
padding = ((UIActions)verticalContiner).getVerticalSpacing();
|
||||
}
|
||||
// render as menu item style action link
|
||||
out.write( renderMenuAction(context, link, padding) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -239,7 +247,7 @@ public class ActionLinkRenderer extends BaseRenderer
|
||||
*
|
||||
* @return action link HTML
|
||||
*/
|
||||
private String renderMenuAction(FacesContext context, UIActionLink link)
|
||||
private String renderMenuAction(FacesContext context, UIActionLink link, int padding)
|
||||
{
|
||||
StringBuilder buf = new StringBuilder(256);
|
||||
|
||||
@@ -252,7 +260,6 @@ public class ActionLinkRenderer extends BaseRenderer
|
||||
}
|
||||
|
||||
buf.append("</td><td");
|
||||
int padding = link.getPadding();
|
||||
if (padding != 0)
|
||||
{
|
||||
buf.append(" style=\"padding:")
|
||||
@@ -314,23 +321,24 @@ public class ActionLinkRenderer extends BaseRenderer
|
||||
// Private helpers
|
||||
|
||||
/**
|
||||
* Return true if the action link is present within a UIMenu component container
|
||||
* Return any vertically rendered container component the action link is present within
|
||||
*
|
||||
* @param link The ActionLink to test
|
||||
*
|
||||
* @return true if the action link is present within a UIMenu component
|
||||
* @return UIComponent vertically rendered component
|
||||
*/
|
||||
private static boolean isInMenu(UIActionLink link)
|
||||
private static UIComponent getVerticalContainer(UIActionLink link)
|
||||
{
|
||||
UIComponent parent = link.getParent();
|
||||
while (parent != null)
|
||||
{
|
||||
if (parent instanceof UIMenu)
|
||||
if (parent instanceof UIMenu ||
|
||||
(parent instanceof UIActions && ((UIActions)parent).getVerticalSpacing() != 0))
|
||||
{
|
||||
break;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return (parent != null);
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
@@ -355,42 +355,6 @@ public class RichListRenderer extends BaseRenderer
|
||||
public void renderListBefore(FacesContext context, UIRichList richList, UIColumn[] columns)
|
||||
throws IOException
|
||||
{
|
||||
// ResponseWriter out = context.getResponseWriter();
|
||||
|
||||
// render column headers as labels
|
||||
// TODO: add "showHeaders" to RichList to allow hiding of header facets for some view modes
|
||||
/*
|
||||
out.write("<tr");
|
||||
outputAttribute(out, richList.getAttributes().get("headerStyleClass"), "class");
|
||||
out.write('>');
|
||||
for (int i=0; i<columns.length; i++)
|
||||
{
|
||||
UIColumn column = columns[i];
|
||||
|
||||
if (column.isRendered() == true)
|
||||
{
|
||||
out.write("<th");
|
||||
outputAttribute(out, column.getAttributes().get("width"), "width");
|
||||
outputAttribute(out, column.getAttributes().get("style"), "style");
|
||||
outputAttribute(out, column.getAttributes().get("styleClass"), "class");
|
||||
out.write('>');
|
||||
|
||||
// output the header facet if any
|
||||
UIComponent header = column.getHeader();
|
||||
if (header != null)
|
||||
{
|
||||
header.encodeBegin(context);
|
||||
header.encodeChildren(context);
|
||||
header.encodeEnd(context);
|
||||
}
|
||||
}
|
||||
|
||||
// we don't render child controls for the header row
|
||||
out.write("</th>");
|
||||
}
|
||||
out.write("</tr>");
|
||||
*/
|
||||
|
||||
this.rowIndex = 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user