mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
. First pass of a new style for the header area in the web-client UI
- Reclaims a large ammount of unused vertical space at the top of the application git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2474 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -38,6 +38,7 @@ import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||
import org.alfresco.service.cmr.repository.TemplateNode;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
@@ -97,6 +98,14 @@ public class NavigationBean
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ruleService The ruleService to use
|
||||
*/
|
||||
public void setRuleService(RuleService ruleService)
|
||||
{
|
||||
this.ruleService = ruleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cifsServer The cifsServer to set.
|
||||
*/
|
||||
@@ -189,6 +198,15 @@ public class NavigationBean
|
||||
this.helpUrl = helpUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of rules associated with the current space
|
||||
*/
|
||||
public int getRuleCount()
|
||||
{
|
||||
Node node = getCurrentNode();
|
||||
return (node != null ? this.ruleService.countRules(node.getNodeRef()) : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the search context object if any.
|
||||
*/
|
||||
@@ -361,7 +379,6 @@ public class NavigationBean
|
||||
Path path = this.nodeService.getPath(nodeRef);
|
||||
|
||||
// resolve CIFS network folder location for this node
|
||||
|
||||
DiskSharedDevice diskShare = cifsServer.getConfiguration().getPrimaryFilesystem();
|
||||
|
||||
if (diskShare != null)
|
||||
@@ -650,6 +667,9 @@ public class NavigationBean
|
||||
/** NamespaceService bean reference */
|
||||
protected NamespaceService namespaceService;
|
||||
|
||||
/** RuleService bean reference*/
|
||||
protected RuleService ruleService;
|
||||
|
||||
/** CIFSServer bean reference */
|
||||
protected CIFSServer cifsServer;
|
||||
|
||||
|
@@ -99,6 +99,7 @@ public abstract class UserMembersBean
|
||||
/** roles for current person */
|
||||
private List<PermissionWrapper> personRoles = null;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Abstract methods
|
||||
|
||||
@@ -109,6 +110,7 @@ public abstract class UserMembersBean
|
||||
*/
|
||||
public abstract Node getNode();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean property getters and setters
|
||||
|
||||
|
@@ -111,8 +111,8 @@ public class NewRuleWizard extends BaseActionWizard
|
||||
private boolean editingAction;
|
||||
private boolean editingCondition;
|
||||
|
||||
private RuleService ruleService;
|
||||
private RulesBean rulesBean;
|
||||
protected RuleService ruleService;
|
||||
protected RulesBean rulesBean;
|
||||
|
||||
private List<SelectItem> modelTypes;
|
||||
private List<SelectItem> mimeTypes;
|
||||
|
@@ -18,6 +18,7 @@ package org.alfresco.web.ui.common.component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
import javax.faces.el.ValueBinding;
|
||||
@@ -53,7 +54,7 @@ public class UIMenu extends SelfRenderingComponent
|
||||
ResponseWriter out = context.getResponseWriter();
|
||||
|
||||
// output a textual label with an optional icon to show the menu
|
||||
String menuId = getNextMenuId(context);
|
||||
String menuId = getNextMenuId(this, context);
|
||||
out.write("<a href='#' onclick=\"javascript:_toggleMenu(event, '");
|
||||
out.write(menuId);
|
||||
out.write("');return false;\"");
|
||||
@@ -66,9 +67,7 @@ public class UIMenu extends SelfRenderingComponent
|
||||
String label = getLabel();
|
||||
if (label != null)
|
||||
{
|
||||
out.write("<span>");
|
||||
out.write(Utils.encode(label));
|
||||
out.write("</span>");
|
||||
}
|
||||
|
||||
// output image
|
||||
@@ -80,7 +79,6 @@ public class UIMenu extends SelfRenderingComponent
|
||||
out.write("</a>");
|
||||
|
||||
// output the hidden DIV section to contain the menu item table
|
||||
// also output the javascript handlers used to hide the menu after a delay of non-use
|
||||
out.write("<br><div id='");
|
||||
out.write(menuId);
|
||||
out.write("' style=\"position:absolute;display:none;padding-left:2px;\">");
|
||||
@@ -180,7 +178,7 @@ public class UIMenu extends SelfRenderingComponent
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Private helpers
|
||||
// Helpers
|
||||
|
||||
/**
|
||||
* Return the next usable menu DIV id in a sequence
|
||||
@@ -189,7 +187,7 @@ public class UIMenu extends SelfRenderingComponent
|
||||
*
|
||||
* @return next menu ID
|
||||
*/
|
||||
private String getNextMenuId(FacesContext context)
|
||||
public static String getNextMenuId(UIComponent component, FacesContext context)
|
||||
{
|
||||
Integer val = (Integer)context.getExternalContext().getRequestMap().get(MENU_ID_KEY);
|
||||
if (val == null)
|
||||
@@ -198,7 +196,7 @@ public class UIMenu extends SelfRenderingComponent
|
||||
}
|
||||
|
||||
// build next id in sequence
|
||||
String id = getClientId(context) + '_' + val.toString();
|
||||
String id = component.getClientId(context) + '_' + val.toString();
|
||||
|
||||
// save incremented value in the request ready for next menu component instance
|
||||
val = Integer.valueOf( val.intValue() + 1 );
|
||||
|
@@ -64,6 +64,8 @@ public class UIModeList extends UICommand
|
||||
this.horizontal = (Boolean)values[2];
|
||||
this.disabled = (Boolean)values[3];
|
||||
this.label = (String)values[4];
|
||||
this.menu = (Boolean)values[5];
|
||||
this.menuImage = (String)values[6];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,13 +73,15 @@ public class UIModeList extends UICommand
|
||||
*/
|
||||
public Object saveState(FacesContext context)
|
||||
{
|
||||
Object values[] = new Object[5];
|
||||
Object values[] = new Object[7];
|
||||
// standard component attributes are saved by the super class
|
||||
values[0] = super.saveState(context);
|
||||
values[1] = this.iconColumnWidth;
|
||||
values[2] = this.horizontal;
|
||||
values[3] = this.disabled;
|
||||
values[4] = this.label;
|
||||
values[5] = this.menu;
|
||||
values[6] = this.menuImage;
|
||||
return (values);
|
||||
}
|
||||
|
||||
@@ -202,6 +206,40 @@ public class UIModeList extends UICommand
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the menu rendering flag
|
||||
*
|
||||
* @return true if the menu rendering mode is to be used
|
||||
*/
|
||||
public boolean isMenu()
|
||||
{
|
||||
ValueBinding vb = getValueBinding("menu");
|
||||
if (vb != null)
|
||||
{
|
||||
this.menu = (Boolean)vb.getValue(getFacesContext());
|
||||
}
|
||||
|
||||
if (this.menu != null)
|
||||
{
|
||||
return this.menu.booleanValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
// return the default
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the mode list is a menu
|
||||
*
|
||||
* @param menu the menu flag
|
||||
*/
|
||||
public void setMenu(boolean menu)
|
||||
{
|
||||
this.menu = menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the label.
|
||||
*/
|
||||
@@ -224,6 +262,28 @@ public class UIModeList extends UICommand
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the menu image.
|
||||
*/
|
||||
public String getMenuImage()
|
||||
{
|
||||
ValueBinding vb = getValueBinding("menuImage");
|
||||
if (vb != null)
|
||||
{
|
||||
this.menuImage = (String)vb.getValue(getFacesContext());
|
||||
}
|
||||
|
||||
return this.menuImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param menuImage The menu image to set.
|
||||
*/
|
||||
public void setMenuImage(String menuImage)
|
||||
{
|
||||
this.menuImage = menuImage;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Private data
|
||||
@@ -237,6 +297,12 @@ public class UIModeList extends UICommand
|
||||
/** disabled flag */
|
||||
private Boolean disabled = null;
|
||||
|
||||
/** menu rendering flag */
|
||||
private Boolean menu = null;
|
||||
|
||||
/** menu image to use */
|
||||
private String menuImage = null;
|
||||
|
||||
/** the label */
|
||||
private String label;
|
||||
|
||||
|
@@ -28,6 +28,7 @@ import javax.faces.context.ResponseWriter;
|
||||
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIListItem;
|
||||
import org.alfresco.web.ui.common.component.UIMenu;
|
||||
import org.alfresco.web.ui.common.component.UIModeList;
|
||||
|
||||
/**
|
||||
@@ -74,54 +75,137 @@ public class ModeListRenderer extends BaseRenderer
|
||||
|
||||
ResponseWriter out = context.getResponseWriter();
|
||||
|
||||
// start outer table container the list items
|
||||
Map attrs = list.getAttributes();
|
||||
out.write("<table cellspacing=1 cellpadding=0");
|
||||
outputAttribute(out, attrs.get("styleClass"), "class");
|
||||
outputAttribute(out, attrs.get("style"), "style");
|
||||
outputAttribute(out, attrs.get("width"), "width");
|
||||
out.write('>');
|
||||
|
||||
// horizontal rendering outputs a single row with each item as a column cell
|
||||
if (list.isHorizontal() == true)
|
||||
if (list.isMenu() == false)
|
||||
{
|
||||
out.write("<tr>");
|
||||
}
|
||||
|
||||
// output title row if present
|
||||
if (list.getLabel() != null)
|
||||
{
|
||||
// each row is an inner table with a single row and 2 columns
|
||||
// first column contains an icon if present, second column contains text
|
||||
if (list.isHorizontal() == false)
|
||||
// start outer table container the list items
|
||||
out.write("<table cellspacing=1 cellpadding=0");
|
||||
outputAttribute(out, attrs.get("styleClass"), "class");
|
||||
outputAttribute(out, attrs.get("style"), "style");
|
||||
outputAttribute(out, attrs.get("width"), "width");
|
||||
out.write('>');
|
||||
|
||||
// horizontal rendering outputs a single row with each item as a column cell
|
||||
if (list.isHorizontal() == true)
|
||||
{
|
||||
out.write("<tr>");
|
||||
}
|
||||
|
||||
out.write("<td><table cellpadding=0 width=100%");
|
||||
outputAttribute(out, attrs.get("itemSpacing"), "cellspacing");
|
||||
out.write("><tr>");
|
||||
|
||||
// output icon column
|
||||
if (list.getIconColumnWidth() != 0)
|
||||
// output title row if present
|
||||
if (list.getLabel() != null)
|
||||
{
|
||||
// each row is an inner table with a single row and 2 columns
|
||||
// first column contains an icon if present, second column contains text
|
||||
if (list.isHorizontal() == false)
|
||||
{
|
||||
out.write("<tr>");
|
||||
}
|
||||
|
||||
out.write("<td><table cellpadding=0 width=100%");
|
||||
outputAttribute(out, attrs.get("itemSpacing"), "cellspacing");
|
||||
out.write("><tr>");
|
||||
|
||||
// output icon column
|
||||
if (list.getIconColumnWidth() != 0)
|
||||
{
|
||||
out.write("<td");
|
||||
outputAttribute(out, list.getIconColumnWidth(), "width");
|
||||
out.write("></td>");
|
||||
}
|
||||
|
||||
// output title label
|
||||
out.write("<td><span");
|
||||
outputAttribute(out, attrs.get("labelStyle"), "style");
|
||||
outputAttribute(out, attrs.get("labelStyleClass"), "class");
|
||||
out.write('>');
|
||||
out.write(Utils.encode(list.getLabel()));
|
||||
out.write("</span></td></tr></table></td>");
|
||||
|
||||
if (list.isHorizontal() == false)
|
||||
{
|
||||
out.write("</tr>");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// render as a pop-up menu
|
||||
// TODO: show the image set for the individual item if available?
|
||||
out.write("<table cellspacing=0 cellpadding=0 style='white-space:nowrap'><tr>");
|
||||
String selectedImage = (String)attrs.get("selectedImage");
|
||||
if (selectedImage != null)
|
||||
{
|
||||
out.write("<td");
|
||||
outputAttribute(out, list.getIconColumnWidth(), "width");
|
||||
out.write("></td>");
|
||||
int colWidth = list.getIconColumnWidth();
|
||||
if (colWidth != 0)
|
||||
{
|
||||
out.write(" width=");
|
||||
out.write(Integer.toString(colWidth));
|
||||
}
|
||||
out.write('>');
|
||||
out.write(Utils.buildImageTag(context, selectedImage, null, "absmiddle"));
|
||||
out.write("</td>");
|
||||
}
|
||||
|
||||
// output title label
|
||||
out.write("<td><span");
|
||||
outputAttribute(out, attrs.get("labelStyle"), "style");
|
||||
outputAttribute(out, attrs.get("labelStyleClass"), "class");
|
||||
out.write('>');
|
||||
out.write(Utils.encode(list.getLabel()));
|
||||
out.write("</span></td></tr></table></td>");
|
||||
String menuId = UIMenu.getNextMenuId(list, context);
|
||||
out.write("<td><a href='#' onclick=\"javascript:_toggleMenu(event, '");
|
||||
out.write(menuId);
|
||||
out.write("');return false;\">");
|
||||
|
||||
if (list.isHorizontal() == false)
|
||||
// use default label if available
|
||||
String label = list.getLabel();
|
||||
if (label == null || label.length() == 0)
|
||||
{
|
||||
out.write("</tr>");
|
||||
// else get the child components and walk to find the selected
|
||||
for (Iterator i=list.getChildren().iterator(); i.hasNext(); /**/)
|
||||
{
|
||||
UIComponent child = (UIComponent)i.next();
|
||||
if (child instanceof UIListItem && child.isRendered() == true)
|
||||
{
|
||||
// found a valid UIListItem child to render
|
||||
UIListItem item = (UIListItem)child;
|
||||
|
||||
// if selected render as the label
|
||||
if (item.getValue().equals(list.getValue()) == true)
|
||||
{
|
||||
label = item.getLabel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// render the label
|
||||
if (label != null && label.length() != 0)
|
||||
{
|
||||
out.write("<span");
|
||||
outputAttribute(out, attrs.get("labelStyle"), "style");
|
||||
outputAttribute(out, attrs.get("labelStyleClass"), "class");
|
||||
out.write('>');
|
||||
out.write(Utils.encode(label));
|
||||
out.write("</span>");
|
||||
}
|
||||
|
||||
// output image
|
||||
if (list.getMenuImage() != null)
|
||||
{
|
||||
out.write(Utils.buildImageTag(context, list.getMenuImage(), null, "absmiddle"));
|
||||
}
|
||||
|
||||
out.write("</a></td></tr></table>");
|
||||
|
||||
// output the hidden DIV section to contain the menu item table
|
||||
out.write("<div id='");
|
||||
out.write(menuId);
|
||||
out.write("' style=\"position:absolute;display:none;padding-left:2px;\">");
|
||||
|
||||
// start outer table container the list items
|
||||
out.write("<table cellspacing=1 cellpadding=0");
|
||||
outputAttribute(out, attrs.get("styleClass"), "class");
|
||||
outputAttribute(out, attrs.get("style"), "style");
|
||||
outputAttribute(out, attrs.get("width"), "width");
|
||||
out.write('>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,11 +347,17 @@ public class ModeListRenderer extends BaseRenderer
|
||||
ResponseWriter out = context.getResponseWriter();
|
||||
|
||||
// end outer table
|
||||
if (((UIModeList)component).isHorizontal() == true)
|
||||
UIModeList list = (UIModeList)component;
|
||||
if (list.isHorizontal() == true)
|
||||
{
|
||||
out.write("</tr>");
|
||||
}
|
||||
out.write("</table>");
|
||||
if (list.isMenu() == true)
|
||||
{
|
||||
// close menu hidden div section
|
||||
out.write("</div>");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -64,6 +64,8 @@ public class ModeListTag extends HtmlComponentTag
|
||||
setIntProperty(component, "itemSpacing", this.itemSpacing);
|
||||
setIntProperty(component, "iconColumnWidth", this.iconColumnWidth);
|
||||
setIntProperty(component, "width", this.width);
|
||||
setStringProperty(component, "menuImage", this.menuImage);
|
||||
setBooleanProperty(component, "menu", this.menu);
|
||||
setBooleanProperty(component, "horizontal", this.horizontal);
|
||||
setBooleanProperty(component, "disabled", this.disabled);
|
||||
setStringProperty(component, "label", this.label);
|
||||
@@ -319,7 +321,33 @@ public class ModeListTag extends HtmlComponentTag
|
||||
{
|
||||
this.disabledStyleClass = disabledStyleClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the menu
|
||||
*
|
||||
* @param menu the menu
|
||||
*/
|
||||
public void setMenu(String menu)
|
||||
{
|
||||
this.menu = menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the menuImage
|
||||
*
|
||||
* @param menuImage the menuImage
|
||||
*/
|
||||
public void setMenuImage(String menuImage)
|
||||
{
|
||||
this.menuImage = menuImage;
|
||||
}
|
||||
|
||||
|
||||
/** the menu */
|
||||
private String menu;
|
||||
|
||||
/** the menuImage */
|
||||
private String menuImage;
|
||||
|
||||
/** the disabledStyle */
|
||||
private String disabledStyle;
|
||||
|
Reference in New Issue
Block a user