JBoss Rich Faces SVN: r12693 - 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-19 12:08:56 -0500 (Thu, 19 Feb 2009)
New Revision: 12693
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/columnsAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColumnsFiltering.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testValueAttribute.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnsBean.java
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-19 15:31:37 UTC (rev 12692)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColumnsBean.java 2009-02-19 17:08:56 UTC (rev 12693)
@@ -20,6 +20,7 @@
public class Column {
String header;
Ordering ordering;
+ Object filterValue;
public Column(String header) {
super();
@@ -29,6 +30,12 @@
public void listener(ActionEvent event) {
setStatus(getStatus() + "ActionListener" + columns.indexOf(this));
}
+
+ public boolean filterMethod(Object o) {
+ Row [] rows = (Row[])o;
+ int i = columns.indexOf(this);
+ return rows[i].value == i;
+ }
public String getHeader() {
return header;
@@ -44,6 +51,15 @@
public void setOrdering(Ordering ordering) {
this.ordering = ordering;
}
+
+ public Object getFilterValue() {
+ return filterValue;
+ }
+
+ public void setFilterValue(Object filterValue) {
+ this.filterValue = filterValue;
+ }
+
}
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/columnsAutoTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/columnsAutoTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/columnsAutoTest.xhtml 2009-02-19 17:08:56 UTC (rev 12693)
@@ -0,0 +1,34 @@
+<!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.autoTestTemplate}">
+ <ui:define name="component">
+ <rich:dataTable id="table" value="#{columnsBean.model}" var="row" width="750">
+ <rich:columns value="#{columnsBean.columns}" var="column"
+ onclick="EventQueue.fire('onclick')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseup="EventQueue.fire('onmouseup')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ title="title"
+ style="color: green"
+ styleClass="columnClass"
+ index="index">
+ <f:facet name="header">
+ <h:outputText value="#{column.header}"></h:outputText>
+ </f:facet>
+ <h:outputText value="#{row[index].value}"></h:outputText>
+ </rich:columns>
+ </rich:dataTable>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColumnsFiltering.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColumnsFiltering.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testColumnsFiltering.xhtml 2009-02-19 17:08:56 UTC (rev 12693)
@@ -0,0 +1,51 @@
+<!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">
+ <rich:columns id="c#{index}" value="#{columnsBean.columns}" var="column"
+ index="index" filterBy="#{row[index].value}" filterValue="#{column.filterValue}">
+ <f:facet name="header" filterEvent="onkeyup">
+ <h:outputText value="#{column.filterValue}"></h:outputText>
+ </f:facet>
+ <h:outputText value="#{row[index].value}" />
+ </rich:columns>
+ </rich:dataTable><br/>
+
+ <rich:dataTable id="table2" value="#{columnsBean.model}" var="row">
+ <f:facet name="header">
+ <rich:column colspan="2">
+ <h:outputText value="Test Filter Method"></h:outputText>
+ </rich:column>
+ </f:facet>
+ <rich:columns id="c#{index}" value="#{columnsBean.columns}" var="column"
+ index="index" filterMethod="#{column.filterMethod}">
+ <h:outputText value="#{row[index].value}" />
+ </rich:columns>
+ </rich:dataTable><br/>
+
+ <rich:dataTable id="table3" value="#{columnsBean.model}" var="row">
+ <f:facet name="header">
+ <rich:column colspan="2">
+ <h:outputText value="Test Filter Expression"></h:outputText>
+ </rich:column>
+ </f:facet>
+ <rich:columns id="c#{index}" value="#{columnsBean.columns}" var="column"
+ index="index" filterExpression="#{(row[index].value-1) == index}">
+ <h:outputText value="#{row[index].value}" />
+ </rich:columns>
+ </rich:dataTable><br/>
+
+ <h:commandButton id="submit" value="Submit"></h:commandButton>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testValueAttribute.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testValueAttribute.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/columns/testValueAttribute.xhtml 2009-02-19 17:08:56 UTC (rev 12693)
@@ -0,0 +1,25 @@
+<!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">
+ <rich:columns id="c#{index}" value="Header0,Header1,Header2" var="column"
+ index="index">
+ <f:facet name="header">
+ <h:outputText value="#{column}"></h:outputText>
+ </f:facet>
+ <h:outputText value="#{row[index].value}" />
+ </rich:columns>
+ </rich:dataTable><br/>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
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 15:31:37 UTC (rev 12692)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColumnsTest.java 2009-02-19 17:08:56 UTC (rev 12693)
@@ -23,6 +23,8 @@
import java.util.Arrays;
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
import org.richfaces.model.Ordering;
import org.testng.Assert;
@@ -33,6 +35,46 @@
static final String RESET_METHOD = "#{columnsBean.reset}";
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";
+
+ enum FEATURE {
+ SORTING,
+ FILTERING
+ }
+
+ static final String [] COLUMNS_CLASSSES = new String [] {"dr-table-cell", "rich-table-cell", "columnClass"};
+
+ @Test
+ public void testStylesClassesAndStandardHTMLAttributes(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+
+ String tableId = tester.getClientId("table");
+ String columnPath = "//table[@id='"+tableId+"']/tbody/tr/td[1]";
+
+ assertEvents(columnPath, SeleniumEvent.STANDARD_HTML_EVENTS);
+ assertAttributeContains(columnPath, "class", "columnClass", "StyleClass attribute was not output to client");
+ assertClassNames(columnPath, COLUMNS_CLASSSES, "Columns have unexpected css classes", false);
+ assertStyleAttributeContains(columnPath, "color: green", "Style attribute was not output to client");
+ assertAttributeContains(columnPath, "title", "title", "Title attribute was not output to client");
+ }
+
+ @Test
+ public void testValueAttribute(Template template) {
+ renderPage(VALUE_ATTRIBUTE_TEST_URL, template, RESET_METHOD);
+
+ final int columnsCount = 3;
+
+ String tableId = getParentId() + "_form:table";
+ assertColumnsCount(columnsCount, tableId, "Strign value attribute was not applied properly. Table should have 3 columns");
+
+ for (int i = 0; i < columnsCount; i++) {
+ AssertTextEquals("//table[@id='"+tableId+"']/thead/tr/th["+(i+1)+"]", "Header" + i, "Var was not initialized properly");
+ checkColumnsData(tableId, i, new String[] {String.valueOf(i), String.valueOf(i+1)}, null, "");
+ }
+
+ }
@Test
@@ -49,8 +91,56 @@
}
-
-
+ @Test
+ public void testFilteringFeature(Template template) {
+ renderPage(FILTERING_TEST_URL, template, RESET_METHOD);
+
+ // Check filterBy attribute ----------->>>>>>
+
+ String tableId = getParentId() + "_form:table";
+ String filterInputPath = "//table[@id='"+tableId+"']/thead/tr/th[1]/*/input";
+ final int columnsCount = 3;
+
+ // Filter by the first column with '0' filter value
+ selenium.type(filterInputPath, "0");
+ waitForAjaxCompletion();
+
+ for (int i = 0; i < columnsCount; i++) {
+ checkColumnsData(tableId, i, new String [] {String.valueOf(i)}, FEATURE.FILTERING, "Filterby does snot work.");
+ }
+ AssertTextEquals("//table[@id='"+tableId+"']/thead/tr/th[1]", "0", "Filter value attribute does not work. Binding value was not changed.");
+
+ // Filter by the third column with '3' filter value
+ selenium.type(filterInputPath, "");
+ waitForAjaxCompletion();
+
+ filterInputPath = "//table[@id='"+tableId+"']/thead/tr/th[3]/*/input";
+ selenium.type(filterInputPath, "3");
+ waitForAjaxCompletion();
+
+ for (int i = 0; i < columnsCount; i++) {
+ checkColumnsData(tableId, i, new String [] {String.valueOf(i + 1)}, FEATURE.FILTERING, "Filterby does snot work.");
+ }
+ AssertTextEquals("//table[@id='"+tableId+"']/thead/tr/th[3]", "3", "Filter value attribute does not work. Binding value was not changed.");
+
+ //<<<----------------
+
+ // Test filter method attribute
+
+ tableId = getParentId() + "_form:table2";
+ for (int i = 0; i < columnsCount; i++) {
+ checkColumnsData(tableId, i, new String [] {String.valueOf(i)}, FEATURE.FILTERING, "FilterMethod does not work.");
+ }
+
+ // Test filter expression attribute
+ tableId = getParentId() + "_form:table3";
+ for (int i = 0; i < columnsCount; i++) {
+ checkColumnsData(tableId, i, new String [] {String.valueOf(i + 1)}, FEATURE.FILTERING, "FilterExpression does not work.");
+ }
+
+ }
+
+
@Test
public void testOutputAndNestedInputsAndCommands(Template template) {
renderPage(template, RESET_METHOD);
@@ -131,7 +221,7 @@
}
}
- private void checkSorting (String tableId, int col, String [] expected) {
+ private void checkColumnsData (String tableId, int col, String [] expected, FEATURE feature, String message) {
int l = expected.length;
String [] values = new String [l];
for (int i = 0; i < l; i++) {
@@ -140,7 +230,7 @@
for (int i = 0; i < l; i++) {
if (!expected[i].equals(values[i])) {
- Assert.fail("Column number [" + col + "] was sorted unexpected. Column's value should be: " + Arrays.toString(expected) + ". But was: " + Arrays.toString(values));
+ Assert.fail(message + "Column number [" + col + "] was "+(feature != null ? ((feature == FEATURE.SORTING) ? "sorted" : "filtered") : "")+" unexpectedly. Column's value should be: " + Arrays.toString(expected) + ". But was: " + Arrays.toString(values));
}
}
}
@@ -158,19 +248,20 @@
}
private void testOrdering(String tableId, int cols) {
+ final String message = "SortBy does not work.";
for (int i=0; i<cols; i++) {
clickSort(tableId, i);
- checkSorting(tableId, 0, new String [] {"0", "1"});
- checkSorting(tableId, 1, new String [] {"1", "2"});
- checkSorting(tableId, 2, new String [] {"2", "3"});
+ checkColumnsData(tableId, 0, new String [] {"0", "1"}, FEATURE.SORTING, message);
+ checkColumnsData(tableId, 1, new String [] {"1", "2"}, FEATURE.SORTING, message);
+ checkColumnsData(tableId, 2, new String [] {"2", "3"}, FEATURE.SORTING, message);
checkSortOrderAttribute(tableId, i, Ordering.ASCENDING);
clickSort(tableId, i);
- checkSorting(tableId, 0, new String [] {"1", "0"});
- checkSorting(tableId, 1, new String [] {"2", "1"});
- checkSorting(tableId, 2, new String [] {"3", "2"});
+ checkColumnsData(tableId, 0, new String [] {"1", "0"}, FEATURE.SORTING, message);
+ checkColumnsData(tableId, 1, new String [] {"2", "1"}, FEATURE.SORTING, message);
+ checkColumnsData(tableId, 2, new String [] {"3", "2"}, FEATURE.SORTING, message);
checkSortOrderAttribute(tableId, i, Ordering.DESCENDING);
}
@@ -181,5 +272,10 @@
public String getTestUrl() {
return "pages/columns/columnsTest.xhtml";
}
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/columns/columnsAutoTest.xhtml";
+ }
}
15 years, 10 months
JBoss Rich Faces SVN: r12692 - trunk/docs/userguide/en/src/main/docbook.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2009-02-19 10:31:37 -0500 (Thu, 19 Feb 2009)
New Revision: 12692
Modified:
trunk/docs/userguide/en/src/main/docbook/master.xml
Log:
components TOC is reordered alphabetically, editor is placed in the right order
Modified: trunk/docs/userguide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/master.xml 2009-02-19 14:03:27 UTC (rev 12691)
+++ trunk/docs/userguide/en/src/main/docbook/master.xml 2009-02-19 15:31:37 UTC (rev 12692)
@@ -108,9 +108,9 @@
&contextMenu_table;
&dataFilterSlider_table;
&dataScroller_table;
-&editor_table;
&columns_table;
&dataTable_table;
+&editor_table;
&dnd_table;
&dropDownMenu_table;
&extendedDataTable_table;
15 years, 10 months
JBoss Rich Faces SVN: r12691 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-02-19 09:03:27 -0500 (Thu, 19 Feb 2009)
New Revision: 12691
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/ajaxHTMLLinkAutoTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
Log:
RF-6203, RF-6204, RF-6205, RF-6206, RF-6208
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/ajaxHTMLLinkAutoTest.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/ajaxHTMLLinkAutoTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
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-18 23:47:10 UTC (rev 12690)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-02-19 14:03:27 UTC (rev 12691)
@@ -331,6 +331,62 @@
}
//
+// ActionSource test methods
+//
+
+ public void testAS() {
+ reset();
+ clickLoad();
+
+ base.sendAction();
+
+ checkActionListener(true);
+ checkNestedActionListener(true);
+ checkNavigation(true);
+ checkUpdateModel(true);
+ }
+
+ public void testASImmediate() {
+ reset();
+ setupControl(TestSetupEntry.immediate, Boolean.TRUE);
+ clickLoad();
+
+ base.sendAction();
+
+ checkActionListener(true);
+ checkNestedActionListener(true);
+ checkNavigation(true);
+ checkUpdateModel(false);
+ }
+
+ public void testASImmediateWithExternalValidationFailed() {
+ reset();
+ setupControl(TestSetupEntry.immediate, Boolean.TRUE);
+ clickLoad();
+
+ setExtrenalValidationFailed();
+ base.sendAction();
+
+ checkActionListener(true);
+ checkNestedActionListener(true);
+ checkNavigation(true);
+ checkUpdateModel(false);
+ }
+
+ public void testASExtrenalValidationFailure() {
+ reset();
+ clickLoad();
+
+ setExtrenalValidationFailed();
+ base.sendAction();
+
+ checkActionListener(false);
+ checkNestedActionListener(false);
+ checkNavigation(false);
+ checkUpdateModel(false);
+ }
+
+//
// EditableValueHolder test methods
//
@@ -604,11 +660,15 @@
}
public void checkNavigation(boolean passed) {
- if (!"Navigation successfully".equals(base.getTextById("_auto_test_navigation"))) {
- Assert.fail("Navigation has not been occurred");
- }
+ boolean isNavigated = base.isPresent("_auto_test_navigation")
+ && "Navigation successfully".equals(base.getTextById("_auto_test_navigation"));
+ if (passed && !isNavigated) {
+ Assert.fail("Navigation has not been occurred");
+ } else if (!passed && isNavigated) {
+ Assert.fail("Navigation would not have been occurred");
+ }
}
-
+
public void checkProcessInputChangeListener(boolean passed) {
String status = getStatus();
if (passed && status != null && status.indexOf(AutoTestBean.PROCESS_INPUT_CHANGE_LISTENER) == -1) {
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2009-02-18 23:47:10 UTC (rev 12690)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2009-02-19 14:03:27 UTC (rev 12691)
@@ -1234,7 +1234,16 @@
*/
public void sendAjax() {
}
-
+
+ /**
+ * Control action that should force ActionSource component to produce an action event (as a rule - a full form submit)
+ * This method should wait for full submit completion
+ * Used for auto testing only
+ */
+ public void sendAction() {
+ throw new UnsupportedOperationException("This method has always to be overridden before usage");
+ }
+
/**
* Control action that should force ajax request that navigate to other page.
* This method should NOT wait for ajax completion
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-18 23:47:10 UTC (rev 12690)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-19 14:03:27 UTC (rev 12691)
@@ -17,10 +17,11 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+ */
package org.richfaces.testng;
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.annotations.Test;
@@ -60,14 +61,60 @@
assertActionInvoked(true);
assertListenerInvoked(true);
-// linkId = parentId + "l1";
-// writeStatus("Click link 1");
-// clickCommandAndWait(linkId);
-// assertValueSubmitted(true);
-// assertActionInvoked(true);
-// assertListenerInvoked(true);
+ // linkId = parentId + "l1";
+ // writeStatus("Click link 1");
+ // clickCommandAndWait(linkId);
+ // assertValueSubmitted(true);
+ // assertActionInvoked(true);
+ // assertListenerInvoked(true);
}
+ @Test
+ public void testComponentDesignMode(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Check action and actionListener defined as component attributes and actionListener defined as nested tag are invoked");
+ writeStatus(" on the server after button is pressed, navigation occurs");
+ tester.testAS();
+ }
+
+ @Test
+ public void testImmediate(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test immediate attribute");
+ tester.testASImmediate();
+ }
+
+ @Test
+ public void testImmediateWithExternalValidationFailed(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test immediate attribute with external validation failed");
+ tester.testASImmediateWithExternalValidationFailed();
+ }
+
+ @Test
+ public void testWithExternalValidationFailure(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ writeStatus("Check component in case of external validation failure: listeners and navigation does not work");
+ autoTester.testASExtrenalValidationFailure();
+ }
+
+ @Test
+ public void testRenderedAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test component with rendered = false is not present on the page");
+ tester.testRendered();
+ }
+
+ @Override
+ public void sendAction() {
+ clickCommandAndWait(getAutoTester(this).getClientId(AutoTester.COMPONENT_ID));
+ }
+
private void assertValueSubmitted(boolean submitted) {
if (submitted) {
writeStatus("Check that a new value is submitted");
@@ -79,7 +126,7 @@
}
private void assertActionInvoked(boolean invoked) {
- if(invoked) {
+ if (invoked) {
writeStatus("Check that action is invoked");
AssertTextEquals(getParentId() + IS_ACTION_INVOKED, "true", "An action is not invoked");
} else {
@@ -89,7 +136,7 @@
}
private void assertListenerInvoked(boolean invoked) {
- if(invoked) {
+ if (invoked) {
writeStatus("Check that listener is invoked");
AssertTextEquals(getParentId() + IS_LISTENER_INVOKED, "true", "A listener is not invoked");
} else {
@@ -103,4 +150,9 @@
return "pages/ajaxHTMLCommandLink/ajaxHTMLLinkTest.xhtml";
}
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/ajaxHTMLCommandLink/ajaxHTMLLinkAutoTest.xhtml";
+ }
+
}
15 years, 10 months
JBoss Rich Faces SVN: r12690 - in trunk: framework/impl/src/main/java/org/ajax4jsf/renderkit and 26 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-02-18 18:47:10 -0500 (Wed, 18 Feb 2009)
New Revision: 12690
Added:
trunk/samples/seamIntegration/src/main/webapp/WEB-INF/lib/
trunk/sandbox/ui/layout/
trunk/sandbox/ui/layout/pom.xml
trunk/sandbox/ui/layout/src/
trunk/sandbox/ui/layout/src/main/
trunk/sandbox/ui/layout/src/main/config/
trunk/sandbox/ui/layout/src/main/config/component/
trunk/sandbox/ui/layout/src/main/config/component/layoutPanel.xml
trunk/sandbox/ui/layout/src/main/config/component/page.xml
trunk/sandbox/ui/layout/src/main/java/
trunk/sandbox/ui/layout/src/main/java/org/
trunk/sandbox/ui/layout/src/main/java/org/richfaces/
trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/
trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UILayoutPanel.java
trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UIPage.java
trunk/sandbox/ui/layout/src/main/java/org/richfaces/renderkit/
trunk/sandbox/ui/layout/src/main/java/org/richfaces/renderkit/html/
trunk/sandbox/ui/layout/src/main/java/org/richfaces/renderkit/html/HtmlPageRenderer.java
trunk/sandbox/ui/layout/src/main/resources/
trunk/sandbox/ui/layout/src/main/templates/
trunk/sandbox/ui/layout/src/main/templates/org/
trunk/sandbox/ui/layout/src/main/templates/org/richfaces/
trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlLayoutPanel.jspx
trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlPage.jspx
trunk/sandbox/ui/layout/src/test/
trunk/sandbox/ui/layout/src/test/java/
trunk/sandbox/ui/layout/src/test/java/org/
trunk/sandbox/ui/layout/src/test/java/org/richfaces/
trunk/test-applications/realworld/upload.tgz
Removed:
trunk/DEADJOE
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/AbstractFacesTest.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java
trunk/samples/seamIntegration/pom.xml
trunk/samples/seamIntegration/profiles.xml
trunk/sandbox/ui/pom.xml
trunk/test-applications/ajaxTest/pom.xml
trunk/test-applications/ajaxTest/src/test/java/org/richfaces/RepeaterTest.java
trunk/test-applications/ajaxTest/src/test/resources/org/richfaces/logging.properties
Log:
https://jira.jboss.org/jira/browse/RF-6010 fixed.
Layout components project have been created in the sandbox
Fixed default viewroot locale in the jsf-test.
Deleted: trunk/DEADJOE
===================================================================
--- trunk/DEADJOE 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/DEADJOE 2009-02-18 23:47:10 UTC (rev 12690)
@@ -1,16 +0,0 @@
-
-*** These modified files were found in JOE when it aborted on Wed Oct 31 15:45:33 2007
-*** JOE was aborted because the terminal closed
-
-*** File '(Unnamed)'
-/home/asmirnov/.bash_profile
-deployRelease.sh
-./ui/drag-drop/pom.xml
-./samples/ajaxPortlet/pom.xml
-./cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/pom.xml
-./framework/impl/pom.xml
-framework/impl/src/main/java/org/richfaces/VersionBean.java
-ui/paint2D/src/org/richfaces/renderkit/html/Paint2DResource.java
-ui/paint2D/src/main/java/org/richfaces/renderkit/html/Paint2DResource.java
-pom.xml
-/home/asmirnov/work/jboss-4.2.0.GA-src/build/output/jboss-4.2.0.GA/server/default/conf/jboss-log4j.xml
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxChildrenRenderer.java 2009-02-18 23:47:10 UTC (rev 12690)
@@ -142,8 +142,7 @@
}
if (!found) {
- if (component instanceof AjaxChildrenEncoder
- && (!limitToList)) {
+ if (component instanceof AjaxChildrenEncoder) {
((AjaxChildrenEncoder) component).encodeAjaxChild(context,
currentPath, ids, renderedAreas);
} else {
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/AbstractFacesTest.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/AbstractFacesTest.java 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/AbstractFacesTest.java 2009-02-18 23:47:10 UTC (rev 12690)
@@ -3,10 +3,13 @@
*/
package org.richfaces.test;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.EventListener;
+import java.util.Locale;
+import java.util.Properties;
import java.util.logging.LogManager;
import javax.faces.FactoryFinder;
@@ -19,6 +22,7 @@
import javax.faces.context.FacesContextFactory;
import javax.faces.lifecycle.Lifecycle;
import javax.faces.lifecycle.LifecycleFactory;
+import javax.faces.render.RenderKitFactory;
import javax.faces.webapp.FacesServlet;
import javax.servlet.Filter;
@@ -212,9 +216,31 @@
/**
* This template method called from the {@link #setUp()} to populate virtual server content.
- * The default implementation do nothing.
+ * The default implementation tries to load web content from directory pointed by the System property
+ * "webroot" or same property from the "/webapp.properties" file.
*/
protected void setupWebContent() {
+ String webappDirectory = System.getProperty("webroot");
+ File webFile = null;
+ if (null == webappDirectory) {
+ URL resource = this.getClass().getResource("/webapp.properties");
+ if (null != resource && "file".equals(resource.getProtocol())) {
+ Properties webProperties = new Properties();
+ try {
+ InputStream inputStream = resource.openStream();
+ webProperties.load(inputStream);
+ inputStream.close();
+ webFile = new File(resource.getPath());
+ webFile = new File(webFile.getParentFile(), webProperties.getProperty("webroot")).getAbsoluteFile();
+ facesServer.addResourcesFromDirectory("/", webFile);
+ } catch (IOException e) {
+ throw new TestException(e);
+ }
+ }
+ } else {
+ webFile = new File(webappDirectory);
+ facesServer.addResourcesFromDirectory("/", webFile);
+ }
}
@@ -252,6 +278,8 @@
protected UIViewRoot setupView() {
UIViewRoot viewRoot = (UIViewRoot) application.createComponent(UIViewRoot.COMPONENT_TYPE);
viewRoot.setViewId("/test.xhtml");
+ viewRoot.setLocale(Locale.getDefault());
+ viewRoot.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
return viewRoot;
}
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java 2009-02-18 23:47:10 UTC (rev 12690)
@@ -473,11 +473,15 @@
if (!file.isDirectory()) {
file = file.getParentFile();
}
+ if(file.exists()){
try {
addFiles(baseDirectory, file);
} catch (MalformedURLException e) {
throw new TestException(e);
}
+ } else {
+ throw new TestException("Base webapp directory ["+file.getPath()+"] does not exist");
+ }
}
/**
Modified: trunk/samples/seamIntegration/pom.xml
===================================================================
--- trunk/samples/seamIntegration/pom.xml 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/samples/seamIntegration/pom.xml 2009-02-18 23:47:10 UTC (rev 12690)
@@ -13,7 +13,7 @@
<packaging>war</packaging>
<name>seamIntegration Maven Webapp</name>
<properties>
- <seam.version>2.1.1-SNAPSHOT</seam.version>
+ <seam.version>2.1.2-SNAPSHOT</seam.version>
</properties>
<build>
<finalName>seamIntegration</finalName>
Modified: trunk/samples/seamIntegration/profiles.xml
===================================================================
--- trunk/samples/seamIntegration/profiles.xml 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/samples/seamIntegration/profiles.xml 2009-02-18 23:47:10 UTC (rev 12690)
@@ -19,8 +19,14 @@
<profile>
<id>seam-devel</id>
<properties>
- <seam.version>2.1.0-SNAPSHOT</seam.version>
+ <seam.version>2.1.2-SNAPSHOT</seam.version>
</properties>
</profile>
+ <profile>
+ <id>seam-stable</id>
+ <properties>
+ <seam.version>2.1.1.GA</seam.version>
+ </properties>
+ </profile>
</profiles>
</profilesXml>
\ No newline at end of file
Added: trunk/sandbox/ui/layout/pom.xml
===================================================================
--- trunk/sandbox/ui/layout/pom.xml (rev 0)
+++ trunk/sandbox/ui/layout/pom.xml 2009-02-18 23:47:10 UTC (rev 12690)
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>ui</artifactId>
+ <groupId>org.richfaces.sandbox</groupId>
+ <version>3.3.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>layout</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ <name>layout</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <shortName>layout</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>core</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
Property changes on: trunk/sandbox/ui/layout/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/sandbox/ui/layout/src/main/config/component/layoutPanel.xml
===================================================================
--- trunk/sandbox/ui/layout/src/main/config/component/layoutPanel.xml (rev 0)
+++ trunk/sandbox/ui/layout/src/main/config/component/layoutPanel.xml 2009-02-18 23:47:10 UTC (rev 12690)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://labs.jboss.com/jbossrichfaces/component-config.dtd">
+
+<components>
+ <component>
+ <name>org.richfaces.LayoutPanel</name>
+ <family>org.richfaces.LayoutPanel</family>
+ <classname>org.richfaces.component.html.HtmlLayoutPanel</classname>
+ <superclass>org.richfaces.component.UILayoutPanel</superclass>
+ <description>
+ <![CDATA[
+ ]]>
+ </description>
+ <renderer generate="true" override="true">
+ <name>org.richfaces.LayoutPanelRenderer</name>
+ <template>org/richfaces/htmlLayoutPanel.jspx</template>
+ </renderer>
+ <tag>
+ <name>layoutPanel</name>
+ <classname>org.richfaces.taglib.LayoutPanelTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ </tag>
+ <!--
+ <taghandler>
+ <classname>org.ajax4jsf.tag.TestHandler</classname>
+ </taghandler>
+ -->
+ &ui_component_attributes;
+ <!--
+ <property>
+ <name>param</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue>"default"</defaultvalue>
+ </property>
+ -->
+ </component>
+</components>
Property changes on: trunk/sandbox/ui/layout/src/main/config/component/layoutPanel.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/sandbox/ui/layout/src/main/config/component/page.xml
===================================================================
--- trunk/sandbox/ui/layout/src/main/config/component/page.xml (rev 0)
+++ trunk/sandbox/ui/layout/src/main/config/component/page.xml 2009-02-18 23:47:10 UTC (rev 12690)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://labs.jboss.com/jbossrichfaces/component-config.dtd">
+
+<components>
+ <component>
+ <name>org.richfaces.Page</name>
+ <family>org.richfaces.Page</family>
+ <classname>org.richfaces.component.html.HtmlPage</classname>
+ <superclass>org.richfaces.component.UIPage</superclass>
+ <description>
+ <![CDATA[
+ ]]>
+ </description>
+ <renderer generate="true" override="true">
+ <name>org.richfaces.PageRenderer</name>
+ <template>org/richfaces/htmlPage.jspx</template>
+ </renderer>
+ <tag>
+ <name>page</name>
+ <classname>org.richfaces.taglib.PageTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ </tag>
+ <!--
+ <taghandler>
+ <classname>org.ajax4jsf.tag.TestHandler</classname>
+ </taghandler>
+ -->
+ &ui_component_attributes;
+ &ajax_region_attributes;
+ &html_universal_attributes;
+ <property hidden="true" existintag="true">
+ <name>renderRegionOnly</name>
+ <classname>boolean</classname>
+ <description>
+ Flag to disable rendering in AJAX responses content
+ outside of active region. If this attribute set to
+ "true" , no one of the components outside of region will
+ be included to AJAX response. If set to "false", search
+ for components to include in response will be performed
+ on all tree. Default value is "true".
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+ <property>
+ <name>pageTitle</name>
+ <classname>java.lang.String</classname>
+ <description>
+ String for output as a page title.
+ </description>
+ </property>
+ <property>
+ <name>onload</name>
+ <classname>java.lang.String</classname>
+ <description>
+ JavaScript code to execute on a page load.
+ </description>
+ </property>
+ <property>
+ <name>onunload</name>
+ <classname>java.lang.String</classname>
+ <description>
+ JavaScript code to execute on a page unload.
+ </description>
+ </property>
+ <property>
+ <name>format</name>
+ <classname>java.lang.String</classname>
+ <description>
+ <![CDATA[Page layout format ( html, xhtml, html-transitional, html-3.2 ) for encoding DOCTYPE, namespace and Content-Type definitions]]>
+ </description>
+ </property>
+ <property>
+ <name>contentType</name>
+ <classname>java.lang.String</classname>
+ <description>
+ <![CDATA[Set custom mime content type to response]]>
+ </description>
+ </property>
+ <property>
+ <name>namespace</name>
+ <classname>java.lang.String</classname>
+ <description>
+ <![CDATA[Set html element default namespace]]>
+ </description>
+ </property>
+ <!--
+ <property>
+ <name>param</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue>"default"</defaultvalue>
+ </property>
+ -->
+ </component>
+</components>
Property changes on: trunk/sandbox/ui/layout/src/main/config/component/page.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UILayoutPanel.java
===================================================================
--- trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UILayoutPanel.java (rev 0)
+++ trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UILayoutPanel.java 2009-02-18 23:47:10 UTC (rev 12690)
@@ -0,0 +1,19 @@
+/**
+ *
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UILayoutPanel extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.LayoutPanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.LayoutPanel";
+
+}
Property changes on: trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UILayoutPanel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UIPage.java
===================================================================
--- trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UIPage.java (rev 0)
+++ trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UIPage.java 2009-02-18 23:47:10 UTC (rev 12690)
@@ -0,0 +1,23 @@
+/**
+ *
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.ajax4jsf.component.UIAjaxRegion;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIPage extends UIAjaxRegion {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Page";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Page";
+
+
+
+}
Property changes on: trunk/sandbox/ui/layout/src/main/java/org/richfaces/component/UIPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/sandbox/ui/layout/src/main/java/org/richfaces/renderkit/html/HtmlPageRenderer.java
===================================================================
--- trunk/sandbox/ui/layout/src/main/java/org/richfaces/renderkit/html/HtmlPageRenderer.java (rev 0)
+++ trunk/sandbox/ui/layout/src/main/java/org/richfaces/renderkit/html/HtmlPageRenderer.java 2009-02-18 23:47:10 UTC (rev 12690)
@@ -0,0 +1,43 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.html.AjaxPageRenderer;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class HtmlPageRenderer extends AjaxPageRenderer {
+
+
+ @Override
+ public void doEncodeBegin(ResponseWriter out, FacesContext context,
+ UIComponent component) throws IOException {
+ // generate page lead with header, up to body tag.
+ super.doEncodeBegin(out, context, component);
+ // header facet.
+ // start content body.
+ // menu facet.
+ // content placeholder.
+ }
+
+
+ @Override
+ public void doEncodeEnd(ResponseWriter out, FacesContext context,
+ UIComponent component) throws IOException {
+ // close content .
+ // footer facet.
+ // Close page body.
+ // generate page trailer closing tags.
+ super.doEncodeEnd(out, context, component);
+ }
+
+}
Property changes on: trunk/sandbox/ui/layout/src/main/java/org/richfaces/renderkit/html/HtmlPageRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlLayoutPanel.jspx
===================================================================
--- trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlLayoutPanel.jspx (rev 0)
+++ trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlLayoutPanel.jspx 2009-02-18 23:47:10 UTC (rev 12690)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ class="org.richfaces.renderkit.html.LayoutPanelRenderer"
+ baseclass="org.ajax4jsf.renderkit.AjaxComponentRendererBase"
+ component="org.richfaces.component.UILayoutPanel"
+ >
+ <f:clientid var="clientId"/>
+ <div id="#{clientId}"
+ x:passThruWithExclusions="value,name,type,id"
+ >
+ </div>
+</f:root>
\ No newline at end of file
Property changes on: trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlLayoutPanel.jspx
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlPage.jspx
===================================================================
--- trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlPage.jspx (rev 0)
+++ trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlPage.jspx 2009-02-18 23:47:10 UTC (rev 12690)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ class="org.richfaces.renderkit.html.PageRenderer"
+ baseclass="org.ajax4jsf.renderkit.AjaxComponentRendererBase"
+ component="org.richfaces.component.UIPage"
+ >
+ <f:clientid var="clientId"/>
+ <div id="#{clientId}"
+ x:passThruWithExclusions="value,name,type,id"
+ >
+ </div>
+</f:root>
\ No newline at end of file
Property changes on: trunk/sandbox/ui/layout/src/main/templates/org/richfaces/htmlPage.jspx
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/sandbox/ui/pom.xml
===================================================================
--- trunk/sandbox/ui/pom.xml 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/sandbox/ui/pom.xml 2009-02-18 23:47:10 UTC (rev 12690)
@@ -19,5 +19,6 @@
<!--module>rex-button</module-->
<module>sortableHeader</module>
<module>colorPicker</module>
+ <module>layout</module>
</modules>
</project>
\ No newline at end of file
Modified: trunk/test-applications/ajaxTest/pom.xml
===================================================================
--- trunk/test-applications/ajaxTest/pom.xml 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/test-applications/ajaxTest/pom.xml 2009-02-18 23:47:10 UTC (rev 12690)
@@ -43,7 +43,7 @@
<configuration>
<systemProperties>
<property>
- <name>webapp</name>
+ <name>webroot</name>
<value>${basedir}/src/main/webapp</value>
</property>
</systemProperties>
@@ -94,12 +94,12 @@
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>1.2_11</version>
+ <version>1.2_12</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>1.2_11</version>
+ <version>1.2_12</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/test-applications/ajaxTest/src/test/java/org/richfaces/RepeaterTest.java
===================================================================
--- trunk/test-applications/ajaxTest/src/test/java/org/richfaces/RepeaterTest.java 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/test-applications/ajaxTest/src/test/java/org/richfaces/RepeaterTest.java 2009-02-18 23:47:10 UTC (rev 12690)
@@ -25,12 +25,7 @@
@Override
protected void setupWebContent() {
- String webappDirectory = System.getProperty("webapp");
- if (null == webappDirectory) {
- throw new TestException("The 'webapp' system property does not set");
- }
- File webFile = new File(webappDirectory);
- facesServer.addResourcesFromDirectory("/", webFile);
+ super.setupWebContent();
facesServer.addResource("/WEB-INF/faces-config.xml", "test-faces-config.xml");
}
Modified: trunk/test-applications/ajaxTest/src/test/resources/org/richfaces/logging.properties
===================================================================
--- trunk/test-applications/ajaxTest/src/test/resources/org/richfaces/logging.properties 2009-02-18 17:32:02 UTC (rev 12689)
+++ trunk/test-applications/ajaxTest/src/test/resources/org/richfaces/logging.properties 2009-02-18 23:47:10 UTC (rev 12690)
@@ -11,5 +11,5 @@
org.ajax4jsf.level=INFO
javax.enterprise.resource.webcontainer.jsf.level=INFO
com.gargoylesoftware.htmlunit.level=INFO
-org.richfaces.level=INFO
+org.richfaces.test.level=ALL
\ No newline at end of file
Added: trunk/test-applications/realworld/upload.tgz
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/realworld/upload.tgz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 10 months
JBoss Rich Faces SVN: r12689 - in trunk: test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-02-18 12:32:02 -0500 (Wed, 18 Feb 2009)
New Revision: 12689
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestServlet.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/AutoTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
trunk/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
trunk/ui/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java
Log:
PanelMenuGroup: nested components are processed for server-aware closed groups
https://jira.jboss.org/jira/browse/RF-6119
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestServlet.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestServlet.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestServlet.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -35,7 +35,9 @@
*/
public class AutoTestServlet extends HttpServlet {
- private static final String COMPONENT_PARAMETER_NAME = "c";
+ private static final long serialVersionUID = -7355230949138030161L;
+
+ private static final String COMPONENT_PARAMETER_NAME = "c";
private static final String EVENT_PARAMETER_NAME = "ev";
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/AutoTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/AutoTestBean.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/AutoTestBean.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -104,7 +104,7 @@
private boolean converterSet;
- private String processInput;
+// private String processInput;
private boolean processSet = false;
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -159,12 +159,12 @@
String componentId = tester.getClientId("componentId");
AssertPresentAndVisible(componentId, "Component is not output to a client");
- String subComponentId = tester.getClientId("subComponentId");
-
- String styleGroup = selenium.getAttribute("//*[@id='icon" + componentId + "']/@style");
- String styleSubGroup = selenium.getAttribute("//*[@id='icon" + subComponentId + "']/@style");
-
- //Assert.assertFalse(styleGroup == null ? styleSubGroup == null : styleGroup.equals(styleSubGroup), "Expected [" + styleGroup + "] <> [" + styleSubGroup + "]");
+// String subComponentId = tester.getClientId("subComponentId");
+//
+// String styleGroup = selenium.getAttribute("//*[@id='icon" + componentId + "']/@style");
+// String styleSubGroup = selenium.getAttribute("//*[@id='icon" + subComponentId + "']/@style");
+//
+// Assert.assertFalse(styleGroup == null ? styleSubGroup == null : styleGroup.equals(styleSubGroup), "Expected [" + styleGroup + "] <> [" + styleSubGroup + "]");
}
@Override
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelTest.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -20,9 +20,7 @@
*/
package org.richfaces.testng;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.ajax4jsf.template.Template;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -46,8 +46,7 @@
*
* @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
*/
- protected Class getComponentClass() {
- // TODO Auto-generated method stub
+ protected Class<? extends UIComponent> getComponentClass() {
return null;
}
@@ -58,17 +57,17 @@
// Create AJAX Submit function.
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
component, context,AjaxRendererUtils.AJAX_FUNCTION_NAME);
- Map options = AjaxRendererUtils.buildEventOptions(context, component);
- Map parameters = (Map) options.get("parameters");
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map<String, Object> parameters = (Map<String, Object>) options.get("parameters");
if (null == parameters) {
- parameters = new HashMap();
+ parameters = new HashMap<String, Object>();
options.put("parameters", parameters);
}
ajaxFunction.addParameter(JSReference.NULL);
ajaxFunction.addParameter(options);
// Fill parameters.
- for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
- UIComponent child = (UIComponent) it.next();
+ for (Iterator<UIComponent> it = component.getChildren().iterator(); it.hasNext();) {
+ UIComponent child = it.next();
if (child instanceof UIParameter) {
UIParameter parameter = ((UIParameter) child);
String name = parameter.getName();
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -49,7 +49,7 @@
/* (non-Javadoc)
* @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
*/
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return UIResource.class;
}
@@ -63,7 +63,7 @@
String family = resource.getFamily();
ResourceRenderer renderer = null;
InternetResource internetResource = null;
- Map<String, Object> attributes = Collections.EMPTY_MAP;
+ Map<String, Object> attributes = Collections.emptyMap();
if (SCRIPT_COMPONENT_FAMILY.equals(family)) {
renderer = InternetResourceBuilder.getInstance().getScriptRenderer();
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -22,6 +22,7 @@
package org.richfaces.component;
import javax.faces.component.ActionSource2;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.BooleanConverter;
import javax.faces.el.MethodBinding;
@@ -38,6 +39,10 @@
public static final String COMPONENT_TYPE = "org.richfaces.panelMenuGroup";
+ public static final String EXPAND_MODE_AJAX = "ajax";
+ public static final String EXPAND_MODE_SERVER = "server";
+ public static final String EXPAND_MODE_NONE = "none";
+
public abstract String getStyleClass();
public abstract void setStyleClass(String styleClass);
@@ -77,8 +82,16 @@
public abstract void setName(String string);
public abstract String getName();
- public boolean isExpanded(){
-
+ public boolean isParentDisabled() {
+ UIComponent parent = this.getParent();
+ if(!(parent instanceof UIPanelMenuGroup)){
+ return false;
+ }
+
+ return this.isDisabled() || ((UIPanelMenuGroup) parent).isParentDisabled();
+ }
+
+ public boolean isExpanded(){
Object value = getValue();
if(value == null){
return false;
@@ -142,8 +155,8 @@
}
// Invoke the default ActionListener
- ActionListener listener =
- context.getApplication().getActionListener();
+ ActionListener listener =
+ context.getApplication().getActionListener();
if (listener != null) {
listener.processAction((ActionEvent) event);
}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -63,7 +63,7 @@
String src = getIconByType("custom",false,context,component);
int w = 16; //width(context);
- for (int i=0;i<level;i++){
+ for (int i=0; i<level; i++){
writer.startElement("img", component);
writer.writeAttribute("src", src, null);
writer.writeAttribute("alt", " ", null);
@@ -171,46 +171,50 @@
public void insertLabel(FacesContext context, UIComponent component) throws IOException {
Object value = component.getAttributes().get("label");
- if (value!=null){
+ if (value!=null) {
context.getResponseWriter().writeText(value, null);
}
}
protected boolean isChildrenExpanded(UIComponent component){
- if (component.getChildren() != null){
- Iterator itr = component.getChildren().iterator();
- while(itr.hasNext()){
- UIComponent child = (UIComponent)itr.next();
- if(child instanceof UIPanelMenuGroup){
- if( ((UIPanelMenuGroup)child).isExpanded() ){
- return true;
- } else {
- return isChildrenExpanded(child);
- }
- }
- }
- }
+ if (component.getChildren() == null) {
+ return false;
+ }
+
+ Iterator<UIComponent> itr = component.getChildren().iterator();
+ while (itr.hasNext()) {
+ UIComponent child = itr.next();
+ if (child instanceof UIPanelMenuGroup) {
+ if (((UIPanelMenuGroup) child).isExpanded()) {
+ return true;
+ } else {
+ return isChildrenExpanded(child);
+ }
+ }
+ }
return false;
}
protected boolean isParentDisabled(UIComponent component){
- boolean returnValue = false;
UIComponent parent = component.getParent();
- if(parent instanceof UIPanelMenuGroup){
- UIPanelMenuGroup parentGroup = (UIPanelMenuGroup)parent;
- if(parentGroup.isDisabled()){
- returnValue = true;
- } else {
- returnValue = isParentDisabled(parentGroup);
- }
+ if(!(parent instanceof UIPanelMenuGroup)){
+ return false;
}
- return returnValue;
+
+ UIPanelMenuGroup parentGroup = (UIPanelMenuGroup) parent;
+ return parentGroup.isDisabled() || isParentDisabled(parentGroup);
}
+ protected boolean isParentExpended(UIComponent component){
+ UIComponent parent = component.getParent();
+ return parent instanceof UIPanelMenuGroup
+ && ((UIPanelMenuGroup)parent).isExpanded();
+ }
+
protected boolean isSubmitted(FacesContext context, UIComponent component){
boolean submitted = false;
String clientId = component.getClientId(context);
- Map requestParameterMap = context.getExternalContext().getRequestParameterMap();
+ Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap();
Object value = requestParameterMap.get("panelMenuAction"+clientId);
if (clientId!=null&&value!=null){
@@ -222,25 +226,31 @@
}
protected String getItemMode(UIComponent component) {
- String parentExpandMode = findMenu(component).getExpandMode();
String parentMode = findMenu(component).getMode();
- if (null == parentMode || "".equals(parentMode))
+ if (null == parentMode || "".equals(parentMode)) {
parentMode = "server";
- if (null == parentExpandMode || "".equals(parentExpandMode))
+ }
+
+ String parentExpandMode = findMenu(component).getExpandMode();
+ if (null == parentExpandMode || "".equals(parentExpandMode)) {
parentExpandMode = "none";
+ }
+
String mode = "none";
if (component instanceof UIPanelMenuGroup) {
UIPanelMenuGroup group = (UIPanelMenuGroup) component;
- if (null != group.getExpandMode() && ! "".equals(group.getExpandMode()))
+ if (null != group.getExpandMode() && ! "".equals(group.getExpandMode())) {
mode = group.getExpandMode();
- else
- mode = parentExpandMode;
+ } else {
+ mode = parentExpandMode;
+ }
} else if (component instanceof UIPanelMenuItem) {
UIPanelMenuItem item = (UIPanelMenuItem) component;
- if (null != item.getMode() && ! "".equals(item.getMode()))
+ if (null != item.getMode() && ! "".equals(item.getMode())) {
mode = item.getMode();
- else
+ } else {
mode = parentMode;
+ }
}
return mode;
}
@@ -255,11 +265,8 @@
while( !(parent instanceof UIPanelMenu) && !(parent instanceof UIPanelMenuGroup)) {
parent = parent.getParent();
}
- if(parent instanceof UIPanelMenu){
- return true;
- } else {
- return false;
- }
+
+ return parent instanceof UIPanelMenu;
}
/**
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -37,27 +37,28 @@
public class PanelMenuGroupRenderer extends PanelMenuRendererBase {
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return UIPanelMenuGroup.class;
}
protected void doDecode(FacesContext context, UIComponent component) {
String clientId = component.getClientId(context);
- Map requestMap =context.getExternalContext().getRequestParameterMap();
- UIPanelMenuGroup group = ((UIPanelMenuGroup)component);
+ Map<String, String> requestMap =
+ context.getExternalContext().getRequestParameterMap();
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
- if(requestMap.containsKey("panelMenuState"+clientId)){
+ if (requestMap.containsKey("panelMenuState"+clientId)) {
Object property = requestMap.get("panelMenuState"+clientId);
if (property.equals("opened")) {
group.setSubmittedValue("true");
} else if (property.equals("closed")) {
group.setSubmittedValue("false");
}
-
}
+
if(isSubmitted(context, component)){
new ActionEvent(component).queue();
- if ("ajax".equals(getItemMode(component))) {
+ if (UIPanelMenuGroup.EXPAND_MODE_AJAX.equals(getItemMode(component))) {
new AjaxEvent(component).queue();
}
}
@@ -162,8 +163,9 @@
}
}
- if ("".equals(icon))
+ if ("".equals(icon)) {
icon = "custom";
+ }
String source = getIconByType(icon, isTopLevel, context, component);
boolean drawHidden = false;
if (source != null && source.trim().length() == 0) {
@@ -205,7 +207,7 @@
return styleBuffer.toString();
}
- public void insertLabel(FacesContext context, UIComponent component) throws IOException {
+ public void insertLabel (FacesContext context, UIComponent component) throws IOException {
Object label = component.getAttributes().get("label");
if (label!=null){
context.getResponseWriter().writeText(label, null);
@@ -217,7 +219,7 @@
throws ConverterException {
UIPanelMenuGroup group = (UIPanelMenuGroup)component;
- if(group.getConverter() != null){
+ if (group.getConverter() != null) {
return group.getConverter().getAsObject(context, component, (String)submittedValue);
} else {
return submittedValue;
@@ -225,7 +227,7 @@
}
- public boolean isOpened(FacesContext context, UIComponent component)throws IOException {
+ public boolean isOpened (FacesContext context, UIComponent component) throws IOException {
boolean value = false;
if(component instanceof UIPanelMenuGroup){
@@ -240,11 +242,9 @@
} else {
//check expanded attributes in children groups, if exists
boolean isChildrenExpanded = isChildrenExpanded(component);
- value = isChildrenExpanded && disabled; // ? "opened" : "closed";
+ value = isChildrenExpanded && disabled;
}
-
}
-
return value;
}
@@ -305,10 +305,11 @@
public String getTableClass(FacesContext context, UIComponent component) {
String result;
- if (isTopLevel(component))
+ if (isTopLevel(component)) {
result = "dr-pmenu-top-group rich-pmenu-top-group ";
- else
+ } else {
result = "dr-pmenu-group";
+ }
return result;
}
@@ -318,4 +319,17 @@
return group.getName().equals(parentMenu.getSelectedName());
}
+ @Override
+ public void renderChildren(FacesContext facesContext, UIComponent component)
+ throws IOException {
+
+ String mode = ((UIPanelMenuGroup) component).getExpandMode();
+ if (UIPanelMenuGroup.EXPAND_MODE_NONE.equalsIgnoreCase(mode)
+ || isOpened(facesContext, component)) {
+ super.renderChildren(facesContext, component);
+ }
+ }
+
+
+
}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -34,7 +34,7 @@
import org.richfaces.renderkit.PanelMenuRendererBase;
public class PanelMenuItemRenderer extends PanelMenuRendererBase {
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return UIPanelMenuItem.class;
}
@@ -43,7 +43,6 @@
}
protected void doDecode(FacesContext context, UIComponent component) {
if(isSubmitted(context, component)) {
- UIPanelMenuItem item = (UIPanelMenuItem)component;
new ActionEvent(component).queue();
if ("ajax".equals(getItemMode(component))) {
new AjaxEvent(component).queue();
@@ -88,9 +87,9 @@
throws IOException{
UIPanelMenu panelMenu = findMenu(component);
- ResponseWriter writer = context.getResponseWriter();
- boolean isTopLevel = isTopLevel(component);
- String iconType = null;
+ ResponseWriter writer = context.getResponseWriter();
+ boolean isTopLevel = isTopLevel(component);
+ String iconType = null;
UIPanelMenuItem item = (UIPanelMenuItem)component;
String defaultItemIcon = null;
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -51,19 +51,19 @@
* @see org.ajax4jsf.framework.renderer.RendererBase#getComponentClass()
*/
- protected Class getComponentClass() {
+ private static final String FIRST_EXPANDED_ENCODED = "firstExpandedEncoded";
+
+ protected Class<? extends UIComponent> getComponentClass() {
return UIComponent.class;
}
// find and encode UIParameter's components
- public List encodeParams(FacesContext context, UIPanelMenuItem component) throws IOException {
+ public List<String> encodeParams(FacesContext context, UIPanelMenuItem menuItem) throws IOException {
- UIPanelMenuItem menuItem = component;
- List params = new ArrayList();
- StringBuffer buff = new StringBuffer();
+ List<String> params = new ArrayList<String>();
- List children = menuItem.getChildren();
- for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ List<UIComponent> children = menuItem.getChildren();
+ for (Iterator<UIComponent> iterator = children.iterator(); iterator.hasNext();) {
UIComponent child = (UIComponent) iterator.next();
if(child instanceof UIParameter){
@@ -73,14 +73,11 @@
if (name != null) {
Object value = param.getValue();
- buff.append("params[");
- buff.append(ScriptUtils.toScript(name));
- buff.append("] = ");
- buff.append(ScriptUtils.toScript(value));
- buff.append(";");
+ StringBuffer buff = new StringBuffer();
+ buff.append("params[").append(ScriptUtils.toScript(name)).append("] = ")
+ .append(ScriptUtils.toScript(value)).append(";");
params.add(buff.toString());
}
-
}
}
@@ -88,237 +85,255 @@
}
@Override
- protected void preEncodeBegin(FacesContext context, UIComponent component) throws IOException {
+ protected void preEncodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+
super.preEncodeBegin(context, component);
-
+
// In case of encoding the UIPanelMenu in "expandSingle=true" mode
// the value of "firstExpandedEncoded" attribute should be reset to
- // initial "false" state
- if (component instanceof UIPanelMenu) {
- UIPanelMenu panelMenu = (UIPanelMenu) component;
- if (panelMenu.isExpandSingle()) {
- panelMenu.getAttributes().put("firstExpandedEncoded", false);
- }
- }
+ // initial "false" state
+ if (component instanceof UIPanelMenu) {
+ UIPanelMenu panelMenu = (UIPanelMenu) component;
+ if (panelMenu.isExpandSingle()) {
+ panelMenu.getAttributes().put(FIRST_EXPANDED_ENCODED, false);
+ }
+ }
}
public void insertScript(FacesContext context, UIComponent component)
throws IOException {
- StringBuffer buffer = new StringBuffer();
- StringBuffer panelMenu = new StringBuffer();
- List flatList = new LinkedList();
- Map levels = new HashMap();
+ StringBuffer buffer = new StringBuffer();
- Set itemNames = new HashSet();
+ Set<String> itemNames = new HashSet<String>();
- UIPanelMenu parentMenu = (UIPanelMenu)component;
+ UIPanelMenu panelMenu = (UIPanelMenu)component;
- boolean expandSingle = parentMenu.isExpandSingle();
-
- String selectedChild = parentMenu.getSelectedName();
-
+ Map<String, Integer> levels = new HashMap<String, Integer>();
+ List<UIComponent> flatList = new LinkedList<UIComponent>();
flatten(component.getChildren(), flatList, levels, 0);
- panelMenu.append("var ids = new PanelMenu('")
- .append(component.getClientId(context).toString())
- .append("',")
- .append(new Boolean(expandSingle).toString())
- .append(",").append("'").append(selectedChild).append("'")
- .append(").getIds();\n");
-
- for (Iterator iter = flatList.iterator(); iter.hasNext();) {
- UIComponent child = (UIComponent) iter.next();
- if ((child instanceof UIPanelMenuItem)||(child instanceof UIPanelMenuGroup)) {
- boolean childDisabled;
- if (!((UIPanelMenu)component).isDisabled())
- childDisabled = child instanceof UIPanelMenuGroup ? ((UIPanelMenuGroup)child).isDisabled() : ((UIPanelMenuItem)child).isDisabled();
- else
- childDisabled = true;
- boolean childRendered = child instanceof UIPanelMenuGroup ? ((UIPanelMenuGroup)child).isRendered() : ((UIPanelMenuItem)child).isRendered();
- boolean parentRendered = true;
- if (! (child.getParent() instanceof UIPanelMenu))
- parentRendered = child.getParent() instanceof UIPanelMenuGroup ? ((UIPanelMenuGroup)child.getParent()).isRendered() : ((UIPanelMenuItem)child.getParent()).isRendered();
- if (!parentRendered){
- child.getAttributes().put("rendered",Boolean.FALSE);
- }
-
- //UIPanelMenu parentMenu = findMenu(child);
-
- String event = parentMenu.getEvent();
- if ("".equals(event))
- event = "click";
- else if (event.startsWith("on"))
- event = event.substring(2);
-
- String onopen = (child instanceof UIPanelMenuGroup) && !((UIPanelMenuGroup)child).isDisabled() && !isParentDisabled(child) ?
- parentMenu.getOngroupexpand() + ";" + ((UIPanelMenuGroup)child).getOnexpand() : "";
- String onclose = (child instanceof UIPanelMenuGroup) && !((UIPanelMenuGroup)child).isDisabled() && !isParentDisabled(child) ?
- parentMenu.getOngroupcollapse() + ";" + ((UIPanelMenuGroup)child).getOncollapse() : "";
- String hoveredStyle = (child instanceof UIPanelMenuGroup ?
- parentMenu.getHoveredGroupStyle() : parentMenu.getHoveredItemStyle())
- + ";" + (child instanceof UIPanelMenuGroup ?
- ((UIPanelMenuGroup)child).getHoverStyle() : ((UIPanelMenuItem)child).getHoverStyle());
- String hoveredClass = (child instanceof UIPanelMenuGroup ?
- parentMenu.getHoveredGroupClass() : parentMenu.getHoveredItemClass())
- + " " + (child instanceof UIPanelMenuGroup ?
- ((UIPanelMenuGroup)child).getHoverClass() : ((UIPanelMenuItem)child).getHoverClass());
- String [] hoveredStyles = hoveredStyle.split(";");
- String [] hoveredClasses = hoveredClass.split(" ");
-
- String mode = getItemMode(child);
- Object target = child.getAttributes().get("target");
- String targetString;
- if (null == target)
- targetString = "";
- else
- targetString = target.toString();
-
-
-
-
- if (childRendered && parentRendered){
- if ( !isParentDisabled(child) ){
- String childName;
- if(child instanceof UIPanelMenuGroup){
- childName = ((UIPanelMenuGroup)child).getName();
- } else {
- childName = ((UIPanelMenuItem)child).getName();
- }
-
- if(itemNames.contains(childName)){
- throw new RuntimeException("Attibute \"name\" with value \"" + childName + "\" is already used in PanelMenu. It must be unique for every group/item.");
- } else {
- itemNames.add(childName);
- }
-
- buffer.append("var params = new Object();");
+ for (UIComponent child : flatList) {
+ if (!(child instanceof UIPanelMenuItem || child instanceof UIPanelMenuGroup)) {
+ continue;
+ }
+
+ boolean parentRendered = child.getParent().isRendered();
+ if (!parentRendered) {
+ child.getAttributes().put("rendered",Boolean.FALSE);
+ }
+
+ boolean childRendered = child.isRendered();
+ if (!childRendered || !parentRendered || isParentDisabled(child) || !isParentExpended(child)) {
+ continue;
+ }
+
+ boolean childDisabled = panelMenu.isDisabled()
+ || child instanceof UIPanelMenuGroup ? ((UIPanelMenuGroup)child).isDisabled() : ((UIPanelMenuItem)child).isDisabled();
+
+
+ String childName;
+ if(child instanceof UIPanelMenuGroup){
+ childName = ((UIPanelMenuGroup)child).getName();
+ } else {
+ childName = ((UIPanelMenuItem)child).getName();
+ }
+
+ if(itemNames.contains(childName)){
+ throw new RuntimeException("Attibute \"name\" with value \"" + childName + "\" is already used in PanelMenu. It must be unique for every group/item.");
+ } else {
+ itemNames.add(childName);
+ }
+
+ buffer.append("var params = new Object();");
- if(child instanceof UIPanelMenuItem){
- List paramsList = encodeParams(context, (UIPanelMenuItem)child);
- if(!paramsList.isEmpty()){
- for (Iterator iterator = paramsList.iterator(); iterator.hasNext();) {
- buffer.append((String)iterator.next());
- }
- }
- }
-
- buffer
- .append("new PanelMenuItem(ids, params,{myId:'")
- .append((String) child.getClientId(context))
- .append("',parentId:'")
- .append((String) child.getParent().getClientId(context))
- .append("'},{type:" + (child instanceof UIPanelMenuItem ? "\"item\"":"\"node\""))
- .append(",onopen:"+("".equals(onopen) ? "\"\"" : "\"" + onopen + "\"")+",onclose:"+("".equals(onclose) ? "\"\"" : "\"" + onclose + "\""))
- .append(",event:\"" + event + "\"")
- .append(",mode:\"" + mode + "\"")
- .append(",target:\"" + targetString + "\"")
- .append(",disabled:" + new Boolean(childDisabled).toString())
- .append(",target:\"" + targetString + "\"")
- .append(",name:\"" + childName + "\"")
- .append("},{");
-
- for (int i = 0; i < hoveredStyles.length; i++)
- if (!"".equals(hoveredStyles[i])) {
- String [] temp = hoveredStyles[i].split(":");
- String cssName = temp[0].trim();
- String cssValue = temp[1].trim();
- buffer.append("\"" + cssName + "\": \"" + cssValue + "\"");
- if (i != hoveredStyles.length - 1)
- buffer.append(",");
- }
-
- buffer.append("},");
- if (hoveredClasses.length > 0) {
- buffer.append("new Array(");
- for (int i = 0; i < hoveredClasses.length; i++)
- if (!"".equals(hoveredClasses[i])) {;
- buffer.append("\"" + hoveredClasses[i] + "\"");
- if (i != hoveredClasses.length - 1)
- buffer.append(",");
- }
- buffer.append("),");
- } else
- buffer.append("new Array(),");
-
- buffer.append(levels.get(child.getClientId(context)));
- switchOnImagesIfNeeded(context,child,buffer);
-
- addActionIfNeeded(context,child,buffer);
-
- setExpandedIfNeeded(context,child,buffer);
-
- addAjaxFunction(context,child,buffer);
-
- addOnItemHover(parentMenu.getOnitemhover(), child, buffer);
-
- String iconPos = "left";
- boolean isTopLevel = isTopLevel(child);
- if(child instanceof UIPanelMenuGroup){
- iconPos = isTopLevel ? parentMenu.getIconGroupTopPosition() : parentMenu.getIconGroupPosition();
- } else {
- iconPos = isTopLevel ? parentMenu.getIconItemTopPosition() : parentMenu.getIconItemPosition();
- }
-
- buffer.append(","+'"'+iconPos+'"');
-
- addImages(buffer,context,child,component.getClientId(context).toString());
-
- buffer.append(");\n");
- }
- } else {
- continue;
+ if (child instanceof UIPanelMenuItem) {
+ for (String param : encodeParams(context, (UIPanelMenuItem)child)) {
+ buffer.append(param);
}
}
+
+ buffer.append("new PanelMenuItem(ids, params,")
+ .append("{myId:'").append(child.getClientId(context)).append("',")
+ .append("parentId:'").append(child.getParent().getClientId(context)).append("'},")
+ .append("{type:").append(child instanceof UIPanelMenuItem ? "\"item\"":"\"node\"").append(",")
+ .append("onopen:").append(getOnOpen(panelMenu, child)).append(",")
+ .append("onclose:").append(getNoClose(panelMenu, child)).append(",")
+ .append("event:\"").append(getEvent(panelMenu)).append("\",")
+ .append("mode:\"").append(getItemMode(child)).append("\",")
+ .append("disabled:").append(childDisabled).append(",")
+ .append("target:\"").append(getTarget(child)).append("\",")
+ .append("name:\"").append(childName).append("\"")
+ .append("},{").append(getHoveredStyle(panelMenu, child)).append("},")
+ .append(getHoverClass(panelMenu, child))
+ .append(levels.get(child.getClientId(context)))
+ .append(switchOnImagesIfNeeded(context,child));
+
+ addActionIfNeeded(context,child,buffer);
+
+ setExpandedIfNeeded(context,child,buffer);
+
+ addAjaxFunction(context,child,buffer);
+
+ addOnItemHover(panelMenu.getOnitemhover(), child, buffer);
+
+ String iconPos;
+ boolean isTopLevel = isTopLevel(child);
+ if(child instanceof UIPanelMenuGroup){
+ iconPos = isTopLevel ? panelMenu.getIconGroupTopPosition() : panelMenu.getIconGroupPosition();
+ } else {
+ iconPos = isTopLevel ? panelMenu.getIconItemTopPosition() : panelMenu.getIconItemPosition();
+ }
+
+ buffer.append(",\""+iconPos+'"');
+
+ addImages(buffer, context, child, component.getClientId(context).toString());
+
+ buffer.append(");\n");
}
ResponseWriter writer = context.getResponseWriter();
writer.startElement(HTML.SCRIPT_ELEM, component);
writer.writeAttribute(HTML.id_ATTRIBUTE, "script" + component.getClientId(context), null);
writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- writer.writeText(panelMenu, null);
+ writer.writeText(getPanelMenuScript(context, panelMenu), null);
writer.writeText(buffer, null);
writer.endElement(HTML.SCRIPT_ELEM);
}
+
+ private String getNoClose(UIPanelMenu panelMenu, UIComponent child) {
+ String onclose = (child instanceof UIPanelMenuGroup) && !((UIPanelMenuGroup)child).isDisabled() && !isParentDisabled(child)
+ ? panelMenu.getOngroupcollapse() + ";" + ((UIPanelMenuGroup)child).getOncollapse() : "";
+ return "".equals(onclose) ? "\"\"" : "\"" + onclose + "\"";
+ }
+
+ private String getOnOpen(UIPanelMenu panelMenu, UIComponent child) {
+ String onopen = (child instanceof UIPanelMenuGroup) && !((UIPanelMenuGroup)child).isDisabled() && !isParentDisabled(child)
+ ? panelMenu.getOngroupexpand() + ";" + ((UIPanelMenuGroup)child).getOnexpand() : "";
+ return "".equals(onopen) ? "\"\"" : "\"" + onopen + "\"";
+ }
+
+ private String getTarget(UIComponent child) {
+ Object target = child.getAttributes().get("target");
+ return null == target ? "" : target.toString();
+ }
+
+ private String getHoverClass(UIPanelMenu panelMenu, UIComponent child) {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("new Array(");
+ if (child instanceof UIPanelMenuGroup) {
+ String hoveredGroupClass = panelMenu.getHoveredGroupClass();
+ if (!"".equals(hoveredGroupClass)) {
+ buffer.append("\"").append(hoveredGroupClass).append("\"");
+ }
+ } else {
+ String hoveredItemClass = panelMenu.getHoveredItemClass();
+ if (!"".equals(hoveredItemClass)) {
+ buffer.append("\"").append(hoveredItemClass).append("\"");
+ }
+
+ buffer.append(",");
+
+ String hoverClass = child instanceof UIPanelMenuGroup
+ ? ((UIPanelMenuGroup)child).getHoverClass() : ((UIPanelMenuItem)child).getHoverClass();
+ if (!"".equals(hoverClass)) {
+ buffer.append("\"").append(hoverClass).append("\"");
+ }
+ }
+ buffer.append("),");
+ return buffer.toString();
+ }
+
+ private String getHoveredStyle(UIPanelMenu panelMenu, UIComponent child) {
+ String hoveredStyle = (child instanceof UIPanelMenuGroup
+ ? panelMenu.getHoveredGroupStyle() : panelMenu.getHoveredItemStyle()) + ";" +
+ (child instanceof UIPanelMenuGroup ? ((UIPanelMenuGroup)child).getHoverStyle() : ((UIPanelMenuItem)child).getHoverStyle());
+ String [] hoveredStyles = hoveredStyle.split(";");
+
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < hoveredStyles.length; i++) {
+ if (!"".equals(hoveredStyles[i])) {
+ String [] temp = hoveredStyles[i].split(":");
+ String cssName = temp[0].trim();
+ String cssValue = temp[1].trim();
+ buffer.append("\"" + cssName + "\": \"" + cssValue + "\"");
+ if (i != hoveredStyles.length - 1) {
+ buffer.append(",");
+ }
+ }
+ }
+
+ return buffer.toString();
+ }
+
+ private String getEvent(UIPanelMenu panelMenu) {
+ String event = panelMenu.getEvent();
+ if ("".equals(event)) {
+ event = "click";
+ } else if (event.startsWith("on")) {
+ event = event.substring(2);
+ }
+ return event;
+ }
+
+ private StringBuffer getPanelMenuScript(FacesContext context, UIPanelMenu parentMenu) {
+ StringBuffer panelMenu = new StringBuffer();
+ panelMenu.append("var ids = new PanelMenu('")
+ .append(parentMenu.getClientId(context).toString())
+ .append("',")
+ .append(parentMenu.isExpandSingle())
+ .append(",").append("'").append(parentMenu.getSelectedName()).append("'")
+ .append(").getIds();\n");
+ return panelMenu;
+ }
- public void flatten(List children, List flatList, Map levels,int initialLevel) {
- FacesContext context = FacesContext.getCurrentInstance();
- if (children != null) {
- for (Iterator iter = children.iterator(); iter.hasNext();) {
- UIComponent child = (UIComponent) iter.next();
- if (child instanceof UIPanelMenu){
- continue;
- }
- flatList.add(child);
- levels.put(child.getClientId(context), new Integer(initialLevel));
- flatten(child.getChildren(), flatList, levels, initialLevel + 1);
+ public void flatten(List<UIComponent> children, List<UIComponent> flatList,
+ Map<String, Integer> levels, int initialLevel) {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ if (children == null) {
+ return;
+ }
+
+ for (Iterator<UIComponent> iter = children.iterator(); iter.hasNext();) {
+ UIComponent child = iter.next();
+ if (child instanceof UIPanelMenu){
+ continue;
}
+
+ flatList.add(child);
+ levels.put(child.getClientId(context), initialLevel);
+
+ flatten(child.getChildren(), flatList, levels, initialLevel + 1);
}
}
- private void switchOnImagesIfNeeded(FacesContext context, UIComponent child, StringBuffer buffer)throws IOException {
- boolean isToplevel = isTopLevel(child);
- String customIconOpened = "";
- String customIconClosed = "";
+ private String switchOnImagesIfNeeded(FacesContext context, UIComponent child)throws IOException {
+ boolean isToplevel = isTopLevel(child);
+ String customIconOpened = "";
+ String customIconClosed = "";
UIPanelMenu panelMenu = findMenu(child);
if(panelMenu == null){
- return;
+ return "";
}
- String iconOpened = isToplevel ? panelMenu.getIconExpandedTopGroup() : panelMenu.getIconExpandedGroup();
- String iconClosed = isToplevel ? panelMenu.getIconCollapsedTopGroup() : panelMenu.getIconCollapsedGroup();
+ String iconOpened = isToplevel ? panelMenu.getIconExpandedTopGroup() : panelMenu.getIconExpandedGroup();
+ String iconClosed = isToplevel ? panelMenu.getIconCollapsedTopGroup() : panelMenu.getIconCollapsedGroup();
try {
customIconOpened = (String)child.getAttributes().get("iconOpened");
customIconClosed = (String)child.getAttributes().get("iconClosed");
} catch (Exception e) {}
+ StringBuffer buffer = new StringBuffer();
if (child instanceof UIPanelMenuItem){
buffer.append(",false");
} else {
- if (iconClosed.equals("custom")&&iconOpened.equals("custom")){
- if (customIconClosed.equals("")&&customIconOpened.equals("")){
+ if (iconClosed.equals("custom") && iconOpened.equals("custom")){
+ if (customIconClosed.equals("") && customIconOpened.equals("")){
buffer.append(",false");
} else {
buffer.append(",true");
@@ -327,6 +342,7 @@
buffer.append(",true");
}
}
+ return buffer.toString();
}
private void addActionIfNeeded(FacesContext context,UIComponent child,StringBuffer buffer){
@@ -338,7 +354,8 @@
buffer.append(",true");
}
} else {
- if (((UIPanelMenuGroup)child).getAction()!=null&&!((UIPanelMenuGroup)child).getAction().equals("")){
+ if (((UIPanelMenuGroup) child).getAction() != null &&
+ !((UIPanelMenuGroup)child).getAction().equals("")){
buffer.append(",'panelMenuNodeAction'");
} else {
buffer.append(",false");
@@ -421,11 +438,11 @@
}
if(customItemIcon != null && !customItemIcon.equals("")){
- buffer.append(","+'"'+customIconSource+'"').append(","+'"'+customIconSource+'"'+" ");
+ buffer.append(",\""+customIconSource).append("\",\""+customIconSource+"\" ");
} else if (defaultItemIcon != null && !defaultItemIcon.equals("")){
- buffer.append(","+'"'+defaultItemIconSrc+'"').append(","+'"'+defaultItemIconSrc+'"'+" ");
+ buffer.append(",\""+defaultItemIconSrc).append("\",\""+defaultItemIconSrc+"\" ");
} else {
- buffer.append(","+'"'+PANEL_MENU_SPACER_ICON+'"').append(","+'"'+PANEL_MENU_SPACER_ICON+'"'+" ");
+ buffer.append(",\""+PANEL_MENU_SPACER_ICON).append("\",\""+PANEL_MENU_SPACER_ICON+"\" ");
}
buffer.append(",\"\" ");
@@ -465,43 +482,35 @@
defaultIconNodeOpened = panelMenu.getIconExpandedGroup();
}
- String defaultIconNodeClosedSrc = getIconByType(defaultIconNodeClosed, isTopLevel,context, component);
String defaultIconNodeOpenedSrc = getIconByType(defaultIconNodeOpened, isTopLevel,context, component);
-
- String iconExpanded = "";
- String iconCollapsed = "";
- String iconExpandedSource = "";
- String iconCollapsedSource = "";
-
- iconExpanded = group.isDisabled() ? group.getIconDisabled() : group.getIconExpanded();
- iconCollapsed = group.isDisabled() ? group.getIconDisabled() : group.getIconCollapsed();
- iconExpandedSource = getIconByType(iconExpanded,isTopLevel,context,component);
- iconCollapsedSource = getIconByType(iconCollapsed,isTopLevel,context,component);
-
+ String iconExpanded = group.isDisabled() ? group.getIconDisabled() : group.getIconExpanded();
+ String iconExpandedSource = getIconByType(iconExpanded,isTopLevel,context,component);
if(iconExpanded != null && !iconExpanded.equals("")){
- buffer.append(","+'"'+ iconExpandedSource + '"');
+ buffer.append(",\"" + iconExpandedSource + '"');
} else if(defaultIconNodeOpened != null && !defaultIconNodeOpened.equals("")){
- buffer.append(","+'"'+defaultIconNodeOpenedSrc + '"');
+ buffer.append(",\"" + defaultIconNodeOpenedSrc + '"');
} else {
- buffer.append(","+'"'+PANEL_MENU_SPACER_ICON + '"');
+ buffer.append(",\"" + PANEL_MENU_SPACER_ICON + '"');
}
-
+
+ String defaultIconNodeClosedSrc = getIconByType(defaultIconNodeClosed, isTopLevel,context, component);
+ String iconCollapsed = group.isDisabled() ? group.getIconDisabled() : group.getIconCollapsed();
+ String iconCollapsedSource = getIconByType(iconCollapsed,isTopLevel,context,component);
if(iconCollapsed != null && !iconCollapsed.equals("")){
- buffer.append(","+'"'+iconCollapsedSource+'"');
+ buffer.append(",\"" + iconCollapsedSource + '"');
} else if(defaultIconNodeClosed != null && !defaultIconNodeClosed.equals("")){
- buffer.append(","+'"'+defaultIconNodeClosedSrc+'"');
+ buffer.append(",\"" + defaultIconNodeClosedSrc + '"');
} else {
- buffer.append(","+'"'+PANEL_MENU_SPACER_ICON + '"');
+ buffer.append(",\"" + PANEL_MENU_SPACER_ICON + '"');
}
}
buffer.append(",\"" + PANEL_MENU_SPACER_ICON + "\"");
}
protected void addAjaxFunction(FacesContext context, UIComponent child, StringBuffer buffer) {
- JSFunction function = AjaxRendererUtils.buildAjaxFunction(child,
- context);
- Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
- child);
+ JSFunction function = AjaxRendererUtils.buildAjaxFunction(child, context);
+ Map<String, Object> eventOptions =
+ AjaxRendererUtils.buildEventOptions(context, child);
function.addParameter(eventOptions);
buffer.append(",\"");
@@ -509,45 +518,46 @@
buffer.append("\"");
}
- protected void addOnItemHover(String menuOnItemHover, UIComponent child, StringBuffer buffer) {
+ protected void addOnItemHover(String menuOnItemHover, UIComponent child,
+ StringBuffer buffer) {
buffer.append(",\"");
- if(child instanceof UIPanelMenuItem){
- if(menuOnItemHover != null && !menuOnItemHover.equals("")) buffer.append(menuOnItemHover);
- }
- buffer.append("\"");
- }
+ if (child instanceof UIPanelMenuItem) {
+ if (menuOnItemHover != null && !menuOnItemHover.equals(""))
+ buffer.append(menuOnItemHover);
+ }
+ buffer.append("\"");
+ }
public void renderChildren(FacesContext facesContext, UIComponent component)throws IOException {
+ if(!(component instanceof UIPanelMenu)) {
+ return;
+ }
- if(component instanceof UIPanelMenu){
- UIPanelMenu panelMenu = (UIPanelMenu)component;
- if(panelMenu.getChildCount() > 0){
- for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
- UIComponent child = (UIComponent) it.next();
- if(child instanceof UIPanelMenuGroup) {
- UIPanelMenuGroup group = (UIPanelMenuGroup)child;
-
- if(panelMenu.isExpandSingle()) {
- if(!(Boolean)panelMenu.getAttributes().get("firstExpandedEncoded")) {
- if(group.isExpanded()) {
- panelMenu.getAttributes().put("firstExpandedEncoded", true);
- }
- }else {
- group.setExpanded(false);
- if((Boolean)group.getValue()){
- group.setValue(null);
- }
- }
- }
+ UIPanelMenu panelMenu = (UIPanelMenu)component;
+ for (Iterator<UIComponent> it = component.getChildren().iterator(); it.hasNext();) {
+ UIComponent child = (UIComponent) it.next();
+ if (child instanceof UIPanelMenuGroup) {
+ UIPanelMenuGroup group = (UIPanelMenuGroup)child;
+
+ if (panelMenu.isExpandSingle()) {
+ if (!(Boolean)panelMenu.getAttributes().get(FIRST_EXPANDED_ENCODED)) {
+ if (group.isExpanded()) {
+ panelMenu.getAttributes().put(FIRST_EXPANDED_ENCODED, true);
+ }
+ } else {
+ group.setExpanded(false);
+ if ((Boolean)group.getValue()) {
+ group.setValue(null);
+ }
}
- renderChild(facesContext, child);
- }
+ }
}
+ renderChild(facesContext, child);
}
}
public void doDecode(FacesContext context, UIComponent component) {
- Map requestMap = context.getExternalContext().getRequestParameterMap();
+ Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();
String menuClientId = component.getClientId(context);
UIPanelMenu menu = ((UIPanelMenu)component);
Object selectedItemName = requestMap.get(menuClientId + "selectedItemName");
Modified: trunk/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
===================================================================
--- trunk/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2009-02-18 17:32:02 UTC (rev 12689)
@@ -82,8 +82,9 @@
this.myId = ids.myId;
this.mode = options.mode;
- if (!this.mode)
+ if (!this.mode) {
this.mode = ("node" == this.type) ? "none" : "server";
+ }
this.ajaxSubmit = ajaxFunction;
this.onItemHover = onItemHover;
@@ -92,6 +93,7 @@
this.hoveredStyles = hoveredStyles;
this.hoveredClasses = hoveredClasses;
this.tdhider = Element.extend(idsMap[ids.myId]);
+
if (!this.tdhider) {
this.tdhider = $(ids.myId);
}
@@ -115,6 +117,7 @@
}
parent = parent.parentObj;
}
+
// parent - root menu object
this.rootMenu = parent;
@@ -158,13 +161,14 @@
this._attachBehaviors();
this.inputs = this._getDirectChildrenByTag(this.content,"INPUT");
- for (var i=0;i<this.inputs.length;i++){
- if (this.inputs[i].name.indexOf("panelMenuState")!=-1){
- this.inputState = this.inputs[i];
- } else if (this.inputs[i].name.indexOf("panelMenuAction")!=-1){
- this.inputAction = this.inputs[i];
- }
- }
+ for (var i=0;i<this.inputs.length;i++){
+ if (this.inputs[i].name.indexOf("panelMenuState")!=-1){
+ this.inputState = this.inputs[i];
+ } else if (this.inputs[i].name.indexOf("panelMenuAction")!=-1){
+ this.inputAction = this.inputs[i];
+ }
+ }
+
if (opened){
this.parentObj.lastExpanded = this;
this.expand();
Modified: trunk/ui/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java
===================================================================
--- trunk/ui/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java 2009-02-18 14:16:10 UTC (rev 12688)
+++ trunk/ui/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java 2009-02-18 17:32:02 UTC (rev 12689)
@@ -35,6 +35,7 @@
import org.ajax4jsf.resource.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import com.gargoylesoftware.htmlunit.ElementNotFoundException;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.sun.faces.application.ActionListenerImpl;
@@ -43,7 +44,7 @@
* Unit test for simple Component.
*/
public class PanelMenuComponentTest extends AbstractAjax4JsfTestCase {
- private static Set javaScripts = new HashSet();
+ private static Set<String> javaScripts = new HashSet<String>();
private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
private String[] imageResources = new String[]{
@@ -84,7 +85,36 @@
private UIPanelMenuGroup group3;
private UIPanelMenuItem item1;
private UIPanelMenuItem item2;
+ private UIPanelMenuItem item3;
+
+ /*
+ <viewRoot>
+ <from id="form">
+ <panelMenu id="panelMenu" >
+ <panelMenuGroup id="group1" disabled="true" expandMode="none" >
+ <panelMenuItem id="item1" ></panelMenuItem>
+ </panelMenuGroup>
+ <panelMenuGroup id="group2" value="true">
+ <panelMenuGroup id="subgroup" > <!-- in this case content don't rendered -->
+ <panelMenuItem id="item3" />
+ </panelMenuGroup>
+
+ <panelMenuItem id="item2" disabled="true"/>
+ <panelMenuItem id="triangleItem" icon="triangle" />
+ <panelMenuItem id="spacerItem" icon="spacer" />
+ <panelMenuItem id="triangleDownItem" icon="triangleDown" />
+ <panelMenuItem id="triangleUpItem" icon="triangleUp" />
+ <panelMenuItem id="chevronItem" icon="chevron" />
+ <panelMenuItem id="chevronUpItem" icon="chevronUp" />
+ <panelMenuItem id="chevronDownItem" icon="chevronDown" />
+ <panelMenuItem id="discItem" icon="disc" />
+ <panelMenuItem id="gridItem" icon="grid" />
+ </panelMenuGroup>
+ </panelMenu>
+ </form>
+ </viewRoot>
+ */
public void setUp() throws Exception {
super.setUp();
@@ -102,11 +132,13 @@
group1 = (UIPanelMenuGroup)application.createComponent("org.richfaces.panelMenuGroup");
group1.setId("group1");
+ group1.setExpandMode("none");
group1.setDisabled(true);
panelMenu.getChildren().add(group1);
group2 = (UIPanelMenuGroup)application.createComponent("org.richfaces.panelMenuGroup");
group2.setId("group2");
+ group2.setValue(true);
panelMenu.getChildren().add(group2);
item1 = (UIPanelMenuItem)application.createComponent("org.richfaces.panelMenuItem");
@@ -116,6 +148,11 @@
group3 = (UIPanelMenuGroup)application.createComponent("org.richfaces.panelMenuGroup");
group3.setId("subgroup");
group2.getChildren().add(group3);
+
+ item3 = (UIPanelMenuItem)application.createComponent("org.richfaces.panelMenuItem");
+ item3.setId("item3");
+ group3.getChildren().add(item3);
+
item2 = (UIPanelMenuItem)application.createComponent("org.richfaces.panelMenuItem");
item2.setId("item2");
@@ -137,7 +174,7 @@
item.setId("triangleDownItem");
item.setIcon("triangleDown");
group2.getChildren().add(item);
-
+
item = (UIPanelMenuItem)application.createComponent("org.richfaces.panelMenuItem");
item.setId("triangleUpItem");
item.setIcon("triangleUp");
@@ -188,7 +225,6 @@
public void testRender() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
- //System.out.println(page.asXml());
HtmlElement div = page.getHtmlElementById(panelMenu.getClientId(facesContext));
assertNotNull(div);
@@ -231,6 +267,12 @@
assertNotNull(rightIcon);
assertEquals("img", rightIcon.getNodeName());
+ try {
+ page.getHtmlElementById(item3.getClientId(facesContext));
+ } catch (ElementNotFoundException e) {
+ // it is right this element must be absent
+ }
+
HtmlElement firstItemHide = page.getHtmlElementById("tablehide" + item1.getClientId(facesContext));
assertNotNull(firstItemHide);
assertEquals("table", firstItemHide.getNodeName());
15 years, 10 months
JBoss Rich Faces SVN: r12688 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-02-18 09:16:10 -0500 (Wed, 18 Feb 2009)
New Revision: 12688
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxAutoTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
Log:
RF-6075
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxAutoTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxAutoTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxAutoTest.xhtml 2009-02-18 14:16:10 UTC (rev 12688)
@@ -0,0 +1,34 @@
+<!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.autoTestTemplate}">
+ <ui:define name="component">
+ <rich:comboBox id="componentId"
+ rendered="#{autoTestBean.rendered}"
+ required="#{autoTestBean.required}"
+ requiredMessage="#{autoTestBean.requiredMessage}"
+ immediate="#{autoTestBean.immediate}"
+ style="width: 100%; color: yellow"
+ styleClass="noname"
+ value="#{autoTestBean.input}"
+ onclick="EventQueue.fire('onclick')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseup="EventQueue.fire('onmouseup')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ >
+ <f:selectItem itemValue="1" />
+ <f:selectItem itemValue="2" />
+ </rich:comboBox>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-18 09:53:52 UTC (rev 12687)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-18 14:16:10 UTC (rev 12688)
@@ -285,6 +285,16 @@
}
/**
+ * component with rendered = false is not present on the page
+ */
+ @Test
+ public void testRendered(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ autoTester.testRendered();
+ }
+
+ /**
* Check with enableManualInput = false attribute.
*/
@Test
15 years, 10 months
JBoss Rich Faces SVN: r12687 - 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-18 04:53:52 -0500 (Wed, 18 Feb 2009)
New Revision: 12687
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataFilterSlider/dataFilterSliderTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5991
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataFilterSlider/dataFilterSliderTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java 2009-02-18 01:41:36 UTC (rev 12686)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java 2009-02-18 09:53:52 UTC (rev 12687)
@@ -20,8 +20,12 @@
*/
package org.richfaces.testng;
+import java.util.ArrayList;
+import java.util.List;
+
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -34,6 +38,12 @@
private static final String DATA_FLT_SLIDER_TRACK = DATA_FLT_SLIDER_ID + "slider-track";
+ private static final String DATA_FLT_SLIDER_HANDLE = DATA_FLT_SLIDER_ID + "slider-handle";
+
+ private static final String DATA_FLT_SLIDER_RANGE = DATA_FLT_SLIDER_ID + "slider-range";
+
+ private static final String DATA_FLT_SLIDER_TRAILER = DATA_FLT_SLIDER_ID + "slider-trailer";
+
private static final String TABLE = "planetList";
private static final int PLANETS_ALL = 11;
@@ -273,6 +283,52 @@
tester.testBypassUpdate();
}
+ @Test
+ public void testStandardHTMLAttributesAreOutputToClient(Template template) {
+ renderPage(template, null);
+
+ writeStatus("Check component's specific HTML attributes are output to client");
+
+ List<SeleniumEvent> events = new ArrayList<SeleniumEvent>();
+ events.add(SeleniumEvent.ONKEYDOWN);
+ events.add(SeleniumEvent.ONKEYUP);
+ events.add(SeleniumEvent.ONKEYPRESS);
+
+ assertEvents(getParentId() + FORM_ID + DATA_FLT_SLIDER_INPUT, events);
+
+ writeStatus("Check standart HTML attributes");
+ //String sliderContainerXpath = "//div[contains(@class, 'slider-container')]";
+ //assertEvents(sliderContainerXpath, SeleniumEvent.STANDARD_HTML_EVENTS);
+ }
+
+ @Test
+ public void testStylesAndStyleClassesAreOutputToClient(Template template) {
+ renderPage(template, null);
+
+ writeStatus("Check styles and classes are output to client");
+
+ writeStatus("Check styleClass/style attributes");
+ String sliderContainerXpath = "//div[contains(@class, 'slider-container')]";
+ assertStyleAttributeContains(sliderContainerXpath, "font-size: 16px", "Style attribute was not output to client");
+ assertClassAttributeContains(sliderContainerXpath, "noclass", "Class attribute was not output to client");
+
+ writeStatus("Check trackStyleClass attribute");
+ String sliderTrackId = getParentId() + FORM_ID + DATA_FLT_SLIDER_TRACK;
+ assertClassAttributeContains(sliderTrackId, "track-style-class", "trackStyleClass attribute was not output to client");
+
+ writeStatus("Check handleStyleClass attribute");
+ String sliderHandleId = getParentId() + FORM_ID + DATA_FLT_SLIDER_HANDLE;
+ assertClassAttributeContains(sliderHandleId, "handle-style-class", "handleStyleClass attribute was not output to client");
+
+ writeStatus("Check rangeStyleClass attribute");
+ String sliderRangeId = getParentId() + FORM_ID + DATA_FLT_SLIDER_RANGE;
+ assertClassAttributeContains(sliderRangeId, "range-style-class", "rangeStyleClass attribute was not output to client");
+
+ writeStatus("Check trailerStyleClass attribute");
+ String sliderTrailerId = getParentId() + FORM_ID + DATA_FLT_SLIDER_TRAILER;
+ assertClassAttributeContains(sliderTrailerId, "trailer-style-class", "trailerStyleClass attribute was not output to client");
+ }
+
private void clickSlider(int position) {
String trackId = getParentId() + FORM_ID + DATA_FLT_SLIDER_TRACK;
int w = selenium.getElementWidth(trackId).intValue();
15 years, 10 months
JBoss Rich Faces SVN: r12686 - in branches/jsf2.0: framework/impl/src/main/java/org/ajax4jsf/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-02-17 20:41:36 -0500 (Tue, 17 Feb 2009)
New Revision: 12686
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
branches/jsf2.0/framework/jsf-test/pom.xml
branches/jsf2.0/framework/pom.xml
branches/jsf2.0/tests/ajax/pom.xml
Log:
change jsf-api artefact from com.sun.faces to javax.faces group id.
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2009-02-17 22:43:53 UTC (rev 12685)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2009-02-18 01:41:36 UTC (rev 12686)
@@ -280,7 +280,7 @@
* @param phaseId -
* phase, for which events must be processed.
*/
- void broadcastEvents(FacesContext context, PhaseId phaseId) {
+ public void broadcastEvents(FacesContext context, PhaseId phaseId) {
EventsQueue[] events = getEvents();
EventsQueue anyPhaseEvents = events[PhaseId.ANY_PHASE.getOrdinal()];
EventsQueue phaseEvents = events[phaseId.getOrdinal()];
Modified: branches/jsf2.0/framework/jsf-test/pom.xml
===================================================================
--- branches/jsf2.0/framework/jsf-test/pom.xml 2009-02-17 22:43:53 UTC (rev 12685)
+++ branches/jsf2.0/framework/jsf-test/pom.xml 2009-02-18 01:41:36 UTC (rev 12686)
@@ -23,7 +23,7 @@
<version>2.4</version>
</dependency>
<dependency>
- <groupId>com.sun.faces</groupId>
+ <groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
Modified: branches/jsf2.0/framework/pom.xml
===================================================================
--- branches/jsf2.0/framework/pom.xml 2009-02-17 22:43:53 UTC (rev 12685)
+++ branches/jsf2.0/framework/pom.xml 2009-02-18 01:41:36 UTC (rev 12686)
@@ -92,7 +92,7 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>com.sun.faces</groupId>
+ <groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
Modified: branches/jsf2.0/tests/ajax/pom.xml
===================================================================
--- branches/jsf2.0/tests/ajax/pom.xml 2009-02-17 22:43:53 UTC (rev 12685)
+++ branches/jsf2.0/tests/ajax/pom.xml 2009-02-18 01:41:36 UTC (rev 12686)
@@ -63,7 +63,7 @@
</build>
<dependencies>
<dependency>
- <groupId>com.sun.faces</groupId>
+ <groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.0-SNAPSHOT</version>
<exclusions>
15 years, 10 months
JBoss Rich Faces SVN: r12685 - trunk/framework/impl/src/main/javascript/prototype.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2009-02-17 17:43:53 -0500 (Tue, 17 Feb 2009)
New Revision: 12685
Modified:
trunk/framework/impl/src/main/javascript/prototype/prototype-1.6.0.3.js
Log:
https://jira.jboss.org/jira/browse/RF-6235
Modified: trunk/framework/impl/src/main/javascript/prototype/prototype-1.6.0.3.js
===================================================================
--- trunk/framework/impl/src/main/javascript/prototype/prototype-1.6.0.3.js 2009-02-17 17:27:00 UTC (rev 12684)
+++ trunk/framework/impl/src/main/javascript/prototype/prototype-1.6.0.3.js 2009-02-17 22:43:53 UTC (rev 12685)
@@ -2012,9 +2012,18 @@
cumulativeOffset: function(element) {
var valueT = 0, valueL = 0;
do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
+ // RF: added by PY
+ if($(element).getStyle('position') == 'fixed') {
+ var pageOffsets = document.viewport.getScrollOffsets();
+ valueT += pageOffsets[1] + element.offsetTop;
+ valueL += pageOffsets[0] + element.offsetLeft;
+ break;
+ } else {
+ // RF: end
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+ element = element.offsetParent;
+ } // RF: added by PY
} while (element);
return Element._returnOffset(valueL, valueT);
},
15 years, 10 months
JBoss Rich Faces SVN: r12684 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/comboBox and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-02-17 12:27:00 -0500 (Tue, 17 Feb 2009)
New Revision: 12684
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
Log:
RF-6071
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java 2009-02-17 15:17:59 UTC (rev 12683)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java 2009-02-17 17:27:00 UTC (rev 12684)
@@ -40,6 +40,7 @@
private Boolean directInputSuggestions;
private Boolean filterNewValues;
private Boolean selectFirstOnUpdate;
+ private Boolean enableManualInput;
private List<SelectItem> treeItems;
private List<String> treeNames;
@@ -58,6 +59,7 @@
directInputSuggestions = false;
filterNewValues = true;
selectFirstOnUpdate = true;
+ enableManualInput = true;
}
/**
@@ -143,4 +145,12 @@
public Boolean getSelectFirstOnUpdate() {
return selectFirstOnUpdate;
}
+
+ public void setEnableManualInput(Boolean enableManualInput) {
+ this.enableManualInput = enableManualInput;
+ }
+
+ public Boolean getEnableManualInput() {
+ return enableManualInput;
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-17 15:17:59 UTC (rev 12683)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-17 17:27:00 UTC (rev 12684)
@@ -55,12 +55,15 @@
private String selectFirstOnUpdate;
+ private String enableManualInput;
+
private void init(Template template) {
renderPage(null, template, "#{comboBean.init}");
String attrForm = getParentId() + "attrForm";
directInputSuggestions = attrForm + ":directInputSuggestions";
filterNewValues = attrForm + ":filterNewValues";
selectFirstOnUpdate = attrForm + ":selectFirstOnUpdate";
+ enableManualInput = attrForm + ":enableManualInput";
String mainForm = getParentId() + "_form";
comboBox = mainForm + ":comboBox";
comboboxField = comboBox + "comboboxField";
@@ -281,6 +284,16 @@
Assert.assertEquals(selenium.getValue(comboboxField), "Select ...");
}
+ /**
+ * Check with enableManualInput = false attribute.
+ */
+ @Test
+ public void testDisableManualInput(Template template) {
+ init(template);
+ clickAjaxCommandAndWait(enableManualInput);
+ Assert.assertEquals(selenium.getAttribute("xpath=id('" + comboboxField + "')@readonly"), "true");
+ }
+
@Override
public void setValueEmpty() {
selenium.type(getParentId() + "autoTestForm:componentIdcomboboxValue", "");
15 years, 10 months