accessibilityServiceCache = null;
@@ -381,4 +390,130 @@
}
return creationData;
}
+
+ /**
+ * Finds visual tag with 'VPE-FACET' attribute in it.
+ * Facet element should be rendered into this tag.
+ *
+ * @param facetsParentNode node for which its facet should be rendered.
+ * @param facetName facet's name to compare to 'VPE-FACET' attribute value.
+ * @return found visual tag or 'null' otherwise.
+ */
+ public static nsIDOMElement findVisualTagWithFacetAttribute(nsIDOMNode facetsParentNode, String facetName) {
+ nsIDOMElement tagForFacet = null;
+ nsIDOMNodeList nodeList = facetsParentNode.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ nsIDOMElement element = null;
+ try {
+ element = (nsIDOMElement) nodeList.item(i).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ } catch (org.mozilla.xpcom.XPCOMException e) {
+ /*
+ * Cannot parse node to element, return null.
+ */
+ return null;
+ }
+ /*
+ * If current tag has 'VPE-FACET' attribute
+ * with the corresponding facet name.
+ * Then return this tag.
+ */
+ if (element.hasAttribute(VpeVisualDomBuilder.VPE_FACET)) {
+ String facetAttributeName = element.getAttribute(VpeVisualDomBuilder.VPE_FACET);
+ /*
+ * In some cases there could be several footer in one visual node.
+ * For instance, header and footer could be in single column cell.
+ * Thus VPE-FACET can contain several facet names
+ * separated by whitespace, i.e. "header footer".
+ */
+ if (facetAttributeName.indexOf(facetName) >= 0) {
+ return element;
+ }
+ }
+ /*
+ * Else search in children
+ */
+ tagForFacet = findVisualTagWithFacetAttribute(element, facetName);
+ /*
+ * When tag is found in children it will be returned
+ */
+ if (null != tagForFacet) {
+ return tagForFacet;
+ }
+ }
+ /*
+ * If nothing matched return null
+ */
+ return tagForFacet;
+ }
+
+ /**
+ * Clarifies JSF facet element's children: JSF tags, other tags, HTML, text.
+ * (For JSF Facet cannot display more than one JSF component).
+ * Results are put into the map with keys:
+ * 'FACET-JSF-TAG' - for suitable JSF element
+ *
'FACET-ODD-TAGS' - for superfluous elements
+ *
'FACET-HTML-TAG' - for HTML elements and plain text
+ *
+ * @param facet the facet
+ * @param pageContext the page context
+ * @return map with arranged elements or empty map if nothing was found.
+ */
+ public static Map> findFacetElements(Node facet, VpePageContext pageContext) {
+ Map> facetChildren = new HashMap>();
+ List jsfTag = new ArrayList();
+ List oddTags = new ArrayList();
+ List htmlTags = new ArrayList();
+ facetChildren.put(FACET_JSF_TAG, jsfTag);
+ facetChildren.put(FACET_ODD_TAGS, oddTags);
+ facetChildren.put(FACET_HTML_TAGS, htmlTags);
+ if (null != facet) {
+ NodeList children = facet.getChildNodes();
+ Node lastJSFComponent = null;
+ for (int i = 0; i < children.getLength() ; i++) {
+ Node child = children.item(i);
+ String sourcePrefix = child.getPrefix();
+ List taglibs = XmlUtil.getTaglibsForNode(child,
+ pageContext);
+ TaglibData sourceNodeTaglib = XmlUtil.getTaglibForPrefix(
+ sourcePrefix, taglibs);
+ /*
+ * Here will be nodes with taglibs
+ * Plain html tags and text - will not.
+ */
+ if (null != sourceNodeTaglib) {
+ String sourceNodeUri = sourceNodeTaglib.getUri();
+ if ((JSF_CORE_URI.equalsIgnoreCase(sourceNodeUri)
+ || JSF_HTML_URI.equalsIgnoreCase(sourceNodeUri)
+ || RICH_FACES_URI.equalsIgnoreCase(sourceNodeUri)
+ || A4J_URI.equalsIgnoreCase(sourceNodeUri)
+ || FACELETS_URI.equalsIgnoreCase(sourceNodeUri))) {
+ /*
+ * Mark the correct jsf component
+ * and add it to the odd list for further correction.
+ */
+ lastJSFComponent = child;
+ oddTags.add(child);
+ } else {
+ /*
+ * All other tags: JSF or not.
+ */
+ oddTags.add(child);
+ }
+ } else {
+ /*
+ * Plain html and text
+ */
+ htmlTags.add(child);
+ }
+ /*
+ * Fill the correct JSF component:
+ * remove it from the odd list and add to the jsf list.
+ */
+ oddTags.remove(lastJSFComponent);
+ jsfTag.add(lastJSFComponent);
+ }
+ }
+ return facetChildren;
+ }
+
}
Index: src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java
===================================================================
--- src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java (revision 20840)
+++ src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java (working copy)
@@ -192,7 +192,7 @@
// div.appendChild(visualDocument.createTextNode(redundantText));
div.appendChild(outterTable);
- if (true || sourceElements.hasTableCaption()) {
+ if (sourceElements.hasTableCaption()) {
caption = visualDocument.createElement(HTML.TAG_CAPTION);
if (sourceElements.getTableCaption() != null) {
VpeChildrenInfo info = new VpeChildrenInfo(caption);
Index: src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java
===================================================================
--- src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java (revision 20840)
+++ src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java (working copy)
@@ -15,6 +15,7 @@
import java.util.Map;
import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.expression.VpeExpression;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilder;
@@ -23,6 +24,7 @@
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionInfo;
import org.jboss.tools.vpe.editor.template.expression.VpeValue;
import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.jboss.tools.vpe.editor.util.VpeClassUtil;
import org.mozilla.interfaces.nsIDOMAttr;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -265,6 +267,23 @@
if (tableSize == 0) {
tableSize = childrenCount;
}
+ Map> captionFacetChildren = null;
+ Map> headerFacetChildren = null;
+ Map> footerFacetChildren = null;
+ captionFacetChildren = VisualDomUtil.findFacetElements(caption, pageContext);
+ headerFacetChildren = VisualDomUtil.findFacetElements(header, pageContext);
+ footerFacetChildren = VisualDomUtil.findFacetElements(footer, pageContext);
+ /*
+ * Add additional table cell for odd facet's elements.
+ */
+ boolean captionHtmlElementsPresents = ((null != captionFacetChildren) && (captionFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS).size() > 0));
+ boolean headerHtmlElementsPresents = ((null != headerFacetChildren) && (headerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS).size() > 0));
+ boolean footerHtmlElementsPresents = ((null != footerFacetChildren) && (footerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS).size() > 0));
+ boolean htmlFacetsElementsPresents = captionHtmlElementsPresents || headerHtmlElementsPresents || footerHtmlElementsPresents;
+ boolean htmlFacetsElementsRendered = false;
+ if (htmlFacetsElementsPresents) {
+ childrenCount++;
+ }
int rowCount = (childrenCount + tableSize - 1) / tableSize;
nsIDOMElement visualHead = null;
@@ -275,8 +294,7 @@
visualCaption = visualDocument
.createElement(HTML.TAG_CAPTION);
visualTable.appendChild(visualCaption);
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(
- visualCaption);
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualCaption);
childrenInfo.addSourceChild(caption);
creatorInfo.addChildrenInfo(childrenInfo);
if (captionClassExpr != null
@@ -317,8 +335,7 @@
for (int i = 0; i < rowCount; i++) {
int cci = 0; // index of column class. Reset on every new row.
- nsIDOMElement visualRow = visualDocument
- .createElement(HTML.TAG_TR);
+ nsIDOMElement visualRow = visualDocument.createElement(HTML.TAG_TR);
if (rowClasses.size() > 0) {
visualRow.setAttribute(HTML.ATTR_CLASS, rowClasses.get(rci)
.toString());
@@ -330,8 +347,7 @@
if (i*tableSize+j >= childrenCount) {
break;
}
- nsIDOMElement visualCell = visualDocument
- .createElement(HTML.TAG_TD);
+ nsIDOMElement visualCell = visualDocument.createElement(HTML.TAG_TD);
if (columnClasses.size() > 0) {
visualCell.setAttribute(HTML.ATTR_CLASS, columnClasses.get(
cci).toString());
@@ -340,27 +356,64 @@
cci = 0;
}
visualRow.appendChild(visualCell);
- int sourceIndex = tableSize * i + j;
- if (sourceIndex < childrenCount) {
- Node child = sourceChildren[sourceIndex];
- if (child != header && child != footer) {
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(
- visualCell);
- childrenInfo.addSourceChild(child);
- creatorInfo.addChildrenInfo(childrenInfo);
- }
- }
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-3373
+ * Add odd facets elements to the first table cell
+ */
+ if (htmlFacetsElementsPresents && !htmlFacetsElementsRendered) {
+ VpeChildrenInfo childrenInfo = null;
+ if (captionHtmlElementsPresents) {
+ for (Node node : captionFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
+ childrenInfo = new VpeChildrenInfo(visualCell);
+ childrenInfo.addSourceChild(node);
+ creatorInfo.addChildrenInfo(childrenInfo);
+ }
+ }
+ if (headerHtmlElementsPresents) {
+ for (Node node : headerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
+ childrenInfo = new VpeChildrenInfo(visualCell);
+ childrenInfo.addSourceChild(node);
+ creatorInfo.addChildrenInfo(childrenInfo);
+ }
+ }
+ if (footerHtmlElementsPresents) {
+ for (Node node : footerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
+ childrenInfo = new VpeChildrenInfo(visualCell);
+ childrenInfo.addSourceChild(node);
+ creatorInfo.addChildrenInfo(childrenInfo);
+ }
+ }
+ htmlFacetsElementsRendered = true;
+ } else {
+
+ int sourceIndex = tableSize * i + j;
+ if (sourceIndex < childrenCount) {
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-3373
+ * Correct index when odd facets elements presents
+ */
+ if (htmlFacetsElementsPresents) {
+ sourceIndex = sourceIndex-1;
+ }
+ Node child = sourceChildren[sourceIndex];
+ if (child != header && child != footer) {
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualCell);
+ childrenInfo.addSourceChild(child);
+ creatorInfo.addChildrenInfo(childrenInfo);
+ }
+ }
}
+ }
if (visualBody != null) {
visualBody.appendChild(visualRow);
} else {
visualTable.appendChild(visualRow);
}
}
- makeSpecial(header, visualHead, visualDocument, tableSize,
- creatorInfo, HTML.TAG_TH, headerClassExpr, pageContext);
- makeSpecial(footer, visualFoot, visualDocument, tableSize,
- creatorInfo, HTML.TAG_TD, footerClassExpr, pageContext);
+ makeSpecial(header, "header", visualHead, visualDocument, tableSize, //$NON-NLS-1$
+ creatorInfo, HTML.TAG_TH, headerClassExpr, pageContext);
+ makeSpecial(footer, "footer", visualFoot, visualDocument, tableSize, //$NON-NLS-1$
+ creatorInfo, HTML.TAG_TD, footerClassExpr, pageContext);
for (int i = 0; i < propertyCreators.size(); i++) {
VpeCreator creator = (VpeCreator) propertyCreators.get(i);
@@ -382,24 +435,25 @@
return creatorInfo;
}
- private void makeSpecial(Node header, nsIDOMElement visualHead,
+ private void makeSpecial(Node facet, String facetName, nsIDOMElement visualHead,
nsIDOMDocument visualDocument, int tableSize,
VpeCreatorInfo creatorInfo, String cellTag,
VpeExpression headerClassExpr, VpePageContext pageContext) throws VpeExpressionException {
- if (header != null && visualHead != null) {
+ if (facet != null && visualHead != null) {
nsIDOMElement visualRow = visualDocument.createElement(HTML.TAG_TR);
visualHead.appendChild(visualRow);
nsIDOMElement visualCell = visualDocument.createElement(cellTag);
visualCell.setAttribute(HTML.ATTR_COLSPAN, "" + tableSize); //$NON-NLS-1$
- if (headerClassExpr != null && header.getParentNode() != null) {
+ if (headerClassExpr != null && facet.getParentNode() != null) {
String headerClass = headerClassExpr.exec(pageContext,
- header.getParentNode()).stringValue();
+ facet.getParentNode()).stringValue();
visualCell.setAttribute(HTML.ATTR_CLASS, headerClass);
}
visualRow.appendChild(visualCell);
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualCell);
- childrenInfo.addSourceChild(header);
+ childrenInfo.addSourceChild(facet);
creatorInfo.addChildrenInfo(childrenInfo);
+ visualCell.setAttribute(VpeVisualDomBuilder.VPE_FACET, facetName);
}
}
#P org.jboss.tools.jsf.vpe.richfaces
Index: src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java
===================================================================
--- src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java (revision 20840)
+++ src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java (working copy)
@@ -11,12 +11,18 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import java.util.List;
+import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.SourceDomUtil;
+import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.w3c.dom.Element;
@@ -43,28 +49,71 @@
div.setAttribute("style", style); //$NON-NLS-1$
}
- // Encode Header
- Node header = ComponentUtil.getFacet(sourceElement, "header", true); //$NON-NLS-1$
- if(header!=null) {
- nsIDOMElement headerDiv = visualDocument.createElement("div"); //$NON-NLS-1$
+ /*
+ * Encode the Header Facet
+ * Find elements from the f:facet
+ */
+ Map> headerFacetChildren = null;
+ Element headerFacet = SourceDomUtil.getFacetByName(sourceElement, RichFaces.NAME_FACET_HEADER);
+ if (headerFacet != null) {
+ headerFacetChildren = VisualDomUtil.findFacetElements(headerFacet, pageContext);
+ nsIDOMElement headerDiv = visualDocument.createElement(HTML.TAG_DIV);
+ /*
+ * By adding attribute VPE-FACET to this visual node
+ * we force JsfFacet to be rendered inside it.
+ */
+ headerDiv.setAttribute(VpeVisualDomBuilder.VPE_FACET, RichFaces.NAME_FACET_HEADER);
div.appendChild(headerDiv);
- String headerClass = sourceElement.getAttribute("headerClass"); //$NON-NLS-1$
- headerDiv.setAttribute("class", "dr-pnl-h rich-panel-header " + (headerClass==null?"":headerClass)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- headerDiv.setAttribute("style", ComponentUtil.getHeaderBackgoundImgStyle()); //$NON-NLS-1$
+ String headerClass = sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS);
+ headerDiv.setAttribute(HTML.ATTR_CLASS,
+ "dr-pnl-h rich-panel-header " + (headerClass == null ? "" : headerClass)); //$NON-NLS-1$ //$NON-NLS-2$
+ headerDiv.setAttribute(HTML.ATTR_STYLE,
+ ComponentUtil.getHeaderBackgoundImgStyle());
VpeChildrenInfo headerInfo = new VpeChildrenInfo(headerDiv);
- headerInfo.addSourceChild(header);
+ headerInfo.addSourceChild(headerFacet);
creationData.addChildrenInfo(headerInfo);
}
+
+ // Encode Header
+// Node header = ComponentUtil.getFacet(sourceElement, "header", true); //$NON-NLS-1$
+// if(header!=null) {
+// nsIDOMElement headerDiv = visualDocument.createElement("div"); //$NON-NLS-1$
+// div.appendChild(headerDiv);
+// String headerClass = sourceElement.getAttribute("headerClass"); //$NON-NLS-1$
+// headerDiv.setAttribute("class", "dr-pnl-h rich-panel-header " + (headerClass==null?"":headerClass)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+// headerDiv.setAttribute("style", ComponentUtil.getHeaderBackgoundImgStyle()); //$NON-NLS-1$
+//
+// VpeChildrenInfo headerInfo = new VpeChildrenInfo(headerDiv);
+// headerInfo.addSourceChild(header);
+// creationData.addChildrenInfo(headerInfo);
+// }
- // Encode Body
- nsIDOMElement bodyDiv = visualDocument.createElement("div"); //$NON-NLS-1$
+ /*
+ * Encode rich:panel content
+ */
+ nsIDOMElement bodyDiv = visualDocument.createElement(HTML.TAG_DIV);
div.appendChild(bodyDiv);
- String bodyClass = sourceElement.getAttribute("bodyClass"); //$NON-NLS-1$
- bodyDiv.setAttribute("class", "dr-pnl-b rich-panel-body " + (bodyClass==null?"":bodyClass)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+ String bodyClass = sourceElement.getAttribute(RichFaces.ATTR_BODY_CLASS);
+ bodyDiv.setAttribute(HTML.ATTR_CLASS,
+ "dr-pnl-b rich-panel-body " + (bodyClass == null ? "" : bodyClass)); //$NON-NLS-1$ //$NON-NLS-2$
+ /*
+ * If there are some odd HTML elements from facet
+ * add them to the panel body first.
+ */
+ boolean headerHtmlElementsPresents = ((headerFacetChildren != null) && (headerFacetChildren
+ .get(VisualDomUtil.FACET_HTML_TAGS).size() > 0));
+ VpeChildrenInfo bodyInfo = new VpeChildrenInfo(bodyDiv);
+ if (headerHtmlElementsPresents) {
+ for (Node node : headerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
+ bodyInfo.addSourceChild(node);
+ }
+ }
+
+ /*
+ * Add the rest panel's content
+ */
List children = ComponentUtil.getChildren(sourceElement, true);
- VpeChildrenInfo bodyInfo = new VpeChildrenInfo(bodyDiv);
for (Node child : children) {
bodyInfo.addSourceChild(child);
}
Index: src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java
===================================================================
--- src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java (revision 20840)
+++ src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java (working copy)
@@ -46,8 +46,9 @@
public static final String ATTR_JOINT_POINT = "jointPoint"; //$NON-NLS-1$
public static final String ATTR_DISABLED = "disabled";//$NON-NLS-1$
public static final String ATTR_ELEMENTS = "elements"; //$NON-NLS-1$
+ public static final String ATTR_HEADER_CLASS = "headerClass"; //$NON-NLS-1$
+ public static final String ATTR_BODY_CLASS = "bodyClass"; //$NON-NLS-1$
public static final String ATTR_FOOTER_CLASS = "footerClass"; //$NON-NLS-1$
- public static final String ATTR_HEADER_CLASS = "headerClass"; //$NON-NLS-1$
public static final String ATTR_INPUT_CLASS = "inputClass"; //$NON-NLS-1$
public static final String ATTR_INPUT_SIZE = "inputSize"; //$NON-NLS-1$
public static final String ATTR_INPUT_STYLE = "inputStyle"; //$NON-NLS-1$
Index: src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessageTemplate.java
===================================================================
--- src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessageTemplate.java (revision 20840)
+++ src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessageTemplate.java (working copy)
@@ -15,6 +15,7 @@
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
@@ -40,14 +41,11 @@
protected static String FATAL_MESSAGE = "Fatal message"; //$NON-NLS-1$
protected static String INFO_MESSAGE = "Info message"; //$NON-NLS-1$
protected static String WARNING_MESSAGE = "Warning message"; //$NON-NLS-1$
+ protected static String FACET_TAG_NAME = ":facet"; //$NON-NLS-1$
protected static String[] markers = { "passedMarker", "errorMarker", //$NON-NLS-1$ //$NON-NLS-2$
"fatalMarker", "infoMarker", "warnMarker" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected static String FACET_TAG_NAME = "facet"; //$NON-NLS-1$
-
- protected static String NAME_ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
-
private final static String MESSAGE_STYLE = "padding-left: 1px;padding-right: 1px;padding-top: 1px;padding-bottom: 1px"; //$NON-NLS-1$
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
@@ -235,6 +233,7 @@
if (!(facets.get(markers[i]) instanceof Element))
continue;
else {
+ td.setAttribute(VpeVisualDomBuilder.VPE_FACET, markers[i]);
childrenInfo.addSourceChild(facets.get(markers[i]));
}
tr.appendChild(td);
@@ -271,20 +270,15 @@
NodeList nodeList = sourceElement.getChildNodes();
HashMap facets = new HashMap();
-
for (int i = 0; i < nodeList.getLength(); i++) {
-
- if (!(nodeList.item(i) instanceof Element))
- continue;
-
- String facetName = nodeList.item(i).getPrefix() + Constants.COLON
- + FACET_TAG_NAME;
-
- if (nodeList.item(i).getNodeName().equalsIgnoreCase(facetName)
+ if (!(nodeList.item(i) instanceof Element)){
+ continue;
+ }
+ if (nodeList.item(i).getNodeName().endsWith(FACET_TAG_NAME)
&& searchInMarker(((Element) nodeList.item(i))
- .getAttribute(NAME_ATTRIBUTE_NAME))) {
+ .getAttribute(RichFaces.ATTR_NAME))) {
facets.put(((Element) nodeList.item(i))
- .getAttribute(NAME_ATTRIBUTE_NAME), nodeList.item(i));
+ .getAttribute(RichFaces.ATTR_NAME), nodeList.item(i));
}
}
Index: src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessagesTemplate.java
===================================================================
--- src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessagesTemplate.java (revision 20840)
+++ src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMessagesTemplate.java (working copy)
@@ -13,6 +13,8 @@
import java.util.HashMap;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
@@ -26,14 +28,11 @@
public class RichFacesMessagesTemplate extends RichFacesMessageTemplate {
- private static final String LAYOUT = "layout"; //$NON-NLS-1$
- private static final String TABLE = "table"; //$NON-NLS-1$
- private static final String CSS_RICH_MESSAGES
- = "rich-messages"; //$NON-NLS-1$
- private static final String CSS_RICH_MESSAGES_MARKER
- = "rich-messages-marker"; //$NON-NLS-1$
- private static final String CSS_RICH_MESSAGES_LABEL
- = "rich-messages-label"; //$NON-NLS-1$
+ private static final String LAYOUT = "layout"; //$NON-NLS-1$
+ private static final String TABLE = "table"; //$NON-NLS-1$
+ private static final String CSS_RICH_MESSAGES = "rich-messages"; //$NON-NLS-1$
+ private static final String CSS_RICH_MESSAGES_MARKER = "rich-messages-marker"; //$NON-NLS-1$
+ private static final String CSS_RICH_MESSAGES_LABEL = "rich-messages-label"; //$NON-NLS-1$
@Override
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
@@ -127,6 +126,8 @@
if (facet != null) {
final VpeChildrenInfo childrenInfo = new VpeChildrenInfo(marker);
+ marker.setAttribute(VpeVisualDomBuilder.VPE_FACET, facet
+ .getAttribute(RichFaces.ATTR_NAME));
creationData.addChildrenInfo(childrenInfo);
childrenInfo.addSourceChild(facet);
}