[richfaces-svn-commits] JBoss Rich Faces SVN: r767 - in trunk/richfaces/panelmenu/src/main: java/org/richfaces/component/panelmenu and 10 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue May 15 13:08:48 EDT 2007


Author: sergeyhalipov
Date: 2007-05-15 13:08:48 -0400 (Tue, 15 May 2007)
New Revision: 767

Added:
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrow.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrowDown.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrowUp.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconBasic.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDisc.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDots.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrow.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrowDown.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrowUp.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSpacer.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSquare.java
   trunk/richfaces/panelmenu/src/main/resources/org/
   trunk/richfaces/panelmenu/src/main/resources/org/richfaces/
   trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/
   trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/
   trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/
   trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss
   trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/
   trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
Modified:
   trunk/richfaces/panelmenu/src/main/config/component/panelMenu.xml
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuGroup.java
   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/java/org/richfaces/renderkit/PanelMenuRenderer.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
   trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx
   trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
   trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
Log:
Initial commit for panel menu component.

Modified: trunk/richfaces/panelmenu/src/main/config/component/panelMenu.xml
===================================================================
--- trunk/richfaces/panelmenu/src/main/config/component/panelMenu.xml	2007-05-15 14:17:36 UTC (rev 766)
+++ trunk/richfaces/panelmenu/src/main/config/component/panelMenu.xml	2007-05-15 17:08:48 UTC (rev 767)
@@ -63,51 +63,61 @@
 	    	<name>iconItem</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the enabled item state</description>
