Author: dvinnichek
Date: 2010-07-05 03:17:44 -0400 (Mon, 05 Jul 2010)
New Revision: 23233
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/RichFacesDataTableScrollerTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
Log:
fix rich:dataGrid and rich:dataTable templates
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 2010-07-04
22:45:46 UTC (rev 23232)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java 2010-07-05
07:17:44 UTC (rev 23233)
@@ -56,8 +56,11 @@
creationData.addChildrenInfo(new VpeChildrenInfo(null));
ComponentUtil.setCSSLink(pageContext, "dataTable/dataTable.css",
"richFacesDataGrid"); //$NON-NLS-1$ //$NON-NLS-2$
- String tableClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
- table.setAttribute(HTML.ATTR_CLASS, "dr-table rich-table " +
(tableClass==null?Constants.EMPTY:tableClass)); //$NON-NLS-1$
+ String tableClass = "dr-table rich-table"; //$NON-NLS-1$
+ if(sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
+ tableClass += " " + sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
//$NON-NLS-1$
+ }
+ table.setAttribute(HTML.ATTR_CLASS, tableClass);
/*
* Encode colgroup definition.
@@ -84,7 +87,7 @@
if (headerBody != null) {
nsIDOMElement thead = visualDocument.createElement(HTML.TAG_THEAD);
table.appendChild(thead);
- String headerClass = (String)
sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS);
+ String headerClass = sourceElement.hasAttribute(RichFaces.ATTR_HEADER_CLASS) ?
sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS) : null;
encodeTableHeaderOrFooterFacet(pageContext, creationData, thead, columnsLength,
visualDocument, headerBody,
"dr-table-header rich-table-header", //$NON-NLS-1$
"dr-table-header-continue rich-table-header-continue", //$NON-NLS-1$
@@ -101,7 +104,7 @@
if (footerBody != null) {
nsIDOMElement tfoot = visualDocument.createElement(HTML.TAG_TFOOT);
table.appendChild(tfoot);
- String footerClass = (String)
sourceElement.getAttribute(RichFaces.ATTR_FOOTER_CLASS);
+ String footerClass = sourceElement.hasAttribute(RichFaces.ATTR_FOOTER_CLASS) ?
sourceElement.getAttribute(RichFaces.ATTR_FOOTER_CLASS) : null;
encodeTableHeaderOrFooterFacet(pageContext, creationData, tfoot, columnsLength,
visualDocument, footerBody,
"dr-table-footer rich-table-footer", //$NON-NLS-1$
"dr-table-footer-continue rich-table-footer-continue", //$NON-NLS-1$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableScrollerTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableScrollerTemplate.java 2010-07-04
22:45:46 UTC (rev 23232)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableScrollerTemplate.java 2010-07-05
07:17:44 UTC (rev 23233)
@@ -123,11 +123,11 @@
/*
* Adding fake children info to avoid creating pseudo element.
*/
- creationData.addChildrenInfo(new VpeChildrenInfo(div));
+ creationData.addChildrenInfo(new VpeChildrenInfo(div));
- String align = sourceElement.getAttribute(RichFaces.ATTR_ALIGN);
- if (align == null) {
- align = HTML.VALUE_ALIGN_CENTER;
+ String align = HTML.VALUE_ALIGN_CENTER;
+ if (sourceElement.hasAttribute(RichFaces.ATTR_ALIGN)) {
+ align = sourceElement.getAttribute(RichFaces.ATTR_ALIGN);
}
div.setAttribute(HTML.ATTR_ALIGN, align);
@@ -265,7 +265,6 @@
private void readAttributes(Node sourceNode) {
Element sourceElement = (Element) sourceNode;
- String attrValue = null;
showBoundaryControls = (!sourceElement
.hasAttribute(ATTR_BOUNDARY_CONTROLS) || ATTR_VALUE_SHOW
@@ -288,33 +287,29 @@
inactiveStyle = sourceElement.getAttribute(ATTR_INACTIVE_STYLE);
inactiveStyleClass = CSS_RICH_DATASCR_INACT;
- attrValue = sourceElement.getAttribute(ATTR_INACTIVE_STYLE_CLASS);
- if (ComponentUtil.isNotBlank(attrValue)) {
- inactiveStyleClass += Constants.WHITE_SPACE + attrValue;
+ if (sourceElement.hasAttribute(ATTR_INACTIVE_STYLE_CLASS)) {
+ inactiveStyleClass += Constants.WHITE_SPACE +
sourceElement.getAttribute(ATTR_INACTIVE_STYLE_CLASS);
}
selectedStyle = sourceElement.getAttribute(ATTR_SELECTED_STYLE);
selectedStyleClass = CSS_RICH_DATASCR_ACT;
- attrValue = sourceElement.getAttribute(ATTR_SELECTED_STYLE_CLASS);
- if (ComponentUtil.isNotBlank(attrValue)) {
- selectedStyleClass += Constants.WHITE_SPACE + attrValue;
+ if (sourceElement.hasAttribute(ATTR_SELECTED_STYLE_CLASS)) {
+ selectedStyleClass += Constants.WHITE_SPACE +
sourceElement.getAttribute(ATTR_SELECTED_STYLE_CLASS);
}
tableStyle = sourceElement.getAttribute(ATTR_TABLE_STYLE);
tableStyleClass = CSS_RICH_DATASCROLLER_TABLE;
- attrValue = sourceElement.getAttribute(ATTR_TABLE_STYLE_CLASS);
- if (ComponentUtil.isNotBlank(attrValue)) {
- tableStyleClass += Constants.WHITE_SPACE + attrValue;
+ if (sourceElement.hasAttribute(ATTR_TABLE_STYLE_CLASS)) {
+ tableStyleClass += Constants.WHITE_SPACE +
sourceElement.getAttribute(ATTR_TABLE_STYLE_CLASS);
}
style = sourceElement.getAttribute(HTML.ATTR_STYLE);
styleClass = CSS_RICH_DATASCR;
- attrValue = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
- if (ComponentUtil.isNotBlank(attrValue)) {
- styleClass += Constants.WHITE_SPACE + attrValue;
+ if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
+ styleClass += Constants.WHITE_SPACE +
sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
}
}
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 2010-07-04
22:45:46 UTC (rev 23232)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2010-07-05
07:17:44 UTC (rev 23233)
@@ -45,8 +45,11 @@
VpeCreationData creationData = new VpeCreationData(table);
ComponentUtil.setCSSLink(pageContext, "dataTable/dataTable.css",
"richFacesDataTable"); //$NON-NLS-1$ //$NON-NLS-2$
- String tableClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
- table.setAttribute(HTML.ATTR_CLASS, "dr-table rich-table " +
(tableClass==null?Constants.EMPTY:tableClass)); //$NON-NLS-1$
+ String tableClass = "dr-table rich-table"; //$NON-NLS-1$
+ if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
+ tableClass += " " + sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
//$NON-NLS-1$
+ }
+ table.setAttribute(HTML.ATTR_CLASS, tableClass);
// Encode colgroup definition.
ArrayList<Element> columns = getColumns(sourceElement);
@@ -54,9 +57,9 @@
nsIDOMElement colgroup = visualDocument.createElement(HTML.TAG_COLGROUP);
colgroup.setAttribute(HTML.ATTR_SPAN, String.valueOf(columnsLength));
table.appendChild(colgroup);
-
- String columnsWidth = sourceElement.getAttribute(RichFaces.ATTR_COLUMNS_WIDTH);
- if (null != columnsWidth) {
+
+ if (sourceElement.hasAttribute(RichFaces.ATTR_COLUMNS_WIDTH)) {
+ String columnsWidth = sourceElement.getAttribute(RichFaces.ATTR_COLUMNS_WIDTH);
String[] widths = columnsWidth.split(Constants.COMMA);
for (int i = 0; i < widths.length; i++) {
nsIDOMElement col = visualDocument.createElement(HTML.TAG_COL);
@@ -86,7 +89,7 @@
if(headerJsfElementPresents || hasColumnWithHeader) {
nsIDOMElement thead = visualDocument.createElement(HTML.TAG_THEAD);
table.appendChild(thead);
- String headerClass = (String)
sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS);
+ String headerClass = sourceElement.hasAttribute(RichFaces.ATTR_HEADER_CLASS) ?
sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS) : null;
if(headerJsfElementPresents) {
Node node = headerFacetChildren.get(VisualDomUtil.FACET_JSF_TAG).get(0);
encodeTableHeaderOrFooterFacet(pageContext, creationData,
@@ -120,7 +123,7 @@
if (footerJsfElementPresents || hasColumnWithFooter) {
nsIDOMElement tfoot = visualDocument.createElement(HTML.TAG_TFOOT);
table.appendChild(tfoot);
- String footerClass = (String)
sourceElement.getAttribute(RichFaces.ATTR_FOOTER_CLASS);
+ String footerClass = sourceElement.hasAttribute(RichFaces.ATTR_FOOTER_CLASS) ?
sourceElement.getAttribute(RichFaces.ATTR_FOOTER_CLASS) : null;
if(hasColumnWithFooter) {
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
tfoot.appendChild(tr);
@@ -199,7 +202,7 @@
if (null != facet) {
String classAttribute = facetName + "Class"; //$NON-NLS-1$
- String columnHeaderClass = column.getAttribute(classAttribute);
+ String columnHeaderClass = column.hasAttribute(classAttribute) ?
column.getAttribute(classAttribute) : null;
nsIDOMElement td = visualDocument.createElement(element);
parentTr.appendChild(td);
String styleClass = ComponentUtil.encodeStyleClass(null, skinCellClass,
headerClass, columnHeaderClass);
@@ -208,9 +211,9 @@
HTML.STYLE_PARAMETER_DISPLAY, HTML.STYLE_VALUE_NONE);
}
td.setAttribute(HTML.ATTR_CLASS, styleClass);
- td.setAttribute(HTML.ATTR_SCOPE, "col"); //$NON-NLS-1$
- String colspan = column.getAttribute("colspan"); //$NON-NLS-1$
- if(colspan!=null && colspan.length()>0) {
+ td.setAttribute(HTML.ATTR_SCOPE, "col"); //$NON-NLS-1$
+ if(column.hasAttribute("colspan")) { //$NON-NLS-1$
+ String colspan = column.getAttribute("colspan"); //$NON-NLS-1$
td.setAttribute(HTML.ATTR_COLSPAN, colspan);
}
if (RichFaces.NAME_FACET_HEADER.equals(facetName)) {