Author: dmaliarevich
Date: 2009-01-16 11:03:01 -0500 (Fri, 16 Jan 2009)
New Revision: 13087
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataGrid.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataGrid.xhtml.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-3491, DataGrid displays text nodes now, default
table size was added.
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 2009-01-16
15:53:54 UTC (rev 13086)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java 2009-01-16
16:03:01 UTC (rev 13087)
@@ -30,7 +30,12 @@
public class RichFacesDataGridTemplate extends RichFacesDataTableTemplate {
+ /*
+ *
https://jira.jboss.org/jira/browse/JBIDE-3491
+ * Set default table size when no attributes are specified.
+ */
private int defaultRows = 3;
+ private int defaultColumns = 1;
private String[] rowClasses;
private String[] columnClasses;
@@ -88,11 +93,16 @@
nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
table.appendChild(tbody);
- // Create mapping to Encode body
- List<Node> children = ComponentUtil.getChildren(sourceElement);
+ /*
+ *
https://jira.jboss.org/jira/browse/JBIDE-3491
+ * Add text nodes to children list too.
+ */
+ //Create mapping to Encode body
+ List<Node> children = ComponentUtil.getChildren(sourceElement, true);
sourceElement.getAttribute(RichFaces.ATTR_ELEMENTS);
int elementsCount = getElementsCount(sourceElement, columnsLength);
+
if(columnsLength>0) {
int rowIndex = 0;
for(int elementIndex = 0; elementIndex<elementsCount; rowIndex++) {
@@ -106,9 +116,7 @@
if(!children.isEmpty()) {
VpeChildrenInfo childInfo = new VpeChildrenInfo(td);
for (Node child : children) {
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- childInfo.addSourceChild(child);
- }
+ childInfo.addSourceChild(child);
}
creationData.addChildrenInfo(childInfo);
}
@@ -151,11 +159,11 @@
}
protected int getColumnsCount(Element sourceElement) {
- int count = 0;
+ int count = defaultColumns;
// check for exact value in component
try {
int span = Integer.parseInt(sourceElement.getAttribute(RichFaces.ATTR_COLUMNS));
- count = span > 0 ? span : 0;
+ count = span > 0 ? span : defaultColumns;
} catch (NumberFormatException e) {
// Ignore wrong formatted attribute
}
@@ -163,7 +171,7 @@
}
protected int getElementsCount(Element sourceElement, int columnCount) {
- int elements = 0;
+ int elements = columnCount * defaultRows;
// check for exact value in component
try {
int span = Integer.parseInt(sourceElement.getAttribute(RichFaces.ATTR_ELEMENTS));
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataGrid.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataGrid.xhtml 2009-01-16
15:53:54 UTC (rev 13086)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataGrid.xhtml 2009-01-16
16:03:01 UTC (rev 13087)
@@ -20,6 +20,12 @@
<h:outputText value="#{data.field1}" />
</rich:panel>
</rich:dataGrid>
+
+ <rich:dataGrid value="#{bean.dtList}" var="data"
id="dataGrid2">
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ <h:outputText value="#{data.field1}" />
+ </rich:dataGrid>
+
</h:form>
</body>
</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataGrid.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataGrid.xhtml.xml 2009-01-16
15:53:54 UTC (rev 13086)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataGrid.xhtml.xml 2009-01-16
16:03:01 UTC (rev 13087)
@@ -105,4 +105,57 @@
</TBODY>
</TABLE>
</test>
+
+
+ <test id="dataGrid2">
+ <TABLE VALUE="#{bean.dtList}" VAR="data"
ID="dataGrid2"
+ CLASS="dr-table rich-table">
+ <COLGROUP SPAN="1">
+ </COLGROUP>
+ <TBODY>
+ <TR CLASS="dr-table-row rich-table-row">
+ <TD CLASS="dr-table-cell rich-table-cell">
+ <SPAN CLASS="vpe-text">
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+</SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ #{data.field1}
+</SPAN>
+ </SPAN>
+ </TD>
+ </TR>
+ <TR CLASS="dr-table-row rich-table-row">
+ <TD CLASS="dr-table-cell rich-table-cell">
+ <SPAN CLASS="vpe-text">
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+</SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ #{data.field1}
+</SPAN>
+ </SPAN>
+ </TD>
+ </TR>
+ <TR CLASS="dr-table-row rich-table-row">
+ <TD CLASS="dr-table-cell rich-table-cell">
+ <SPAN CLASS="vpe-text">
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+</SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ #{data.field1}
+</SPAN>
+ </SPAN>
+ </TD>
+ </TR>
+ </TBODY>
+ </TABLE>
+ </test>
</tests>
\ No newline at end of file