Author: dbiatenia
Date: 2007-06-09 06:49:38 -0400 (Sat, 09 Jun 2007)
New Revision: 1112
Modified:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
Log:
added css-classes for label and icon inside item&group
Modified:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java 2007-06-09
10:48:19 UTC (rev 1111)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java 2007-06-09
10:49:38 UTC (rev 1112)
@@ -36,6 +36,7 @@
import org.richfaces.component.UISwitchablePanel;
import org.richfaces.component.panelmenu.UIPanelMenu;
import org.richfaces.component.panelmenu.UIPanelMenuGroup;
+import org.richfaces.component.panelmenu.UIPanelMenuItem;
import org.richfaces.event.SwitchablePanelSwitchEvent;
public class PanelMenuGroupRenderer extends PanelMenuRendererBase {
@@ -204,4 +205,28 @@
}
return false;
}
+
+ public String getLabelClass(FacesContext context, UIComponent component) {
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+ UIPanelMenu parentMenu = findMenu(group);
+ if(!group.isDisabled() && !parentMenu.isDisabled()){
+ if(isTopLevel(component)){
+ return "rich-pmenu-group-self-label rich-pmenu-top-group-self-label";
+ } else return "rich-pmenu-group-self-label";
+ }
+ return "";
+ }
+
+ public String getIconClass(FacesContext context, UIComponent component) {
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+ UIPanelMenu parentMenu = findMenu(group);
+ if(!group.isDisabled() && !parentMenu.isDisabled()){
+ if(isTopLevel(component)){
+ return "rich-pmenu-group-self-icon rich-pmenu-top-group-self-icon";
+ } else return "rich-pmenu-group-self-icon";
+ }
+ return "";
+ }
+
+
}
Modified:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java 2007-06-09
10:48:19 UTC (rev 1111)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java 2007-06-09
10:49:38 UTC (rev 1112)
@@ -135,9 +135,10 @@
UIPanelMenuItem item = (UIPanelMenuItem)component;
UIPanelMenu parentMenu = findMenu(item);
if (!parentMenu.isDisabled() && !item.isDisabled()) {
- if (calculateLevel(item) == 0)
- classBuffer.append(parentMenu.getTopItemClass() + " ");
- else
+ if (calculateLevel(item) == 0) {
+ classBuffer.append(parentMenu.getTopItemClass()).append(" ");
+ classBuffer.append("rich-pmenu-top-item ");
+ } else
classBuffer.append(parentMenu.getItemClass() + " ");
classBuffer.append(item.getStyleClass());
} else
@@ -162,4 +163,25 @@
return styleBuffer.toString();
}
+ public String getLabelClass(FacesContext context, UIComponent component) {
+ UIPanelMenuItem item = (UIPanelMenuItem)component;
+ UIPanelMenu parentMenu = findMenu(item);
+ if(!item.isDisabled() && !parentMenu.isDisabled()){
+ if(isTopLevel(component)){
+ return "rich-pmenu-item-label rich-pmenu-top-item-label";
+ } else return "rich-pmenu-item-label";
+ }
+ return "";
+ }
+
+ public String getIconClass(FacesContext context, UIComponent component) {
+ UIPanelMenuItem item = (UIPanelMenuItem)component;
+ UIPanelMenu parentMenu = findMenu(item);
+ if(!item.isDisabled() && !parentMenu.isDisabled()){
+ if(isTopLevel(component)){
+ return "rich-pmenu-item-icon rich-pmenu-top-item-icon";
+ } else return "rich-pmenu-item-icon";
+ }
+ return "";
+ }
}
Show replies by date