Author: svasilyev
Date: 2007-09-18 11:32:21 -0400 (Tue, 18 Sep 2007)
New Revision: 3689
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-901
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-09-18
15:32:17 UTC (rev 3688)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2007-09-18
15:32:21 UTC (rev 3689)
@@ -52,8 +52,6 @@
STYLE_ATTR_NAME,
HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
- Attr ddmLabelFromAttribute = sourceElement.getAttributeNode("value");
-
Element visualMenuLabel =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
visualMenuLabel.setAttribute("class", "dr-label-text-decor
rich-label-text-decor");
correctAttribute(sourceElement, visualMenuLabel,
@@ -68,21 +66,23 @@
visualMenu.appendChild(visualMenuLabel);
- String ddmLabelFromFacet = getLabelFacet(sourceElement);
- Map visualNodeMap = pageContext.getDomMapping().getVisualMap();
-
VpeCreationData creatorInfo = new VpeCreationData(visualMenu);
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualMenuLabel);
- Node textLabel = null;
- if (ddmLabelFromFacet != null) {
- textLabel = visualDocument.createTextNode(ddmLabelFromFacet);
+// Node textLabel = null;
+// String ddmLabelFromFacet = getLabelFacet(sourceElement);
+ Element facetElement = getLabelFacet1(sourceElement);
+ if ( facetElement != null) {
+ childrenInfo.addSourceChild(facetElement);
} else {
- textLabel = visualDocument.createTextNode(ddmLabelFromAttribute.getValue());
+ Attr ddmLabelFromAttribute = sourceElement.getAttributeNode("value");
+ String textLabel = ddmLabelFromAttribute != null &&
ddmLabelFromAttribute.getValue() != null
+ ? ddmLabelFromAttribute.getValue()
+ : "";
+ Node textLabelNode = visualDocument.createTextNode(textLabel);
+ visualMenuLabel.appendChild(textLabelNode);
}
- if (textLabel != null) {
- visualMenuLabel.appendChild(textLabel);
- creatorInfo.addChildrenInfo(childrenInfo);
- }
+
+ creatorInfo.addChildrenInfo(childrenInfo);
visualMenu.appendChild(visualMenuLabel);
MozillaSupports.release(visualMenuLabel);
@@ -123,6 +123,31 @@
return labelFacet;
}
+ private Element getLabelFacet1(Element sourceElement) {
+ if (sourceElement == null) {
+ return null;
+ }
+
+ NodeList children = sourceElement.getChildNodes();
+ if (children != null) {
+ int size = children.getLength();
+ if (size > 0) {
+ for (int i=0; i<size; i++) {
+ Node child = children.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE
+ && child.getNodeName().endsWith(":facet")) {
+ Element facetElement = (Element)child;
+ if (LABEL_FACET_NAME.equals(facetElement.getAttribute("name"))) {
+ return facetElement;
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
private String getElementTextContent(Element element) {
String content = null;
NodeList children = element.getChildNodes();