Author: yradtsevich
Date: 2008-10-22 15:43:46 -0400 (Wed, 22 Oct 2008)
New Revision: 11087
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/column/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/column/sortable.gif
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SourceDomUtil.java
Log:
Method getClasses extracted from VpePanelGridCreator and placed into new class
VpeClassUtil.
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/column/sortable.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/column/sortable.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnTemplate.java 2008-10-22
16:30:12 UTC (rev 11086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnTemplate.java 2008-10-22
19:43:46 UTC (rev 11087)
@@ -10,15 +10,20 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
+import java.util.ArrayList;
import java.util.List;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
+import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
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.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -26,30 +31,52 @@
import org.w3c.dom.Node;
public class RichFacesColumnTemplate extends VpeAbstractTemplate {
+ private static final String HEADER_ICON_STYLE = "vertical-align:middle;";
+ private static final String SORTABLE_PATH = "column/sortable.gif";
//$NON-NLS-1$
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
Element sourceElement = (Element)sourceNode;
+ VpeCreationData creationData;
+ boolean visible =
!RichFaces.VAL_FALSE.equals(sourceElement.getAttribute(RichFaces.ATTR_VISIBLE));
+
+ if (visible) {
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ String columnClass = getColumnClass(sourceElement);
+ ComponentUtil.copyAttributes(sourceNode, td);
+ td.setAttribute(HTML.ATTR_CLASS, columnClass);
+ creationData = new VpeCreationData(td);
+
+ // Create mapping to Encode body
+ VpeChildrenInfo tdInfo = new VpeChildrenInfo(td);
+ List<Node> children = ComponentUtil.getChildren(sourceElement,true);
+ for (Node child : children) {
+ tdInfo.addSourceChild(child);
+ }
+ creationData.addChildrenInfo(tdInfo);
+
+ } else {
+ creationData = new VpeCreationData(null);
+ creationData.setChildrenInfoList(new ArrayList<VpeChildrenInfo>(0));
+ }
- nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ return creationData;
+ }
+
+ private String getColumnClass(Element sourceElement) {
+ String columnClass;
if(isHeader(sourceElement)) {
- td.setAttribute(HTML.ATTR_CLASS, "dr-table-headercell
rich-table-headercell"); //$NON-NLS-1$
+ columnClass = "dr-table-headercell rich-table-headercell"; //$NON-NLS-1$
} else if(isFooter(sourceElement)) {
- td.setAttribute(HTML.ATTR_CLASS, "dr-table-footercell
rich-table-footercell"); //$NON-NLS-1$
+ columnClass = "dr-table-footercell rich-table-footercell"; //$NON-NLS-1$
} else {
- td.setAttribute(HTML.ATTR_CLASS, "dr-table-cell rich-table-cell");
//$NON-NLS-1$
+ columnClass = "dr-table-cell rich-table-cell"; //$NON-NLS-1$
}
- ComponentUtil.copyAttributes(sourceNode, td);
- VpeCreationData creationData = new VpeCreationData(td);
-
- // Create mapping to Encode body
- VpeChildrenInfo tdInfo = new VpeChildrenInfo(td);
- List<Node> children = ComponentUtil.getChildren(sourceElement,true);
- for (Node child : children) {
- tdInfo.addSourceChild(child);
+
+ String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
+ if (styleClass != null) {
+ columnClass += " " + styleClass; //$NON-NLS-1$
}
- creationData.addChildrenInfo(tdInfo);
-
- return creationData;
+ return columnClass;
}
private boolean isHeader(Element sourceElement) {
@@ -73,14 +100,56 @@
}
@Override
- public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
- nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- visualElement.removeAttribute(name);
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
}
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#getNodeForUptate(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMNode, java.lang.Object)
+ */
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
- nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- visualElement.setAttribute(name, value);
+ public Node getNodeForUptate(VpePageContext pageContext, Node sourceNode,
+ nsIDOMNode visualNode, Object data) {
+ /* XXX: The implementation is a little tricky, it returns first n-th parent
+ * that has a nodeMapping. */
+
+ final VpeDomMapping domMapping = pageContext.getDomMapping();
+ SourceDomUtil.getParentHavingDomMapping(sourceNode, domMapping);
+ final Node parent = SourceDomUtil.getParentHavingDomMapping(sourceNode, domMapping);
+
+ if (parent != null) {
+ return parent;
+ } else {
+ return sourceNode;
+ }
}
+
+ /** Creates <code>IMG</code> tag if it is specified by
<code><rich:column></code>
+ * attributes.
+ * @param pageContext
+ *
+ * @param column source <code><rich:column></code> element
+ * @param visualDocument Mozilla's Visual Document
+ * @return <code>IMG</code> tag if it is necessary,
<code>null</code> otherwise */
+ public static nsIDOMElement getHeaderIcon(VpePageContext pageContext, Element column,
nsIDOMDocument visualDocument) {
+ String sortable = ComponentUtil.getAttribute(column, RichFaces.ATTR_SORTABLE);
+ String sortBy = column.getAttribute(RichFaces.ATTR_SORT_BY);
+ if (RichFaces.VAL_TRUE.equals(sortable) || sortBy != null) {
+ nsIDOMElement img = visualDocument.createElement(HTML.TAG_IMG);
+ String sortIcon = column.getAttribute(RichFaces.ATTR_SORT_ICON);
+ if (sortIcon != null) {
+ sortIcon = VpeStyleUtil.addFullPathToImgSrc(sortIcon, pageContext, true);
+ sortIcon = sortIcon.replace('\\', '/');
+ img.setAttribute(HTML.ATTR_SRC, sortIcon);
+ } else {
+ ComponentUtil.setImg(img, SORTABLE_PATH);
+ }
+ img.setAttribute(HTML.ATTR_STYLE, HEADER_ICON_STYLE);
+ return img;
+ } else {
+ return null;
+ }
+ }
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java 2008-10-22
16:30:12 UTC (rev 11086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java 2008-10-22
19:43:46 UTC (rev 11087)
@@ -63,7 +63,7 @@
nsIDOMElement thead = visualDocument.createElement(HTML.TAG_THEAD);
table.appendChild(thead);
String headerClass = (String)
sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS);
- encodeTableHeaderOrFooterFacet(creationData, thead, columnsLength, visualDocument,
header,
+ encodeTableHeaderOrFooterFacet(pageContext, creationData, thead, columnsLength,
visualDocument, header,
"dr-table-header rich-table-header", //$NON-NLS-1$
"dr-table-header-continue rich-table-header-continue", //$NON-NLS-1$
"dr-table-headercell rich-table-headercell", //$NON-NLS-1$
@@ -76,7 +76,7 @@
nsIDOMElement tfoot = visualDocument.createElement(HTML.TAG_TFOOT);
table.appendChild(tfoot);
String footerClass = (String)
sourceElement.getAttribute(RichFaces.ATTR_FOOTER_CLASS);
- encodeTableHeaderOrFooterFacet(creationData, tfoot, columnsLength, visualDocument,
footer,
+ encodeTableHeaderOrFooterFacet(pageContext, creationData, tfoot, columnsLength,
visualDocument, footer,
"dr-table-footer rich-table-footer", //$NON-NLS-1$
"dr-table-footer-continue rich-table-footer-continue", //$NON-NLS-1$
"dr-table-footercell rich-table-footercell", //$NON-NLS-1$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2008-10-22
16:30:12 UTC (rev 11086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2008-10-22
19:43:46 UTC (rev 11087)
@@ -73,7 +73,7 @@
table.appendChild(thead);
String headerClass = (String)
sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS);
if(header != null) {
- encodeTableHeaderOrFooterFacet(creationData, thead, columnsLength, visualDocument,
header,
+ encodeTableHeaderOrFooterFacet(pageContext, creationData, thead, columnsLength,
visualDocument, header,
"dr-table-header rich-table-header", //$NON-NLS-1$
"dr-table-header-continue rich-table-header-continue", //$NON-NLS-1$
"dr-table-headercell rich-table-headercell", //$NON-NLS-1$
@@ -86,7 +86,7 @@
if(styleClass!=null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
- encodeHeaderOrFooterFacets(creationData, tr, visualDocument, columnsHeaders,
+ encodeHeaderOrFooterFacets(pageContext, creationData, tr, visualDocument,
columnsHeaders,
"dr-table-subheadercell rich-table-subheadercell", //$NON-NLS-1$
headerClass, RichFaces.NAME_FACET_HEADER, HTML.TAG_TD);
}
@@ -106,12 +106,12 @@
if(styleClass!=null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
- encodeHeaderOrFooterFacets(creationData, tr, visualDocument, columnsFooters,
+ encodeHeaderOrFooterFacets(pageContext, creationData, tr, visualDocument,
columnsFooters,
"dr-table-subfootercell rich-table-subfootercell", //$NON-NLS-1$
footerClass, RichFaces.NAME_FACET_FOOTER, HTML.TAG_TD);
}
if (footer != null) {
- encodeTableHeaderOrFooterFacet(creationData, tfoot, columnsLength, visualDocument,
footer,
+ encodeTableHeaderOrFooterFacet(pageContext, creationData, tfoot, columnsLength,
visualDocument, footer,
"dr-table-footer rich-table-footer", //$NON-NLS-1$
"dr-table-footer-continue rich-table-footer-continue", //$NON-NLS-1$
"dr-table-footercell rich-table-footercell", //$NON-NLS-1$
@@ -148,10 +148,10 @@
trInfo.addSourceChild(child);
} else if(child.getNodeName().endsWith(RichFaces.TAG_COLUMN_GROUP)) {
- RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(creationData, (Element)child,
visualDocument, tbody);
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
(Element)child, visualDocument, tbody);
tr = null;
} else if(child.getNodeName().endsWith(RichFaces.TAG_SUB_TABLE)) {
- RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData, (Element)child,
visualDocument, tbody);
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
(Element)child, visualDocument, tbody);
tr = null;
} else {
VpeChildrenInfo childInfo = new VpeChildrenInfo(tbody);
@@ -190,9 +190,12 @@
}
- public static void encodeHeaderOrFooterFacets(VpeCreationData creationData,
nsIDOMElement parentTr, nsIDOMDocument visualDocument, ArrayList<Element>
headersOrFooters, String skinCellClass, String headerClass, String facetName, String
element) {
+ public static void encodeHeaderOrFooterFacets(VpePageContext pageContext,
VpeCreationData creationData,
+ nsIDOMElement parentTr, nsIDOMDocument visualDocument, ArrayList<Element>
headersOrFooters,
+ String skinCellClass, String headerClass, String facetName, String element) {
for (Element column : headersOrFooters) {
String classAttribute = facetName + "Class"; //$NON-NLS-1$
+
String columnHeaderClass = column.getAttribute(classAttribute);
nsIDOMElement td = visualDocument.createElement(element);
parentTr.appendChild(td);
@@ -205,19 +208,28 @@
}
Node facetBody = ComponentUtil.getFacet(column, facetName,true);
- VpeChildrenInfo child = new VpeChildrenInfo(td);
- child.addSourceChild(facetBody);
- creationData.addChildrenInfo(child);
+ nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
+ td.appendChild(span);
+ if (RichFaces.NAME_FACET_HEADER.equals(facetName)) {
+ nsIDOMElement icon = RichFacesColumnTemplate.getHeaderIcon(pageContext, column,
visualDocument);
+ if (icon != null) {
+ td.appendChild(icon);
+ }
+ }
+
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(span);
+ childrenInfo.addSourceChild(facetBody);
+ creationData.addChildrenInfo(childrenInfo);
}
}
- protected void encodeTableHeaderOrFooterFacet(VpeCreationData creationData,
nsIDOMElement parentTheadOrTfood, int columns, nsIDOMDocument visualDocument, Node
facetBody, String skinFirstRowClass, String skinRowClass, String skinCellClass, String
facetBodyClass, String element) {
+ protected void encodeTableHeaderOrFooterFacet(final VpePageContext pageContext,
VpeCreationData creationData, nsIDOMElement parentTheadOrTfood, int columns,
nsIDOMDocument visualDocument, Node facetBody, String skinFirstRowClass, String
skinRowClass, String skinCellClass, String facetBodyClass, String element) {
boolean isColumnGroup = facetBody.getNodeName().endsWith(RichFaces.TAG_COLUMN_GROUP);
boolean isSubTable = facetBody.getNodeName().endsWith(RichFaces.TAG_SUB_TABLE);
if(isColumnGroup) {
- RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(creationData, (Element)facetBody,
visualDocument, parentTheadOrTfood);
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
(Element)facetBody, visualDocument, parentTheadOrTfood);
} else if(isSubTable) {
- RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData, (Element)facetBody,
visualDocument, parentTheadOrTfood);
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
(Element)facetBody, visualDocument, parentTheadOrTfood);
} else {
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
parentTheadOrTfood.appendChild(tr);
@@ -359,7 +371,7 @@
}
}
}
-
+
super.validate(pageContext, sourceNode, visualDocument, data);
}
@@ -374,4 +386,4 @@
nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
visualElement.setAttribute(name, value);
}
-}
\ No newline at end of file
+}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java 2008-10-22
16:30:12 UTC (rev 11086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesExtendedDataTableTemplate.java 2008-10-22
19:43:46 UTC (rev 11087)
@@ -175,7 +175,7 @@
String headerClass = (String) sourceElement
.getAttribute(HEADER_CLASS);
if (header != null) {
- encodeTableHeaderOrFooterFacet(creationData, thead,
+ encodeTableHeaderOrFooterFacet(pageContext, creationData, thead,
columnsLength, visualDocument, header,
DR_TABLE_HEADER_RICH_TABLE_HEADER,
DR_TABLE_HEADER_CONTINUE_RICH_TABLE_HEADER_CONTINUE,
@@ -226,7 +226,7 @@
footerClass);
}
if (footer != null) {
- encodeTableHeaderOrFooterFacet(creationData, tfoot,
+ encodeTableHeaderOrFooterFacet(pageContext, creationData, tfoot,
columnsLength, visualDocument, footer,
DR_TABLE_FOOTER_RICH_TABLE_FOOTER,
DR_TABLE_FOOTER_CONTINUE_RICH_TABLE_FOOTER_CONTINUE,
@@ -268,12 +268,12 @@
}
trInfo.addSourceChild(child);
} else if (child.getNodeName().endsWith(COLUMN_GROUP)) {
- RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(pageContext,
creationData, (Element) child, visualDocument,
tbody);
tr = null;
} else if (child.getNodeName().endsWith(SUB_TABLE)) {
- RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(pageContext,
creationData, (Element) child, visualDocument,
tbody);
tr = null;
@@ -469,7 +469,7 @@
* @param facetBodyClass
* @param element
*/
- protected void encodeTableHeaderOrFooterFacet(VpeCreationData creationData,
+ protected void encodeTableHeaderOrFooterFacet(final VpePageContext pageContext,
VpeCreationData creationData,
nsIDOMElement parentTheadOrTfood, int columns,
nsIDOMDocument visualDocument, Element facetBody,
String skinFirstRowClass, String skinRowClass,
@@ -478,10 +478,10 @@
.endsWith(COLUMN_GROUP);
boolean isSubTable = facetBody.getNodeName().endsWith(SUB_TABLE);
if (isColumnGroup) {
- RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(creationData,
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
facetBody, visualDocument, parentTheadOrTfood);
} else if (isSubTable) {
- RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData,
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
facetBody, visualDocument, parentTheadOrTfood);
} else {
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java 2008-10-22
16:30:12 UTC (rev 11086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java 2008-10-22
19:43:46 UTC (rev 11087)
@@ -170,7 +170,7 @@
Element captionFacet = ComponentUtil.getFacet(sourceElement, CAPTION_FACET);
if (null != captionFacet) {
// Creating table caption with facet content
- nsIDOMElement fecetDiv = encodeFacetsToDiv(captionFacet, false, CSS_CAPTION_CLASS,
"", creationData, visualDocument);
+ nsIDOMElement fecetDiv = encodeFacetsToDiv(pageContext, captionFacet, false,
CSS_CAPTION_CLASS, "", creationData, visualDocument);
captionRow_TD_DIV.appendChild(fecetDiv);
} else {
captionRow_TD_DIV.appendChild(visualDocument.createTextNode(captionLabel));
@@ -199,7 +199,7 @@
// ---------------------buttons------------------------
if (!"none".equalsIgnoreCase(controlsType)) {
- nsIDOMElement controlsDiv = createControlsDiv(creationData, visualDocument,
sourceElement);
+ nsIDOMElement controlsDiv = createControlsDiv(pageContext, creationData,
visualDocument, sourceElement);
buttonsTD.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
CSS_BUTTON_VALIGN_CLASS);
buttonsTD.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR, "center");
@@ -281,7 +281,7 @@
// --------------------------------------------
- nsIDOMElement contentDiv = createResultList(creationData, visualDocument,
+ nsIDOMElement contentDiv = createResultList(pageContext, creationData, visualDocument,
sourceElement);
tr1_TD1.appendChild(contentDiv);
@@ -297,7 +297,7 @@
*
* @return the element
*/
- private nsIDOMElement createControlsDiv( VpeCreationData creationData, nsIDOMDocument
visualDocument,
+ private nsIDOMElement createControlsDiv(final VpePageContext pageContext,
VpeCreationData creationData, nsIDOMDocument visualDocument,
Element sourceElement) {
String topControlClass = sourceElement.getAttribute(TOP_CONTROL_CLASS);
@@ -329,7 +329,7 @@
Element bottom_control_facet = ComponentUtil.getFacet(sourceElement,
BOTTOM_CONTROL_FACET);
if (fastOrderControlsVisible) {
- nsIDOMElement btnTopDiv = createSingleButtonDiv(creationData, visualDocument,
+ nsIDOMElement btnTopDiv = createSingleButtonDiv(pageContext, creationData,
visualDocument,
(null == topControlLabel ? TOP_CONTROL_LABEL_DEFAULT
: topControlLabel), TOP_CONTROL_IMG,
showButtonLabels, top_control_facet, CSS_TOP_CONTROL_CLASS, topControlClass);
@@ -337,11 +337,11 @@
}
if (orderControlsVisible) {
- nsIDOMElement btnUpDiv = createSingleButtonDiv(creationData, visualDocument,
+ nsIDOMElement btnUpDiv = createSingleButtonDiv(pageContext, creationData,
visualDocument,
(null == upControlLabel ? UP_CONTROL_LABEL_DEFAULT
: upControlLabel), UP_CONTROL_IMG,
showButtonLabels, up_control_facet, CSS_UP_CONTROL_CLASS, upControlClass);
- nsIDOMElement btnDownDiv = createSingleButtonDiv(creationData, visualDocument,
+ nsIDOMElement btnDownDiv = createSingleButtonDiv(pageContext, creationData,
visualDocument,
(null == downControlLabel ? DOWN_CONTROL_LABEL_DEFAULT
: downControlLabel), DOWN_CONTROL_IMG,
showButtonLabels, down_control_facet, CSS_DOWN_CONTROL_CLASS, downControlClass);
@@ -350,7 +350,7 @@
}
if (fastOrderControlsVisible) {
- nsIDOMElement btnBottomDiv = createSingleButtonDiv(creationData, visualDocument,
+ nsIDOMElement btnBottomDiv = createSingleButtonDiv(pageContext, creationData,
visualDocument,
(null == bottomControlLabel ? BOTTOM_CONTROL_LABEL_DEFAULT
: bottomControlLabel), BOTTOM_CONTROL_IMG,
showButtonLabels, bottom_control_facet, CSS_BOTTOM_CONTROL_CLASS,
bottomControlClass);
@@ -375,7 +375,7 @@
*
* @return the ns idom element
*/
- private nsIDOMElement createSingleButtonDiv(VpeCreationData creationData,
+ private nsIDOMElement createSingleButtonDiv(final VpePageContext pageContext,
VpeCreationData creationData,
nsIDOMDocument visualDocument, String btnName, String imgName,
boolean showButtonLabels, Element buttonFacet, String cssStyleName,
String customStyleClass) {
@@ -402,7 +402,7 @@
if (null != buttonFacet) {
// Creating button with facet content
- nsIDOMElement fecetDiv = encodeFacetsToDiv(buttonFacet, true, cssStyleName,
customStyleClass, creationData, visualDocument);
+ nsIDOMElement fecetDiv = encodeFacetsToDiv(pageContext, buttonFacet, true,
cssStyleName, customStyleClass, creationData, visualDocument);
div2.appendChild(fecetDiv);
} else {
a.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_BUTTON_SELECTION_CLASS);
@@ -431,7 +431,7 @@
*
* @return the element
*/
- private nsIDOMElement createResultList(VpeCreationData creationData, nsIDOMDocument
visualDocument,
+ private nsIDOMElement createResultList(final VpePageContext pageContext, VpeCreationData
creationData, nsIDOMDocument visualDocument,
Element sourceElement) {
nsIDOMElement contentDiv = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
@@ -554,13 +554,13 @@
if (child.getNodeName().endsWith(":column")) {
trInfo.addSourceChild(child);
} else if (child.getNodeName().endsWith(":columnGroup")) {
- RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(pageContext,
creationData, (Element) child, visualDocument,
tbody);
tr = null;
trInfo = null;
} else if (child.getNodeName().endsWith(":subTable")) {
- RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(pageContext,
creationData, (Element) child, visualDocument,
tbody);
tr = null;
@@ -598,7 +598,7 @@
*
* @return the element
*/
- private nsIDOMElement encodeFacetsToDiv(Element facetBody,
+ private nsIDOMElement encodeFacetsToDiv(final VpePageContext pageContext, Element
facetBody,
boolean isControlFacet, String cssStyleName,
String customStyleClass, VpeCreationData creationData,
nsIDOMDocument visualDocument) {
@@ -613,10 +613,10 @@
.endsWith(":columnGroup");
boolean isSubTable = facetBody.getNodeName().endsWith(":subTable");
if (isColumnGroup) {
- RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(creationData,
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
facetBody, visualDocument, tbody);
} else if (isSubTable) {
- RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData,
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
facetBody, visualDocument, tbody);
} else {
nsIDOMElement tr = visualDocument
@@ -675,7 +675,7 @@
* @param facetBodyClass
* @param element
*/
- private void encodeTableHeaderOrFooterFacet(VpeCreationData creationData,
+ private void encodeTableHeaderOrFooterFacet(final VpePageContext pageContext,
VpeCreationData creationData,
nsIDOMElement parentTheadOrTfood, int columns,
nsIDOMDocument visualDocument, Element facetBody,
String skinFirstRowClass, String skinCellClass,
@@ -684,10 +684,10 @@
.endsWith(":columnGroup");
boolean isSubTable = facetBody.getNodeName().endsWith(":subTable");
if (isColumnGroup) {
- RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(creationData,
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
facetBody, visualDocument, parentTheadOrTfood);
} else if (isSubTable) {
- RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData,
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
facetBody, visualDocument, parentTheadOrTfood);
} else {
nsIDOMElement tr = visualDocument
@@ -727,6 +727,9 @@
/**
*
* @param creationData
+ /**
+ *
+ * @param creationData
* @param parentTr
* @param visualDocument
* @param headersOrFooters
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java 2008-10-22
16:30:12 UTC (rev 11086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java 2008-10-22
19:43:46 UTC (rev 11087)
@@ -165,7 +165,7 @@
String headerClass = (String) sourceElement
.getAttribute(HEADER_CLASS);
if (header != null) {
- encodeTableHeaderOrFooterFacet(creationData, thead,
+ encodeTableHeaderOrFooterFacet(pageContext, creationData, thead,
columnsLength, visualDocument, header,
"dr-table-header rich-table-header",
"dr-table-header-continue rich-table-header-continue",
@@ -215,7 +215,7 @@
footerClass, FOOTER, HtmlComponentUtil.HTML_TAG_TD);
}
if (footer != null) {
- encodeTableHeaderOrFooterFacet(creationData, tfoot,
+ encodeTableHeaderOrFooterFacet(pageContext, creationData, tfoot,
columnsLength, visualDocument, footer,
"dr-table-footer rich-table-footer",
"dr-table-footer-continue rich-table-footer-continue",
@@ -259,12 +259,12 @@
}
trInfo.addSourceChild(child);
} else if (child.getNodeName().endsWith(":columnGroup")) {
- RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(pageContext,
creationData, (Element) child, visualDocument,
tbody);
tr = null;
} else if (child.getNodeName().endsWith(":subTable")) {
- RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(pageContext,
creationData, (Element) child, visualDocument,
tbody);
tr = null;
@@ -370,7 +370,7 @@
* @param facetBodyClass
* @param element
*/
- protected void encodeTableHeaderOrFooterFacet(VpeCreationData creationData,
+ protected void encodeTableHeaderOrFooterFacet(final VpePageContext pageContext,
VpeCreationData creationData,
nsIDOMElement parentTheadOrTfood, int columns,
nsIDOMDocument visualDocument, Element facetBody,
String skinFirstRowClass, String skinRowClass,
@@ -379,10 +379,10 @@
.endsWith(":columnGroup");
boolean isSubTable = facetBody.getNodeName().endsWith(":subTable");
if (isColumnGroup) {
- RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(creationData,
+ RichFacesColumnGroupTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
facetBody, visualDocument, parentTheadOrTfood);
} else if (isSubTable) {
- RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData,
+ RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(pageContext, creationData,
facetBody, visualDocument, parentTheadOrTfood);
} else {
nsIDOMElement tr = visualDocument
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java 2008-10-22
16:30:12 UTC (rev 11086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java 2008-10-22
19:43:46 UTC (rev 11087)
@@ -34,22 +34,10 @@
public class RichFacesSubTableTemplate extends VpeAbstractTemplate {
- /**
- *
- */
- private static final String VAL_TRUE = "true";
- /**
- *
- */
- private static final String ATTR_BREAK_BEFORE = "breakBefore"; //$NON-NLS-1$
- /**
- *
- */
- private static final String COLUMN_CLASSES_EXPRESSION = "{@columnClasses}";
//$NON-NLS-1$
- /**
- *
- */
- private static final String ROW_CLASSES_EXPRESSION = "{@rowClasses}";
//$NON-NLS-1$
+ private static final String COLUMN_CLASSES_EXPRESSION =
+ "{@" + RichFaces.ATTR_COLUMN_CLASSES + "}"; //$NON-NLS-1$
//$NON-NLS-2$
+ private static final String ROW_CLASSES_EXPRESSION =
+ "{@" + RichFaces.ATTR_ROW_CLASSES + "}"; //$NON-NLS-1$
//$NON-NLS-2$
private static final String DEAFAULT_CELL_CLASS = "dr-subtable-cell
rich-subtable-cell"; //$NON-NLS-1$
private static List<String> rowClasses;
private static List<String> columnClasses;
@@ -69,15 +57,20 @@
* @param parentVisualNode
* @return
*/
- public VpeCreationData encode(VpeCreationData creationData, final Element sourceElement,
final nsIDOMDocument visualDocument, final nsIDOMElement parentVisualNode) {
+ public VpeCreationData encode(final VpePageContext pageContext, VpeCreationData
creationData, final Element sourceElement,
+ final nsIDOMDocument visualDocument, nsIDOMElement parentVisualNode) {
+
if(creationData!=null) {
// Encode header
- encodeHeader(creationData, sourceElement, visualDocument, parentVisualNode);
+ encodeHeader(pageContext, creationData, sourceElement, visualDocument,
parentVisualNode);
}
initClasses(sourceElement, null);
nsIDOMElement curTr = visualDocument.createElement(HTML.TAG_TR);
+ if (parentVisualNode == null) {
+ parentVisualNode = curTr;
+ }
ComponentUtil.copyAttributes(sourceElement, curTr);
boolean header = false;
@@ -112,7 +105,7 @@
final List<Node> children = ComponentUtil.getChildren(sourceElement);
for (final Node child : children) {
if (child.getNodeName().endsWith(':' + RichFaces.TAG_COLUMN)) {
- final boolean breakBefore = VAL_TRUE.equals(
((Element)child).getAttribute(ATTR_BREAK_BEFORE) );
+ final boolean breakBefore = RichFaces.VAL_TRUE.equals(
((Element)child).getAttribute(RichFaces.ATTR_BREAK_BEFORE) );
if (breakBefore) {
curRow++;
curColumn = 0;
@@ -144,11 +137,11 @@
if(parentVisualNode!=null) {
// Encode footer
- encodeFooter(creationData, sourceElement, visualDocument, parentVisualNode);
+ encodeFooter(pageContext, creationData, sourceElement, visualDocument,
parentVisualNode);
}
-
return creationData;
}
+
/** Adds necessary attributes to its children.*/
@Override
@@ -189,19 +182,21 @@
public VpeCreationData create(final VpePageContext pageContext, final Node sourceNode,
final nsIDOMDocument visualDocument) {
final Element sourceElement = (Element)sourceNode;
- final VpeCreationData creationData = encode(null, sourceElement, visualDocument,
null);
+ final VpeCreationData creationData = encode(pageContext, null, sourceElement,
visualDocument, null);
return creationData;
}
- protected void encodeHeader(final VpeCreationData creationData, final Element
sourceElement, final nsIDOMDocument visualDocument, final nsIDOMElement parentVisualNode)
{
- encodeHeaderOrFooter(creationData, sourceElement, visualDocument, parentVisualNode,
"header", "dr-subtable-header rich-subtable-header",
"dr-subtable-headercell rich-subtable-headercell");
+ protected void encodeHeader(final VpePageContext pageContext, final VpeCreationData
creationData, final Element sourceElement, final nsIDOMDocument visualDocument, final
nsIDOMElement parentVisualNode) {
+ encodeHeaderOrFooter(pageContext, creationData, sourceElement, visualDocument,
parentVisualNode, "header", "dr-subtable-header rich-subtable-header",
"dr-subtable-headercell rich-subtable-headercell");
}
- protected void encodeFooter(final VpeCreationData creationData, final Element
sourceElement, final nsIDOMDocument visualDocument, final nsIDOMElement parentVisualNode)
{
- encodeHeaderOrFooter(creationData, sourceElement, visualDocument, parentVisualNode,
"footer", "dr-subtable-footer rich-subtable-footer",
"dr-subtable-footercell rich-subtable-footercell");
+ protected void encodeFooter(final VpePageContext pageContext, final VpeCreationData
creationData, final Element sourceElement, final nsIDOMDocument visualDocument, final
nsIDOMElement parentVisualNode) {
+ encodeHeaderOrFooter(pageContext, creationData, sourceElement, visualDocument,
parentVisualNode, "footer", "dr-subtable-footer rich-subtable-footer",
"dr-subtable-footercell rich-subtable-footercell");
}
- protected void encodeHeaderOrFooter(final VpeCreationData creationData, final Element
sourceElement, final nsIDOMDocument visualDocument, final nsIDOMElement parentVisualNode,
final String facetName, final String trClass, final String tdClass) {
+ protected void encodeHeaderOrFooter(final VpePageContext pageContext, final
VpeCreationData creationData,
+ final Element sourceElement, final nsIDOMDocument visualDocument, final nsIDOMElement
parentVisualNode,
+ final String facetName, final String trClass, final String tdClass) {
final ArrayList<Element> columns =
RichFacesDataTableTemplate.getColumns(sourceElement);
final ArrayList<Element> columnsHeaders =
RichFacesDataTableTemplate.getColumnsWithFacet(columns, facetName);
if(!columnsHeaders.isEmpty()) {
@@ -211,7 +206,7 @@
if(styleClass!=null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
- RichFacesDataTableTemplate.encodeHeaderOrFooterFacets(creationData, tr,
visualDocument, columnsHeaders,
+ RichFacesDataTableTemplate.encodeHeaderOrFooterFacets(pageContext, creationData, tr,
visualDocument, columnsHeaders,
tdClass,
null, facetName, HTML.TAG_TD);
}
@@ -307,4 +302,15 @@
final nsIDOMElement visualNode, final Object data, final String name, final String
value) {
return true;
}
-}
\ No newline at end of file
+
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#getNodeForUptate(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMNode, java.lang.Object)
+ */
+ @Override
+ public Node getNodeForUptate(VpePageContext pageContext, Node sourceNode,
+ nsIDOMNode visualNode, Object data) {
+ Node parent = sourceNode.getParentNode();
+ return parent;
+ }
+}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2008-10-22
16:30:12 UTC (rev 11086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2008-10-22
19:43:46 UTC (rev 11087)
@@ -17,67 +17,73 @@
* @author Sergey Dzmitrovich
*/
public class RichFaces {
-
/**
* The Constructor.
*/
private RichFaces() {
}
- /** jsf tags which are used with richFaces. */
- public static final String TAG_COLUMN = "column"; //$NON-NLS-1$
- public static final String TAG_COLUMNS = "columns"; //$NON-NLS-1$
- /** The Constant TAG_FACET. */
- public static final String TAG_FACET = "facet"; //$NON-NLS-1$
- public static final String TAG_COLUMN_GROUP = "columnGroup"; //$NON-NLS-1$
- public static final String TAG_SUB_TABLE = "subTable"; //$NON-NLS-1$
+ /** The Constant ATTR_ADD_CONTROL_LABEL. */
+ public static final String ATTR_ADD_CONTROL_LABEL = "addControlLabel";
//$NON-NLS-1$
+ public static final String ATTR_ALIGN = "align"; //$NON-NLS-1$
+ public static final String ATTR_BREAK_BEFORE = "breakBefore"; //$NON-NLS-1$
- /** The Constant ATTR_NAME. */
- public static final String ATTR_NAME = "name"; //$NON-NLS-1$
- /** The Constant ATTR_STYLE. */
- public static final String ATTR_STYLE = "style"; //$NON-NLS-1$
- /** The Constant ATTR_WIDTH. */
- public static final String ATTR_WIDTH = "width"; //$NON-NLS-1$
- /** The Constant ATTR_VALUE. */
- public static final String ATTR_VALUE = "value"; //$NON-NLS-1$
+ public static final String ATTR_CAPTION_CLASS = "captionClass"; //$NON-NLS-1$
+ public static final String ATTR_CAPTION_STYLE = "captionStyle"; //$NON-NLS-1$
+ /** The Constant ATTR_COLUMN_CLASSES. */
+ public static final String ATTR_COLUMN_CLASSES = "columnClasses";
//$NON-NLS-1$
+ public static final String ATTR_COLUMNS = "columns"; //$NON-NLS-1$
+ public static final String ATTR_COLUMNS_WIDTH = "columnsWidth"; //$NON-NLS-1$
+
+ /** The Constant ATTR_CONTROLS_TYPE. */
+ public static final String ATTR_CONTROLS_TYPE = "controlsType"; //$NON-NLS-1$
+ /** The Constant ATTR_DEFAULT_LABEL. */
+ public static final String ATTR_DEFAULT_LABEL = "defaultLabel"; //$NON-NLS-1$
+ public static final String ATTR_DIRECTION = "direction"; //$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_FOOTER_CLASS = "footerClass"; //$NON-NLS-1$
+ public static final String ATTR_HEADER_CLASS = "headerClass"; //$NON-NLS-1$
+ /** The Constant ATTR_INPUT_CLASS. */
+ public static final String ATTR_INPUT_CLASS = "inputClass"; //$NON-NLS-1$
/** The Constant ATTR_INPUT_SIZE. */
public static final String ATTR_INPUT_SIZE = "inputSize"; //$NON-NLS-1$
- /** The Constant ATTR_INPUT_CLASS. */
- public static final String ATTR_INPUT_CLASS = "inputClass"; //$NON-NLS-1$
/** The Constant ATTR_INPUT_STYLE. */
public static final String ATTR_INPUT_STYLE = "inputStyle"; //$NON-NLS-1$
+ public static final String ATTR_LIST_HEIGHT = "listHeight"; //$NON-NLS-1$
+ public static final String ATTR_LIST_WIDTH = "listWidth"; //$NON-NLS-1$
+ /** The Constant ATTR_NAME. */
+ public static final String ATTR_NAME = "name"; //$NON-NLS-1$
+ public static final String ATTR_POPUP = "popup";//$NON-NLS-1$
/** The Constant ATTR_ROW_CLASSES. */
public static final String ATTR_ROW_CLASSES = "rowClasses"; //$NON-NLS-1$
- /** The Constant ATTR_COLUMN_CLASSES. */
- public static final String ATTR_COLUMN_CLASSES = "columnClasses";
//$NON-NLS-1$
- /** The Constant ATTR_CONTROLS_TYPE. */
- public static final String ATTR_CONTROLS_TYPE = "controlsType"; //$NON-NLS-1$
+ public static final String ATTR_SELECT_ITEM_LABEL = "itemLabel";
//$NON-NLS-1$
+ public static final String ATTR_SELECT_ITEM_VALUE = "itemValue";
//$NON-NLS-1$
/** The Constant ATTR_SHOW_BUTTON_LABELS. */
public static final String ATTR_SHOW_BUTTON_LABELS = "showButtonLabels";
//$NON-NLS-1$
- /** The Constant ATTR_DEFAULT_LABEL. */
- public static final String ATTR_DEFAULT_LABEL = "defaultLabel"; //$NON-NLS-1$
- /** The Constant ATTR_ADD_CONTROL_LABEL. */
- public static final String ATTR_ADD_CONTROL_LABEL = "addControlLabel";
//$NON-NLS-1$
+ public static final String ATTR_SORT_BY = "sortBy"; //$NON-NLS-1$
+ public static final String ATTR_SORT_ICON = "sortIcon"; //$NON-NLS-1$
+ public static final String ATTR_SORTABLE = "sortable"; //$NON-NLS-1$
+ /** The Constant ATTR_STYLE. */
+ public static final String ATTR_STYLE = "style"; //$NON-NLS-1$
/** The Constant ATTR_STYLE_CLASS. */
public static final String ATTR_STYLE_CLASS = "styleClass"; //$NON-NLS-1$
- public static final String ATTR_SELECT_ITEM_LABEL = "itemLabel";
//$NON-NLS-1$
- public static final String ATTR_SELECT_ITEM_VALUE = "itemValue";
//$NON-NLS-1$
- public static final String ATTR_DISABLED = "disabled";//$NON-NLS-1$
- public static final String ATTR_POPUP = "popup";//$NON-NLS-1$
- public static final String ATTR_DIRECTION = "direction"; //$NON-NLS-1$
- public static final String ATTR_ALIGN = "align"; //$NON-NLS-1$
- public static final String ATTR_LIST_WIDTH = "listWidth"; //$NON-NLS-1$
- public static final String ATTR_LIST_HEIGHT = "listHeight"; //$NON-NLS-1$
- public static final String ATTR_COLUMNS_WIDTH = "columnsWidth"; //$NON-NLS-1$
- public static final String ATTR_HEADER_CLASS = "headerClass"; //$NON-NLS-1$
- public static final String ATTR_FOOTER_CLASS = "footerClass"; //$NON-NLS-1$
- public static final String ATTR_CAPTION_CLASS = "captionClass"; //$NON-NLS-1$
- public static final String ATTR_CAPTION_STYLE = "captionStyle"; //$NON-NLS-1$
- public static final String ATTR_COLUMNS = "columns"; //$NON-NLS-1$
- public static final String ATTR_ELEMENTS = "elements"; //$NON-NLS-1$
-
+ /** The Constant ATTR_VALUE. */
+ public static final String ATTR_VALUE = "value"; //$NON-NLS-1$
+ public static final String ATTR_VISIBLE = "visible"; //$NON-NLS-1$
+ /** The Constant ATTR_WIDTH. */
+ public static final String ATTR_WIDTH = "width"; //$NON-NLS-1$
+ public static final String NAME_FACET_CAPTION = "caption"; //$NON-NLS-1$
+ public static final String NAME_FACET_FOOTER = "footer"; //$NON-NLS-1$
public static final String NAME_FACET_HEADER = "header"; //$NON-NLS-1$
- public static final String NAME_FACET_FOOTER = "footer"; //$NON-NLS-1$
- public static final String NAME_FACET_CAPTION = "caption"; //$NON-NLS-1$
-
+ /** jsf tags which are used with richFaces. */
+ public static final String TAG_COLUMN = "column"; //$NON-NLS-1$
+ public static final String TAG_COLUMN_GROUP = "columnGroup"; //$NON-NLS-1$
+ public static final String TAG_COLUMNS = "columns"; //$NON-NLS-1$
+ /** The Constant TAG_FACET. */
+ public static final String TAG_FACET = "facet"; //$NON-NLS-1$
+ public static final String TAG_SUB_TABLE = "subTable"; //$NON-NLS-1$
+
+ public static final String VAL_TRUE = "true"; //$NON-NLS-1$
+ public static final String VAL_FALSE = "false"; //$NON-NLS-1$
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SourceDomUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SourceDomUtil.java 2008-10-22
16:30:12 UTC (rev 11086)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SourceDomUtil.java 2008-10-22
19:43:46 UTC (rev 11087)
@@ -10,6 +10,10 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.util;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
+import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Node;
public class SourceDomUtil {
@@ -23,4 +27,24 @@
}
return null;
}
+
+
+ /** Finds first n-th parent of <code>sourceNode</code> that has
+ * a linked non-null nodeMaping in <code>domMapping</code>.
+ *
+ * @param domMapping
+ * @param sourceNode
+ * @return first n-th parent of <code>sourceNode</code> that has
+ * a linked non-null nodeMaping in <code>domMapping</code>
+ * or <code>null</code> if there is not any. */
+ public static Node getParentHavingDomMapping(final Node sourceNode, final VpeDomMapping
domMapping) {
+ VpeNodeMapping nodeMapping = null;
+ Node parent = sourceNode;
+ do {
+ parent = parent.getParentNode();
+ nodeMapping = domMapping.getNodeMapping(parent);
+ } while (nodeMapping == null && parent != null);
+
+ return parent;
+ }
}