+	    	<defaultvalue><![CDATA["grid"]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconDisabledItem</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the disabled item state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconTopItem</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the enabled top item state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconTopDisabledItem</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the disabled top item state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconExpandedGroup</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the expanded  Group state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconCollapsedGroup</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the collapsed  Group state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconDisabledGroup</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the disabled group state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconExpandedTopGroup</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the expanded  top group state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconCollapsedTopGroup</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the collapsed top group state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconTopDisableGroup</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the disabled top Group state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 	    	<name>iconItemPosition</name>
@@ -285,16 +295,19 @@
 	    	<name>iconExpanded</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the expanded item state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 		<property>
 	    	<name>iconCollapsed</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the collapsed item state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 		<property>
 	    	<name>iconDisabled</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the disabled item state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 			<name>disabled</name>
@@ -408,11 +421,13 @@
 	    	<name>icon</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon or the default one name to be displayed for the enabled item state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 		<property>
 	    	<name>iconDisabled</name>
 	    	<classname>java.lang.String</classname>
 	    	<description>Path to the icon to be displayed for the disabled item state</description>
+	    	<defaultvalue><![CDATA[""]]></defaultvalue>
 	    </property>
 	    <property>
 			<name>disabled</name>

Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuGroup.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuGroup.java	2007-05-15 14:17:36 UTC (rev 766)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuGroup.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -26,6 +26,10 @@
 public abstract class UIPanelMenuGroup extends UISwitchablePanel {
 	
 	public static final String COMPONENT_TYPE = "org.richfaces.panelMenuGroup";
+	
+	public abstract String getStyleClass();
+	
+	public abstract void setStyleClass(String styleClass);
 
 	public abstract String getMode();
 	public abstract void setMode(String mode);
@@ -43,8 +47,8 @@
 	public abstract void setAction(String action);
 	public abstract String getTarget();
 	public abstract void setTarget(String target);
-	public abstract boolean isImmediate();
-	public abstract void setImmediate(boolean immediate);
+	/*public abstract boolean isImmediate();
+	public abstract void setImmediate(boolean immediate);*/
 	public abstract String getHoverClass();
 	public abstract void setHoverClass(String hoverClass);
 	public abstract String getHoverStyle();

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-15 14:17:36 UTC (rev 766)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -21,13 +21,93 @@
 
 package org.richfaces.renderkit;
 
+import java.io.IOException;
+import java.util.Map;
+
 import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
 
+import org.ajax4jsf.framework.util.style.CSSFormat;
+import org.richfaces.component.panelmenu.UIPanelMenu;
+
 public class PanelMenuGroupRenderer extends PanelMenuRendererBase {
 	protected Class getComponentClass() {
 		return UIComponent.class;
 	}
 	
+	public void insertImage(FacesContext context, UIComponent component, Object data)
+			throws IOException {
+		
+		String from = (String)data;
+		String align = "";
+		
+		UIPanelMenu panelMenu = findMenu(component);
+		boolean isTopLevel = component.getParent() instanceof UIPanelMenu;
+
+		if (isTopLevel){
+			align = panelMenu.getIconItemTopPosition();
+		} else {
+			align = panelMenu.getIconItemPosition();
+		}
+		
+		if (align.equalsIgnoreCase(from)) {
+			image(context, component, "");
+		} else{
+			image(context, component, "spacer");
+		}
+		
+	}
 	
+	private void image(FacesContext context, UIComponent component, String data)throws IOException {
+		ResponseWriter writer = context.getResponseWriter();
 
+		UIPanelMenu panelMenu = findMenu(component);
+		if(panelMenu == null){
+			return;
+		}
+		
+		boolean isTopLevel = component.getParent() instanceof UIPanelMenu;
+		boolean isOpened = isOpened(context,component).equals("opened") ? true : false;
+
+		String source = "";
+		String iconNode = "";
+		
+		Object iconCollapsed = component.getAttributes().get("iconCollapsed");
+		Object iconExpanded = component.getAttributes().get("iconExpanded");
+		
+		if (( isOpened ? iconExpanded : iconCollapsed ).equals("")){
+			source = getIconByType("custom", isTopLevel,context, component);
+		} else {
+			if (iconNode.equals("none")){
+				return;
+			} else {
+				source = getIconByType(data.equals("spacer")?"custom":iconCollapsed.toString(),isTopLevel,context,component);
+			}
+		}
+
+		int h = 16; //width(context);
+		writer.startElement("img", component);
+		writer.writeAttribute("src", source, null);
+		writer.writeAttribute("alt","",null);
+		writer.writeAttribute("vspace", "0", null);
+		writer.writeAttribute("hspace", "0", null);
+		writer.writeAttribute("style","display:block;",null);
+		writer.writeAttribute("width", String.valueOf(h), null);
+		writer.writeAttribute("height",String.valueOf(h), null);
+		writer.endElement("img");
+	}
+	
+	public String isOpened(FacesContext context, UIComponent component)throws IOException {
+		String clientId = component.getClientId(context);
+		Map requestParameterMap = context.getExternalContext().getRequestParameterMap();
+		Object value = requestParameterMap.get("panelMenuState"+clientId);
+		if (value != null) {
+			if (value.equals("opened")) {
+				return "opened";
+			}
+		}
+		return "closed";
+	}
+
 }

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-15 14:17:36 UTC (rev 766)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -21,11 +21,92 @@
 
 package org.richfaces.renderkit;
 
+import java.io.IOException;
+
 import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
 
+import org.ajax4jsf.framework.renderer.compiler.TemplateContext;
+import org.richfaces.component.panelmenu.UIPanelMenu;
+import org.richfaces.component.panelmenu.UIPanelMenuItem;
+
 public class PanelMenuItemRenderer extends PanelMenuRendererBase {
 	protected Class getComponentClass() {
 		return UIComponent.class;
 	}
 
+	public String getOnClick(TemplateContext templateContext){
+		FacesContext context = templateContext.getFacesContext();
+		UIComponent component = templateContext.getComponent();
+		String clientId = component.getClientId(context);
+		return ";PanelMenuStorage['" + clientId + "'].trigger(event);";
+	}
+	
+	public void insertImage(FacesContext context, UIComponent component, Object data) throws IOException {
+		String from = (String)data;
+		UIPanelMenu panelMenu = findMenu(component);
+		if(panelMenu == null){
+			return;
+		}
+		String align = "";
+		boolean isTopLevel = component.getParent() instanceof UIPanelMenu;
+		
+		if (isTopLevel){
+			align = panelMenu.getIconItemTopPosition();
+		} else {
+			align = panelMenu.getIconItemPosition();
+		}
+		
+		if (component.getChildCount()==0){
+			if (align.equalsIgnoreCase(from)){
+				image(context,component,"");
+			} else{
+				image(context,component,"spacer");
+			}
+		} else {
+			image(context,component,"spacer");
+		}
+	}
+	
+	private void image(FacesContext context, UIComponent component, String align) 
+			throws IOException{
+		
+		UIPanelMenu panelMenu = findMenu(component);
+		ResponseWriter writer 	= context.getResponseWriter();
+		String iconItemTopLevel = panelMenu.getIconTopItem();
+		String iconItem 		= panelMenu.getIconItem();
+		boolean isTopLevel 		= component.getParent() instanceof UIPanelMenu;		
+		String source 			= "";
+		String iconType			= "";	
+		Object customIcon 		= ((UIPanelMenuItem)component).getIcon();
+		
+		if (customIcon.equals("")){
+			if (isTopLevel){
+				source = getIconByType(align.equals("spacer") ? "custom" : iconItemTopLevel, isTopLevel, context, component);
+			} else {
+				source = getIconByType(align.equals("spacer") ? "custom" : iconItem, isTopLevel, context, component);
+			}
+		} else {
+			if ((!isTopLevel&&iconItem.equals("none"))||(isTopLevel&&iconItemTopLevel.equals("none"))){
+				iconType = "none";
+			} else {
+				source = getIconByType(align.equals("spacer") ? "custom" : customIcon.toString(),isTopLevel,context,component);
+			}
+		}
+	
+		if (!iconType.equals("none")){
+			int h = 16; //width(context);
+			writer.startElement("img",component);
+			writer.writeAttribute("src",source,null);
+			writer.writeAttribute("alt","",null);
+			writer.writeAttribute("vspace","0",null);
+			writer.writeAttribute("hspace","0",null);
+			writer.writeAttribute("style","display:block;",null);
+			writer.writeAttribute("width",String.valueOf(h),null);
+			writer.writeAttribute("height",String.valueOf(h),null);
+			writer.endElement("img");
+		}	
+	}
+	
 }

Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java	2007-05-15 14:17:36 UTC (rev 766)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -21,8 +21,24 @@
 
 package org.richfaces.renderkit;
 
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.application.ViewHandler;
 import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
 
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.richfaces.component.panelmenu.UIPanelMenu;
+import org.richfaces.component.panelmenu.UIPanelMenuGroup;
+import org.richfaces.component.panelmenu.UIPanelMenuItem;
+import org.richfaces.renderkit.iconImages.PanelMenuIconSpacer;
+
 /**
  * @author hans
  *
@@ -36,4 +52,259 @@
 		return UIComponent.class;
 	}
 	
+	public void insertScript(FacesContext context, UIComponent component)
+			throws IOException {
+		
+		StringBuffer buffer		= new StringBuffer();
+		StringBuffer panelMenu	= new StringBuffer();
+		List flatList		 	= new LinkedList();
+		Map levels			 	= new HashMap();
+		
+		Object singleOpen = component.getAttributes().get("singleOpen");
+		
+		if (singleOpen!=null){
+			singleOpen = singleOpen.toString();
+		} else {
+			singleOpen = "false";
+		}
+		
+		flatten(component.getChildren(), flatList, levels, 0);
+		
+		panelMenu
+					.append("new PanelMenu('")
+					.append(component.getClientId(context).toString())
+					.append("',")
+					.append(singleOpen.toString())
+					.append(");\n");
+		String iconPosition = ((UIPanelMenu)component).getIconItemPosition();
+		String iconPositionTopLevel = ((UIPanelMenu)component).getIconItemTopPosition();
+		for (Iterator iter = flatList.iterator(); iter.hasNext();) {
+			UIComponent child = (UIComponent) iter.next();
+			if ((child instanceof UIPanelMenuItem)||(child instanceof UIPanelMenuGroup)) {
+				Object childDisabled = child.getAttributes().get("disabled");
+				boolean childRendered = child instanceof UIPanelMenuGroup ? ((UIPanelMenuGroup)child).isRendered() : ((UIPanelMenuItem)child).isRendered();
+				boolean parentRendered = true;
+				if (! (child.getParent() instanceof UIPanelMenu))
+					parentRendered = child.getParent() instanceof UIPanelMenuGroup ? ((UIPanelMenuGroup)child.getParent()).isRendered() : ((UIPanelMenuItem)child.getParent()).isRendered();
+				if (!parentRendered){
+					child.getAttributes().put("rendered",Boolean.FALSE);
+				}
+				String onopen = child instanceof UIPanelMenuGroup ? 
+						findMenu(child).getOngroupexpand() : "";
+				String onclose = child instanceof UIPanelMenuGroup ? 
+						findMenu(child).getOngroupcollapse() : "";
+				
+				
+				if (childRendered && parentRendered){
+					if (childDisabled==null || !childDisabled.equals("true")){
+						buffer
+								.append("new PanelMenuItem({myId:'")
+								.append((String) child.getClientId(context))
+								.append("',parentId:'")
+								.append((String) child.getParent().getClientId(context))
+								.append("'},{type:" + (child instanceof UIPanelMenuItem ? "\"item\"":"\"node\""))
+								.append(",onopen:"+(onopen.equals("") ? "\"\"" : "\"" + onopen + "\"")+",onclose:"+(onclose.equals("") ? "\"\"" : "\"" + onclose + "\""))
+								.append("}," + levels.get(child.getClientId(context)));
+	
+						switchOnImagesIfNeeded(context,child,buffer);
+						
+						addActionIfNeeded(context,child,buffer);
+						
+						setExpandedIfNeeded(context,child,buffer);
+						
+						String iconPos = child.getParent() instanceof UIPanelMenu ? iconPositionTopLevel.toLowerCase() : iconPosition.toLowerCase() ;
+						
+						buffer.append(","+'"'+iconPos+'"');
+						
+						addImages(buffer,context,child,component.getClientId(context).toString());
+						
+						buffer.append("\n");
+					}
+				} else {
+					continue;
+				}
+			}
+		}
+		StringBuffer ret = new StringBuffer();
+		ret.append("<script ");
+		ret.append("type=\"text/javascript\"");
+		ret.append("id =\"script" + component.getClientId(context)+"\">\n");
+		ret.append(panelMenu);
+		ret.append(buffer);
+		ret.append("\n</script>");
+		
+		ResponseWriter writer 	= context.getResponseWriter();
+		writer.write(ret.toString());
+	}
+	
+	public void flatten(List children, List flatList, Map levels,int initialLevel) {
+		FacesContext context = FacesContext.getCurrentInstance();
+		if (children != null) {
+			for (Iterator iter = children.iterator(); iter.hasNext();) {
+				UIComponent child = (UIComponent) iter.next();
+				if (child instanceof UIPanelMenu){
+					continue;
+				}
+				flatList.add(child);
+				levels.put(child.getClientId(context), new Integer(initialLevel));
+				flatten(child.getChildren(), flatList, levels, initialLevel + 1);
+			}
+		}
+	}
+	
+	private void switchOnImagesIfNeeded(FacesContext context, UIComponent child, StringBuffer buffer)throws IOException {
+		boolean isToplevel			= child.getParent() instanceof UIPanelMenu;
+		String customIconOpened		= "";
+		String customIconClosed		= "";
+
+		UIPanelMenu panelMenu = findMenu(child);
+		if(panelMenu == null){
+			return;
+		}
+		String iconOpened			= isToplevel ? panelMenu.getIconExpandedTopGroup() : panelMenu.getIconExpandedGroup();
+		String iconClosed			= isToplevel ? panelMenu.getIconCollapsedTopGroup() : panelMenu.getIconCollapsedGroup();
+
+		try {
+			customIconOpened = (String)child.getAttributes().get("iconOpened");
+			customIconClosed = (String)child.getAttributes().get("iconClosed");
+		} catch (Exception e) {}
+		
+		if (child instanceof UIPanelMenuItem){
+			buffer.append(",false");
+		} else {
+			if (iconClosed.equals("custom")&&iconOpened.equals("custom")){
+				if (customIconClosed.equals("")&&customIconOpened.equals("")){
+					buffer.append(",false");
+				} else {
+					buffer.append(",true");
+				}
+			} else {
+				buffer.append(",true");
+			}
+		}
+	}
+	
+	private void addActionIfNeeded(FacesContext context,UIComponent child,StringBuffer buffer){
+		if (child instanceof UIPanelMenuItem){
+			if (child.getChildCount()>0){
+				buffer.append(",'panelMenuItemAction'");	
+			} else {
+				ViewHandler viewHandler = context.getApplication().getViewHandler();
+				String viewId = context.getViewRoot().getViewId();
+				String actionUrl = context.getExternalContext().encodeActionURL(viewHandler.getActionURL(context, viewId));
+				buffer.append(",'"+actionUrl+"'");
+			}
+		} else {
+			if (((UIPanelMenuGroup)child).getAction()!=null&&!((UIPanelMenuGroup)child).getAction().equals("")){
+				buffer.append(",'panelMenuNodeAction'");
+			} else {
+				buffer.append(",false");
+			}
+		}
+	}
+	
+	private void setExpandedIfNeeded(FacesContext context,UIComponent child,StringBuffer buffer){
+		String value = "";
+		try {
+			value = context.getExternalContext().getRequestParameterMap().get("panelMenuState"+child.getClientId(context)).toString();
+		} catch (Exception e) {
+			value = "";
+		}
+		if (!value.equals("")){
+			if (value.equals("opened")) {
+				buffer.append(",true");
+			} else {
+				buffer.append(",false");
+			}
+		} else {
+			Object property = child.getAttributes().get("expanded");
+			if (property!=null&&property.equals("true")){
+				buffer.append(",true");
+			} else {
+				buffer.append(",false");
+			}
+		}					
+	}
+	
+	private void addImages(StringBuffer buffer,FacesContext context,UIComponent component,String id){
+		UIPanelMenu panelMenu = findMenu(component);
+		if(panelMenu == null){
+			return;
+		}
+		
+		final String PANEL_MENU_SPACER_ICON = InternetResourceBuilder.getInstance().createResource(null,PanelMenuIconSpacer.class.getName()).getUri(context, null);;
+		boolean isTopLevel = component.getParent() instanceof UIPanelMenu;
+
+		String iconItem 				=	isTopLevel ? panelMenu.getIconTopItem() : panelMenu.getIconItem();
+		String iconNodeClosed 			=	isTopLevel ? panelMenu.getIconCollapsedTopGroup() : panelMenu.getIconCollapsedGroup();
+		String iconNodeOpened 			=	isTopLevel ? panelMenu.getIconExpandedTopGroup() : panelMenu.getIconExpandedGroup();
+		
+		String sourceIconItem			=	getIconByType(iconItem, isTopLevel,context, component);
+		String sourceIconNodeClosed		=	getIconByType(iconNodeClosed, isTopLevel,context, component);
+		String sourceIconNodeOpened		=	getIconByType(iconNodeOpened, isTopLevel,context, component);
+
+		String customIconOpened = "";
+		String customIconClosed = "";
+		String customIconOpenedSource = "";
+		String customIconClosedSource = "";
+		String customIcon = "";
+		String customIconSource = "";
+		
+		if (component instanceof UIPanelMenuGroup){
+			
+			customIconOpened = (String) component.getAttributes().get("iconOpened");
+			customIconClosed = (String) component.getAttributes().get("iconClosed");
+			customIconOpenedSource = getIconByType(customIconOpened,isTopLevel,context,component);
+			customIconClosedSource = getIconByType(customIconClosed,isTopLevel,context,component);
+			
+		} else if (component instanceof UIPanelMenuItem){
+			
+			customIcon = component.getAttributes().get("icon").toString();
+			customIconSource = getIconByType(customIcon,isTopLevel,context,component);
+			
+		}		
+		
+		if (component instanceof UIPanelMenuGroup){
+			if (!iconNodeClosed.equals("")&&!iconNodeOpened.equals("")){
+				if (!iconNodeClosed.equals("custom")&&!iconNodeOpened.equals("custom")){
+					if(component.getAttributes().get("iconOpened").equals("")&&component.getAttributes().get("iconClosed").equals("")){
+						buffer.append(","+'"'+ (sourceIconNodeOpened.equals("")?customIconOpenedSource:sourceIconNodeOpened) + '"').append(","+'"'+(sourceIconNodeClosed.equals("")?customIconClosedSource:sourceIconNodeClosed)+'"'+");");
+					} else 	if(component.getAttributes().get("iconOpened").equals("")){
+						buffer.append(","+'"'+customIconClosedSource+'"').append(","+'"'+customIconClosedSource+'"'+");");
+					} else if (component.getAttributes().get("iconClosed").equals("")) {
+						buffer.append(","+'"'+customIconOpenedSource+'"').append(","+'"'+customIconOpenedSource+'"'+");");
+					} else {
+						buffer.append(","+'"'+customIconOpenedSource+'"').append(","+'"'+customIconClosedSource+'"'+");");
+					}
+				} else if (iconNodeClosed.equals("custom")){					
+					buffer.append(",\"" + (customIconOpened.equals("")? sourceIconNodeOpened : customIconOpenedSource) + '"').append(",\"" + (customIconClosed.equals("")? PANEL_MENU_SPACER_ICON : customIconClosedSource)+"\");");
+				} else if (iconNodeOpened.equals("custom")){
+					buffer.append(",\"" + (customIconOpened.equals("")? PANEL_MENU_SPACER_ICON : customIconOpenedSource) + '"').append(",\"" + (customIconClosed.equals("")? sourceIconNodeClosed : customIconClosedSource)+"\");");
+				} else{
+					buffer.append(",\"" + (customIconOpened.equals("")? PANEL_MENU_SPACER_ICON : customIconOpenedSource) + '"').append(",\"" + (customIconClosed.equals("")? PANEL_MENU_SPACER_ICON : customIconClosedSource)+"\");");
+				}
+			} else {
+				buffer.append(");");
+			}
+		}  else {
+			if (!iconItem.equals("")){
+				if (!iconItem.equals("custom")){
+					if(component.getAttributes().get("icon").equals("")){
+						buffer.append(","+'"'+sourceIconItem+'"').append(","+'"'+sourceIconItem+'"'+");");
+					} else {
+						buffer.append(","+'"'+customIconSource+'"').append(","+'"'+customIconSource+'"'+");");
+					}
+				} else {
+					if(component.getAttributes().get("icon").equals("")){
+						buffer.append(","+'"'+PANEL_MENU_SPACER_ICON+'"').append(","+'"'+PANEL_MENU_SPACER_ICON+'"'+");");
+					} else {
+						buffer.append(","+'"'+customIconSource+'"').append(","+'"'+customIconSource+'"'+");");
+					}					
+				}
+			} else {
+				buffer.append(");");					
+			}
+		}
+	}
+	
 }

Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java	2007-05-15 14:17:36 UTC (rev 766)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -21,12 +21,126 @@
 
 package org.richfaces.renderkit;
 
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
 import org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase;
+import org.ajax4jsf.framework.renderer.compiler.TemplateContext;
+import org.ajax4jsf.framework.skin.Skin;
+import org.richfaces.component.panelmenu.UIPanelMenu;
+import org.richfaces.renderkit.iconImages.PanelMenuIconArrow;
+import org.richfaces.renderkit.iconImages.PanelMenuIconArrowDown;
+import org.richfaces.renderkit.iconImages.PanelMenuIconArrowUp;
+import org.richfaces.renderkit.iconImages.PanelMenuIconDisc;
+import org.richfaces.renderkit.iconImages.PanelMenuIconDots;
+import org.richfaces.renderkit.iconImages.PanelMenuIconDoubleArrow;
+import org.richfaces.renderkit.iconImages.PanelMenuIconDoubleArrowDown;
+import org.richfaces.renderkit.iconImages.PanelMenuIconDoubleArrowUp;
+import org.richfaces.renderkit.iconImages.PanelMenuIconSpacer;
+import org.richfaces.renderkit.iconImages.PanelMenuIconSquare;
 
 /**
  * @author hans
  *
  */
 public abstract class PanelMenuRendererBase extends HeaderResourcesRendererBase {
-
+	public void insertTDs(FacesContext context , UIComponent component) throws IOException {
+		ResponseWriter writer 	= context.getResponseWriter();
+		int level = calculateLevel(component);
+		StringBuffer buffer = new StringBuffer();
+		String src = getIconByType("custom",false,context,component);
+		int w = 16; //width(context);
+		for (int i=0;i<level;i++){
+			buffer.append("<td><img src=\"" + src + "\" alt=\"\" hspace=\"0\" vspace=\"0\" height=\""+w+"\" width=\""+w+"\" style=\"display:block;\"></td>\n");
+		}
+		writer.write(buffer.toString());
+	}
+	
+	protected int calculateLevel (UIComponent component){
+		int level = 0;
+		UIComponent parent = component.getParent();
+		while(parent != null){
+			if(parent instanceof UIPanelMenu){
+				return level;
+			}
+			parent = parent.getParent();
+			level++;
+		}
+		return level;
+	}
+	
+	/**
+	 * If icon type is a pre-defined value, return corresponding image, otherwise
+	 * otherwise  
+	 * @param iconType
+	 * @param context
+	 * @param component
+	 * @return URI of requested image
+	 */
+	protected String getIconByType(String iconType, boolean isTopLevel, FacesContext context, 
+			UIComponent component){
+		
+		String source = "";
+		String color = "";
+		Skin skin = getSkin(context);
+				
+		if (isTopLevel){
+				color = (String) skin.getParameter(context,"panelmenu.headerBulletColor");
+		} else {
+			color = (String) skin.getParameter(context,"panelmenu.itemBulletColor");
+		}
+		if(iconType != null && !iconType.equals("none")){
+			if (iconType.equals("custom")){
+				source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, color);
+			} else if (iconType.equals("triangle")) {
+				source = getResource(PanelMenuIconArrow.class.getName()).getUri(context, color);
+			} else if (iconType.equals("triangleDown")) {
+				source = getResource(PanelMenuIconArrowDown.class.getName()).getUri(context, color);
+			} else if (iconType.equals("triangleUp")) {
+				source = getResource(PanelMenuIconArrowUp.class.getName()).getUri(context, color);
+			} else if (iconType.equals("chevron")) {
+				source = getResource(PanelMenuIconDoubleArrow.class.getName()).getUri(context, color);
+			} else if (iconType.equals("chevronUp")) {
+				source = getResource(PanelMenuIconDoubleArrowUp.class.getName()).getUri(context, color);
+			} else if (iconType.equals("chevronDown")) {
+				source = getResource(PanelMenuIconDoubleArrowDown.class.getName()).getUri(context, color);
+			} else if (iconType.equals("square")) {
+				source = getResource(PanelMenuIconSquare.class.getName()).getUri(context, color);
+			} else if (iconType.equals("disc")) {
+				source = getResource(PanelMenuIconDisc.class.getName()).getUri(context, color);
+			} else if (iconType.equals("grid")) {
+				source = getResource(PanelMenuIconDots.class.getName()).getUri(context, color);
+			} else {
+				source = (String)getUtils().encodeResourceURL(new  TemplateContext(this,context,component),iconType);
+			}
+		}
+		return source;
+	}
+	
+	protected UIPanelMenu findMenu (UIComponent component){
+		if (component instanceof UIPanelMenu) return (UIPanelMenu)component;
+		UIComponent parent = component;
+		while(parent != null){
+			if(parent instanceof UIPanelMenu){
+				return (UIPanelMenu) parent;
+			}
+			parent = parent.getParent();
+		}
+		return (UIPanelMenu) parent;
+	}
+	
+	public String getHideStyle(FacesContext context, UIComponent component)
+			throws IOException {
+		return "";
+	}
+	
+	public void insertValue(FacesContext context, UIComponent component) throws IOException {
+		Object value = component.getAttributes().get("value");
+		if (value!=null){
+			context.getResponseWriter().write(value.toString());
+		}
+	}
 }

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrow.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrow.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrow.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,61 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.GeneralPath;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconArrow extends PanelMenuIconBasic {
+
+	public PanelMenuIconArrow() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D g2d) {
+		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+		g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+		GeneralPath path = new GeneralPath();
+
+		Dimension  dimension = getDimensions(context);
+		g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
+		g2d.translate(47,30);
+		path.moveTo(0,0);
+		path.lineTo(33,33);
+		path.lineTo(33,34);
+		path.lineTo(0,67);
+		path.closePath();
+		g2d.setColor((Color)(((Object[]) restoreData(context))[1]));
+		g2d.fill(path);
+	}
+}
\ No newline at end of file

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrowDown.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrowDown.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrowDown.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,66 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.GeneralPath;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconArrowDown extends PanelMenuIconBasic {
+
+	public PanelMenuIconArrowDown() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D g2d) {
+		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+		g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+		GeneralPath path = new GeneralPath();
+
+		Dimension dimension = getDimensions(context);
+		
+		g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
+		g2d.translate(31,54);
+		
+		path.moveTo(0,0);
+		path.lineTo(33,33);
+		path.lineTo(34,33);
+		path.lineTo(67,0);
+		path.closePath();
+		Object [] data = (Object[]) restoreData(context);
+		Color col = (Color)data[1];
+		
+		g2d.setColor(col);
+		g2d.fill(path);
+	}	
+}

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrowUp.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrowUp.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconArrowUp.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,65 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.GeneralPath;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconArrowUp extends PanelMenuIconBasic {
+
+	public PanelMenuIconArrowUp() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D g2d) {
+		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+		g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+		GeneralPath path = new GeneralPath();
+
+		Dimension dimension = getDimensions(context);
+	
+		g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
+		g2d.translate(31,47);
+		path.moveTo(0,33);
+		path.lineTo(33,0);
+		path.lineTo(34,0);
+		path.lineTo(67,33);
+		path.closePath();
+		Object [] data = (Object[]) restoreData(context);
+		Color col = (Color)data[1];
+		
+		g2d.setColor(col);
+		g2d.fill(path);
+	}	
+}

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconBasic.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconBasic.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconBasic.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,95 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.Java2Dresource;
+import org.ajax4jsf.framework.resource.ResourceContext;
+import org.ajax4jsf.framework.skin.Skin;
+import org.ajax4jsf.framework.skin.SkinFactory;
+import org.ajax4jsf.framework.util.HtmlColor;
+import org.ajax4jsf.framework.util.HtmlDimensions;
+
+
+/**
+ * @author Pavel Kotikov
+ *
+ */
+public class PanelMenuIconBasic extends Java2Dresource {
+
+	public PanelMenuIconBasic() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	
+	public Dimension getDimensions(FacesContext facesContext, Object data) {
+		return calculateDimensions(getDataToStore(facesContext, data));
+	}
+	protected Dimension getDimensions(ResourceContext resourceContext) {
+		return calculateDimensions(restoreData(resourceContext));
+	}
+	
+	protected void paint(ResourceContext context, Graphics2D g2d) {
+
+	}
+	
+	protected Dimension calculateDimensions(Object data){
+		Object [] stored = (Object []) data;
+		int h = ((Integer) stored[0]).intValue();
+		return new Dimension(h,h);
+	}
+
+	
+	/**
+	 * @param data - pass icon color there
+	 */
+	protected Object getDataToStore(FacesContext context, Object data) {
+		Object[] stored = new Object[5];
+		Skin skin = SkinFactory.getInstance().getSkin(context);
+		
+		stored[0] = new Integer(HtmlDimensions.decode("16px").intValue());
+		
+		Color col = null;
+		
+		if (data!=null){
+			col = HtmlColor.decode(data.toString());
+		} else {
+			col = HtmlColor.decode(skin.getParameter(context, "headerTextColor").toString());
+		}
+		stored[1]= col;
+		return stored;
+	}
+	
+	public boolean isCacheable() {
+		return true;
+	}
+	
+}

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDisc.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDisc.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDisc.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,59 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Ellipse2D;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconDisc extends PanelMenuIconBasic {
+
+	public PanelMenuIconDisc() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D g2d) {
+		
+		Dimension dimension = getDimensions(context);
+		Object [] data = (Object[]) restoreData(context);
+		Color col = (Color)data[1];
+		
+		int dim = (int) Math.round(dimension.getWidth() / 3);
+		
+		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+		g2d.setColor(col);
+		g2d.translate(dim,dim);
+		Ellipse2D dot = new Ellipse2D.Double(0, 0, dim, dim);
+		g2d.fill(dot);
+		
+	}
+}
\ No newline at end of file

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDots.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDots.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDots.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,71 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Rectangle2D;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconDots extends PanelMenuIconBasic {
+
+	public PanelMenuIconDots() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D g2d) {
+		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+		g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+		g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+		g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+		g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+		Rectangle2D.Float path = new Rectangle2D.Float();
+		Dimension dimension = getDimensions(context);
+		g2d.setStroke(new BasicStroke(16,BasicStroke.CAP_SQUARE,BasicStroke.JOIN_BEVEL));
+		g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);		
+
+		g2d.translate(40,40);
+		
+		path.setRect(0,0,40,40);
+		Object [] data = (Object[]) restoreData(context);
+		Color col = (Color)data[1];
+		
+		g2d.setColor(col);
+		Color bcolor = new Color(1f,1f,1f,0f);
+		g2d.setBackground(bcolor);
+		g2d.fill(path);
+		g2d.clearRect(16,0,8,40);
+		g2d.clearRect(0,16,40,8);
+	}	
+}
\ No newline at end of file

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrow.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrow.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrow.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,90 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImage;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconDoubleArrow extends PanelMenuIconBasic {
+
+	public PanelMenuIconDoubleArrow() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D graphics2d) {
+		
+		BufferedImage bufferedImage = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB);
+		Graphics2D g2d = bufferedImage.createGraphics();
+		
+		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+		g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+		g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+		g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+		g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+		Dimension dimension = getDimensions(context);
+		GeneralPath path = new GeneralPath();
+		g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
+		g2d.translate(28,28);
+		Object [] data = (Object[]) restoreData(context);
+		Color col = (Color)data[1];
+		
+		g2d.setColor(col);
+
+		path.moveTo(1,1);
+		path.lineTo(17,1);
+		path.lineTo(47,31);
+		path.lineTo(17,61);
+		path.lineTo(1,61);
+		path.lineTo(31,31);
+		path.closePath();
+		g2d.fill(path);
+		
+		g2d.translate(24,0);
+
+		g2d.fill(path);
+		
+		AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight()/128, dimension.getHeight()/128);
+		AffineTransformOp transformOp = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
+		
+		graphics2d.drawImage(bufferedImage,transformOp, 0, 0);
+	
+		g2d.dispose();
+	}
+}
\ No newline at end of file

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrowDown.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrowDown.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrowDown.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,89 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImage;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconDoubleArrowDown extends PanelMenuIconBasic {
+
+	public PanelMenuIconDoubleArrowDown() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D graphics2D) {
+		BufferedImage bufferedImage = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB);
+		Graphics2D g2d = bufferedImage.createGraphics();
+		
+		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+		g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+		g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+		g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+		g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+		Dimension dimension = getDimensions(context);
+		GeneralPath path = new GeneralPath();
+		g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
+		g2d.translate(28,28);
+		Object [] data = (Object[]) restoreData(context);
+		Color col = (Color)data[1];
+		
+		g2d.setColor(col);
+
+		path.moveTo(1,0);
+		path.lineTo(31,30);
+		path.lineTo(61,0);
+		path.lineTo(61,16);
+		path.lineTo(31,46);
+		path.lineTo(1,16);
+		path.closePath();
+		g2d.fill(path);
+		
+		g2d.translate(0,24);
+
+		g2d.fill(path);
+		
+		AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight()/128, dimension.getHeight()/128);
+		AffineTransformOp transformOp = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
+		
+		graphics2D.drawImage(bufferedImage,transformOp, 0, 0);
+	
+		g2d.dispose();		
+	}
+}
\ No newline at end of file

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrowUp.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrowUp.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDoubleArrowUp.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,89 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImage;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconDoubleArrowUp extends PanelMenuIconBasic {
+
+	public PanelMenuIconDoubleArrowUp() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D graphics2D) {
+		BufferedImage bufferedImage = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB);
+		Graphics2D g2d = bufferedImage.createGraphics();
+		
+		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+		g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+		g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+		g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+		g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+		Dimension dimension = getDimensions(context);
+		GeneralPath path = new GeneralPath();
+		g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
+		g2d.translate(28,28);
+		Object [] data = (Object[]) restoreData(context);
+		Color col = (Color)data[1];
+		
+		g2d.setColor(col);
+
+		path.moveTo(0,46);
+		path.lineTo(0,31);
+		path.lineTo(30,1);
+		path.lineTo(61,31);
+		path.lineTo(61,46);
+		path.lineTo(30,16);
+		path.closePath();
+		g2d.fill(path);
+		
+		g2d.translate(0,24);
+
+		g2d.fill(path);
+		
+		AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight()/128, dimension.getHeight()/128);
+		AffineTransformOp transformOp = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
+		
+		graphics2D.drawImage(bufferedImage,transformOp, 0, 0);
+	
+		g2d.dispose();
+	}
+}
\ No newline at end of file

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSpacer.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSpacer.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSpacer.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,43 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.Graphics2D;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconSpacer extends PanelMenuIconBasic {
+
+	public PanelMenuIconSpacer() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D g2d) {
+		
+	}
+}
\ No newline at end of file

