Author: yradtsevich
Date: 2010-11-09 10:59:32 -0500 (Tue, 09 Nov 2010)
New Revision: 26379
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/column-RF4.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/column-RF4.xhtml.xml
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/RichFacesDataTableTemplate.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/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7449: Vpe templates for rich iteration.
- added support for breakRowBefore attribute of rich:column
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 2010-11-09
14:47:33 UTC (rev 26378)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnTemplate.java 2010-11-09
15:59:32 UTC (rev 26379)
@@ -189,10 +189,16 @@
}
}
- public static boolean isBreakBefore(Node child) {
- String breakBeforeVal = ((Element)child).getAttribute(RichFaces.ATTR_BREAK_BEFORE);
- boolean breakBefore = breakBeforeVal != null &&
breakBeforeVal.equalsIgnoreCase(RichFaces.VALUE_TRUE);
- return breakBefore;
+ public static boolean isBreakBefore(Node node) {
+ if (node instanceof Element) {
+ Element element = (Element) node;
+ String breakBeforeVal = element.getAttribute(RichFaces.ATTR_BREAK_BEFORE);
+ String brealRowBeforeVal = element.getAttribute(RichFaces.ATTR_BREAK_ROW_BEFORE);
+ return RichFaces.VALUE_TRUE.equals(breakBeforeVal)
+ || RichFaces.VALUE_TRUE.equals(brealRowBeforeVal);
+ } else {
+ return false;
+ }
}
/**
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-11-09
14:47:33 UTC (rev 26378)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2010-11-09
15:59:32 UTC (rev 26379)
@@ -346,7 +346,7 @@
} else if (nodeName.equals(sourceElement.getPrefix() + Constants.COLON +
RichFaces.TAG_COLUMN) ||
nodeName.equals(sourceElement.getPrefix() + Constants.COLON +
RichFaces.TAG_COLUMNS)) {
// For new row, save length of previous.
- if (Boolean.getBoolean(column.getAttribute(RichFaces.ATTR_BREAK_BEFORE))) {
+ if (RichFacesColumnTemplate.isBreakBefore(column)) {
count = Math.max(currentLength,count);
currentLength = 0;
}
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 2010-11-09
14:47:33 UTC (rev 26378)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java 2010-11-09
15:59:32 UTC (rev 26379)
@@ -422,9 +422,8 @@
currentLength = 0;
} else if (nodeName.equals(sourceElement.getPrefix() + COLUMN) ||
nodeName.equals(sourceElement.getPrefix() + COLUMNS)) {
- String breakBeforeStr = column.getAttribute("breakBefore"); //$NON-NLS-1$
// For new row, save length of previsous.
- if (Boolean.getBoolean(breakBeforeStr)) {
+ if (RichFacesColumnTemplate.isBreakBefore(column)) {
if (currentLength > count) {
count = currentLength;
}
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 2010-11-09
14:47:33 UTC (rev 26378)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java 2010-11-09
15:59:32 UTC (rev 26379)
@@ -100,8 +100,7 @@
String nodeName = child.getNodeName();
if (nodeName.endsWith(':' + RichFaces.TAG_COLUMN) ||
nodeName.endsWith(':' + RichFaces.TAG_COLUMNS)) {
- final boolean breakBefore = RichFaces.VALUE_TRUE.equals(
((Element)child).getAttribute(RichFaces.ATTR_BREAK_BEFORE) );
- if (breakBefore) {
+ if (RichFacesColumnTemplate.isBreakBefore(child)) {
curRow++;
curColumn = 0;
curTr = visualDocument.createElement(HTML.TAG_TR);
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 2010-11-09
14:47:33 UTC (rev 26378)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2010-11-09
15:59:32 UTC (rev 26379)
@@ -30,6 +30,7 @@
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$
+ public static final String ATTR_BREAK_ROW_BEFORE = "breakRowBefore"; //
RichFaces 4.0 attribute //$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_COLLAPSE_ICON = "collapseIcon"; //$NON-NLS-1$
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/column-RF4.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/column-RF4.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/column-RF4.xhtml 2010-11-09
15:59:32 UTC (rev 26379)
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+<head>
+</head>
+<body>
+ <h1>column (RichFaces 4)</h1>
+ <h:form>
+ <rich:dataTable id="table1" value="#{bookList.bookList}"
var="book" sortMode="multi">
+ <rich:column sortBy="#{book.price}" id="col1" >
+ <h:outputText value="#{book.price}" />
+ </rich:column>
+ <rich:column id="col2" sortBy="#{book.numOfCopies}"
breakRowBefore="true">
+ <h:outputText value="#{book.numOfCopies}" />
+ </rich:column>
+ </rich:dataTable>
+ </h:form>
+</body>
+</html>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/column-RF4.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/column-RF4.xhtml.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/column-RF4.xhtml.xml 2010-11-09
15:59:32 UTC (rev 26379)
@@ -0,0 +1,18 @@
+<tests>
+ <test id="table1">
+ <TABLE>
+ <COLGROUP SPAN="1">
+ </COLGROUP>
+ <TR>
+ <TD>
+ <SPAN CLASS="vpe-text">#{book.price}</SPAN>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <SPAN CLASS="vpe-text">#{book.numOfCopies}</SPAN>
+ </TD>
+ </TR>
+ </TABLE>
+ </test>
+</tests>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2010-11-09
14:47:33 UTC (rev 26378)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2010-11-09
15:59:32 UTC (rev 26379)
@@ -95,6 +95,9 @@
public void testColumn() throws Throwable {
performContentTest("components/column.xhtml");//$NON-NLS-1$
}
+ public void testColumnRF4() throws Throwable {
+ performContentTest("components/column-RF4.xhtml");//$NON-NLS-1$
+ }
public void testDataGrid() throws Throwable {
performContentTest("components/dataGrid.xhtml");//$NON-NLS-1$