[jbosstools-commits] JBoss Tools SVN: r7210 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: src/org/jboss/tools/jsf/vpe/richfaces/template and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Mar 31 09:28:45 EDT 2008


Author: dmaliarevich
Date: 2008-03-31 09:28:45 -0400 (Mon, 31 Mar 2008)
New Revision: 7210

Modified:
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1588, styles updated

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css	2008-03-31 13:24:09 UTC (rev 7209)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css	2008-03-31 13:28:45 UTC (rev 7210)
@@ -12,9 +12,6 @@
 
 .dr-pmenu-top-group-div {
 	border-color: #C4C0B9;
-}
-
-.dr-pmenu-top-group-div {
 	border: 1px solid;
 	margin-bottom: 3px;
 	padding: 1px;
@@ -28,6 +25,10 @@
 	border-color: #C4C0B9;
 }
 
+.dr-pmenu-group {
+	cursor: pointer;
+}
+
 .dr-pmenu-top-group {
 	background-color: #D4CFC7;
 	font-family: Arial, Verdana, sans-serif;

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java	2008-03-31 13:24:09 UTC (rev 7209)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java	2008-03-31 13:28:45 UTC (rev 7210)
@@ -59,6 +59,8 @@
 	
 	private static final String TRUE = "true"; //$NON-NLS-1$
 	private static final String RIGHT = "right"; //$NON-NLS-1$
+	private static final String SPACE = " "; //$NON-NLS-1$
+	private static final String EMPTY = ""; //$NON-NLS-1$
 	
 	/*
 	 *	rich:panelMenu attributes for groups
@@ -215,25 +217,11 @@
 			Element sourceParentElement, Element parent, Element sourceElement,
 			nsIDOMDocument visualDocument, nsIDOMElement div, boolean expanded,
 			boolean disabled, String activeChildId) {
-		String disabledStyle = pmg_disabledStyle;
-		String disableClass = null;
-		String style = sourceElement
-				.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
-		String styleClass = sourceElement
-				.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+		String disabledStyle = EMPTY;
+		String disableClass = EMPTY;
+		String style = EMPTY;
+		String styleClass = EMPTY;
 
-		if (disabledStyle == null){
-			disabledStyle = pm_disabledGroupStyle;
-		}
-
-		if (attrPresents(pmg_disabledClass)) {
-			disableClass = pmg_disabledClass;
-		} else if (attrPresents(pm_disabledGroupClass)) {
-			disableClass = pm_disabledGroupClass;
-		} else {
-			disableClass = "rich-pmenu-group-disabled"; //$NON-NLS-1$
-		}
-
 		nsIDOMElement table = visualDocument
 				.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
 		div.appendChild(table);
@@ -284,54 +272,66 @@
 		setIcon(pageContext, parent, sourceParentElement, sourceElement, img1,
 				img2, expanded, disabled);
 
-		if (parent.getNodeName().endsWith(PANEL_MENU_END_TAG)
-				|| ((parent.getNodeName().endsWith(PANEL_MENU_GROUP_END_TAG)) 
-						&& (sourceElement.getNodeName().endsWith(PANEL_MENU_GROUP_END_TAG)))) {
-			if (styleClass != null
-					&& attrPresents(pm_topGroupClass)) {
+		boolean childOfPanelMenu = parent.getNodeName().endsWith(
+				PANEL_MENU_END_TAG);
+
+		if (childOfPanelMenu) {
+			if (attrPresents(pm_topGroupClass)) {
 				styleClass = "dr-pmenu-group-self-label dr-pmenu-top-group" //$NON-NLS-1$
-						+ " " //$NON-NLS-1$
-						+ pm_topGroupClass;
+						+ SPACE + pm_topGroupClass;
 			} else {
 				styleClass = "dr-pmenu-group-self-label dr-pmenu-top-group"; //$NON-NLS-1$
 			}
-			
-			if (style != null
-					&& attrPresents(pm_topGroupStyle)) {
-				style = pm_topGroupStyle;
-			} else {
-				style = ""; //$NON-NLS-1$
+
+			if (attrPresents(pm_topGroupStyle)) {
+				style += pm_topGroupStyle;
 			}
 			div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
 					"dr-pmenu-top-group-div"); //$NON-NLS-1$
 		} else {
-			if (styleClass != null
-					&& attrPresents(pm_groupClass)) {
-				styleClass = "dr-pmenu-group-self-label rich-pmenu-group-self-label" //$NON-NLS-1$
-						+ " " //$NON-NLS-1$
-						+ pm_groupClass;
+			if (attrPresents(pm_groupClass)) {
+				styleClass = "dr-pmenu-group-self-label dr-pmenu-group rich-pmenu-group-self-label" //$NON-NLS-1$
+						+ SPACE + pm_groupClass;
 			} else {
-				styleClass = "dr-pmenu-group-self-label rich-pmenu-group-self-label"; //$NON-NLS-1$
+				styleClass = "dr-pmenu-group-self-label dr-pmenu-group rich-pmenu-group-self-label"; //$NON-NLS-1$
 			}
-			if (style != null
-					&& attrPresents(pm_groupStyle)) {
-				style = pm_groupStyle;
-			} else {
-				style = ""; //$NON-NLS-1$
+			if (attrPresents(pm_groupStyle)) {
+				style += pm_groupStyle;
 			}
 			div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
 					"dr-pmenu-top-self-div"); //$NON-NLS-1$
 		}
 
+		if (attrPresents(pmg_style)) {
+			style += SPACE + pmg_style;
+		}
+		if (attrPresents(pm_styleClass)) {
+			styleClass += SPACE + pm_styleClass;
+		}
+		if (attrPresents(pmg_styleClass)) {
+			styleClass += SPACE + pmg_styleClass;
+		}
+
 		if (disabled) {
-			styleClass = styleClass + " " + disableClass; //$NON-NLS-1$
-
-			if (disabledStyle != null) {
-				style = style + " " + disabledStyle; //$NON-NLS-1$
+			if (attrPresents(pm_disabledGroupClass)) {
+				disableClass += SPACE + pm_disabledGroupClass;
 			}
+			if (attrPresents(pmg_disabledClass)) {
+				disableClass += SPACE + pmg_disabledClass;
+			} 
+			disableClass += SPACE + "rich-pmenu-group-disabled"; //$NON-NLS-1$
+			styleClass += SPACE + disableClass;
+			
+			if (attrPresents(pm_disabledGroupStyle)) {
+				disabledStyle += pm_disabledGroupStyle;
+			}
+			if (attrPresents(pmg_disabledStyle)) {
+				disabledStyle += pmg_disabledStyle;
+			}
+			style += SPACE + disabledStyle;
 		}
-
-		if (!"".equals(style.trim())) { //$NON-NLS-1$
+		
+		if (!EMPTY.equals(style.trim())) {
 			table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
 		}
 		table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
@@ -503,6 +503,6 @@
      * @return true, if successful
      */
     private static boolean attrPresents(String attr) {
-		return ((null != attr) && (!"".equals(attr))); //$NON-NLS-1$
+		return null != attr;
 	}
 }
