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:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user