Added: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSquare.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSquare.java	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSquare.java	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,70 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.iconImages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.GeneralPath;
+import java.util.Date;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconSquare extends PanelMenuIconBasic {
+
+	public PanelMenuIconSquare() {
+		setRenderer(new GifRenderer());
+		setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+	}
+
+	protected void paint(ResourceContext context, Graphics2D g2d) {
+		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+		g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+		g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+		g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+		g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+		g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+		GeneralPath path = new GeneralPath();
+		Dimension dimension = getDimensions(context);
+		g2d.setStroke(new BasicStroke(16,BasicStroke.CAP_SQUARE,BasicStroke.JOIN_BEVEL));
+		g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);		
+
+		g2d.translate(40,40);
+		path.moveTo(0,0);
+		path.lineTo(40,0);
+		path.lineTo(40,40);
+		path.lineTo(0,40);
+		path.closePath();
+		Object [] data = (Object[]) restoreData(context);
+		Color col = (Color)data[1];
+		
+		g2d.setColor(col);
+		g2d.fill(path);
+	}
+}
\ No newline at end of file

Added: trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss
===================================================================
--- trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/css/panelMenu.xcss	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:template 
+	xmlns:f="http://jsf.exadel.com/template"
+   	xmlns:u="http://jsf.exadel.com/template/util" 
+   	xmlns="http://www.w3.org/1999/xhtml">	
+
+	<f:verbatim>
+		.dr-pmenu-group {
+			height: 20px;
+		}
+		
+		.dr-pmenu-item {
+			height: 20px;
+		}
+	</f:verbatim>
+	
+	<u:selector name=".dr-pmenu-group">
+		<u:style name="width" value="100%"/>
+		<u:style name="padding" value="0px"/>
+		<u:style name="vertical-align" value="middle"/>
+		<u:style name="cursor" value="pointer"/>
+		<u:style name="text-align" value="left"/>
+		<u:style name="font-weight" skin="headerWeightFont"/>
+		<u:style name="font-family" skin="headerFamilyFont"/>
+		<u:style name="font-size" skin="headerSizeFont"/>
+		<u:style name="color" skin="headerTextColor"/>
+		<u:style name="border-style" value="none"/>
+		<u:style name="border-top-style" value="solid"/>
+		<u:style name="border-color" skin="panelBorderColor"/>
+		<u:style name="background-color" skin="headerBackgroundColor"/>
+	</u:selector>
+	
+	<u:selector name=".dr-pmenu-item">
+		<u:style name="width" value="100%"/>
+		<u:style name="padding" value="0px"/>
+		<u:style name="vertical-align" value="middle"/>
+		<u:style name="cursor" value="pointer"/>
+		<u:style name="text-align" value="left"/>
+		<u:style name="font-family" skin="generalFamilyFont"/>
+		<u:style name="font-weight" skin="generalWeightFont"/>
+		<u:style name="font-size" skin="generalSizeFont"/>
+		<u:style name="color" skin="generalTextColor"/>
+		<u:style name="border-style" value="none"/>
+		<u:style name="border-top-style" value="solid"/>
+		<u:style name="border-color" skin="subBorderColor"/>
+	</u:selector>
+</f:template>
\ No newline at end of file

