Author: dsakovich
Date: 2007-11-02 09:57:32 -0400 (Fri, 02 Nov 2007)
New Revision: 4659
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1249 Fix dropDownMenu template
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2007-11-02
12:55:41 UTC (rev 4658)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2007-11-02
13:57:32 UTC (rev 4659)
@@ -22,6 +22,7 @@
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.xpcom.XPCOMException;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -233,4 +234,51 @@
} else
visualElement.removeAttribute(attrName);
}
+
+ /**
+ * Is invoked after construction of all child nodes of the current visual
+ * node.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param data
+ * Object <code>VpeCreationData</code>, built by a
method
+ * <code>create</code>
+ */
+
+ @Override
+ public void validate(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument, VpeCreationData data) {
+ super.validate(pageContext, sourceNode, visualDocument, data);
+ correctLabelStyles(data.getNode());
+ }
+
+ /**
+ * Correct font for label
+ *
+ * @param node
+ */
+ private void correctLabelStyles(nsIDOMNode node) {
+
+ try {
+ nsIDOMElement element = (nsIDOMElement) node
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ if (node.getNodeName().equalsIgnoreCase(
+ HtmlComponentUtil.HTML_TAG_SPAN)) {
+ String styleClass = element.getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
+ styleClass = (styleClass==null?"":styleClass) + " dr-label-text-decor
dr-menu-label";
+ element.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
+ }
+ nsIDOMNodeList list = node.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ correctLabelStyles(list.item(i));
+ }
+ } catch (XPCOMException e) {
+ return;
+ }
+ }
}
\ No newline at end of file