[richfaces-svn-commits] JBoss Rich Faces SVN: r791 - in trunk/richfaces/panelmenu/src/main: templates/org/richfaces and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu May 17 07:15:54 EDT 2007


Author: sergeyhalipov
Date: 2007-05-17 07:15:54 -0400 (Thu, 17 May 2007)
New Revision: 791

Modified:
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
   trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
   trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
Log:
Panel menu: Support for different style and styleClass attributes.

Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java	2007-05-17 00:38:29 UTC (rev 790)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java	2007-05-17 11:15:54 UTC (rev 791)
@@ -30,6 +30,7 @@
 
 import org.ajax4jsf.framework.util.style.CSSFormat;
 import org.richfaces.component.panelmenu.UIPanelMenu;
+import org.richfaces.component.panelmenu.UIPanelMenuGroup;
 
 public class PanelMenuGroupRenderer extends PanelMenuRendererBase {
 	protected Class getComponentClass() {
@@ -98,4 +99,35 @@
 		writer.endElement("img");
 	}
 
+	public String getFullStyleClass(FacesContext context, UIComponent component) {
+		StringBuffer classBuffer = new StringBuffer("");
+		UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+		UIPanelMenu parentMenu = findMenu(group);
+		if (!group.isDisabled()) {
+			if (calculateLevel(group) == 0) 
+				classBuffer.append(parentMenu.getTopGroupClass() + " ");
+			else 
+				classBuffer.append(parentMenu.getGroupClass() + " ");
+			classBuffer.append(group.getStyleClass());
+		} else
+			classBuffer.append(parentMenu.getDisabledGroupClass() + " ")
+				.append(group.getDisabledClass());
+		return classBuffer.toString();
+	}
+	
+	public String getFullStyle(FacesContext context, UIComponent component) {
+		StringBuffer styleBuffer = new StringBuffer("");
+		UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+		UIPanelMenu parentMenu = findMenu(group);
+		if (!group.isDisabled()) {
+			if (calculateLevel(group) == 0) 
+				styleBuffer.append(parentMenu.getTopGroupStyle() + "; ");
+			else 
+				styleBuffer.append(parentMenu.getGroupStyle() + "; ");
+			styleBuffer.append(group.getStyle());
+		} else
+			styleBuffer.append(parentMenu.getDisabledGroupStyle() + "; ")
+				.append(group.getDisabledStyle());
+		return styleBuffer.toString();
+	}
 }

Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java	2007-05-17 00:38:29 UTC (rev 790)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java	2007-05-17 11:15:54 UTC (rev 791)
@@ -29,6 +29,7 @@
 
 import org.ajax4jsf.framework.renderer.compiler.TemplateContext;
 import org.richfaces.component.panelmenu.UIPanelMenu;
+import org.richfaces.component.panelmenu.UIPanelMenuGroup;
 import org.richfaces.component.panelmenu.UIPanelMenuItem;
 
 public class PanelMenuItemRenderer extends PanelMenuRendererBase {
@@ -109,4 +110,36 @@
 		}	
 	}
 	
+	public String getFullStyleClass(FacesContext context, UIComponent component) {
+		StringBuffer classBuffer = new StringBuffer("");
+		UIPanelMenuItem item = (UIPanelMenuItem)component;
+		UIPanelMenu parentMenu = findMenu(item);
+		if (!item.isDisabled()) {
+			if (calculateLevel(item) == 0) 
+				classBuffer.append(parentMenu.getTopItemClass() + " ");
+			else 
+				classBuffer.append(parentMenu.getItemClass() + " ");
+			classBuffer.append(item.getStyleClass());
+		} else
+			classBuffer.append(parentMenu.getDisabledItemClass() + " ")
+				.append(item.getDisabledClass());
+		return classBuffer.toString();
+	}
+	
+	public String getFullStyle(FacesContext context, UIComponent component) {
+		StringBuffer styleBuffer = new StringBuffer("");
+		UIPanelMenuItem item = (UIPanelMenuItem)component;
+		UIPanelMenu parentMenu = findMenu(item);
+		if (!item.isDisabled()) {
+			if (calculateLevel(item) == 0) 
+				styleBuffer.append(parentMenu.getTopItemStyle() + "; ");
+			else 
+				styleBuffer.append(parentMenu.getItemStyle() + "; ");
+			styleBuffer.append(item.getStyle());
+		} else
+			styleBuffer.append(parentMenu.getDisabledItemStyle() + "; ")
+				.append(item.getDisabledStyle());
+		return styleBuffer.toString();
+	}
+	
 }

Modified: trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
===================================================================
--- trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx	2007-05-17 00:38:29 UTC (rev 790)
+++ trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx	2007-05-17 11:15:54 UTC (rev 791)
@@ -16,8 +16,8 @@
 		<td>
 			<table cellpadding="0" cellspacing="0" border="0" width="100%"
 					id="tablehide#{clientId}"
-					class="rich-pmenu-group dr-pmenu-group #{component.styleClass}" 
-					style="#{component.style}" >
+					class="rich-pmenu-group dr-pmenu-group #{this:getFullStyleClass( context, component )}" 
+					style="#{this:getFullStyle( context, component )}" >
 				<f:call name="utils.encodePassThru" />
 				<tr>
 					<f:call name="utils.encodeId" />

Modified: trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
===================================================================
--- trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx	2007-05-17 00:38:29 UTC (rev 790)
+++ trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx	2007-05-17 11:15:54 UTC (rev 791)
@@ -16,8 +16,8 @@
 		<td>
 			<table cellpadding="0" cellspacing="0" border="0" width="100%"
 					onclick="#{onClick}" 
-					class="rich-pmenu-item dr-pmenu-item #{component.styleClass}" 
-					style="#{component.style}" 
+					class="rich-pmenu-item dr-pmenu-item #{this:getFullStyleClass( context, component )}" 
+					style="#{this:getFullStyle( context, component )}" 
 					id="tablehide#{clientId}" >
 				<f:call name="utils.encodePassThruWithExclusions">
 					<f:parameter value="onclick"/> 




More information about the richfaces-svn-commits mailing list