Added: trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
===================================================================
--- trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js	                        (rev 0)
+++ trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js	2007-05-15 17:08:48 UTC (rev 767)
@@ -0,0 +1,255 @@
+if (!window.DW) {
+	window.DW = {};
+}
+
+if (!window.Richfaces) {
+	window.Richfaces = {};
+}
+
+var PanelMenuStorage = new Object(); 
+PanelMenu = Class.create();
+PanelMenu.prototype = { 
+	initialize: function(myId,so){ 
+		this.childObj = new Array(); 
+		this.SingleOpen = so;
+		this.lastExpanded = null;
+		this.is = 'panelMenu';		
+		PanelMenuStorage[myId] = this;}}; 
+PanelMenuItem = Class.create();
+PanelMenuItem.prototype = {
+	initialize: function(ids, options, level, haveDynamicIcon, action, opened, iconAlign, iconExpanded, iconCollapsed){
+	if (!ids.parentId){return};
+	this.type = options.type;
+	this.onopen = options.onopen;
+	this.onclose = options.onclose;
+	this.tdhider = $("tdhide"+ids.myId);
+	this.tablehider = $("tablehide"+ids.myId);
+	this.haveDynamicIcon = haveDynamicIcon;
+	if (this.haveDynamicIcon==true)
+		this.iconswitcher = $("icon"+ids.myId);
+	this.childObj = new Array();
+	this.parentObj = PanelMenuStorage[ids.parentId];
+	this.parentObj.childObj.push(this);
+	this.obj = $(ids.myId);
+	this.content = this._getDirectChildrenByTag(this.obj,"TD")[level+1];
+	this.iconAlign = iconAlign;
+	if (level == 0){
+		this.tdhider.style.display = "";
+		this.tablehider.style.display = "";
+	} else if (this._getDirectChildrenByTag(this.content,"INPUT")[0].value!="closed"){
+		this.tdhider.style.display = "";
+		this.tablehider.style.display = "";
+	}
+	this.iconCollapsed = iconCollapsed;
+	this.iconExpanded = iconExpanded;
+	if(action){
+		this.action = action;
+	}
+	PanelMenuStorage[ids.myId] = this;
+	this._attachBehaviors();
+	this.inputs = this._getDirectChildrenByTag(this.content,"INPUT");	
+		for (var i=0;i<this.inputs.length;i++){
+			if (this.inputs[i].name.indexOf("panelMenuState")!=-1){
+				this.inputState = this.inputs[i];
+			} else if (this.inputs[i].name.indexOf("panelMenuAction")!=-1){
+				this.inputAction = this.inputs[i];
+			}
+		}	
+	if (opened){
+		if (this.parentObj.is=='panelMenu')
+			this.parentObj.lastExpanded = this;
+		this.expand();
+	} else {
+		this.expanded = false;
+	}
+	if (this.parentObj.type=="node"&&this.parentObj.expanded){
+		if (this.type=="node")
+		this.tdhider.style.display="";
+	}
+	},
+
+	collapse: function(){
+		if (this.expanded){
+			if (this._getDirectChildrenByTag(this.content,"INPUT")[0]!=null){
+			this._getDirectChildrenByTag(this.content,"INPUT")[0].value="closed";}
+			for (var i = 0; i < this.childObj.length; i++){
+				if (this.childObj[i]._getDirectChildrenByTag(this.childObj[i].content,"INPUT")[0]!=null){
+				this.childObj[i]._getDirectChildrenByTag(this.childObj[i].content,"INPUT")[0].value="";}
+				if (this.haveDynamicIcon){
+					var img = null
+					if (this.iconAlign=="right"){
+						img = this._getDirectChildrenByTag(this.iconswitcher.nextSibling,"IMG")[0];
+					} else {
+						img = this._getDirectChildrenByTag(this.iconswitcher.previousSibling,"IMG")[0];
+					}
+						if (img!=null){
+							if (this.iconCollapsed!="none"){
+								if (this.iconCollapsed!=null) {
+									img.src = this.iconCollapsed;
+								} else {
+									img.src = "images/panelMenuSpacer.png";
+								}
+							}
+						}
+				}
+				this.childObj[i].collapse(); 
+				this.childObj[i].hide();
+				this.childObj[i].tdhider.style.display="none";
+				this.childObj[i].tablehider.style.display="none";
+			}}
+		this.expanded = false;
+	}, 
+	hide: function(){ 
+		this.obj.style.display = 'none';
+		this.inputState.value="closed";
+	}, 
+	expand: function(){ 
+		if (!this.expanded){
+			if (this._getDirectChildrenByTag(this.content,"INPUT")[0]!=null){
+				this.inputState.value="opened";
+			}
+			if (this.haveDynamicIcon){
+				var img = null
+				if (this.iconAlign=="right"){
+					img = this._getDirectChildrenByTag(this.iconswitcher.nextSibling,"IMG")[0];
+				} else {
+					img = this._getDirectChildrenByTag(this.iconswitcher.previousSibling,"IMG")[0];
+				}
+				if (img!=null){
+					if (this.iconExpanded!="none"){
+						if (this.iconExpanded!=null) {
+							img.src = this.iconExpanded;
+						} else {
+							img.src = "images/panelMenuSpacer.png";}}}}
+			for (var i = 0; i < this.childObj.length; i++){ 
+				this.childObj[i].show();
+			}
+		}
+		this.expanded = true;
+	}, 
+	show: function(){ 
+		if (this.type!="node")
+			this.inputState.value="opened";
+		this.tdhider.style.display="";
+		this.tablehider.style.display="";
+		this.obj.style.display = "";
+	},
+	
+	preTrigger:function(e){
+		this.inputAction.setAttribute('value', this.obj.id);
+	}, 
+	trigger:function(e){
+		if (this.action !="panelMenuItemAction"){
+			this.preTrigger(e);
+			var form = Event.findElement(e, "form");
+			if(!form || typeof(form) == 'undefined' || !form.tagName || form.tagName.toLowerCase() != 'form'){
+				form = document.createElement('form');
+				form.setAttribute('method', 'post');
+				form.setAttribute('enctype', 'application/x-www-form-urlencoded');
+				form.action = action;
+				document.body.appendChild(form);
+			}
+			form.submit();
+		}
+	},
+	itemClicked: function(e){
+		if(this.action){
+			if (this.action=='panelMenuNodeAction'){
+				if (this.expanded){
+					if (this.type="node"){
+						if (new Function(this.onclose+";return true;")()){
+							this.collapse();
+						} 
+					}
+					if (this.action){
+						this.trigger(e);
+					}
+				} else { 
+					if (this.parentObj.is=='panelMenu'&&this.parentObj.SingleOpen){
+						if (this.parentObj.lastExpanded!=null){
+							this.parentObj.lastExpanded.collapse();
+						}
+						if (this.type="node"){
+							if (new Function(this.onopen+";return true;")()){
+								this.expand();
+							} 
+						}
+						if (this.action){
+							this.trigger(e);
+						}
+						this.parentObj.lastExpanded = this;
+					} else {
+						if (this.type="node"){
+							if (new Function(this.onopen+";return true;")()){
+								this.expand();
+							} 
+						}
+						if (this.action){
+							this.trigger(e);
+						}
+					}
+				}
+			}
+		} else {
+			if (this.expanded){
+				if (this.type="node"){
+					if (new Function(this.onopen+";return true;")()){
+						this.collapse();
+					} 
+				}
+				if (this.action){
+					this.trigger(e);
+				}
+			} else { 
+				if (this.parentObj.is=='panelMenu'&&this.parentObj.SingleOpen){
+					if (this.parentObj.lastExpanded!=null){
+						this.parentObj.lastExpanded.collapse();
+					}
+					if (this.type="node"){
+						if (new Function(this.onopen+";return true;")()){
+							this.expand();
+						} 
+					}
+					if (this.action){
+						this.trigger(e);
+					}
+					this.parentObj.lastExpanded = this;
+				} else {
+					if (this.type="node"){
+						if (new Function(this.onopen+";return true;")()){
+							this.expand();
+						} 
+					}
+					if (this.action){
+						this.trigger(e);
+					}
+				}
+			}
+		}
+	},
+   
+   _getDirectChildrenByTag: function(e, tagName) {
+      var allKids = e.childNodes;
+      var kids = new Array();
+	  var ddk;
+	  tagName = tagName.toLowerCase();
+      for( var i = 0 ; i < allKids.length ; i++ )
+         if ( allKids[i] && allKids[i].tagName && allKids[i].tagName.toLowerCase() == tagName )
+            kids.push(allKids[i]);
+      return kids;
+   },
+   
+   _fireEditEvent: function(e){
+		if( document.createEvent ) {
+			var evObj = document.createEvent('HTMLEvents');
+			evObj.initEvent( e, true, false );
+			this.edit.dispatchEvent(evObj);
+		} else if( document.createEventObject ) {
+			this.edit.fireEvent('on' + e);
+		}
+	}, 
+   
+ 	_attachBehaviors: function() {
+		this.obj.onclick = this.itemClicked.bindAsEventListener(this);
+	}
+};
\ No newline at end of file