\ No newline at end of file

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java	2008-03-31 13:24:09 UTC (rev 7209)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java	2008-03-31 13:28:45 UTC (rev 7210)
@@ -51,6 +51,7 @@
 	private static final String IMG_SPACER_SRC = "/panelMenuItem/spacer.gif"; //$NON-NLS-1$
 	private static final String STYLE_PATH = "/panelMenuItem/style.css"; //$NON-NLS-1$
 	
+	private static final String TRUE = "true"; //$NON-NLS-1$
 	private static final String NO_SIZE_VALUE = "0"; //$NON-NLS-1$
 	private static final String DEFAULT_SIZE_VALUE = "16"; //$NON-NLS-1$
 	
@@ -60,6 +61,7 @@
 	/*
 	 *	rich:panelMenu attributes for items
 	 */ 
+	private static String pm_disabled;
 	private static String pm_iconItem;
 	private static String pm_iconDisabledItem;
 	private static String pm_iconItemPosition;
@@ -179,7 +181,8 @@
 			if (sourceElement.getParentNode().getNodeName().endsWith(
 					":panelMenu")) { //$NON-NLS-1$
 
-				if ("true".equalsIgnoreCase(pmi_disabled)) { //$NON-NLS-1$
+				if ((TRUE.equalsIgnoreCase(pmi_disabled))
+						|| (TRUE.equalsIgnoreCase(pm_disabled))) {
 					setIcon(pageContext, imgPoints, sourceElement,
 							sourceParentElement, pm_iconTopDisabledItem,
 							pmi_iconDisabled);
@@ -197,7 +200,8 @@
 						imgPoints, imgSpacer2);
 
 			} else {
-				if ("true".equalsIgnoreCase(pmi_disabled)) { //$NON-NLS-1$
+				if ((TRUE.equalsIgnoreCase(pmi_disabled))
+						|| (TRUE.equalsIgnoreCase(pm_disabled))) {
 					setIcon(pageContext, imgPoints, sourceElement,
 							sourceParentElement, pm_iconDisabledItem,
 							pmi_iconDisabled);
@@ -324,6 +328,7 @@
 		/*
 		 *	rich:panelMenu attributes for items
 		 */ 
+		pm_disabled = sourceParentElement.getAttribute(RichFacesPanelMenuTemplate.DISABLED);
 		pm_iconItem = sourceParentElement.getAttribute(RichFacesPanelMenuTemplate.ICON_ITEM);
 		pm_iconDisabledItem = sourceParentElement.getAttribute(RichFacesPanelMenuTemplate.ICON_DISABLED_ITEM);
 		pm_iconItemPosition = sourceParentElement.getAttribute(RichFacesPanelMenuTemplate.ICON_ITEM_POSITION);




More information about the jbosstools-commits mailing list