JBoss Rich Faces SVN: r12703 - trunk/ui/togglePanel/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-02-20 10:23:08 -0500 (Fri, 20 Feb 2009)
New Revision: 12703
Modified:
trunk/ui/togglePanel/src/main/config/component/togglePanel.xml
Log:
fix ui_input entity locatoin
Modified: trunk/ui/togglePanel/src/main/config/component/togglePanel.xml
===================================================================
--- trunk/ui/togglePanel/src/main/config/component/togglePanel.xml 2009-02-20 13:02:15 UTC (rev 12702)
+++ trunk/ui/togglePanel/src/main/config/component/togglePanel.xml 2009-02-20 15:23:08 UTC (rev 12703)
@@ -44,6 +44,9 @@
</description>
<defaultvalue>DEFAULT_METHOD</defaultvalue>
</property>
+
+ &ui_input_attributes;
+
<property required="false" el="true" elonly="true">
<name>value</name>
<classname>java.lang.Object</classname>
@@ -91,7 +94,6 @@
</taghandler>
-->
&ui_component_attributes;
- &ui_input_attributes;
&html_style_attributes;
&html_events;
<!--
15 years, 10 months
JBoss Rich Faces SVN: r12702 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-02-20 08:02:15 -0500 (Fri, 20 Feb 2009)
New Revision: 12702
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
Log:
https://jira.jboss.org/jira/browse/RF-6202
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-20 12:46:27 UTC (rev 12701)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-20 13:02:15 UTC (rev 12702)
@@ -27,6 +27,7 @@
import org.richfaces.AutoTester;
import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
import org.testng.annotations.Test;
public class AjaxHTMLCommandLinkTest extends SeleniumTestBase {
@@ -151,6 +152,17 @@
assertClassAttributeContains(componentId, "noclass", "Class attribute was not output to client");
}
+ @Test
+ public void testComponentIsRenderedAsLinkWithTextDefinedAsValueAttribute(Template template) {
+ renderAutoTestPage(LOOK_AND_FEEL_TEST_URL, template, null);
+ writeStatus("Check component is rendered as link with text defined as value attribute");
+
+ String componentId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ isRenderedAs(componentId, "a");
+ AssertTextEquals(componentId, "HtmlCommandLink",
+ "Component should be rendered as link with text defined as value attribute");
+ }
+
@Override
public void sendAction() {
clickCommandAndWait(getAutoTester(this).getClientId(AutoTester.COMPONENT_ID));
@@ -186,6 +198,12 @@
}
}
+ private void isRenderedAs(String id, String tagName) {
+ if (selenium.getXpathCount("//" + tagName + "[@id='" + id + "']").intValue() != 1) {
+ Assert.fail("Dom element with id [" + id + "] is not rendered as <" + tagName + ">");
+ }
+ }
+
@Override
public String getTestUrl() {
return "pages/ajaxHTMLCommandLink/ajaxHTMLLinkTest.xhtml";
15 years, 10 months
JBoss Rich Faces SVN: r12701 - trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-02-20 07:46:27 -0500 (Fri, 20 Feb 2009)
New Revision: 12701
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/TemplateBean.java
Log:
Remove try/catch block for template bean reset method
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/TemplateBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/TemplateBean.java 2009-02-20 12:45:44 UTC (rev 12700)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/TemplateBean.java 2009-02-20 12:46:27 UTC (rev 12701)
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.List;
+import javax.el.ELException;
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
import javax.faces.context.FacesContext;
@@ -123,16 +124,12 @@
FacesContext context = FacesContext.getCurrentInstance();
if (context != null) {
if (methodName != null && methodName.trim().length() > 0 && !"null".equals(methodName)) {
- try {
ExpressionFactory factory = context.getApplication().getExpressionFactory();
if (factory != null) {
MethodExpression methodExpression = factory.createMethodExpression(context.getELContext(),
methodName, Void.class, new Class[] {});
methodExpression.invoke(context.getELContext(), new Object[] {});
}
- } catch (Exception e) {
- log.error("Reset method has not been found by this expression: " + methodName, e);
- }
}
}
15 years, 10 months
JBoss Rich Faces SVN: r12700 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/columnGroup and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-02-20 07:45:44 -0500 (Fri, 20 Feb 2009)
New Revision: 12700
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnGroupTest.java
Log:
RF-6093
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java 2009-02-20 12:31:06 UTC (rev 12699)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnGroupBean.java 2009-02-20 12:45:44 UTC (rev 12700)
@@ -12,6 +12,8 @@
*/
public class ColumnGroupBean {
+ boolean rendered = true;
+
List<String> rows = new ArrayList<String>();
public ColumnGroupBean() {
@@ -19,6 +21,15 @@
rows.add("Text" + i);
}
}
+
+ public void reset() {
+ rendered = true;
+ }
+
+ public void prepareRenderedTest() {
+ reset();
+ rendered = false;
+ }
public List<String> getRows() {
return rows;
@@ -28,6 +39,8 @@
this.rows = rows;
}
+ public boolean isRendered() {
+ return rendered;
+ }
-
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml 2009-02-20 12:31:06 UTC (rev 12699)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columnGroup/columnGroupTest.xhtml 2009-02-20 12:45:44 UTC (rev 12700)
@@ -10,31 +10,41 @@
<ui:define name="component">
<rich:dataTable id="table" value="#{columnGroupBean.rows}" var="row">
<f:facet name="header">
- <rich:columnGroup columnClasses="columnClass"
+ <rich:columnGroup rendered="#{columnGroupBean.rendered}"
+ columnClasses="columnClass"
rowClasses="rowClass"
style="color: green"
title="title">
- <rich:column colspan="2">
- <h:outputText value="Header1"></h:outputText>
+ <rich:column rowspan="2">
+ <h:outputText value="Header"></h:outputText>
</rich:column>
- <rich:column colspan="2">
- <h:outputText value="Header2"></h:outputText>
+ <rich:column >
+ <h:outputText value="Header"></h:outputText>
</rich:column>
+ <rich:column>
+ <h:outputText value="Header"></h:outputText>
+ </rich:column>
+ <rich:column rowspan="2">
+ <h:outputText value="Header"></h:outputText>
+ </rich:column>
+ <rich:column colspan="2" breakBefore="true">
+ <h:outputText value="Header"></h:outputText>
+ </rich:column>
</rich:columnGroup>
</f:facet>
- <rich:column>
- <h:outputText value="#{row}"></h:outputText>
- </rich:column>
- <rich:column>
- <h:outputText value="#{row}"></h:outputText>
- </rich:column>
- <rich:column>
- <h:outputText value="#{row}"></h:outputText>
- </rich:column>
- <rich:column>
- <h:outputText value="#{row}"></h:outputText>
- </rich:column>
- </rich:dataTable>
+ <rich:column>
+ <h:outputText value="#{row}"></h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row}"></h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row}"></h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row}"></h:outputText>
+ </rich:column>
+ </rich:dataTable>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnGroupTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnGroupTest.java 2009-02-20 12:31:06 UTC (rev 12699)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnGroupTest.java 2009-02-20 12:45:44 UTC (rev 12700)
@@ -14,9 +14,25 @@
*/
public class ColumnGroupTest extends SeleniumTestBase {
+ static final String RESET_METHOD = "#{columnGroupBean.reset}";
+ static final String RESET_METHOD_FOR_RENDERED_TEST = "#{columnGroupBean.prepareRenderedTest}";
+
+
@Test
+ public void testRenderedAttribute(Template template) {
+ renderPage(template, RESET_METHOD_FOR_RENDERED_TEST);
+ String tableId = getParentId() + "table";
+
+ int headerContentCount = selenium.getXpathCount("//table[@id='"+tableId+"']/thead/*").intValue();
+
+ if (headerContentCount != 0) {
+ Assert.fail("Rendered attribute does not work. Table header should not be output to client.");
+ }
+ }
+
+ @Test
public void testStylesAndClasses(Template template) {
- renderPage(template, null);
+ renderPage(template, RESET_METHOD);
String tableId = getParentId() + "table";
// Check rowClass attribute
@@ -43,28 +59,18 @@
@Test
public void testOutput(Template template) {
- renderPage(template, null);
+ renderPage(template, RESET_METHOD);
String tableId = getParentId() + "table";
- // Check colgroup tag
- int colGroupTagCount = selenium.getXpathCount(getTableXpath(tableId) + "/colgroup").intValue();
- Assert.assertEquals(colGroupTagCount, 1, "Colgroup tag was not output to client");
+ // Check breakBefore attribute
+ int headerRowsCount = selenium.getXpathCount("//table[@id='"+tableId+"']/thead/tr").intValue();
+ int firstRowColsCount = selenium.getXpathCount("//table[@id='"+tableId+"']/thead/tr[1]/th").intValue();
+ int secondRowColsCount = selenium.getXpathCount("//table[@id='"+tableId+"']/thead/tr[2]/th").intValue();
- String colGroupSpan = selenium.getAttribute(getTableXpath(tableId) + "/colgroup/@span");
- Assert.assertEquals(colGroupSpan, "4", "Colgroup span is incorrect. Should be 4. But was " + colGroupSpan);
-
- // Check grouped columns rendering
- int rows = selenium.getXpathCount(getTableXpath(tableId) + "/thead/tr").intValue();
- Assert.assertEquals(rows, 1, "Table header should have one row");
-
- int cols = selenium.getXpathCount(getTableXpath(tableId) + "/thead/tr/th").intValue();
- Assert.assertEquals(cols, 2, "Table header should have two columns");
-
- String colspan = selenium.getAttribute(getTableXpath(tableId) + "/thead/tr/th/@colspan");
- Assert.assertEquals(colspan, "2", "Table header column should have colspan=2 attribute ");
- AssertTextEquals(getTableXpath(tableId) + "/thead/tr/th[1]", "Header1", "Columns header was not rendered as expected");
-
+ if (headerRowsCount != 2 || firstRowColsCount != 4 || secondRowColsCount != 1) {
+ Assert.fail("ColumnGroup component works unexpectly. Table header should have two rows. The first row should have 4 columns. The second - 1 column.");
+ }
}
String getTableXpath(String clientId) {
15 years, 10 months
JBoss Rich Faces SVN: r12699 - in trunk/ui/calendar/src/main: java/org/richfaces/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2009-02-20 07:31:06 -0500 (Fri, 20 Feb 2009)
New Revision: 12699
Modified:
trunk/ui/calendar/src/main/config/component/calendar.xml
trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
Log:
https://jira.jboss.org/jira/browse/RF-3538
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2009-02-20 12:16:19 UTC (rev 12698)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2009-02-20 12:31:06 UTC (rev 12699)
@@ -597,6 +597,10 @@
minimal days required must be a full week, this method returns 7. Default value is "getDefaultMinDaysInFirstWeek()".
</description>
</property>
+ <property>
+ <name>tabindex</name>
+ <classname>java.lang.String</classname>
+ </property>
</component>
&listeners;
</components>
Modified: trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2009-02-20 12:16:19 UTC (rev 12698)
+++ trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2009-02-20 12:31:06 UTC (rev 12699)
@@ -257,7 +257,11 @@
public abstract void setShowApplyButton(boolean showApplyButton);
+ public abstract String getTabIndex();
+ public abstract void setTabIndex(String tabIndex);
+
+
// TODO onclick add users onclick
// currentDate processing -------------------------------------------------
15 years, 10 months
JBoss Rich Faces SVN: r12698 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/columns and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-02-20 07:16:19 -0500 (Fri, 20 Feb 2009)
New Revision: 12698
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColspanRowspanBreakbefore.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnsBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/columnsTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColumnsSorting.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnsTest.java
Log:
Columns tests
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnsBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnsBean.java 2009-02-20 11:56:17 UTC (rev 12697)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnsBean.java 2009-02-20 12:16:19 UTC (rev 12698)
@@ -17,14 +17,19 @@
String status;
+ boolean rendered = true;
+ boolean selfSorted = true;
+
public class Column {
String header;
+ String footer;
Ordering ordering;
Object filterValue;
- public Column(String header) {
+ public Column(String header, String footer) {
super();
this.header = header;
+ this.footer = footer;
}
public void listener(ActionEvent event) {
@@ -59,6 +64,14 @@
public void setFilterValue(Object filterValue) {
this.filterValue = filterValue;
}
+
+ public String getFooter() {
+ return footer;
+ }
+
+ public void setFooter(String footer) {
+ this.footer = footer;
+ }
}
@@ -101,10 +114,14 @@
private int cols = 3;
+ private int headerCols = 5;
+
private List<Row []> model;
private List<Column> columns;
+ private List<Column> headerColumns;
+
public ColumnsBean() {
init();
}
@@ -112,7 +129,7 @@
private void init () {
columns = new ArrayList<Column>();
for (int i = 0; i < cols; i++) {
- columns.add(new Column("Header" + i));
+ columns.add(new Column("Header" + i, "Footer" + i));
}
model = new ArrayList<Row[]>();
@@ -128,7 +145,33 @@
public void reset() {
init();
status = null;
+ rendered = true;
+ selfSorted = true;
}
+
+ public void prepareRenderedTest () {
+ reset();
+ rendered = false;
+ }
+
+ public void prepareExternalSorting () {
+ reset();
+ selfSorted = false;
+ }
+
+ public String sortAscending() {
+ for (Column c : columns) {
+ c.setOrdering(Ordering.ASCENDING);
+ }
+ return null;
+ }
+
+ public String sortDescending() {
+ for (Column c : columns) {
+ c.setOrdering(Ordering.DESCENDING);
+ }
+ return null;
+ }
public List<Row[]> getModel() {
return model;
@@ -179,5 +222,23 @@
this.comparator = comparator;
}
+ public List<Column> getHeaderColumns() {
+ if (headerColumns == null) {
+ headerColumns = new ArrayList<Column>();
+ for (int i = 0; i < headerCols; i++) {
+ headerColumns.add(new Column("Header" + i, "Footer" + i));
+ }
+ }
+ return headerColumns;
+ }
+
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ public boolean isSelfSorted() {
+ return selfSorted;
+ }
+
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/columnsTest.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColspanRowspanBreakbefore.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColspanRowspanBreakbefore.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColspanRowspanBreakbefore.xhtml 2009-02-20 12:16:19 UTC (rev 12698)
@@ -0,0 +1,43 @@
+<!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:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="_form">
+ <br/><br/>
+ <rich:dataTable id="table" value="#{columnsBean.model}" var="row">
+ <f:facet name="header">
+ <rich:columnGroup>
+ <rich:columns rowspan="#{(index == 0 || index == 3)? 2 : 1 }"
+ colspan="#{index == 4 ? 2 : 1}"
+ breakBefore="#{index==4 ? true : false}"
+ value="#{columnsBean.headerColumns}" var="column"
+ index="index">
+ <h:outputText value="#{column.header}"></h:outputText>
+ </rich:columns>
+ </rich:columnGroup>
+ </f:facet>
+ <rich:column>
+ <h:outputText value="Text" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="Text" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="Text" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="Text" />
+ </rich:column>
+ </rich:dataTable><br/>
+
+
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColumnsSorting.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColumnsSorting.xhtml 2009-02-20 11:56:17 UTC (rev 12697)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColumnsSorting.xhtml 2009-02-20 12:16:19 UTC (rev 12698)
@@ -20,9 +20,12 @@
</rich:columns>
</rich:dataTable><br/>
+ <a4j:commandButton id="sortAsc" reRender="table2" action="#{columnsBean.sortAscending}" value="Sort ASC" />
+ <a4j:commandButton id="sortDesc" reRender="table2" action="#{columnsBean.sortDescending}" value="Sort DESC" />
+
<rich:dataTable id="table2" value="#{columnsBean.model}" var="row">
<rich:columns id="c#{index}" value="#{columnsBean.columns}" var="column"
- index="index" comparator="#{columnsBean.comparator}" sortOrder="#{column.ordering}">
+ index="index" selfSorted="#{columnsBean.selfSorted}" comparator="#{columnsBean.comparator}" sortOrder="#{column.ordering}">
<f:facet name="header">
<h:outputText value="#{column.ordering}"></h:outputText>
</f:facet>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnsTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnsTest.java 2009-02-20 11:56:17 UTC (rev 12697)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnsTest.java 2009-02-20 12:16:19 UTC (rev 12698)
@@ -33,10 +33,13 @@
public class ColumnsTest extends SeleniumTestBase {
static final String RESET_METHOD = "#{columnsBean.reset}";
+ static final String RESET_METHOD_FOR_RENDERED_TEST = "#{columnsBean.prepareRenderedTest}";
+ static final String RESET_METHOD_FOR_EXTERNAL_SORT_TEST = "#{columnsBean.prepareExternalSorting}";
static final String SORTING_TEST_URL = "pages/columns/testColumnsSorting.xhtml";
static final String FILTERING_TEST_URL = "pages/columns/testColumnsFiltering.xhtml";
static final String VALUE_ATTRIBUTE_TEST_URL = "pages/columns/testValueAttribute.xhtml";
+ static final String ROSPAN_COLSPAN_BREAKBEFORE_ATTRIBUTES_TEST_URL = "pages/columns/testColspanRowspanBreakbefore.xhtml";
enum FEATURE {
SORTING,
@@ -46,6 +49,96 @@
static final String [] COLUMNS_CLASSSES = new String [] {"dr-table-cell", "rich-table-cell", "columnClass"};
@Test
+ public void testExternalSorting(Template template) {
+ renderAutoTestPage(SORTING_TEST_URL, template, RESET_METHOD_FOR_EXTERNAL_SORT_TEST);
+
+ final int cols = 3;
+
+ String tableId = getParentId() + "_form:table2";
+ String testAscId = getParentId() + "_form:sortAsc";
+ String testDescId = getParentId() + "_form:sortDesc";
+
+ clickAjaxCommandAndWait(testAscId);
+
+ // Test external sorting ASC
+ for (int i = 0; i < cols; i++) {
+ checkColumnsData(tableId, i, new String [] {String.valueOf(i), String.valueOf(i+1)}, FEATURE.SORTING, "Sorting does not work as expected if selfSorted = false.");
+ checkSortOrderAttribute(tableId, i, Ordering.ASCENDING);
+ }
+
+ // Test external sorting DESC
+ clickAjaxCommandAndWait(testDescId);
+ for (int i = 0; i < cols; i++) {
+ checkColumnsData(tableId, i, new String [] {String.valueOf(i+1), String.valueOf(i)}, FEATURE.SORTING, "Sorting does not work as expected if selfSorted = false.");
+ checkSortOrderAttribute(tableId, i, Ordering.DESCENDING);
+ }
+
+ }
+
+ @Test
+ public void testRenderedAttribute (Template template) {
+ renderPage(template, RESET_METHOD_FOR_RENDERED_TEST);
+
+ String tableId = getParentId() + "_form:table";
+
+ int headerCount = selenium.getXpathCount("//table[@id='"+tableId+"']/tbody/*").intValue();
+ int footerCount = selenium.getXpathCount("//table[@id='"+tableId+"']/tfoot/*").intValue();
+ int dataCount = selenium.getXpathCount("//table[@id='"+tableId+"']/tbody/*").intValue();
+
+ if (headerCount != 0 || footerCount != 0 || dataCount != 0) {
+ Assert.fail("Rendered attribute does not work. No data and no facets should be output to client.");
+ }
+ }
+
+ @Test
+ public void testRowspanColspanBreakBeforeAttributes(Template template) {
+ renderPage(ROSPAN_COLSPAN_BREAKBEFORE_ATTRIBUTES_TEST_URL, template, RESET_METHOD);
+
+ String tableId = getParentId() + "_form:table";
+
+ // Check rowspan attribute
+ String col1Rowspan = selenium.getAttribute("//table[@id='"+tableId+"']/thead/tr/th[1]/@rowspan");
+ String col3Rowspan = selenium.getAttribute("//table[@id='"+tableId+"']/thead/tr/th[4]/@rowspan");
+
+ if (!col1Rowspan.equals("2") || !col3Rowspan.equals("2")) {
+ Assert.fail("Rowspan attributes was not output to client. The first and third columns should have rowspan=2. But was: " + col1Rowspan + " and " + col3Rowspan);
+ }
+
+ // Check breakBefore attribute
+ int headerRowsCount = selenium.getXpathCount("//table[@id='"+tableId+"']/thead/tr").intValue();
+ int firstRowColsCount = selenium.getXpathCount("//table[@id='"+tableId+"']/thead/tr[1]/th").intValue();
+ int secondRowColsCount = selenium.getXpathCount("//table[@id='"+tableId+"']/thead/tr[2]/th").intValue();
+
+ if (headerRowsCount != 2 || firstRowColsCount != 4 || secondRowColsCount != 1) {
+ Assert.fail("BreakBefore attribute was not applied as expected. Table header should have two rows. The first row should have 4 columns. The second - 1 column.");
+ }
+
+
+ // Check colspan attribute
+ String col4Colspan = selenium.getAttribute("//table[@id='"+tableId+"']/thead/tr[2]/th/@colspan");
+
+ if (!col4Colspan.equals("2")) {
+ Assert.fail("Colspan attributes was not output to client. The 4th column should have colspan=2. But was: " + col4Colspan);
+ }
+
+ }
+
+
+ @Test
+ public void testHeaderFooterFacets(Template template) {
+ renderPage(template, RESET_METHOD);
+
+ String tableId = getParentId() + "_form:table";
+
+ final int cols = 3;
+ for (int i = 0; i < cols; i++) {
+ AssertTextEquals("//table[@id='"+tableId+"']/thead/tr/th["+(i+1)+"]", "Header" + i, "Header for column " + i + " was not output to client");
+ AssertTextEquals("//table[@id='"+tableId+"']/tfoot/tr/td["+(i+1)+"]", "Footer" + i, "Footer for column " + i + " was not output to client");
+ }
+ }
+
+
+ @Test
public void testStylesClassesAndStandardHTMLAttributes(Template template) {
AutoTester tester = getAutoTester(this);
tester.renderPage(template, RESET_METHOD);
@@ -77,8 +170,6 @@
}
- private static final String CTRL_FORM = "_controls";
-
@Test
public void testSortingFeature(Template template) {
renderPage(SORTING_TEST_URL, template, RESET_METHOD);
15 years, 10 months
JBoss Rich Faces SVN: r12697 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-02-20 06:56:17 -0500 (Fri, 20 Feb 2009)
New Revision: 12697
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/styleAndClasseStandardHTMLAttributesTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
Log:
https://jira.jboss.org/jira/browse/RF-6209
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/styleAndClasseStandardHTMLAttributesTest.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/styleAndClasseStandardHTMLAttributesTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-19 18:16:20 UTC (rev 12696)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-20 11:56:17 UTC (rev 12697)
@@ -25,6 +25,7 @@
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
import org.testng.annotations.Test;
@@ -36,6 +37,8 @@
private final static String SUBMITTED_VALUE = "_form:_submittedValue";
+ private final static String LOOK_AND_FEEL_TEST_URL = "pages/ajaxHTMLCommandLink/styleAndClasseStandardHTMLAttributesTest.xhtml";
+
private static Map<String, String> params = new HashMap<String, String>();
static {
@@ -129,6 +132,25 @@
tester.testASRequestParameters(params);
}
+ @Test
+ public void testStandardHTMLAttributesAreOutputToClient(Template template) {
+ renderAutoTestPage(LOOK_AND_FEEL_TEST_URL, template, null);
+
+ writeStatus("Check standart HTML attributes");
+ assertEvents(getAutoTester(this).getClientId(AutoTester.COMPONENT_ID), SeleniumEvent.STANDARD_HTML_EVENTS);
+ }
+
+ @Test
+ public void testStylesAndStyleClassesAreOutputToClient(Template template) {
+ renderAutoTestPage(LOOK_AND_FEEL_TEST_URL, template, null);
+ writeStatus("Check styles and classes are output to client");
+
+ writeStatus("Check styleClass/style attributes");
+ String componentId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ assertStyleAttributeContains(componentId, "font-size: 16px", "Style attribute was not output to client");
+ assertClassAttributeContains(componentId, "noclass", "Class attribute was not output to client");
+ }
+
@Override
public void sendAction() {
clickCommandAndWait(getAutoTester(this).getClientId(AutoTester.COMPONENT_ID));
15 years, 10 months
JBoss Rich Faces SVN: r12696 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/WEB-INF and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-02-19 13:16:20 -0500 (Thu, 19 Feb 2009)
New Revision: 12696
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/RequestBean.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/autotest/autoTestHiddens.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
Log:
https://jira.jboss.org/jira/browse/RF-6207
Added: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/RequestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/RequestBean.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/RequestBean.java 2009-02-19 18:16:20 UTC (rev 12696)
@@ -0,0 +1,26 @@
+package org.ajax4jsf.autotest.bean;
+
+/**
+ * Used for fetching request parameters to further examination.
+ */
+public class RequestBean {
+
+ private String paramString;
+
+ /**
+ * Gets value of paramString field.
+ * @return value of paramString field
+ */
+ public String getParamString() {
+ return paramString;
+ }
+
+ /**
+ * Set a new value for paramString field.
+ * @param paramString a new value for paramString field
+ */
+ public void setParamString(String paramString) {
+ this.paramString = paramString;
+ }
+
+}
Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/RequestBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-02-19 18:13:16 UTC (rev 12695)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-02-19 18:16:20 UTC (rev 12696)
@@ -309,6 +309,15 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>requestBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.autotest.bean.RequestBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>paramString</property-name>
+ <value>#{param}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>treeBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.tree.TreeTestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/autotest/autoTestHiddens.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/autotest/autoTestHiddens.xhtml 2009-02-19 18:13:16 UTC (rev 12695)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/autotest/autoTestHiddens.xhtml 2009-02-19 18:16:20 UTC (rev 12696)
@@ -5,6 +5,7 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:inputHidden id="_auto_input" value="#{autoTestBean.input}" required="true"></h:inputHidden>
+ <h:outputText id="_auto_request_params" style="display: none;" value="#{requestBean.paramString}" />
<h:inputHidden id="_auto_process_input" value="#{autoTestBean.processInput}" valueChangeListener="#{autoTestBean.processInputChangeListener}"></h:inputHidden>
<a4j:outputPanel ajaxRendered="true">
<h:outputText id="_auto_status" style="display: none;" value="#{autoTestBean.status}"></h:outputText>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-02-19 18:13:16 UTC (rev 12695)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-02-19 18:16:20 UTC (rev 12696)
@@ -50,7 +50,9 @@
public static final String VALUE_ID = "_auto_value";
private static final String TIME_ID = "_auto_time";
-
+
+ private static final String REQ_PARAMS_ID = "_auto_request_params";
+
private static final String MESSAGE_FOR_ID = "_auto_messageId";
public static final String COMPONENT_ID = "componentId";
@@ -62,13 +64,9 @@
private static final String AJAX_SUBMIT = "_auto_ajax_submit";
private static final String AJAX_RESET = "_auto_ajax_reset";
-
- private
- // /private String componentName;
+ private SeleniumTestBase base;
- SeleniumTestBase base;
-
public AutoTester(SeleniumTestBase base) {
this.base = base;
}
@@ -386,6 +384,21 @@
checkUpdateModel(false);
}
+ public void testASRequestParameters(Map<String, String> params) {
+ reset();
+ clickLoad();
+
+ base.sendAction();
+
+ String paramString = base.getTextById(base.getParentId() + AUTOTEST_FORM_ID + REQ_PARAMS_ID);
+
+ for (Map.Entry<String, String> entry : params.entrySet()) {
+ if (!paramString.contains(entry.toString())) {
+ Assert.fail("Request parameter [" + entry.toString() + "] is expected");
+ }
+ }
+ }
+
//
// EditableValueHolder test methods
//
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-19 18:13:16 UTC (rev 12695)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-19 18:16:20 UTC (rev 12696)
@@ -20,6 +20,9 @@
*/
package org.richfaces.testng;
+import java.util.HashMap;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
@@ -33,6 +36,14 @@
private final static String SUBMITTED_VALUE = "_form:_submittedValue";
+ private static Map<String, String> params = new HashMap<String, String>();
+
+ static {
+ params.put("parameter1", "value1");
+ params.put("parameter2", "value2");
+ params.put("parameter3", "value3");
+ }
+
@Test
public void testAjaxHTMLCommandLinkComponent(Template template) {
renderPage(template);
@@ -110,6 +121,14 @@
tester.testRendered();
}
+ @Test
+ public void testNestedParams(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test component encodes nested f:param tags and their values are present as request parameters");
+ tester.testASRequestParameters(params);
+ }
+
@Override
public void sendAction() {
clickCommandAndWait(getAutoTester(this).getClientId(AutoTester.COMPONENT_ID));
15 years, 10 months
JBoss Rich Faces SVN: r12695 - trunk/ui/suggestionbox/src/test/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-02-19 13:13:16 -0500 (Thu, 19 Feb 2009)
New Revision: 12695
Modified:
trunk/ui/suggestionbox/src/test/java/org/richfaces/renderkit/html/SuggestionBoxRendererTest.java
Log:
Unit test updated
Modified: trunk/ui/suggestionbox/src/test/java/org/richfaces/renderkit/html/SuggestionBoxRendererTest.java
===================================================================
--- trunk/ui/suggestionbox/src/test/java/org/richfaces/renderkit/html/SuggestionBoxRendererTest.java 2009-02-19 17:34:20 UTC (rev 12694)
+++ trunk/ui/suggestionbox/src/test/java/org/richfaces/renderkit/html/SuggestionBoxRendererTest.java 2009-02-19 18:13:16 UTC (rev 12695)
@@ -63,9 +63,9 @@
String opacity = renderer.opacityStyle(facesContext, sb);
assertEquals("opacity:0.1; filter:alpha(opacity=10);", opacity);
- sb.getAttributes().put("shadowOpacity", "3");
+ sb.getAttributes().put("shadowOpacity", "5");
opacity = renderer.opacityStyle(facesContext, sb);
- assertEquals("opacity:0.3; filter:alpha(opacity=30);", opacity);
+ assertEquals("opacity:0.5; filter:alpha(opacity=50);", opacity);
}
public void testBorder() throws Exception {
15 years, 10 months
JBoss Rich Faces SVN: r12694 - in trunk: framework/impl/src/main/java/org/ajax4jsf/renderkit and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-02-19 12:34:20 -0500 (Thu, 19 Feb 2009)
New Revision: 12694
Added:
trunk/samples/dataTableDemo/src/main/webapp/pages/page_RF-6152.jsp
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
trunk/samples/dataTableDemo/src/main/java/org/richfaces/Bean.java
trunk/samples/dataTableDemo/src/main/java/org/richfaces/Data.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnsTest.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumnGroup.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
Log:
DataTable: extra column header for breakBefore columns
https://jira.jboss.org/jira/browse/RF-6152
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -977,14 +977,12 @@
}
// continue hack
- Iterator<UIComponent> itr = c.getChildren().iterator();
- while (itr.hasNext()) {
- restoreChildState(faces, (UIComponent) itr.next(), childState);
- }
- itr = c.getFacets().values().iterator();
- while (itr.hasNext()) {
- restoreChildState(faces, (UIComponent) itr.next(), childState);
- }
+ for (UIComponent child : c.getChildren()) {
+ restoreChildState(faces, child, childState);
+ }
+ for (UIComponent facet : c.getFacets().values()) {
+ restoreChildState(faces, facet, childState);
+ }
}
/**
@@ -998,21 +996,6 @@
// For an any validation errors, children components state should be preserved
FacesMessage.Severity sev = context.getMaximumSeverity();
return (sev != null && (FacesMessage.SEVERITY_ERROR.compareTo(sev) >= 0));
-
-
-// Iterator<String> clientIds = this.getChildState(context).keySet().iterator();
-// while (clientIds.hasNext()) {
-// String clientId = clientIds.next();
-// Iterator<FacesMessage> messages = context.getMessages(clientId);
-// while (messages.hasNext()) {
-// FacesMessage message = messages.next();
-// if (message.getSeverity()
-// .compareTo(FacesMessage.SEVERITY_ERROR) >= 0) {
-// return (true);
-// }
-// }
-// }
-// return false;
}
/**
@@ -1056,8 +1039,7 @@
* @return segment containing row key or <code>null</code>
*/
protected String extractKeySegment(FacesContext context, String tailId) {
- int indexOfSecondColon = tailId.indexOf(
- NamingContainer.SEPARATOR_CHAR);
+ int indexOfSecondColon = tailId.indexOf(NamingContainer.SEPARATOR_CHAR);
return (indexOfSecondColon > 0 ? tailId.substring(0, indexOfSecondColon) : null);
}
@@ -1103,7 +1085,7 @@
}
}
} else {
- String baseId = baseClientId+NamingContainer.SEPARATOR_CHAR;
+ String baseId = baseClientId + NamingContainer.SEPARATOR_CHAR;
if (clientId.startsWith(baseId)) {
Object newRowKey = null;
// Call for a child component - try to detect row key
@@ -1135,8 +1117,8 @@
}
}
}
- //
- return found;
+
+ return found;
}
/**
@@ -1356,15 +1338,13 @@
// Send event directly to parent, to avoid wrapping in superclass.
UIComponent parent = getParent();
if (parent == null) {
- throw new IllegalStateException(
- "No parent component for queue event");
+ throw new IllegalStateException("No parent component for queue event");
} else {
parent.queueEvent(event);
}
}
public void broadcast(FacesEvent event) throws AbortProcessingException {
-
if (!(event instanceof IndexedEvent)) {
if (!broadcastLocal(event)) {
super.broadcast(event);
@@ -1380,11 +1360,11 @@
Object eventRowKey = revent.getKey();
setRowKey(faces, eventRowKey);
FacesEvent rowEvent = revent.getTarget();
+
rowEvent.getComponent().broadcast(rowEvent);
+
setRowKey(faces, oldRowKey);
restoreOrigValue(faces);
- // }
- return;
}
/**
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/HeaderResourcesRendererBase.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -25,12 +25,9 @@
import java.util.LinkedHashSet;
import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.webapp.BaseFilter;
/**
* Base renderer for components used JavaScripts and Styles in header. In real
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -22,7 +22,6 @@
package org.ajax4jsf.renderkit;
import java.io.IOException;
-import java.util.Iterator;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
@@ -254,14 +253,10 @@
* @param component
* @throws IOException
*/
- public void renderChildren(FacesContext facesContext,
- UIComponent component) throws IOException {
- if (component.getChildCount() > 0) {
- for (Iterator<UIComponent> it = component.getChildren().iterator(); it.hasNext();) {
- UIComponent child = it.next();
- renderChild(facesContext, child);
- }
- }
+ public void renderChildren(FacesContext facesContext, UIComponent component) throws IOException {
+ for (UIComponent child : component.getChildren()) {
+ renderChild(facesContext, child);
+ }
}
Modified: trunk/samples/dataTableDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/samples/dataTableDemo/src/main/java/org/richfaces/Bean.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/samples/dataTableDemo/src/main/java/org/richfaces/Bean.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -31,7 +31,7 @@
*
*/
public class Bean {
- private List detail = new ArrayList();
+ private List<ChildBean> detail = new ArrayList<ChildBean>();
private String mounth;
@@ -50,14 +50,14 @@
/**
* @return the detail
*/
- public List getDetail() {
+ public List<ChildBean> getDetail() {
return this.detail;
}
/**
* @param detail the detail to set
*/
- public void setDetail(List detail) {
+ public void setDetail(List<ChildBean> detail) {
this.detail = detail;
}
Modified: trunk/samples/dataTableDemo/src/main/java/org/richfaces/Data.java
===================================================================
--- trunk/samples/dataTableDemo/src/main/java/org/richfaces/Data.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/samples/dataTableDemo/src/main/java/org/richfaces/Data.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -21,10 +21,7 @@
package org.richfaces;
-import java.text.DateFormat;
import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
@@ -33,9 +30,9 @@
private static final String[] mnames={"Jan","Feb","Mar","Apr","May"};
- private List mounths = new ArrayList();
+ private List<Bean> mounths = new ArrayList<Bean>();
- private List numbers = new ArrayList();
+ private List<Integer> numbers = new ArrayList<Integer>();
private boolean c3rendered=true;
@@ -62,20 +59,20 @@
/**
* @return the numbers
*/
- public List getNumbers() {
+ public List<Integer> getNumbers() {
return this.numbers;
}
/**
* @param numbers the numbers to set
*/
- public void setNumbers(List numbers) {
+ public void setNumbers(List<Integer> numbers) {
this.numbers = numbers;
}
public Data() {
Properties properties = System.getProperties();
- Enumeration keys = properties.keys();
+ Enumeration<?> keys = properties.keys();
for(int i=0;i<5;i++){
Bean bean = new Bean();
int l = (int)(Math.random()*5)+1;
@@ -99,14 +96,14 @@
/**
* @return the mounths
*/
- public List getMounths() {
+ public List<Bean> getMounths() {
return this.mounths;
}
/**
* @param mounths the mounths to set
*/
- public void setMounths(List mounths) {
+ public void setMounths(List<Bean> mounths) {
this.mounths = mounths;
}
Added: trunk/samples/dataTableDemo/src/main/webapp/pages/page_RF-6152.jsp
===================================================================
--- trunk/samples/dataTableDemo/src/main/webapp/pages/page_RF-6152.jsp (rev 0)
+++ trunk/samples/dataTableDemo/src/main/webapp/pages/page_RF-6152.jsp 2009-02-19 17:34:20 UTC (rev 12694)
@@ -0,0 +1,34 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/dataTable" prefix="data" %>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view >
+ <a4j:form>
+ <data:dataTable value="#{data.mounths}">
+ <data:column id="row1">
+ <f:facet name="header">
+ <h:outputText value="A"/>
+ </f:facet>
+ <h:outputText value="1"></h:outputText>
+ </data:column>
+ <data:column id="row3">
+ <f:facet name="header">
+ <h:outputText value="B"/>
+ </f:facet>
+ <h:outputText value="2"></h:outputText>
+ </data:column>
+ <data:columnGroup>
+ <data:column id="row2" colspan="2">
+ <h:outputText value="3"></h:outputText>
+ </data:column>
+ </data:columnGroup>
+ </data:dataTable>
+ </a4j:form>
+ </f:view>
+ </body>
+</html>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnsTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnsTest.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnsTest.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -77,6 +77,8 @@
}
+ private static final String CTRL_FORM = "_controls";
+
@Test
public void testSortingFeature(Template template) {
renderPage(SORTING_TEST_URL, template, RESET_METHOD);
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -27,7 +27,6 @@
import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import org.ajax4jsf.component.AjaxSupport;
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumnGroup.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumnGroup.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumnGroup.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -36,7 +36,6 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Colgroup";
- @SuppressWarnings("unchecked")
public Iterator<UIComponent> columns(){
return new ColumnsIterator(this);
}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -61,9 +61,7 @@
*
* @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#dataChildren()
*/
- @SuppressWarnings("unchecked")
public Iterator<UIComponent> dataChildren() {
-
return new DataIterator(this);
}
@@ -72,13 +70,10 @@
*
* @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#fixedChildren()
*/
- @SuppressWarnings("unchecked")
public Iterator<UIComponent> fixedChildren() {
-
return new FixedChildrenIterator(this);
}
- @SuppressWarnings("unchecked")
public Iterator<UIComponent> columns() {
return new ColumnsIterator(this);
}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -40,8 +40,8 @@
* @author shura
*
*/
-public abstract class AbstractRowsRenderer extends HeaderResourcesRendererBase implements
- DataVisitor {
+public abstract class AbstractRowsRenderer extends HeaderResourcesRendererBase
+ implements DataVisitor {
public static final String[][] TABLE_EVENT_ATTRS = {
{"onclick","onRowClick"},
@@ -54,23 +54,20 @@
};
- public static final String ROW_CLASS_KEY = AbstractRowsRenderer.class
- .getName()
- + ".rowClass";
+ public static final String ROW_CLASS_KEY =
+ AbstractRowsRenderer.class.getName() + ".rowClass";
- public static final String SKIN_ROW_CLASS_KEY = AbstractRowsRenderer.class
- .getName()
- + ".skinRowClass";
+ public static final String SKIN_ROW_CLASS_KEY =
+ AbstractRowsRenderer.class.getName() + ".skinRowClass";
- public static final String CELL_CLASS_KEY = AbstractRowsRenderer.class
- .getName()
- + ".cellClass";
+ public static final String CELL_CLASS_KEY =
+ AbstractRowsRenderer.class.getName() + ".cellClass";
- public static final String SKIN_CELL_CLASS_KEY = AbstractRowsRenderer.class
- .getName()
- + ".skinCellClass";
+ public static final String SKIN_CELL_CLASS_KEY =
+ AbstractRowsRenderer.class.getName() + ".skinCellClass";
- public static final String SKIN_FIRST_ROW_CLASS_KEY = AbstractRowsRenderer.class.getName()+".firstRowSkinClass";
+ public static final String SKIN_FIRST_ROW_CLASS_KEY =
+ AbstractRowsRenderer.class.getName() + ".firstRowSkinClass";
/*
* (non-Javadoc)
@@ -103,7 +100,9 @@
UIDataAdaptor table = (UIDataAdaptor) component;
Object key = table.getRowKey();
table.captureOrigValue(context);
+
table.walk(context, this, tableHolder);
+
doCleanup(context, tableHolder);
table.setRowKey(key);
table.restoreOrigValue(context);
@@ -140,28 +139,30 @@
public void encodeCaption(FacesContext context, SequenceDataAdaptor table)
throws IOException {
- ResponseWriter writer = context.getResponseWriter();
UIComponent caption = table.getFacet("caption");
- if (caption != null) {
- String captionClass = (String) table.getAttributes().get(
- "captionClass");
- String captionStyle = (String) table.getAttributes().get(
- "captionStyle");
- writer.startElement("caption", table);
- if (captionClass != null) {
- captionClass = "dr-table-caption rich-table-caption "
- + captionClass;
- } else {
- captionClass = "dr-table-caption rich-table-caption";
- }
- writer.writeAttribute("class", captionClass, "captionClass");
- if (captionStyle != null) {
- writer.writeAttribute("style", captionStyle, "captionStyle");
- }
- renderChild(context, caption);
- writer.endElement("caption");
+ if (caption == null) {
+ return;
}
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement("caption", table);
+
+ String captionClass = (String) table.getAttributes().get("captionClass");
+ if (captionClass != null) {
+ captionClass = "dr-table-caption rich-table-caption " + captionClass;
+ } else {
+ captionClass = "dr-table-caption rich-table-caption";
+ }
+ writer.writeAttribute("class", captionClass, "captionClass");
+
+ String captionStyle = (String) table.getAttributes().get("captionStyle");
+ if (captionStyle != null) {
+ writer.writeAttribute("style", captionStyle, "captionStyle");
+ }
+
+ renderChild(context, caption);
+
+ writer.endElement("caption");
}
/**
@@ -210,8 +211,7 @@
styleClass.append(custom);
}
if (styleClass.length() > 0) {
- writer.writeAttribute(HTML.class_ATTRIBUTE, styleClass,
- "styleClass");
+ writer.writeAttribute(HTML.class_ATTRIBUTE, styleClass, "styleClass");
}
}
protected void encodeStyle(ResponseWriter writer, Object parentPredefined,
@@ -231,8 +231,7 @@
style.append(custom);
}
if (style.length() > 0) {
- writer.writeAttribute("style", style,
- "style");
+ writer.writeAttribute("style", style, "style");
}
}
@@ -255,7 +254,8 @@
protected void encodeCellChildren(FacesContext context, UIComponent cell,
String skinFirstRowClass, String skinRowClass, String rowClass,
String skinCellClass, String cellClass) throws IOException {
- Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
// Save top level class parameters ( if any ), and put new for this
// component
Object savedRowClass = requestMap.get(ROW_CLASS_KEY);
@@ -282,7 +282,9 @@
requestMap.put(SKIN_CELL_CLASS_KEY, skinCellClass);
}
+
renderChild(context, cell);
+
// Restore original values.
requestMap.put(ROW_CLASS_KEY, savedRowClass);
requestMap.put(CELL_CLASS_KEY, savedCellClass);
@@ -299,12 +301,15 @@
encodeStyleClass(writer, null, skinFirstRowClass, footerClass, null);
writer.startElement(element, footer);
encodeStyleClass(writer, null, skinCellClass, footerClass, null);
- if (columns>0) {
+ if (columns > 0) {
writer.writeAttribute("colspan", String.valueOf(columns), null);
}
writer.writeAttribute("scope", "colgroup", null);
}
- encodeCellChildren(context, footer,skinFirstRowClass,skinRowClass, footerClass, skinCellClass, null);
+
+ encodeCellChildren(context, footer, skinFirstRowClass, skinRowClass,
+ footerClass, skinCellClass, null);
+
if (!isColgroup) {
writer.endElement(element);
writer.endElement("tr");
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2009-02-19 17:08:56 UTC (rev 12693)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2009-02-19 17:34:20 UTC (rev 12694)
@@ -129,20 +129,21 @@
*/
public void encodeTableStructure(FacesContext context, UIDataTable table)
throws IOException {
- ResponseWriter writer = context.getResponseWriter();
+
Object key = table.getRowKey();
table.captureOrigValue(context);
table.setRowKey(context, null);
+
encodeCaption(context, table);
- int columns = getColumnsCount(table);
+
// Encode colgroup definition.
+ ResponseWriter writer = context.getResponseWriter();
writer.startElement("colgroup", table);
+ int columns = getColumnsCount(table);
writer.writeAttribute("span", String.valueOf(columns), null);
String columnsWidth = (String) table.getAttributes().get("columnsWidth");
-
if (null != columnsWidth) {
-
String[] widths = columnsWidth.split(",");
for (int i = 0; i < widths.length; i++) {
writer.startElement("col", table);
@@ -151,26 +152,26 @@
}
}
writer.endElement("colgroup");
+
encodeHeader(context, table, columns);
encodeFooter(context, table, columns);
+
table.setRowKey(context,key);
table.restoreOrigValue(context);
}
public void encodeHeader(FacesContext context, UIDataTable table,
int numberOfColumns) throws IOException {
- ResponseWriter writer = context.getResponseWriter();
+
UIComponent header = table.getHeader();
boolean columnFacetPresent = isColumnFacetPresent(table, "header");
boolean isFilterByPresent = isHeaderFactoryColumnAttributePresent(table, "filterBy");
- Iterator<UIComponent> colums = table.columns();
-
-
if (header != null || columnFacetPresent || isFilterByPresent) {
+
+ ResponseWriter writer = context.getResponseWriter();
writer.startElement("thead", table);
writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-table-thead", null);
- String headerClass = (String) table.getAttributes().get(
- "headerClass");
+ String headerClass = (String) table.getAttributes().get("headerClass");
if (header != null) {
encodeTableHeaderFacet(context, numberOfColumns, writer, header,
"dr-table-header rich-table-header",
@@ -184,7 +185,8 @@
encodeStyleClass(writer, null,
"dr-table-subheader rich-table-subheader", null,
headerClass);
- encodeHeaderFacets(context, writer, colums,
+
+ encodeHeaderFacets(context, writer, table.columns(),
"dr-table-subheadercell rich-table-subheadercell",
headerClass, "header", "th", numberOfColumns);
@@ -218,33 +220,33 @@
* @param attributeName - attribute name
* @return true if specified attribute should generate header on the table
*/
- public boolean isHeaderFactoryColumnAttributePresent(UIDataTable table, String attributeName) {
- Iterator<UIComponent> columns = table.columns();
- boolean result = false;
+ public boolean isHeaderFactoryColumnAttributePresent(UIDataTable table,
+ String attributeName) {
+ Iterator<UIComponent> columns = table.columns();
+ boolean result = false;
+
+ while (columns.hasNext() && !result) {
+ UIComponent column = columns.next();
+ if (isColumnRendered(column)) {
+ if (null != column.getValueExpression(attributeName)) {
+ result = true;
+ }
+ }
+ }
+ return result;
+ }
- while (columns.hasNext() && !result) {
- UIComponent column = columns.next();
- if (isColumnRendered(column)) {
- if (null != column.getValueExpression(attributeName)) {
- result = true;
- }
- }
- }
- return result;
- }
-
/**
* @param component
* @return
*/
protected boolean isColumnRendered(UIComponent component) {
- boolean rendered = true;
try {
- rendered = component.isRendered();
+ return component.isRendered();
} catch(Exception e){
// DO nothing, rendered binded to row variable;
}
- return rendered;
+ return true;
}
protected void encodeHeaderFacets(FacesContext context,
@@ -258,46 +260,45 @@
while (headers.hasNext()) {
UIComponent column = (UIComponent) headers.next();
- if (isColumnRendered(column)) {
+ if (!isColumnRendered(column)) {
+ continue;
+ }
- Integer colspan = (Integer) column.getAttributes().get("colspan");
- if (colspan != null) {
- t_colCount += colspan.intValue();
- } else {
- t_colCount++;
- }
-
- if (t_colCount > colCount) {
- break;
- }
+ Integer colspan = (Integer) column.getAttributes().get("colspan");
+ if (colspan != null && colspan.intValue() > 0) {
+ t_colCount += colspan.intValue();
+ } else {
+ t_colCount++;
+ }
+
+ if (t_colCount > colCount) {
+ break;
+ }
- String classAttribute = facetName + "Class";
- String columnHeaderClass = (String) column.getAttributes().get(classAttribute);
-
- writer.startElement(element, column);
- encodeStyleClass(writer, null, skinCellClass, headerClass, columnHeaderClass);
- writer.writeAttribute("scope", "col", null);
- getUtils().encodeAttribute(context, column, "colspan");
+ String classAttribute = facetName + "Class";
+ String columnHeaderClass = (String) column.getAttributes().get(classAttribute);
+
+ writer.startElement(element, column);
+ encodeStyleClass(writer, null, skinCellClass, headerClass, columnHeaderClass);
+ writer.writeAttribute("scope", "col", null);
+ getUtils().encodeAttribute(context, column, "colspan");
- boolean sortableColumn = column.getValueExpression("comparator") != null
- || column.getValueExpression("sortBy") != null;
+ boolean sortableColumn = column.getValueExpression("comparator") != null
+ || column.getValueExpression("sortBy") != null;
- HeaderEncodeStrategy strategy = (column instanceof org.richfaces.component.UIColumn
- && "header".equals(facetName)) ? richEncodeStrategy : simpleEncodeStrategy;
+ HeaderEncodeStrategy strategy = (column instanceof org.richfaces.component.UIColumn
+ && "header".equals(facetName)) ? richEncodeStrategy : simpleEncodeStrategy;
- strategy.encodeBegin(context, writer, column, facetName, sortableColumn);
+ strategy.encodeBegin(context, writer, column, facetName, sortableColumn);
- UIComponent facet = column.getFacet(facetName);
- if (facet != null && isColumnRendered(facet)) {
- renderChild(context, facet);
- }
-
- strategy.encodeEnd(context, writer, column, facetName, sortableColumn);
-
- writer.endElement(element);
-
+ UIComponent facet = column.getFacet(facetName);
+ if (facet != null && isColumnRendered(facet)) {
+ renderChild(context, facet);
}
+ strategy.encodeEnd(context, writer, column, facetName, sortableColumn);
+
+ writer.endElement(element);
}
}
@@ -475,8 +476,7 @@
count = currentLength;
}
// Calculate number of columns in row.
- currentLength = calculateRowColumns(((Row) column)
- .columns());
+ currentLength = calculateRowColumns(((Row) column).columns());
// Store max calculated value
if (currentLength > count) {
count = currentLength;
@@ -491,11 +491,9 @@
}
currentLength = 0;
}
- Integer colspan = (Integer) column.getAttributes().get(
- "colspan");
+ Integer colspan = (Integer) column.getAttributes().get("colspan");
// Append colspan of this column
- if (null != colspan
- && colspan.intValue() != Integer.MIN_VALUE) {
+ if (null != colspan && colspan.intValue() != Integer.MIN_VALUE) {
currentLength += colspan.intValue();
} else {
currentLength++;
@@ -504,7 +502,6 @@
// UIColumn always have colspan == 1.
currentLength++;
}
-
}
}
if (currentLength > count) {
@@ -641,14 +638,14 @@
@SuppressWarnings("unchecked")
Map<String, Object> parameters =
- (Map<String, Object>) eventOptions.get("parameters");
+ (Map<String, Object>) eventOptions.get("parameters");
-
parameters.put(id, SORT_FILTER_PARAMETER);
if (sortable) {
parameters.put(SORT_FILTER_PARAMETER, column.getClientId(context));
}
ajaxFunction.addParameter(eventOptions);
+
StringBuffer buffer = new StringBuffer();
ajaxFunction.appendScript(buffer);
@@ -757,16 +754,11 @@
if (imageUrl != null) {
writer.startElement(HTML.IMG_ELEMENT, column);
- writer.writeAttribute(HTML.src_ATTRIBUTE, imageUrl,
- null);
- writer.writeAttribute(HTML.alt_ATTRIBUTE, " ",
- null);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, imageUrl, null);
+ writer.writeAttribute(HTML.alt_ATTRIBUTE, " ", null);
writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
- writer
- .writeAttribute(HTML.height_ATTRIBUTE, "15",
- null);
- writer.writeAttribute(HTML.class_ATTRIBUTE,
- "dr-table-header-sort-img rich-sort-icon", null);
+ writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-table-header-sort-img rich-sort-icon", null);
writer.endElement(HTML.IMG_ELEMENT);
}
writer.endElement(HTML.SPAN_ELEM);
15 years, 10 months