Modified: trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx
===================================================================
--- trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx	2007-05-15 14:17:36 UTC (rev 766)
+++ trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx	2007-05-15 17:08:48 UTC (rev 767)
@@ -1,13 +1,43 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <f:root 
-	xmlns:f="http:/jsf.exadel.com/template" 
-	xmlns:c=" http://java.sun.com/jsf/core" 
-	xmlns:ui=" http://ajax4jsf.org/cdk/ui"
-	xmlns:u=" http://ajax4jsf.org/cdk/u"
-	xmlns:x=" http://ajax4jsf.org/cdk/x"
-	class="org.richfaces.renderkit.html.HtmlPanelMenuRenderer"
-	baseclass="org.richfaces.renderkit.PanelMenuRenderer"
-	component="org.richfaces.component.panelmenu.UIPanelMenu" 
-	>
+		xmlns:f="http:/jsf.exadel.com/template" 
+		xmlns:h=" http://ajax4jsf.org/cdk/headers"
+		xmlns:c=" http://java.sun.com/jsf/core" 
+		xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+		xmlns:u=" http://ajax4jsf.org/cdk/u"
+		xmlns:x=" http://ajax4jsf.org/cdk/x"
+		xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
+		class="org.richfaces.renderkit.html.HtmlPanelMenuRenderer"
+		baseclass="org.richfaces.renderkit.PanelMenuRenderer"
+		component="org.richfaces.component.panelmenu.UIPanelMenu" >
+		
+	<h:styles>
+		/org/richfaces/renderkit/html/css/panelMenu.xcss
+	</h:styles>
+	<h:scripts>
+		new org.ajax4jsf.framework.resource.PrototypeScript(),
+		/org/richfaces/renderkit/html/scripts/utils.js,
+		/org/richfaces/renderkit/html/scripts/panelMenu.js,
+	</h:scripts>
 	
+	<f:clientid var="clientId"/>
+	
+	<f:call name="utils.encodeBeginFormIfNessesary"/>
+	<table cellpadding="0" cellspacing="0" 
+		style="#{component.style};"  class="#{component.styleClass}"
+		id="#{clientId}" >
+		
+		<tbody>
+			<vcp:body>
+					<f:call name="renderChildren" />
+			</vcp:body>
+			<tr style="display:none">
+				<td>
+					<f:clientid var="clientId"/>
+					<f:call name="insertScript"/>
+				</td>
+			</tr>
+		</tbody>
+	</table>
+	<f:call name="utils.encodeEndFormIfNessesary"/>
 </f:root>
\ No newline at end of file

Modified: trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
===================================================================
--- trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx	2007-05-15 14:17:36 UTC (rev 766)
+++ trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx	2007-05-15 17:08:48 UTC (rev 767)
@@ -5,10 +5,49 @@
 	xmlns:ui=" http://ajax4jsf.org/cdk/ui"
 	xmlns:u=" http://ajax4jsf.org/cdk/u"
 	xmlns:x=" http://ajax4jsf.org/cdk/x"
+	xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
 	class="org.richfaces.renderkit.html.HtmlPanelMenuGroupRenderer"
 	baseclass="org.richfaces.renderkit.PanelMenuGroupRenderer"
 	component="org.richfaces.component.panelmenu.UIPanelMenuGroup" 
 	>
 	
-	
+	<f:clientid var="clientId"/>
+	<tr id="tdhide#{clientId}" style="#{hideStyle}" >
+		<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}" >
+				<f:call name="utils.encodePassThru" />
+				<tr>
+					<f:call name="utils.encodeId" />
+					<f:call name="insertTDs" />
+					<td>
+						<f:call name="insertImage">
+							<f:parameter value="left" />
+						</f:call>
+					</td>
+					<td style="width:100%" class="item_content"
+						id="icon#{clientId}" >
+						<input type="hidden" name="panelMenuState#{clientId}" 
+								value="#{isOpened}" >
+						</input>
+						<input type="hidden" name="panelMenuAction#{clientId}"
+								value="" >
+						</input>
+						<f:call name="insertValue"/>
+						
+					</td>
+					<td>
+						<f:call name="insertImage">
+							<f:parameter value="right" />
+						</f:call>
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+	<vcp:body>
+			<f:call name="renderChildren" />
+	</vcp:body>
 </f:root>
\ No newline at end of file

Modified: trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
===================================================================
--- trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx	2007-05-15 14:17:36 UTC (rev 766)
+++ trunk/richfaces/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx	2007-05-15 17:08:48 UTC (rev 767)
@@ -5,9 +5,50 @@
 	xmlns:ui=" http://ajax4jsf.org/cdk/ui"
 	xmlns:u=" http://ajax4jsf.org/cdk/u"
 	xmlns:x=" http://ajax4jsf.org/cdk/x"
+	xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
 	class="org.richfaces.renderkit.html.HtmlPanelMenuItemRenderer"
 	baseclass="org.richfaces.renderkit.PanelMenuItemRenderer"
 	component="org.richfaces.component.panelmenu.UIPanelMenuItem" 
 	>
-		
+	
+	<f:clientid var="clientId"/>
+	<tr id="tdhide#{clientId}" style="hideStyle" >
+		<td>
+			<table cellpadding="0" cellspacing="0" border="0" width="100%"
+					onclick="#{onClick}" 
+					class="rich-pmenu-item dr-pmenu-item #{component.styleClass}" 
+					style="#{component.style}" 
+					id="tablehide#{clientId}" >
+				<f:call name="utils.encodePassThruWithExclusions">
+					<f:parameter value="onclick"/> 
+				</f:call>
+				<tr>
+					<f:call name="utils.encodeId"/>
+					<f:call name="insertTDs"/>
+					<td>
+						<f:call name="insertImage">
+							<f:parameter value="left"/>
+						</f:call>
+					</td>
+					<td style="width:100%" class="item_content">
+						<input type="hidden" name="panelMenuState#{clientId}"
+								value="#{isOpened}" >
+						</input>
+						<input type="hidden" name="panelMenuActionn#{clientId}"
+								value="" >
+						</input>
+						<f:call name="insertValue"/>
+						<vcp:body>
+								<f:call name="renderChildren" />
+						</vcp:body>
+					</td>
+					<td>
+						<f:call name="insertImage">
+							<f:parameter value="right"/>
+						</f:call>
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>	
 </f:root>
\ No newline at end of file




More information about the richfaces-svn-commits mailing list