JBoss Rich Faces SVN: r14885 - in ui/trunk: components/calendar/impl and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-10 09:22:47 -0400 (Fri, 10 Jul 2009)
New Revision: 14885
Modified:
ui/trunk/components/calendar/impl/
ui/trunk/components/tree/treeModel/api/
ui/trunk/components/tree/treeModel/ui/
ui/trunk/pom.xml
ui/trunk/version-matrix/
ui/trunk/version-matrix/pom.xml
Log:
ui:
- added richfaces-impl to version-matrix
- cdk plugin version changed to 3.3.2-snapshot
- tests generation in cdk plugin switched off
Property changes on: ui/trunk/components/calendar/impl
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: ui/trunk/components/tree/treeModel/api
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: ui/trunk/components/tree/treeModel/ui
___________________________________________________________________
Name: svn:ignore
+ target
Modified: ui/trunk/pom.xml
===================================================================
--- ui/trunk/pom.xml 2009-07-10 12:55:14 UTC (rev 14884)
+++ ui/trunk/pom.xml 2009-07-10 13:22:47 UTC (rev 14885)
@@ -29,13 +29,13 @@
<goal>generate</goal>
</goals>
</execution>
- <execution>
+ <!--execution>
<id>generate-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>generate-tests</goal>
</goals>
- </execution>
+ </execution-->
</executions>
</plugin>
</plugins>
Property changes on: ui/trunk/version-matrix
___________________________________________________________________
Name: svn:ignore
+ target
Modified: ui/trunk/version-matrix/pom.xml
===================================================================
--- ui/trunk/version-matrix/pom.xml 2009-07-10 12:55:14 UTC (rev 14884)
+++ ui/trunk/version-matrix/pom.xml 2009-07-10 13:22:47 UTC (rev 14885)
@@ -73,6 +73,11 @@
</dependency>
<dependency>
<groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-test-base</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
@@ -129,7 +134,7 @@
<plugin>
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
- <version>${project.version}</version>
+ <version>3.3.2-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
15 years, 2 months
JBoss Rich Faces SVN: r14884 - branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-07-10 08:55:14 -0400 (Fri, 10 Jul 2009)
New Revision: 14884
Modified:
branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceSelectTest.java
Log:
small fix
Modified: branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceSelectTest.java
===================================================================
--- branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceSelectTest.java 2009-07-10 12:54:40 UTC (rev 14883)
+++ branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceSelectTest.java 2009-07-10 12:55:14 UTC (rev 14884)
@@ -124,9 +124,9 @@
public void initIds() {
super.initIds();
- inplaceValuePrefix = "inplaceValue";
+ inplaceValuePrefix = "value";
inplaceId = formId + "ii";
- iTempValuePx = "inplaceTmpValue";
+ iTempValuePx = "tmpValue";
}
}
15 years, 2 months
JBoss Rich Faces SVN: r14883 - branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-07-10 08:54:40 -0400 (Fri, 10 Jul 2009)
New Revision: 14883
Modified:
branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java
Log:
RF-7493
Modified: branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java
===================================================================
--- branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java 2009-07-10 12:54:08 UTC (rev 14882)
+++ branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ListShuttleTest.java 2009-07-10 12:54:40 UTC (rev 14883)
@@ -112,7 +112,7 @@
sourceSelectionTableId = parentId + "sourceSelectionTableId";
targetSelectionTableId = parentId + "targetSelectionTableId";
availebleListId = parentId + "lstbody";
- targetListId = parentId + "lstlTbody";
+ targetListId = parentId + "lstltbody";
copyAllId = parentId + "lscopyAll";
copyId = parentId + "lscopy";
removeId = parentId + "lsremove";
@@ -152,8 +152,8 @@
for (int i = 1; i <= 2; i++) {
Assert.assertEquals(selenium.getElementWidth("xpath=" + tdXpath + "[" + i + "]").intValue(), selenium.getElementWidth("xpath=" + thXpath + "[" + i + "]").intValue());
}
- tdXpath = "id('" + lsId +"tlTbody')/tr[1]/td";
- thXpath = "id('" + lsId +"tlInternal_header_tab')/thead/tr/th";
+ tdXpath = "id('" + lsId +"tltbody')/tr[1]/td";
+ thXpath = "id('" + lsId +"tlinternal_header_tab')/thead/tr/th";
Assert.assertEquals(selenium.getXpathCount(thXpath).intValue(), 2);
for (int i = 1; i <= 2; i++) {
Assert.assertEquals(selenium.getElementWidth("xpath=" + tdXpath + "[" + i + "]").intValue(), selenium.getElementWidth("xpath=" + thXpath + "[" + i + "]").intValue());
15 years, 2 months
JBoss Rich Faces SVN: r14882 - branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-07-10 08:54:08 -0400 (Fri, 10 Jul 2009)
New Revision: 14882
Modified:
branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java
Log:
RF-7507
Modified: branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java
===================================================================
--- branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java 2009-07-10 12:44:24 UTC (rev 14881)
+++ branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java 2009-07-10 12:54:08 UTC (rev 14882)
@@ -144,7 +144,7 @@
String parentId = getParentId() + "_form:";
String pickListId = parentId + PICK_LIST;
- String destListId = parentId + PICK_LIST + "tlTbody";
+ String destListId = parentId + PICK_LIST + "tltbody";
String srcListId = parentId + PICK_LIST + "tbody";
Assert.assertEquals(getNumberOfChildren(srcListId), 6);
@@ -193,7 +193,7 @@
writeStatus("Check 'switchByClick' attribute");
String parentId = getParentId() + "_form:";
- String destListId = parentId + PICK_LIST + "tlTbody";
+ String destListId = parentId + PICK_LIST + "tltbody";
String srcListId = parentId + PICK_LIST + "tbody";
assertButtonEnabled(COPY_ALL_BTN);
@@ -218,7 +218,7 @@
String pickListId = getParentId() + "_form:" + PICK_LIST;
String focusKeeper = pickListId + "focusKeeper";
- String destListId = pickListId + "tlTbody";
+ String destListId = pickListId + "tltbody";
String srcListId = pickListId + "tbody";
String copyElemId = pickListId + COPY_BTN;
String removeAllElemId = pickListId + REMOVE_ALL_BTN;
15 years, 2 months
JBoss Rich Faces SVN: r14881 - in branches/community/3.3.X/test-applications: test-jsp and 34 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: adubovsky
Date: 2009-07-10 08:44:24 -0400 (Fri, 10 Jul 2009)
New Revision: 14881
Added:
branches/community/3.3.X/test-applications/test-jsp/
branches/community/3.3.X/test-applications/test-jsp/pom.xml
branches/community/3.3.X/test-applications/test-jsp/src/
branches/community/3.3.X/test-applications/test-jsp/src/main/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/ComponentsSkinsBuffers.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/DrawGrids.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/PageContent.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/TestType.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoEventHandlers.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoGeneral.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoStylesClasses.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Convertion.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/UtilListeners.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Validation.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/ImmediateComponentBean.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/RequiredComponentBean.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/comboBox/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/comboBox/ComboBox.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/dropDownMenu/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/dropDownMenu/DropDownMenu.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/extendedDataTable/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/extendedDataTable/ExtendedDataTable.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/pickList/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/pickList/PickList.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/suggestionBox/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/suggestionBox/SuggestionBox.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/BeanManager.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/data/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/data/Car.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/data/CarProvider.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/Attribute.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/AttributesList.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/Status.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/TLDParser.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/phaseTracker/
branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/phaseTracker/PhaseTracker.java
branches/community/3.3.X/test-applications/test-jsp/src/main/resources/
branches/community/3.3.X/test-applications/test-jsp/src/main/resources/messages.properties
branches/community/3.3.X/test-applications/test-jsp/src/main/resources/util/
branches/community/3.3.X/test-applications/test-jsp/src/main/resources/util/data/
branches/community/3.3.X/test-applications/test-jsp/src/main/resources/util/data/cars.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/META-INF/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/META-INF/MANIFEST.MF
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/auto/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/auto/auto-config.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/comboBox.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/dropDownMenu.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/extendedDataTable.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/pickList.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/suggestionBox.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/faces-config.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/web.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/combiModalPanel.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/header.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/main.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoEventHandlers.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoGeneral.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoStylesClasses.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/_blank/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/_blank/_blank.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/_blank/_blankTestPage.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBox.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBoxManualGeneral.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/dropDownMenu/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/dropDownMenu/dropDownMenu.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/dropDownMenu/dropDownMenuManualGeneral.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/extendedDataTable/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/extendedDataTable/extendedDataTable.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/extendedDataTable/extendedDataTableManualGeneral.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickList.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickListManualGeneral.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/suggestionBox/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/suggestionBox/suggestionBox.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/suggestionBox/suggestionBoxManualGeneral.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/index.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/javascript/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/javascript/jsTools.js
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/styles/
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/styles/layout.css
Log:
+ test-jsp project
Added: branches/community/3.3.X/test-applications/test-jsp/pom.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/pom.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/pom.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,30 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>test-applications</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.3.2-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.test-applications</groupId>
+ <artifactId>test-jsp</artifactId>
+ <packaging>war</packaging>
+ <name>RichFaces Test Application (JSP + MyFaces)</name>
+ <build>
+ <finalName>richfaces-test-jsp</finalName>
+ </build>
+<dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.tomahawk</groupId>
+ <artifactId>tomahawk</artifactId>
+ <version>1.1.7</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+</dependencies>
+</project>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/ComponentsSkinsBuffers.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/ComponentsSkinsBuffers.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/ComponentsSkinsBuffers.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,41 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 applicationStructure;
+
+/**
+ * The Class ComponentsSkinsBuffers contains RichFaces skins' and components'
+ * names.
+ */
+public class ComponentsSkinsBuffers {
+
+ /**
+ * The Constant componentsBuffer contains RichFaces components which exist
+ * in this application.
+ */
+ protected static final String[] componentsBuffer = { "comboBox",
+ "extendedDataTable", "dropDownMenu", "pickList", "suggestionBox" };
+
+ /** The Constant skinsBuffer contains available RichFaces skins. */
+ protected static final String[] skinsBuffer = { "blueSky", "classic",
+ "deepMarine", "DEFAULT", "emeraldTown", "japanCherry", "ruby",
+ "wine", "plain" };
+}
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/DrawGrids.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/DrawGrids.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/DrawGrids.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,262 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 applicationStructure;
+
+import java.util.ArrayList;
+
+import javax.el.ELContext;
+import javax.el.MethodExpression;
+import javax.faces.component.html.HtmlCommandButton;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.component.html.HtmlPanelGrid;
+import javax.faces.component.html.HtmlPanelGroup;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.MethodExpressionActionListener;
+
+import util.parser.Attribute;
+
+/**
+ * The Class DrawGrids provides methods for dynamic generating of the results'
+ * grids for events' handlers, styles, classes and common attributes.
+ */
+public class DrawGrids {
+
+ /**
+ * Draw event handlers grid.
+ *
+ * @param panelGrid
+ * the panel grid in which event handlers are drawn
+ * @param events
+ * the events attributes which are drawn in the panel grid
+ */
+ public void drawEventHandlersGrid(final HtmlPanelGrid panelGrid,
+ final ArrayList<Attribute> events) {
+ panelGrid.getChildren().clear();
+
+ HtmlOutputText attrNameHeader = new HtmlOutputText();
+ attrNameHeader.setId("attrEventsHeaderID");
+ attrNameHeader.setValue("EventHandlers");
+ attrNameHeader.setStyle("font-weight: bold; font-size: large");
+
+ HtmlOutputText attrStatusHeader = new HtmlOutputText();
+ attrStatusHeader.setId("attrEventsStatusID");
+ attrStatusHeader.setValue("Status");
+ attrStatusHeader.setStyle("font-weight: bold; font-size: large");
+
+ panelGrid.getChildren().add(attrNameHeader);
+ panelGrid.getChildren().add(attrStatusHeader);
+
+ for (Attribute a : events) {
+ HtmlOutputText attrName = new HtmlOutputText();
+ attrName.setId(a.getName() + "NameID");
+ attrName.setValue(a.getName());
+ attrName.setTitle(a.getDescription());
+ HtmlInputText attrStatus = new HtmlInputText();
+ attrStatus.setValue(a.getStatus());
+ // id should not be changed in order that test execution is correct
+ attrStatus.setId(a.getName() + "ID");
+ attrStatus.setReadonly(true);
+
+ switch (a.getStatus()) {
+ case FAILED:
+ attrStatus.setStyle("color: red");
+ break;
+ case PASSED:
+ attrStatus.setStyle("color: green");
+ break;
+ case NOT_TESTED:
+ attrStatus.setStyle("color: grey");
+ break;
+ }
+
+ panelGrid.getChildren().add(attrName);
+ panelGrid.getChildren().add(attrStatus);
+ }
+ }
+
+ /**
+ * Draw styles and classes grid.
+ *
+ * @param panelGrid
+ * the panel grid in which styles and classes are drawn
+ * @param styles
+ * the styles and classes which are drawn in the panel grid
+ */
+ public void drawStylesClassesGrid(HtmlPanelGrid panelGrid,
+ ArrayList<Attribute> styles) {
+ panelGrid.getChildren().clear();
+
+ HtmlOutputText attrNameHeader = new HtmlOutputText();
+ attrNameHeader.setId("attrStylesHeaderID");
+ attrNameHeader.setValue("StylesClasses");
+ attrNameHeader.setStyle("font-weight: bold; font-size: large");
+
+ HtmlOutputText attrStatusHeader = new HtmlOutputText();
+ attrStatusHeader.setId("attrStylesStatusID");
+ attrStatusHeader.setValue("Status");
+ attrStatusHeader.setStyle("font-weight: bold; font-size: large");
+
+ panelGrid.getChildren().add(attrNameHeader);
+ panelGrid.getChildren().add(attrStatusHeader);
+
+ String onclickFunctions = "";
+ for (Attribute a : styles) {
+ HtmlOutputText attrName = new HtmlOutputText();
+ attrName.setId(a.getName() + "NameID");
+ attrName.setValue(a.getName());
+ attrName.setTitle(a.getDescription());
+ HtmlInputText attrStatus = new HtmlInputText();
+ attrStatus.setValue(a.getStatus());
+ // id should not be changed in order that test execution is correct
+ attrStatus.setId(a.getName() + "ID");
+ attrStatus.setReadonly(true);
+
+ // we should have a button which calls test function for each style
+ // and class. Function is placed in jsTool.js file
+ onclickFunctions += "markClassAsWorkable('" + a.getName() + "');";
+
+ switch (a.getStatus()) {
+ case FAILED:
+ attrStatus.setStyle("color: red");
+ break;
+ case PASSED:
+ attrStatus.setStyle("color: green");
+ break;
+ case NOT_TESTED:
+ attrStatus.setStyle("color: grey");
+ break;
+ }
+
+ panelGrid.getChildren().add(attrName);
+ panelGrid.getChildren().add(attrStatus);
+ }
+
+ onclickFunctions += "return false;";
+ HtmlCommandButton testButton = new HtmlCommandButton();
+ testButton.setId("testButtonID");
+ testButton.setValue("Test Classes");
+
+ // pass all calls of the functions into onclick attribute of the button
+ testButton.setOnclick(onclickFunctions);
+
+ panelGrid.getChildren().add(testButton);
+ panelGrid.getChildren().add(new HtmlPanelGroup());
+ }
+
+ /**
+ * Draw automated general attributes' grid.
+ *
+ * @param panelGrid
+ * the panel grid in which automated general attributes are drawn
+ * @param attrs
+ * the attributes which are drawn in the panel grid
+ */
+ public void drawAutoGeneralGrid(HtmlPanelGrid panelGrid,
+ ArrayList<Attribute> attrs) {
+ panelGrid.getChildren().clear();
+
+ HtmlOutputText attrNameHeader = new HtmlOutputText();
+ attrNameHeader.setId("attrHeaderID");
+ attrNameHeader.setValue("AutoAttribute");
+ attrNameHeader.setStyle("font-weight: bold; font-size: large");
+
+ HtmlOutputText attrStatusHeader = new HtmlOutputText();
+ attrStatusHeader.setId("attrStatusID");
+ attrStatusHeader.setValue("Status");
+ attrStatusHeader.setStyle("font-weight: bold; font-size: large");
+
+ panelGrid.getChildren().add(attrNameHeader);
+ panelGrid.getChildren().add(attrStatusHeader);
+
+ for (Attribute a : attrs) {
+ HtmlOutputText attrName = new HtmlOutputText();
+ attrName.setValue(a.getName());
+ attrName.setId(a.getName() + "NameID");
+ attrName.setTitle(a.getDescription());
+ HtmlInputText attrStatus = new HtmlInputText();
+ attrStatus.setValue(a.getStatus());
+ // id should not be changed in order that test execution is correct
+ attrStatus.setId(a.getName() + "ID");
+ attrStatus.setReadonly(true);
+
+ switch (a.getStatus()) {
+ case FAILED:
+ attrStatus.setStyle("color: red");
+ break;
+ case PASSED:
+ attrStatus.setStyle("color: green");
+ break;
+ case NOT_TESTED:
+ attrStatus.setStyle("color: grey");
+ break;
+ }
+
+ panelGrid.getChildren().add(attrName);
+
+ // we should have a possibility to change immediate and required
+ // attributes for their testing
+ if (a.getName().equalsIgnoreCase("immediate")
+ || a.getName().equalsIgnoreCase("required")) {
+ HtmlCommandButton button = new HtmlCommandButton();
+ button.setId(a.getName() + "ButtonID");
+
+ MethodExpression actionExpression;
+ if (a.getName().equalsIgnoreCase("immediate")) {
+ button.setValue("Change Immediate");
+ actionExpression = getMethodExpression("#{utilListeners.immediateAction}");
+ } else {
+ button.setValue("Change Required");
+ actionExpression = getMethodExpression("#{utilListeners.requiredAction}");
+ }
+ MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(
+ actionExpression);
+
+ button.addActionListener(meActionListener);
+ HtmlPanelGroup pg = new HtmlPanelGroup();
+ pg.setId(a.getName() + "PanelGroupID");
+ pg.getChildren().add(attrStatus);
+ pg.getChildren().add(button);
+ panelGrid.getChildren().add(pg);
+ } else
+ panelGrid.getChildren().add(attrStatus);
+ }
+ }
+
+ /**
+ * Gets the method expression.
+ *
+ * @param name
+ * the name of EL expression
+ *
+ * @return the method expression
+ */
+ private MethodExpression getMethodExpression(String name) {
+ Class[] argtypes = new Class[1];
+ argtypes[0] = ActionEvent.class;
+ FacesContext facesCtx = FacesContext.getCurrentInstance();
+ ELContext elContext = facesCtx.getELContext();
+ return facesCtx.getApplication().getExpressionFactory()
+ .createMethodExpression(elContext, name, null, argtypes);
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/PageContent.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/PageContent.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/PageContent.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,223 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 applicationStructure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.model.SelectItem;
+
+import org.richfaces.VersionBean;
+
+import util.BeanManager;
+
+import automateCommon.AutoEventHandlers;
+import automateCommon.AutoGeneral;
+import automateCommon.AutoStylesClasses;
+
+/**
+ * The PageContent bean contains information about test page content.
+ */
+public class PageContent {
+
+ /** The Constant page extension. */
+ private static final String EXT = ".jsp";
+
+ /** The all RichFaces components which exist in this application. */
+ private List<SelectItem> allComponents;
+
+ /** The all available RichFaces skins. */
+ private List<SelectItem> allSkins;
+
+ /** The RichFaces version. */
+ private final String version = VersionBean.Version._versionInfo;
+
+ /** The current component. */
+ private String component = "_blank";
+
+ /** The current skin. */
+ private String skin = "blueSky";
+
+ /** The current test type. */
+ private TestType testType = TestType.MANUAL_GENERAL_ATTRIBUTES;
+
+ /**
+ * Instantiates a new page content.
+ */
+ public PageContent() {
+ allComponents = new ArrayList<SelectItem>();
+ allComponents.add(new SelectItem("_blank"));
+ for (String component : ComponentsSkinsBuffers.componentsBuffer) {
+ allComponents.add(new SelectItem(component));
+ }
+
+ allSkins = new ArrayList<SelectItem>();
+ for (String skin : ComponentsSkinsBuffers.skinsBuffer) {
+ allSkins.add(new SelectItem(skin));
+ }
+ }
+
+ /**
+ * Call Reset methods in all auto test beans.
+ */
+ public void reset() {
+ testType = TestType.MANUAL_GENERAL_ATTRIBUTES;
+ AutoEventHandlers autoEventHandlersBean = (AutoEventHandlers) BeanManager
+ .getManagedBeanFromSession("autoEventHandlers");
+ autoEventHandlersBean.reset();
+
+ AutoStylesClasses autoStylesClassesBean = (AutoStylesClasses) BeanManager
+ .getManagedBeanFromSession("autoStylesClasses");
+ autoStylesClassesBean.reset();
+
+ AutoGeneral autoGeneralBean = (AutoGeneral) BeanManager
+ .getManagedBeanFromSession("autoGeneral");
+ autoGeneralBean.reset();
+ }
+
+ /**
+ * Gets the current component.
+ *
+ * @return the component
+ */
+ public String getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets the current component.
+ *
+ * @param component
+ * the new component
+ */
+ public void setComponent(String component) {
+ // if different component is selected reset all data from automated
+ // beans: panel grids, statuses etc...
+ if (!component.equals(this.component))
+ this.reset();
+ this.component = component;
+ }
+
+ /**
+ * Gets the current test type.
+ *
+ * @return the test type
+ */
+ public TestType getTestType() {
+ return testType;
+ }
+
+ /**
+ * Sets the current test type.
+ *
+ * @param testType
+ * the new test type
+ */
+ public void setTestType(TestType testType) {
+ this.testType = testType;
+ }
+
+ /**
+ * Gets the current component's path.
+ *
+ * @return the current component 's path
+ */
+ public String getCurrentComponent() {
+ if (component.equals("_blank"))
+ return "/components/_blank/_blank" + EXT;
+ else
+ return "/components/" + component + "/" + component + EXT;
+ }
+
+ /**
+ * Gets the current test page's path.
+ *
+ * @return the current test page's path
+ *
+ * @throws Exception
+ * the exception
+ */
+ public String getCurrentTestPage() throws Exception {
+ if (component.equals("_blank"))
+ return "/components/_blank/_blankTestPage" + EXT;
+ switch (testType) {
+ case MANUAL_GENERAL_ATTRIBUTES:
+ return "/components/" + component + "/" + component
+ + "ManualGeneral" + EXT;
+ case AUTO_GENERAL_ATTRIBUTES:
+ return "/auto/autoGeneral" + EXT;
+ case AUTO_EVENTHANDLERS:
+ return "/auto/autoEventHandlers" + EXT;
+ case AUTO_STYLES_CLASSES:
+ return "/auto/autoStylesClasses" + EXT;
+ default: {
+ throw new Exception("Incorrect testType");
+ }
+ }
+ }
+
+ /**
+ * Gets the RichFaces version.
+ *
+ * @return the RichFaces version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the all RiceFaces components.
+ *
+ * @return the all RichFaces components
+ */
+ public List<SelectItem> getAllComponents() {
+ return allComponents;
+ }
+
+ /**
+ * Gets the current skin.
+ *
+ * @return the current skin
+ */
+ public String getSkin() {
+ return skin;
+ }
+
+ /**
+ * Sets the current skin.
+ *
+ * @param skin
+ * the new skin
+ */
+ public void setSkin(String skin) {
+ this.skin = skin;
+ }
+
+ /**
+ * Gets the all skins.
+ *
+ * @return the all skins
+ */
+ public List<SelectItem> getAllSkins() {
+ return allSkins;
+ }
+}
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/TestType.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/TestType.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/applicationStructure/TestType.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,29 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 applicationStructure;
+
+/**
+ * The Enum TestType contains all test types.
+ */
+public enum TestType {
+ MANUAL_GENERAL_ATTRIBUTES, AUTO_GENERAL_ATTRIBUTES, AUTO_EVENTHANDLERS, AUTO_STYLES_CLASSES
+}
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoEventHandlers.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoEventHandlers.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoEventHandlers.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,96 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 automateCommon;
+
+import java.util.ArrayList;
+
+import javax.faces.component.html.HtmlPanelGrid;
+
+import applicationStructure.DrawGrids;
+import applicationStructure.PageContent;
+
+import util.BeanManager;
+import util.parser.Attribute;
+import util.parser.TLDParser;
+
+/**
+ * The AutoEventHandlers bean is used for automated test of the events'
+ * handlers.
+ */
+public class AutoEventHandlers {
+
+ /** The result event handlers grid. */
+ private HtmlPanelGrid resultEventHandlersGrid = null;
+
+ /** The all event handlers for selected component. */
+ private ArrayList<Attribute> allEventHandlers;
+
+ /**
+ * The drawGrids object generates the results panel grid using DrawGrids
+ * class methods.
+ */
+ DrawGrids drawGrids = new DrawGrids();
+
+ /**
+ * Draw event handlers grid for current component.
+ */
+ public void drawEventHandlersGrid() {
+ PageContent pageContentBean = (PageContent) BeanManager
+ .getManagedBeanFromSession("pageContent");
+
+ String component = pageContentBean.getComponent();
+
+ TLDParser parser = new TLDParser(component);
+ allEventHandlers = parser.getAllAttributes().getHandlers();
+
+ drawGrids.drawEventHandlersGrid(resultEventHandlersGrid,
+ allEventHandlers);
+ }
+
+ /**
+ * Reset results panel grid when different component is selected.
+ */
+ public void reset() {
+ if (null != resultEventHandlersGrid)
+ resultEventHandlersGrid.getChildren().clear();
+ allEventHandlers = null;
+ }
+
+ /**
+ * Gets the result event handlers grid.
+ *
+ * @return the result event handlers grid
+ */
+ public HtmlPanelGrid getResultEventHandlersGrid() {
+ return resultEventHandlersGrid;
+ }
+
+ /**
+ * Sets the result event handlers grid.
+ *
+ * @param resultEventHandlersGrid
+ * the new result event handlers grid
+ */
+ public void setResultEventHandlersGrid(HtmlPanelGrid resultEventHandlersGrid) {
+ this.resultEventHandlersGrid = resultEventHandlersGrid;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoGeneral.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoGeneral.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoGeneral.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,213 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 automateCommon;
+
+import java.util.ArrayList;
+
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlPanelGrid;
+import javax.faces.context.FacesContext;
+
+import components.ImmediateComponentBean;
+
+import util.BeanManager;
+import util.parser.Attribute;
+import util.parser.TLDParser;
+import applicationStructure.DrawGrids;
+import applicationStructure.PageContent;
+
+/**
+ * The AutoGeneral bean is used for automated test of the general attributes.
+ */
+public class AutoGeneral {
+
+ /**
+ * The Constant autoGeneralAttrs keeps names of the attributes which can be
+ * tested automatically.
+ */
+ private static final String[] autoGeneralAttrs = { "immediate",
+ "validator", "validatorMessage", "required", "requiredMessage",
+ "converter", "converterMessage" };
+
+ /** The result auto general grid. */
+ private HtmlPanelGrid resultAutoGeneralGrid = null;
+
+ /** The all automated general attributes for selected component. */
+ private ArrayList<Attribute> allAutoGeneral = new ArrayList<Attribute>();
+
+ /** The current component. */
+ private String component = "";
+
+ /**
+ * The drawGrids object generates the results panel grid using DrawGrids
+ * class methods.
+ */
+ DrawGrids drawGrids = new DrawGrids();
+
+ /**
+ * Draw automated general attributes grid for current component.
+ */
+ public void drawAutoGeneralGrid() {
+ PageContent pageContentBean = (PageContent) BeanManager
+ .getManagedBeanFromSession("pageContent");
+
+ component = pageContentBean.getComponent();
+
+ TLDParser parser = new TLDParser(component);
+ ArrayList<Attribute> allGeneral = parser.getAllAttributes()
+ .getCommonAttributes();
+
+ allAutoGeneral.clear();
+ for (String attr : autoGeneralAttrs) {
+ int index = allGeneral.indexOf(new Attribute(attr));
+ if (index > -1) {
+ allAutoGeneral.add(allGeneral.get(index));
+ }
+ }
+
+ drawGrids.drawAutoGeneralGrid(resultAutoGeneralGrid, allAutoGeneral);
+ }
+
+ /**
+ * Runs the automated tests for current component.
+ */
+ public void testAutoGeneral() {
+ if (!allAutoGeneral.isEmpty()) {
+ for (Attribute attr : allAutoGeneral) {
+ if (attr.getName().equalsIgnoreCase("validator")
+ || attr.getName().equalsIgnoreCase("validatorMessage")
+ || attr.getName().equalsIgnoreCase("required")
+ || attr.getName().equalsIgnoreCase("requiredMessage")
+ || attr.getName().equalsIgnoreCase("immediate")) {
+
+ Validation validationBean = (Validation) BeanManager
+ .getManagedBeanFromSession("validation");
+ ImmediateComponentBean compInt = (ImmediateComponentBean) BeanManager
+ .getManagedBeanFromSession(component);
+
+ if (attr.getName().equalsIgnoreCase("validator"))
+ // run test for "validator" attribute
+ validationBean.validatorCheck(attr, compInt
+ .isImmediate());
+ else if (attr.getName()
+ .equalsIgnoreCase("validatorMessage"))
+ // run test for "validatorMessage" attribute
+ validationBean.validatorMessageCheck(attr);
+ else if (attr.getName().equalsIgnoreCase("required"))
+ // run test for "required" attribute
+ validationBean.requiredCheck(attr);
+ else if (attr.getName().equalsIgnoreCase("requiredMessage"))
+ // run test for "requiredMessage" attribute
+ validationBean.requiredMessageCheck(attr);
+ else if (attr.getName().equalsIgnoreCase("immediate"))
+ // run test for "immediate" attribute
+ validationBean.immediateCheck(attr, compInt
+ .isImmediate());
+ } else if (attr.getName().equalsIgnoreCase("converter")
+ || attr.getName().equalsIgnoreCase("converterMessage")) {
+
+ Convertion convertionBean = (Convertion) BeanManager
+ .getManagedBeanFromSession("convertion");
+ ImmediateComponentBean compInt = (ImmediateComponentBean) BeanManager
+ .getManagedBeanFromSession(component);
+
+ if (attr.getName().equalsIgnoreCase("converter"))
+ // run test for "converter" attribute
+ convertionBean.converterCheck(attr, compInt
+ .isImmediate());
+ else if (attr.getName()
+ .equalsIgnoreCase("converterMessage"))
+ // run test for "converterMessage" attribute
+ convertionBean.converterMessageCheck(attr);
+ }
+ }
+ // redraw the results grid with the last test results
+ drawGrids
+ .drawAutoGeneralGrid(resultAutoGeneralGrid, allAutoGeneral);
+ }
+ }
+
+ /**
+ * Reset the following when different component is selected:
+ * 1. results panel grid
+ * 2. selected component
+ * 3. submitted and local values of the hidden inputs which are used
+ * for messages testing
+ * 4. validation bean
+ * 5. convertion bean
+ */
+ public void reset() {
+ if (null != resultAutoGeneralGrid)
+ resultAutoGeneralGrid.getChildren().clear();
+ allAutoGeneral.clear();
+ component = "";
+ Validation validationBean = (Validation) BeanManager
+ .getManagedBeanFromSession("validation");
+ if (null != validationBean)
+ validationBean.reset();
+
+ Convertion convertionBean = (Convertion) BeanManager
+ .getManagedBeanFromSession("convertion");
+ if (null != convertionBean)
+ convertionBean.reset();
+
+ UIViewRoot vr = FacesContext.getCurrentInstance().getViewRoot();
+ UIInput inp = (UIInput) vr
+ .findComponent("formID:autoGeneralSubviewID:hiddenValidatorInput");
+ if (null != inp) {
+ inp.setSubmittedValue(null);
+ inp.setLocalValueSet(false);
+ }
+ inp = (UIInput) vr
+ .findComponent("formID:autoGeneralSubviewID:hiddenConverterInput");
+ if (null != inp) {
+ inp.setSubmittedValue(null);
+ inp.setLocalValueSet(false);
+ }
+ inp = (UIInput) vr
+ .findComponent("formID:autoGeneralSubviewID:hiddenRequiredInput");
+ if (null != inp) {
+ inp.setSubmittedValue(null);
+ inp.setLocalValueSet(false);
+ }
+ }
+
+ /**
+ * Gets the result automated general attributes grid.
+ *
+ * @return the result auto general grid
+ */
+ public HtmlPanelGrid getResultAutoGeneralGrid() {
+ return resultAutoGeneralGrid;
+ }
+
+ /**
+ * Sets the result automated general attributes grid.
+ *
+ * @param resultAutoGeneralGrid
+ * the new result auto general grid
+ */
+ public void setResultAutoGeneralGrid(HtmlPanelGrid resultAutoGeneralGrid) {
+ this.resultAutoGeneralGrid = resultAutoGeneralGrid;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoStylesClasses.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoStylesClasses.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoStylesClasses.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,95 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 automateCommon;
+
+import java.util.ArrayList;
+
+import javax.faces.component.html.HtmlPanelGrid;
+
+import util.BeanManager;
+import util.parser.Attribute;
+import util.parser.TLDParser;
+import applicationStructure.DrawGrids;
+import applicationStructure.PageContent;
+
+/**
+ * The AutoStylesClasses bean is used for automated test of the styles and
+ * classes.
+ */
+public class AutoStylesClasses {
+
+ /** The result styles classes grid. */
+ private HtmlPanelGrid resultStylesClassesGrid = null;
+
+ /** The all styles and classes for selected component. */
+ private ArrayList<Attribute> allStylesClasses;
+
+ /**
+ * The drawGrids object generates the results panel grid using DrawGrids
+ * class methods.
+ */
+ DrawGrids drawGrids = new DrawGrids();
+
+ /**
+ * Draw styles and classes grid for current component.
+ */
+ public void drawStylesClassesGrid() {
+ PageContent pageContentBean = (PageContent) BeanManager
+ .getManagedBeanFromSession("pageContent");
+
+ String component = pageContentBean.getComponent();
+
+ TLDParser parser = new TLDParser(component);
+ allStylesClasses = parser.getAllAttributes().getStyles();
+
+ drawGrids.drawStylesClassesGrid(resultStylesClassesGrid,
+ allStylesClasses);
+ }
+
+ /**
+ * Reset results panel grid when different component is selected.
+ */
+ public void reset() {
+ if (null != resultStylesClassesGrid)
+ resultStylesClassesGrid.getChildren().clear();
+ allStylesClasses = null;
+ }
+
+ /**
+ * Gets the result styles classes grid.
+ *
+ * @return the result styles classes grid
+ */
+ public HtmlPanelGrid getResultStylesClassesGrid() {
+ return resultStylesClassesGrid;
+ }
+
+ /**
+ * Sets the result styles classes grid.
+ *
+ * @param resultStylesClassesGrid
+ * the new result styles classes grid
+ */
+ public void setResultStylesClassesGrid(HtmlPanelGrid resultStylesClassesGrid) {
+ this.resultStylesClassesGrid = resultStylesClassesGrid;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Convertion.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Convertion.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Convertion.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,268 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 automateCommon;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+import util.data.Car;
+import util.parser.Attribute;
+import util.parser.Status;
+import util.phaseTracker.PhaseTracker;
+
+/**
+ * The Convertion bean provides methods for "converter" and "converterMessage"
+ * attributes testing.
+ */
+public class Convertion {
+
+ /**
+ * The status converter get as object indicates whether getAsObject is
+ * called or not.
+ */
+ private boolean statusConverterGetAsObject = false;
+
+ /**
+ * The status converter get as string indicates whether getAsString is
+ * called or not.
+ */
+ private boolean statusConverterGetAsString = false;
+
+ /**
+ * The phase converter get as object keeps the JSF phase on which
+ * getAsObject is triggered.
+ */
+ private String phaseConverterGetAsObject = "UNDEFINED";
+
+ /**
+ * The phase converter get as string keeps the JSF phase on which
+ * getAsString is triggered.
+ */
+ private String phaseConverterGetAsString = "UNDEFINED";
+
+ /** The converter message test which is actual displayed on the page. */
+ private String converterMessageTest = "";
+
+ /** The converter message which is defined in "converterMessage" attribute. */
+ private String converterMessage;
+
+ /**
+ * Instantiates a new convertion.
+ */
+ public Convertion() {
+ // message should not be changed in order that test execution is
+ // correct
+ this.converterMessage = "test converter error!";
+ }
+
+ /**
+ * Resets test variables.
+ */
+ public void reset() {
+ converterMessageTest = "";
+ statusConverterGetAsObject = false;
+ statusConverterGetAsString = false;
+ }
+
+ /**
+ * Gets the converter.
+ *
+ * @return the converter
+ */
+ public Converter getConvert() {
+ return new Converter() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent, java.lang.String)
+ */
+ public Object getAsObject(FacesContext context,
+ UIComponent component, String newValue)
+ throws ConverterException {
+ // getAsObject is called
+ statusConverterGetAsObject = true;
+ // keep phase
+ phaseConverterGetAsObject = PhaseTracker.currentPhase
+ .toString();
+ if (newValue.equals("converter"))
+ throw new ConverterException(new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "Converter error",
+ "converter to Object error"));
+
+ return newValue;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent, java.lang.Object)
+ */
+ public String getAsString(FacesContext context,
+ UIComponent component, Object value)
+ throws ConverterException {
+ // getAsString is called
+ statusConverterGetAsString = true;
+ // keep phase
+ phaseConverterGetAsString = PhaseTracker.currentPhase
+ .toString();
+
+ return (null == value) ? null : value.toString();
+ }
+ };
+ }
+
+ /**
+ * Gets the car converter.
+ *
+ * @return the car converter
+ */
+ public Converter getCarConvert() {
+ return new Converter() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent, java.lang.String)
+ */
+ public Object getAsObject(FacesContext context,
+ UIComponent component, String newValue)
+ throws ConverterException {
+ // getAsObject is called
+ statusConverterGetAsObject = true;
+ // keep phase
+ phaseConverterGetAsObject = PhaseTracker.currentPhase
+ .toString();
+ if (newValue.indexOf("converter") > -1)
+ throw new ConverterException(new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "Converter error",
+ "converter to Object error"));
+
+ String[] str = newValue.split(":");
+ return new Car(str[0], str[1], Integer.parseInt(str[2]));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent, java.lang.Object)
+ */
+ public String getAsString(FacesContext context,
+ UIComponent component, Object value)
+ throws ConverterException {
+ // getAsString is called
+ statusConverterGetAsString = true;
+ // keep phase
+ phaseConverterGetAsString = PhaseTracker.currentPhase
+ .toString();
+
+ if (value instanceof Car) {
+ Car car = (Car) value;
+ return (null == car) ? null : car.toString();
+ } else
+ throw new ConverterException("is not a class util.data.Car");
+ }
+ };
+ }
+
+ /**
+ * Tests converter attribute.
+ *
+ * @param attr
+ * the tested attribute
+ * @param immediate
+ * the immediate attribute value of the current component
+ */
+ public void converterCheck(Attribute attr, boolean immediate) {
+ // converter should be called...
+ if ((statusConverterGetAsObject) && (statusConverterGetAsString)) {
+ // ... getAsObject on the 3th phase if component is not immediate...
+ if (((phaseConverterGetAsObject.equals("PROCESS_VALIDATIONS(3)"))
+ && (!immediate)
+ // ... getAsObject or on the 2th phase if component is immediate...
+ || (phaseConverterGetAsObject.equals("APPLY_REQUEST_VALUES(2)"))
+ && (immediate))
+ // ... and getAsString on the 6th phase
+ && (phaseConverterGetAsString.equals("RENDER_RESPONSE(6)"))) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ }
+
+ /**
+ * Tests converterMessage attribute.
+ *
+ * @param attr
+ * the tested attribute
+ */
+ public void converterMessageCheck(Attribute attr) {
+ // actual message should be given from page
+ if (converterMessageTest.equals("")) {
+ attr.setStatus(Status.NOT_TESTED);
+ } else {
+ if (converterMessageTest.indexOf(converterMessage) != -1) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ }
+ }
+
+ /**
+ * Gets the converter message test.
+ *
+ * @return the converter message test
+ */
+ public String getConverterMessageTest() {
+ return converterMessageTest;
+ }
+
+ /**
+ * Sets the converter message test.
+ *
+ * @param converterMessageTest
+ * the new converter message test
+ */
+ public void setConverterMessageTest(String converterMessageTest) {
+ this.converterMessageTest = converterMessageTest;
+ }
+
+ /**
+ * Gets the converter message.
+ *
+ * @return the converter message
+ */
+ public String getConverterMessage() {
+ return converterMessage;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/UtilListeners.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/UtilListeners.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/UtilListeners.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,90 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 automateCommon;
+
+import javax.faces.component.UICommand;
+import javax.faces.event.ActionEvent;
+
+import components.ImmediateComponentBean;
+import components.RequiredComponentBean;
+
+import util.BeanManager;
+
+import applicationStructure.PageContent;
+
+/**
+ * The Class UtilListeners is used for changing "required" and "immediate"
+ * attributes. Listeners are added to the corresponding buttons when results
+ * grids are generated.
+ */
+public class UtilListeners {
+
+ /**
+ * Immediate action change "immediate" attribute of the current component.
+ *
+ * @param actionEvent
+ * the action event
+ */
+ public void immediateAction(ActionEvent actionEvent) {
+ PageContent pageContentBean = (PageContent) BeanManager
+ .getManagedBeanFromSession("pageContent");
+ // get current selected component
+ String component = pageContentBean.getComponent();
+
+ ImmediateComponentBean compInt = (ImmediateComponentBean) BeanManager
+ .getManagedBeanFromSession(component);
+ // change button name
+ UICommand c = (UICommand) actionEvent.getComponent();
+ if (compInt.isImmediate()) {
+ compInt.setImmediate(false);
+ c.setValue("Now NOT Immediate");
+ } else {
+ compInt.setImmediate(true);
+ c.setValue("Now Immediate");
+ }
+ }
+
+ /**
+ * Required action change "immediate" attribute of the current component.
+ *
+ * @param actionEvent
+ * the action event
+ */
+ public void requiredAction(ActionEvent actionEvent) {
+ PageContent pageContentBean = (PageContent) BeanManager
+ .getManagedBeanFromSession("pageContent");
+ // get current selected component
+ String component = pageContentBean.getComponent();
+
+ RequiredComponentBean compInt = (RequiredComponentBean) BeanManager
+ .getManagedBeanFromSession(component);
+ // change button name
+ UICommand c = (UICommand) actionEvent.getComponent();
+ if (compInt.isRequired()) {
+ compInt.setRequired(false);
+ c.setValue("Now NOT Required");
+ } else {
+ compInt.setRequired(true);
+ c.setValue("Now Required");
+ }
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Validation.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Validation.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Validation.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,279 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 automateCommon;
+
+import java.util.List;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+import util.parser.Attribute;
+import util.parser.Status;
+import util.phaseTracker.PhaseTracker;
+
+/**
+ * The Validation bean provides methods for "validator", "validatorMessage",
+ * "required", "requiredMessage" and "immediate" attributes testing.
+ */
+public class Validation {
+
+ /** The validator message which is defined in "validatorMessage" attribute. */
+ private String validatorMessage;
+
+ /** The validator message test which is actual displayed on the page. */
+ private String validatorMessageTest = "";
+
+ /** The required message which is defined in "requiredMessage" attribute. */
+ private String requiredMessage;
+
+ /** The required message test which is actual displayed on the page. */
+ private String requiredMessageTest = "";
+
+ /** /** The status validator indicates whether validator is called or not. */
+ private boolean statusValidator = false;
+
+ /** The phase validator keeps the JSF phase on which validator is triggered. */
+ private String phaseValidator = "UNDEFINED";
+
+ /**
+ * Instantiates a new validation.
+ */
+ public Validation() {
+ // messages should not be changed in order that test execution is
+ // correct
+ this.validatorMessage = "validator test message!";
+ this.requiredMessage = "required test message!";
+ }
+
+ /**
+ * Resets test variables.
+ */
+ public void reset() {
+ validatorMessageTest = "";
+ requiredMessageTest = "";
+ statusValidator = false;
+ phaseValidator = "UNDEFINED";
+ }
+
+ /**
+ * Validates input value.
+ *
+ * @param context
+ * the context
+ * @param component
+ * the component
+ * @param value
+ * the value
+ *
+ * @throws ValidatorException
+ * the validator exception
+ */
+ @SuppressWarnings("unchecked")
+ public void validate(FacesContext context, UIComponent component,
+ Object value) throws ValidatorException {
+ // validator is called
+ statusValidator = true;
+ // keep phase
+ phaseValidator = PhaseTracker.currentPhase.toString();
+ if (value != null) {
+ if (value instanceof List) {
+ List<Object> arr_value = (List<Object>) value;
+ for (Object val : arr_value) {
+ // should not be changed in order that test execution is
+ // correct
+ if (val.toString().equals("validator")) {
+ throw new ValidatorException(new FacesMessage(
+ FacesMessage.SEVERITY_ERROR,
+ "Validation error", "Incorrect input"));
+ }
+ }
+ } else {
+ String st = value.toString();
+ // should not be changed in order that test execution
+ // is correct
+ if (st.equals("validator")) {
+ throw new ValidatorException(new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "Validation error",
+ "Incorrect input"));
+ }
+ }
+ }
+ }
+
+ /**
+ * Tests validator attribute.
+ *
+ * @param attr
+ * the tested attribute
+ * @param immediate
+ * the immediate attribute value of the current component
+ */
+ public void validatorCheck(Attribute attr, boolean immediate) {
+ // validator should be called...
+ if (statusValidator) {
+ // ... on the 3th phase if component is not immediate...
+ if ((phaseValidator.equals("PROCESS_VALIDATIONS(3)"))
+ && (!immediate)
+ // ... or on the 2th phase if component is immediate
+ || (phaseValidator.equals("APPLY_REQUEST_VALUES(2)"))
+ && (immediate)) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ }
+
+ /**
+ * Tests validatorMessage attribute.
+ *
+ * @param attr
+ * the tested attribute
+ */
+ public void validatorMessageCheck(Attribute attr) {
+ // actual message should be given from page
+ if (validatorMessageTest.equals("")) {
+ attr.setStatus(Status.NOT_TESTED);
+ } else {
+ if (validatorMessageTest.indexOf(validatorMessage) != -1) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ }
+ }
+
+ /**
+ * Tests immediate attribute.
+ *
+ * @param attr
+ * the tested attribute
+ * @param immediate
+ * the immediate attribute value of the current component
+ */
+ public void immediateCheck(Attribute attr, boolean immediate) {
+ // component should be immediate...
+ if ((statusValidator) && (immediate)) {
+ // ...and validator should be called on the 2th phase
+ if (phaseValidator.equals("APPLY_REQUEST_VALUES(2)")) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ } else
+ attr.setStatus(Status.NOT_TESTED);
+ }
+
+ /**
+ * Tests required attribute.
+ *
+ * @param attr
+ * the tested attribute
+ */
+ public void requiredCheck(Attribute attr) {
+ // actual message should be given from page
+ if (requiredMessageTest.equals("")) {
+ attr.setStatus(Status.NOT_TESTED);
+ } else {
+ attr.setStatus(Status.PASSED);
+ }
+ }
+
+ /**
+ * Tests requiredMessage attribute.
+ *
+ * @param attr
+ * the tested attribute
+ */
+ public void requiredMessageCheck(Attribute attr) {
+ // actual message should be given from page
+ if (requiredMessageTest.equals("")) {
+ attr.setStatus(Status.NOT_TESTED);
+ } else {
+ if (requiredMessageTest.indexOf(requiredMessage) != -1) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ }
+ }
+
+ /**
+ * Gets the validator message.
+ *
+ * @return the validator message
+ */
+ public String getValidatorMessage() {
+ return validatorMessage;
+ }
+
+ /**
+ * Gets the required message.
+ *
+ * @return the required message
+ */
+ public String getRequiredMessage() {
+ return requiredMessage;
+ }
+
+ /**
+ * Gets the validator message test.
+ *
+ * @return the validator message test
+ */
+ public String getValidatorMessageTest() {
+ return validatorMessageTest;
+ }
+
+ /**
+ * Sets the validator message test.
+ *
+ * @param validatorMessageTest
+ * the new validator message test
+ */
+ public void setValidatorMessageTest(String validatorMessageTest) {
+ this.validatorMessageTest = validatorMessageTest;
+ }
+
+ /**
+ * Gets the required message test.
+ *
+ * @return the required message test
+ */
+ public String getRequiredMessageTest() {
+ return requiredMessageTest;
+ }
+
+ /**
+ * Sets the required message test.
+ *
+ * @param requiredMessageTest
+ * the new required message test
+ */
+ public void setRequiredMessageTest(String requiredMessageTest) {
+ this.requiredMessageTest = requiredMessageTest;
+ }
+}
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/ImmediateComponentBean.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/ImmediateComponentBean.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/ImmediateComponentBean.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,43 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 components;
+
+/**
+ * The Interface ImmediateComponentBean.
+ */
+public interface ImmediateComponentBean {
+
+ /**
+ * Checks if is immediate.
+ *
+ * @return true, if is immediate
+ */
+ public boolean isImmediate();
+
+ /**
+ * Sets the immediate.
+ *
+ * @param immediate
+ * the new immediate
+ */
+ public void setImmediate(boolean immediate);
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/RequiredComponentBean.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/RequiredComponentBean.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/RequiredComponentBean.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,43 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 components;
+
+/**
+ * The Interface RequiredComponentBean.
+ */
+public interface RequiredComponentBean {
+
+ /**
+ * Checks if is required.
+ *
+ * @return true, if is required
+ */
+ public boolean isRequired();
+
+ /**
+ * Sets the required.
+ *
+ * @param immediate
+ * the new required
+ */
+ public void setRequired(boolean immediate);
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/comboBox/ComboBox.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/comboBox/ComboBox.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/comboBox/ComboBox.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,127 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 components.comboBox;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.model.SelectItem;
+
+import components.ImmediateComponentBean;
+import components.RequiredComponentBean;
+
+import util.data.Car;
+import util.data.CarProvider;
+
+/**
+ * The ComboBox bean.
+ */
+public class ComboBox implements ImmediateComponentBean, RequiredComponentBean {
+
+ /** The items. */
+ private List<SelectItem> items;
+
+ /** The value. */
+ private String value;
+
+ /** The immediate. */
+ private boolean immediate = false;
+
+ /** The required. */
+ private boolean required = false;
+
+ /**
+ * Instantiates a new combo box.
+ */
+ public ComboBox() {
+ CarProvider cp = new CarProvider();
+ List<Car> listCars = cp.getAllCars();
+ items = new ArrayList<SelectItem>();
+ for (Car car : listCars) {
+ items.add(new SelectItem(car.toString()));
+ }
+ }
+
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @param value
+ * the new value
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the items.
+ *
+ * @return the items
+ */
+ public List<SelectItem> getItems() {
+ return items;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.ImmediateComponentBean#setImmediate(boolean)
+ */
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.ImmediateComponentBean#isImmediate()
+ */
+ public boolean isImmediate() {
+ return immediate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.RequiredComponentBean#isRequired()
+ */
+ public boolean isRequired() {
+ return required;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.RequiredComponentBean#setRequired(boolean)
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/dropDownMenu/DropDownMenu.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/dropDownMenu/DropDownMenu.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/dropDownMenu/DropDownMenu.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,29 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 components.dropDownMenu;
+
+/**
+ * The DropDownMenu bean.
+ */
+public class DropDownMenu {
+
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/extendedDataTable/ExtendedDataTable.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/extendedDataTable/ExtendedDataTable.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/extendedDataTable/ExtendedDataTable.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,63 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 components.extendedDataTable;
+
+import java.util.ArrayList;
+
+import util.data.Car;
+import util.data.CarProvider;
+
+/**
+ * The ExtendedDataTable bean.
+ */
+public class ExtendedDataTable {
+
+ /** The value. */
+ private ArrayList<Car> value = null;
+
+ /**
+ * Instantiates a new extended data table.
+ */
+ public ExtendedDataTable() {
+ CarProvider cpr = new CarProvider();
+ value = cpr.getAllCars();
+ }
+
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
+ public ArrayList<Car> getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @param value
+ * the new value
+ */
+ public void setValue(ArrayList<Car> value) {
+ this.value = value;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/pickList/PickList.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/pickList/PickList.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/pickList/PickList.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,134 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 components.pickList;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.model.SelectItem;
+
+import components.ImmediateComponentBean;
+import components.RequiredComponentBean;
+
+/**
+ * The PickList bean.
+ */
+public class PickList implements ImmediateComponentBean, RequiredComponentBean {
+
+ /** The value. */
+ private List<String> value;
+
+ /** The select items. */
+ private ArrayList<SelectItem> selectItems;
+
+ /** The immediate. */
+ private boolean immediate = false;
+
+ /** The required. */
+ private boolean required = false;
+
+ /**
+ * Instantiates a new pick list.
+ */
+ public PickList() {
+ if (selectItems == null) {
+ selectItems = new ArrayList<SelectItem>();
+ for (int i = 0; i < 10; i++) {
+ selectItems.add(new SelectItem("Car-" + i, "lcar-" + i));
+ }
+ }
+ }
+
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
+ public List<String> getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @param value
+ * the new value
+ */
+ public void setValue(List<String> value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the select items.
+ *
+ * @return the select items
+ */
+ public ArrayList<SelectItem> getSelectItems() {
+ return selectItems;
+ }
+
+ /**
+ * Sets the select items.
+ *
+ * @param selectItems
+ * the new select items
+ */
+ public void setSelectItems(ArrayList<SelectItem> selectItems) {
+ this.selectItems = selectItems;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.ImmediateComponentBean#setImmediate(boolean)
+ */
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.ImmediateComponentBean#isImmediate()
+ */
+ public boolean isImmediate() {
+ return immediate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.RequiredComponentBean#isRequired()
+ */
+ public boolean isRequired() {
+ return required;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.RequiredComponentBean#setRequired(boolean)
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/suggestionBox/SuggestionBox.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/suggestionBox/SuggestionBox.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/components/suggestionBox/SuggestionBox.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,127 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 components.suggestionBox;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import util.data.Car;
+import util.data.CarProvider;
+import components.ImmediateComponentBean;
+
+/**
+ * The SuggestionBox bean.
+ */
+public class SuggestionBox implements ImmediateComponentBean {
+
+ /** The data. */
+ private ArrayList<Car> data = null;
+
+ /** The value. */
+ private String value = "";
+
+ /** The immediate. */
+ private boolean immediate = false;
+
+ /**
+ * Instantiates a new suggestion box.
+ */
+ public SuggestionBox() {
+ CarProvider cPr = new CarProvider();
+ data = cPr.getAllCars();
+ data.add(new Car("validator", "", 0));
+ }
+
+ /**
+ * Suggestion action.
+ *
+ * @param obj
+ * the text which is typed by user
+ *
+ * @return the array list< car>
+ */
+ public ArrayList<Car> suggestionAction(Object obj) {
+ String str = (String) obj;
+ ArrayList<Car> result;
+ result = new ArrayList<Car>();
+ Car car;
+ for (Iterator<Car> itCar = this.data.iterator(); itCar.hasNext();) {
+ car = itCar.next();
+ if (null != car) {
+ // if car name or car model contains typed text then add car to
+ // the result list
+ if (car.getMake().toUpperCase().contains(str.toUpperCase())
+ || car.getModel().toUpperCase().contains(
+ str.toUpperCase())) {
+ result.add(car);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets the data.
+ *
+ * @return the data
+ */
+ public ArrayList<Car> getData() {
+ return data;
+ }
+
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @param value
+ * the new value
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.ImmediateComponentBean#setImmediate(boolean)
+ */
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see components.ImmediateComponentBean#isImmediate()
+ */
+ public boolean isImmediate() {
+ return immediate;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/BeanManager.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/BeanManager.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/BeanManager.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,67 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 util;
+
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * The Class BeanManager provides jsf managed bean from http session.
+ */
+public class BeanManager {
+
+ /**
+ * Retrieves jsf managed bean from http session.
+ *
+ * @param managedBeanName
+ * name of bean.
+ *
+ * @return managed bean if founded.
+ */
+ public static Object getManagedBeanFromSession(String managedBeanName) {
+ ValueExpression preDestroyVe = getExpressionFactory()
+ .createValueExpression(getElContext(),
+ "#{" + managedBeanName + "}", Object.class);
+ return preDestroyVe.getValue(getElContext());
+ }
+
+ /**
+ * Returns ElContext object.
+ *
+ * @return el context.
+ */
+ protected static ELContext getElContext() {
+ return FacesContext.getCurrentInstance().getELContext();
+ }
+
+ /**
+ * Returns ExpressionFactory object.
+ *
+ * @return ExpressionFactory.
+ */
+ protected static ExpressionFactory getExpressionFactory() {
+ return FacesContext.getCurrentInstance().getApplication()
+ .getExpressionFactory();
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/data/Car.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/data/Car.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/data/Car.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,164 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 util.data;
+
+/**
+ * The Class Car is used as class for test data.
+ */
+public class Car {
+
+ /** The make. */
+ private String make;
+
+ /** The model. */
+ private String model;
+
+ /** The price. */
+ private Integer price;
+
+ /**
+ * Instantiates a new car.
+ */
+ public Car() {
+ this.make = "";
+ this.model = "";
+ this.price = 0;
+ }
+
+ /**
+ * Instantiates a new car.
+ *
+ * @param mak
+ * the make
+ * @param mod
+ * the model
+ * @param pr
+ * the price
+ */
+ public Car(String mak, String mod, Integer pr) {
+ this.make = mak;
+ this.model = mod;
+ this.price = pr;
+ }
+
+ /**
+ * Gets the make.
+ *
+ * @return the make
+ */
+ public String getMake() {
+ return make;
+ }
+
+ /**
+ * Sets the make.
+ *
+ * @param make
+ * the new make
+ */
+ public void setMake(String make) {
+ this.make = make;
+ }
+
+ /**
+ * Gets the model.
+ *
+ * @return the model
+ */
+ public String getModel() {
+ return model;
+ }
+
+ /**
+ * Sets the model.
+ *
+ * @param model
+ * the new model
+ */
+ public void setModel(String model) {
+ this.model = model;
+ }
+
+ /**
+ * Gets the price.
+ *
+ * @return the price
+ */
+ public Integer getPrice() {
+ return price;
+ }
+
+ /**
+ * Sets the price.
+ *
+ * @param price
+ * the new price
+ */
+ public void setPrice(Integer price) {
+ this.price = price;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((make == null) ? 0 : make.hashCode());
+ result = prime * result + ((model == null) ? 0 : model.hashCode());
+ result = prime * result + ((price == null) ? 0 : price.hashCode());
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Car) {
+ Car car = (Car) obj;
+ if (this.make.equals(car.make) && (this.model.equals(car.model))
+ && (this.price.equals(car.price))) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return this.make + ":" + this.model + ":" + this.price;
+ }
+}
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/data/CarProvider.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/data/CarProvider.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/data/CarProvider.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,176 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 util.data;
+
+import java.util.ArrayList;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * The Class CarProvider parses cars.xml resource file to provide list of Car
+ * objects which is used for test purposes.
+ */
+public class CarProvider extends DefaultHandler {
+
+ /** The all cars. */
+ private ArrayList<Car> allCars = null;
+
+ /**
+ * Instantiates a new car provider.
+ */
+ public CarProvider() {
+ if (allCars == null) {
+ allCars = new ArrayList<Car>();
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ SAXParser sp = spf.newSAXParser();
+ sp.parse(new InputSource(getClass().getResourceAsStream(
+ "cars.xml")), this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Gets the all cars.
+ *
+ * @return the all cars
+ */
+ public ArrayList<Car> getAllCars() {
+ return allCars;
+ }
+
+ /** The element. */
+ private String element = "";
+
+ /** The make. */
+ private String mak = "";
+
+ /** The model. */
+ private String mod = "";
+
+ /** The price. */
+ private Integer pr = 0;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.helpers.DefaultHandler#startDocument()
+ */
+ public void startDocument() {
+ System.out.println("*** > Parser starts its work");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String,
+ * java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String namespaceURI, String localName,
+ String rawName, Attributes attrs) {
+ element = rawName;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int)
+ */
+ public void characters(char ch[], int start, int length) {
+ String text = new String(ch, start, length);
+
+ if (element.equals("make")) {
+ element = "";
+ mak = text;
+ } else if (element.equals("model")) {
+ element = "";
+ mod = text;
+ } else if (element.equals("price")) {
+ try {
+ element = "";
+ Integer p = Integer.parseInt(text);
+ pr = p;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void endElement(String namespaceURI, String localName, String rawName) {
+
+ if (rawName.equals("car")) {
+ allCars.add(new Car(mak, mod, pr));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.helpers.DefaultHandler#endDocument()
+ */
+ public void endDocument() {
+ System.out.println("*** > Parser ends its work");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.helpers.DefaultHandler#warning(org.xml.sax.SAXParseException)
+ */
+ public void warning(SAXParseException ex) {
+ System.err.println("[Warning] : " + ex.getMessage());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.helpers.DefaultHandler#error(org.xml.sax.SAXParseException)
+ */
+ public void error(SAXParseException ex) {
+ System.err.println("[Error] : " + ex.getMessage());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.helpers.DefaultHandler#fatalError(org.xml.sax.SAXParseException)
+ */
+ public void fatalError(SAXParseException ex) throws SAXException {
+ System.err.println("[Fatal Error] : " + ex.getMessage());
+ throw ex;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/Attribute.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/Attribute.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/Attribute.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,181 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 util.parser;
+
+/**
+ * The Class Attribute represents component's attribute.
+ */
+public class Attribute {
+
+ /** The name. */
+ private String name;
+
+ /** The type. */
+ private String type;
+
+ /** The description. */
+ private String description;
+
+ /** The status (NOT_TESTED, FAILED, PASSED). */
+ private Status status;
+
+ /**
+ * Instantiates a new attribute.
+ */
+ public Attribute() {
+ this.name = "";
+ this.type = "";
+ this.description = "";
+ this.status = Status.NOT_TESTED;
+ }
+
+ /**
+ * Instantiates a new attribute.
+ *
+ * @param name
+ * the name
+ */
+ public Attribute(String name) {
+ this.type = "";
+ this.name = name;
+ this.description = "";
+ this.status = Status.NOT_TESTED;
+ }
+
+ /**
+ * Instantiates a new attribute.
+ *
+ * @param name
+ * the name
+ * @param type
+ * the type
+ * @param desc
+ * the description
+ * @param status
+ * the status
+ */
+ public Attribute(String name, String type, String desc, Status status) {
+ this.name = name;
+ this.type = type;
+ this.description = desc;
+ this.status = status;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name
+ * the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type
+ * the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description
+ * the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Gets the status.
+ *
+ * @return the status
+ */
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the status.
+ *
+ * @param status
+ * the new status
+ */
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "[" + "Name: " + name + "\r\n" + "Description: " + description
+ + "\r\n" + "Type: " + type + "\r\n" + "Status: " + status + "]";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ Attribute attr = (Attribute) obj;
+
+ return (attr.getName().equals(this.name));
+ }
+}
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/AttributesList.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/AttributesList.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/AttributesList.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,142 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 util.parser;
+
+import java.util.ArrayList;
+
+/**
+ * The Class AttributesList is used for keeping all attributes of some component
+ * and providing access to events' handlers, styles, classes and common
+ * attributes.
+ */
+public class AttributesList extends ArrayList<Attribute> {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = 3245089852351607636L;
+
+ /**
+ * Instantiates a new attributes list.
+ */
+ public AttributesList() {
+ super();
+ }
+
+ /**
+ * Gets the names array.
+ *
+ * @return the names array
+ */
+ public ArrayList<String> getNamesArray() {
+ ArrayList<String> result = new ArrayList<String>();
+ for (Attribute attr : this) {
+ result.add(attr.getName());
+ }
+ return result;
+ }
+
+ /**
+ * Gets the descriptions array.
+ *
+ * @return the descriptions array
+ */
+ public ArrayList<String> getDescriptionArray() {
+ ArrayList<String> result = new ArrayList<String>();
+ for (Attribute attr : this) {
+ result.add(attr.getDescription());
+ }
+ return result;
+ }
+
+ /**
+ * Gets the types array.
+ *
+ * @return the types array
+ */
+ public ArrayList<String> getTypeArray() {
+ ArrayList<String> result = new ArrayList<String>();
+ for (Attribute attr : this) {
+ result.add(attr.getType());
+ }
+ return result;
+ }
+
+ /**
+ * Gets the statuses array.
+ *
+ * @return the statuses array
+ */
+ public ArrayList<Status> getStatusArray() {
+ ArrayList<Status> result = new ArrayList<Status>();
+ for (Attribute attr : this) {
+ result.add(attr.getStatus());
+ }
+ return result;
+ }
+
+ /**
+ * Gets the handlers.
+ *
+ * @return the handlers
+ */
+ public ArrayList<Attribute> getHandlers() {
+ ArrayList<Attribute> result = new ArrayList<Attribute>();
+ for (Attribute attr : this) {
+ if (attr.getName().startsWith("on")) {
+ result.add(attr);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets the styles.
+ *
+ * @return the styles
+ */
+ public ArrayList<Attribute> getStyles() {
+ ArrayList<Attribute> result = new ArrayList<Attribute>();
+ for (Attribute attr : this) {
+ if (attr.getName().indexOf("tyle") != -1
+ || attr.getName().indexOf("lass") != -1) {
+ result.add(attr);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets the common attributes.
+ *
+ * @return the common attributes
+ */
+ public ArrayList<Attribute> getCommonAttributes() {
+ ArrayList<Attribute> result = new ArrayList<Attribute>();
+ for (Attribute attr : this) {
+ if (!(attr.getName().startsWith("on")
+ || (attr.getName().indexOf("tyle") != -1) || (attr
+ .getName().indexOf("lass") != -1))) {
+ result.add(attr);
+ }
+ }
+ return result;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/Status.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/Status.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/Status.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,29 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 util.parser;
+
+/**
+ * The Enum Status contains all test statuses of the attribute.
+ */
+public enum Status {
+ NOT_TESTED, FAILED, PASSED
+}
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/TLDParser.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/TLDParser.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/parser/TLDParser.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,242 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 util.parser;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * The Class TLDParser parses richfaces.tld file to provide AttributeList object
+ * for selected component.
+ */
+public class TLDParser {
+
+ /** The component's name. */
+ protected String component;
+
+ /** The tld object represents a richfaces.tld file. */
+ protected JarEntry tld;
+
+ /** The richfacesUI object represents a richfaces-ui.jar file. */
+ protected JarFile richfacesUI;
+
+ /** The all attributes. */
+ protected AttributesList allAttributes;
+
+ /**
+ * Instantiates a new tLD parser.
+ *
+ * @param str
+ * the component's name
+ */
+ public TLDParser(String str) {
+ this.component = str;
+ allAttributes = new AttributesList();
+ }
+
+ /**
+ * Gets the all attributes from richfaces.tld file for selected component.
+ *
+ * @return the all attributes
+ */
+ public AttributesList getAllAttributes() {
+ allAttributes.clear();
+ tld = getRichfacesUI().getJarEntry("META-INF/richfaces.tld");
+ InputStream input = null;
+ try {
+ input = richfacesUI.getInputStream(tld);
+
+ InputStreamReader isr = new InputStreamReader(input);
+ BufferedReader reader = new BufferedReader(isr);
+ String line, attr;
+ Attribute attribute = new Attribute();
+ int position, end;
+ boolean insideTag = true;
+ StringBuilder sb = new StringBuilder("");
+ while (((line = reader.readLine()) != null) && insideTag) {
+ if ((position = line.indexOf("<name>")) != -1) {
+ end = line.indexOf("</name>");
+ attr = line.substring(position + 6, end).trim();
+ if (attr.equalsIgnoreCase(component)) {
+ while (!(line = reader.readLine()).contains("</tag>")) {
+ if (line.contains("<attribute>")) {
+ do {
+ // find attribute name
+ if ((position = line.indexOf("<name>")) != -1) {
+ end = line.indexOf("</name>");
+ attribute.setName(line.substring(
+ position + 6, end).trim());
+ }
+ // find attribute description
+ if ((position = line
+ .indexOf("<description>")) != -1) {
+
+ if ((end = line
+ .indexOf("</description>")) != -1) {
+ attribute
+ .setDescription(line
+ .substring(
+ position + 13,
+ line
+ .length() - 14));
+ } else {
+ sb.append(line.substring(
+ position + 13,
+ line.length()).trim()
+ .replaceAll("\t", ""));
+ line = reader.readLine();
+ while ((end = line
+ .indexOf("</description>")) == -1) {
+ sb.append(line.substring(0,
+ line.length())
+ .replaceAll("\t", ""));
+ line = reader.readLine();
+ }
+ sb.append(line.substring(0,
+ line.length() - 14).trim()
+ .replaceAll("\t", ""));
+
+ attribute.setDescription(sb
+ .toString());
+ sb.delete(0, sb.length());
+ }
+ }
+ // find attribute type
+ if ((position = line.indexOf("<type>")) != -1) {
+ end = line.indexOf("</type>");
+ attribute.setType(line.substring(
+ position + 6, end).trim());
+ }
+ // find attribute method-signature
+ if ((position = line
+ .indexOf("<method-signature>")) != -1) {
+ end = line
+ .indexOf("</method-signature>");
+ attribute.setType(line.substring(
+ position + 18, end).trim());
+ }
+ } while (!((line = reader.readLine())
+ .contains("</attribute>")));
+ // define initial attribute status
+ attribute.setStatus(Status.NOT_TESTED);
+ allAttributes.add(attribute);
+ attribute = new Attribute();
+ }
+ }
+ insideTag = false;
+ }
+ }
+ }
+ reader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return allAttributes;
+ }
+
+ /**
+ * Gets the richfaces.tld resource.
+ *
+ * @return the richfaces.tld resource
+ */
+ public String getExtPath() {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ String resource = "META-INF/richfaces.tld";
+ return loader.getResource(resource).toString();
+ }
+
+ /**
+ * Gets the component's name.
+ *
+ * @return the component's name
+ */
+ public String getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets the component's name.
+ *
+ * @param component
+ * the new component's name
+ */
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ /**
+ * Gets the richfacesUI object representing a richfaces-ui.jar file.
+ *
+ * @return the richfaces ui
+ */
+ public JarFile getRichfacesUI() {
+ String temp = null;
+ int position;
+ try {
+ if ((position = getExtPath().indexOf('!')) != -1) {
+ temp = getExtPath().substring("jar:file:\\".length(), position);
+ }
+ richfacesUI = new JarFile(temp);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return richfacesUI;
+ }
+
+ /**
+ * Gets the all possible handlers from richfaces.tld file.
+ *
+ * @return the all possible handlers
+ */
+ public ArrayList<String> getAllHandlers() {
+ tld = getRichfacesUI().getJarEntry("META-INF/richfaces.tld");
+ InputStream input = null;
+ ArrayList<String> handlers = new ArrayList<String>();
+
+ try {
+ input = richfacesUI.getInputStream(tld);
+ InputStreamReader isr = new InputStreamReader(input);
+ BufferedReader reader = new BufferedReader(isr);
+ String line, temp;
+ int start, end;
+ while ((line = reader.readLine()) != null) {
+ if ((start = line.indexOf("<name>")) != -1) {
+ end = line.indexOf("</name>");
+ temp = line.substring(start + 6, end).trim();
+ if (temp.startsWith("on") && !handlers.contains(temp)) {
+ handlers.add(temp);
+ }
+ }
+ }
+ return handlers;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/phaseTracker/PhaseTracker.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/phaseTracker/PhaseTracker.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/util/phaseTracker/PhaseTracker.java 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,70 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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 util.phaseTracker;
+
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+/**
+ * The Class PhaseTracker prints out the phases application passes.
+ */
+public class PhaseTracker implements PhaseListener {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = 6533052212003582848L;
+
+ /** The Current JSF phase of the application. */
+ public static PhaseId currentPhase = PhaseId.ANY_PHASE;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
+ */
+ public void afterPhase(PhaseEvent arg0) {
+ System.out.println("PhaseTracker.afterPhase()" + arg0.getPhaseId());
+ if (arg0.getPhaseId().toString().equals("RENDER_RESPONSE(6)"))
+ System.out.println("********** end lifecycle *************");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.PhaseListener#beforePhase(javax.faces.event.PhaseEvent)
+ */
+ public void beforePhase(PhaseEvent arg0) {
+ if (arg0.getPhaseId().toString().equals("RESTORE_VIEW(1)"))
+ System.out.println("********** begin lifecycle *************");
+ currentPhase = arg0.getPhaseId();
+ System.out.println("PhaseTracker.beforePhase()" + arg0.getPhaseId());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.PhaseListener#getPhaseId()
+ */
+ public PhaseId getPhaseId() {
+ return PhaseId.ANY_PHASE;
+ }
+}
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/resources/messages.properties
===================================================================
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/resources/util/data/cars.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/resources/util/data/cars.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/resources/util/data/cars.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shop>
+ <car>
+ <make>Audi</make>
+ <model>A6</model>
+ <price>40000</price>
+ </car>
+ <car>
+ <make>Audi</make>
+ <model>Q7</model>
+ <price>48500</price>
+ </car>
+ <car>
+ <make>Audi</make>
+ <model>Q5</model>
+ <price>36500</price>
+ </car>
+ <car>
+ <make>Audi</make>
+ <model>Q8</model>
+ <price>102500</price>
+ </car>
+ <car>
+ <make>BMW</make>
+ <model>760Li</model>
+ <price>115400</price>
+ </car>
+ <car>
+ <make>BMW</make>
+ <model>330i</model>
+ <price>38400</price>
+ </car>
+ <car>
+ <make>BMW</make>
+ <model>X6</model>
+ <price>55900</price>
+ </car>
+ <car>
+ <make>Bentley</make>
+ <model>Arnage</model>
+ <price>240000</price>
+ </car>
+ <car>
+ <make>Bugatti</make>
+ <model>Veyron</model>
+ <price>1340000</price>
+ </car>
+ <car>
+ <make>Mercedes-Benz</make>
+ <model>S63 AMG</model>
+ <price>154200</price>
+ </car>
+ <car>
+ <make>Mercedes-Benz</make>
+ <model>SLR</model>
+ <price>854200</price>
+ </car>
+ <car>
+ <make>Mercedes-Benz</make>
+ <model>E63AMG</model>
+ <price>120200</price>
+ </car>
+ <car>
+ <make>Mercedes-Benz</make>
+ <model>R350</model>
+ <price>61200</price>
+ </car>
+ <car>
+ <make>Mercedes-Benz</make>
+ <model>E300D</model>
+ <price>9800</price>
+ </car>
+ <car>
+ <make>Mazda</make>
+ <model>3</model>
+ <price>17300</price>
+ </car>
+ <car>
+ <make>Mazda</make>
+ <model>6</model>
+ <price>21300</price>
+ </car>
+ <car>
+ <make>Mazda</make>
+ <model>CX7</model>
+ <price>24300</price>
+ </car>
+ <car>
+ <make>Fiat</make>
+ <model>Punto</model>
+ <price>8200</price>
+ </car>
+ <car>
+ <make>Fiat</make>
+ <model>Multipla</model>
+ <price>9100</price>
+ </car>
+ <car>
+ <make>Ford</make>
+ <model>GT-40</model>
+ <price>325100</price>
+ </car>
+ <car>
+ <make>Ford</make>
+ <model>Mondeo</model>
+ <price>23100</price>
+ </car>
+ <car>
+ <make>Ford</make>
+ <model>Fiesta</model>
+ <price>5100</price>
+ </car>
+ <car>
+ <make>Ford</make>
+ <model>Scorpio</model>
+ <price>4800</price>
+ </car>
+ <car>
+ <make>Ferrari</make>
+ <model>Enzo</model>
+ <price>950000</price>
+ </car>
+ <car>
+ <make>Jaguar</make>
+ <model>XJ</model>
+ <price>75400</price>
+ </car>
+</shop>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/META-INF/MANIFEST.MF (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/META-INF/MANIFEST.MF 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: rich-jsp.jar
+
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/auto/auto-config.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/auto/auto-config.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/auto/auto-config.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <managed-bean>
+ <managed-bean-name>utilListeners</managed-bean-name>
+ <managed-bean-class>
+ automateCommon.UtilListeners
+ </managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>convertion</managed-bean-name>
+ <managed-bean-class>
+ automateCommon.Convertion
+ </managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>validation</managed-bean-name>
+ <managed-bean-class>
+ automateCommon.Validation
+ </managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>autoEventHandlers</managed-bean-name>
+ <managed-bean-class>
+ automateCommon.AutoEventHandlers
+ </managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>autoStylesClasses</managed-bean-name>
+ <managed-bean-class>
+ automateCommon.AutoStylesClasses
+ </managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>autoGeneral</managed-bean-name>
+ <managed-bean-class>
+ automateCommon.AutoGeneral
+ </managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+</faces-config>
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/comboBox.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/comboBox.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/comboBox.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <managed-bean>
+ <managed-bean-name>comboBox</managed-bean-name>
+ <managed-bean-class>components.comboBox.ComboBox</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+</faces-config>
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/dropDownMenu.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/dropDownMenu.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/dropDownMenu.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <managed-bean>
+ <managed-bean-name>dropDownMenu</managed-bean-name>
+ <managed-bean-class>components.dropDownMenu.DropDownMenu</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+</faces-config>
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/extendedDataTable.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/extendedDataTable.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/extendedDataTable.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <managed-bean>
+ <managed-bean-name>extendedDataTable</managed-bean-name>
+ <managed-bean-class>components.extendedDataTable.ExtendedDataTable</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+</faces-config>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/pickList.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/pickList.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/pickList.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <managed-bean>
+ <managed-bean-name>pickList</managed-bean-name>
+ <managed-bean-class>components.pickList.PickList</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+</faces-config>
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/suggestionBox.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/suggestionBox.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/config/suggestionBox.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <managed-bean>
+ <managed-bean-name>suggestionBox</managed-bean-name>
+ <managed-bean-class>components.suggestionBox.SuggestionBox</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+</faces-config>
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/faces-config.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <managed-bean>
+ <managed-bean-name>pageContent</managed-bean-name>
+ <managed-bean-class>applicationStructure.PageContent</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+ <lifecycle>
+ <phase-listener>util.phaseTracker.PhaseTracker</phase-listener>
+ </lifecycle>
+
+</faces-config>
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/web.xml 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,269 @@
+<?xml version="1.0"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <description>RichFaces JSP Project web.xml</description>
+
+ <context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>#{pageContent.skin}</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
+ <param-value>enable</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING</param-name>
+ <param-value>enable</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING_LEVEL</param-name>
+ <param-value>extended</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.LoadScriptStrategy</param-name>
+ <param-value>ALL</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>
+ /WEB-INF/auto/auto-config.xml,/WEB-INF/config/pickList.xml,/WEB-INF/config/dropDownMenu.xml,/WEB-INF/config/suggestionBox.xml,/WEB-INF/config/comboBox.xml,/WEB-INF/config/extendedDataTable.xml
+ </param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <description>
+ Only applicable if state saving method is "server" (=
+ default). Defines the amount (default = 20) of the latest
+ views are stored in session.
+ </description>
+ <param-name>
+ org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION
+ </param-name>
+ <param-value>20</param-value>
+ </context-param>
+ <context-param>
+ <description>
+ Only applicable if state saving method is "server" (=
+ default). If true (default) the state will be serialized to
+ a byte stream before it is written to the session. If false
+ the state will not be serialized to a byte stream.
+ </description>
+ <param-name>
+ org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
+ </param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <description>
+ Only applicable if state saving method is "server" (=
+ default) and if
+ org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (=
+ default) If true (default) the serialized state will be
+ compressed before it is written to the session. If false the
+ state will not be compressed.
+ </description>
+ <param-name>
+ org.apache.myfaces.COMPRESS_STATE_IN_SESSION
+ </param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <description>
+ This parameter tells MyFaces if javascript code should be
+ allowed in the rendered HTML output. If javascript is
+ allowed, command_link anchors will have javascript code that
+ submits the corresponding form. If javascript is not
+ allowed, the state saving info and nested parameters will be
+ added as url parameters. Default: "true"
+ </description>
+ <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <context-param>
+ <description>
+ If true, rendered HTML code will be formatted, so that it is
+ "human readable". i.e. additional line separators and
+ whitespace will be written, that do not influence the HTML
+ code. Default: "true"
+ </description>
+ <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <description>
+ If true, a javascript function will be rendered that is able
+ to restore the former vertical scroll on every request.
+ Convenient feature if you have pages with long lists and you
+ do not want the browser page to always jump to the top if
+ you trigger a link or button action that stays on the same
+ page. Default: "false"
+ </description>
+ <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Used for encrypting view state. Only relevant for client
+ side state saving. See MyFaces wiki/web site documentation
+ for instructions on how to configure an application for
+ diffenent encryption strengths.
+ </description>
+ <param-name>org.apache.myfaces.SECRET</param-name>
+ <param-value>NzY1NDMyMTA=</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Validate managed beans, navigation rules and ensure that
+ forms are not nested.
+ </description>
+ <param-name>org.apache.myfaces.VALIDATE</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Treat readonly same as if disabled attribute was set for
+ select elements.
+ </description>
+ <param-name>
+ org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS
+ </param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Use the defined class as the class which will be called when
+ a resource is added to the ExtensionFilter handling. Using
+ StreamingAddResource here helps with performance. If you
+ want to add custom components and want to use the
+ ExtensionFilter, you need to provide your custom
+ implementation here.
+ </description>
+ <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
+ <param-value>
+ org.apache.myfaces.renderkit.html.util.DefaultAddResource
+ </param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Virtual path in the URL which triggers loading of resources
+ for the MyFaces extended components in the ExtensionFilter.
+ </description>
+ <param-name>
+ org.apache.myfaces.RESOURCE_VIRTUAL_PATH
+ </param-name>
+ <param-value>/faces/myFacesExtensionResource</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Check if the extensions-filter has been properly configured.
+ </description>
+ <param-name>
+ org.apache.myfaces.CHECK_EXTENSIONS_FILTER
+ </param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Define partial state saving as true/false.
+ </description>
+ <param-name>javax.faces.PARTIAL_STATE_SAVING_METHOD</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <!-- RichFaces Filter -->
+ <filter>
+ <display-name>RichFaces Filter</display-name>
+ <filter-name>richfaces</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+
+ <!-- Extensions Filter -->
+ <filter>
+ <filter-name>MyFacesExtensionsFilter</filter-name>
+ <filter-class>
+ org.apache.myfaces.webapp.filter.ExtensionsFilter
+ </filter-class>
+ <init-param>
+ <param-name>uploadMaxFileSize</param-name>
+ <param-value>20m</param-value>
+ <description>
+ Set the size limit for uploaded files. Format: 10 - 10
+ bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
+ </description>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>richfaces</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ <dispatcher>ERROR</dispatcher>
+ </filter-mapping>
+
+ <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
+ <filter-mapping>
+ <filter-name>MyFacesExtensionsFilter</filter-name>
+ <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
+ <servlet-name>Faces Servlet</servlet-name>
+ </filter-mapping>
+
+ <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
+ <filter-mapping>
+ <filter-name>MyFacesExtensionsFilter</filter-name>
+ <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
+ </filter-mapping>
+
+ <!-- Listener, to allow Jetty serving MyFaces apps -->
+ <listener>
+ <listener-class>
+ org.apache.myfaces.webapp.StartupServletContextListener
+ </listener-class>
+ </listener>
+
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- Faces Servlet Mapping -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+ <!-- Welcome files -->
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+</web-app>
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/combiModalPanel.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/combiModalPanel.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/combiModalPanel.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<%@page contentType="text/html; charset=UTF-8"%>
+<f:view>
+ <html>
+ <head>
+ <title>Current component inside MODAL PANEL</title>
+ <link href="/test-jsp/styles/layout.css" rel="stylesheet"
+ type="text/css" />
+ <script type="text/javascript" src="/test-jsp/javascript/jsTools.js"></script>
+ </head>
+ <body>
+ <rich:modalPanel id="combiModalPanelID" showWhenRendered="true"
+ autosized="true">
+ <f:facet name="controls">
+ <f:verbatim>
+ <a href="#"
+ onclick="Richfaces.hideModalPanel('combiModalPanelID'); return false;">hide</a>
+ </f:verbatim>
+ </f:facet>
+ <f:facet name="header">
+ <h:outputText value="Combi Modal Panel" />
+ </f:facet>
+ <h:form>
+ <a4j:status startText="working" stopText="-------"
+ startStyle="color: red;"></a4j:status>
+ <a4j:outputPanel id="currentComponentInsideModalPanelID"
+ layout="block">
+ <jsp:include page="#{pageContent.currentComponent}" />
+ </a4j:outputPanel>
+ <a4j:commandButton reRender="currentComponentInsideModalPanelID"
+ value="reRender"></a4j:commandButton>
+ </h:form>
+ </rich:modalPanel>
+
+ <a onclick="Richfaces.showModalPanel('combiModalPanelID');" href="#">show
+ ModalPanel with current component</a>
+ </body>
+ </html>
+</f:view>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/header.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/header.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/header.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,49 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="headerSubviewID">
+ <h:panelGrid columns="1">
+ <h:outputText value="RichFaces version: #{pageContent.version}" />
+ <hr />
+ <h:panelGrid columns="8">
+ <h:panelGrid columns="2">
+ <h:commandButton value="Submit" />
+ <a4j:commandButton reRender="componentID" value="A4j Submit" />
+ <h:commandButton immediate="true" value="Immediate Submit" />
+ <a4j:commandButton reRender="componentID" immediate="true"
+ value="Immediate A4j Submit" />
+ </h:panelGrid>
+ <a4j:status startText="working" stopText="-------"
+ startStyleClass="error"></a4j:status>
+ <h:panelGrid columns="2">
+ <h:panelGrid columns="2">
+ <h:outputText value="Component: " />
+ <h:selectOneMenu value="#{pageContent.component}">
+ <f:selectItems value="#{pageContent.allComponents}" />
+ </h:selectOneMenu>
+
+ <h:outputText value="Skin: " />
+ <h:selectOneMenu value="#{pageContent.skin}">
+ <f:selectItems value="#{pageContent.allSkins}" />
+ </h:selectOneMenu>
+ </h:panelGrid>
+ <h:panelGroup>
+ <h:commandButton value="Apply"/>
+ </h:panelGroup>
+ </h:panelGrid>
+ <h:panelGroup></h:panelGroup>
+ <h:panelGroup></h:panelGroup>
+ <h:panelGroup></h:panelGroup>
+ <h:panelGroup></h:panelGroup>
+ <h:panelGroup>
+ <dl>
+ <li><a href="combiModalPanel.jsf" target="newTab">current
+ component inside MODAL PANEL</a></li>
+ <li><a href="#" target="newTab">current component inside
+ DATA TABLE</a></li>
+ </dl>
+ </h:panelGroup>
+ </h:panelGrid>
+ </h:panelGrid>
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/main.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/main.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/applicationStructure/main.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<%@page contentType="text/html; charset=UTF-8"%>
+<f:view>
+ <html>
+ <head>
+ <title>RichFaces JSP+MyFaces Project</title>
+ <link href="/test-jsp/styles/layout.css" rel="stylesheet"
+ type="text/css" />
+ <script type="text/javascript" src="/test-jsp/javascript/jsTools.js"></script>
+ </head>
+ <body>
+ <h:form id="formID">
+ <a4j:outputPanel id="headerID" layout="block"><jsp:include
+ page="header.jsp" />
+ </a4j:outputPanel>
+ <hr />
+ <rich:messages id="messagesID" showDetail="true" styleClass="error" />
+
+ <a4j:outputPanel id="componentID" layout="block">
+ <jsp:include page="#{pageContent.currentComponent}" /></a4j:outputPanel>
+
+ <h:panelGrid columns="4" border="1">
+ <a4j:commandLink value="ManualGeneralAttribute" reRender="testPageID"
+ limitToList="true" immediate="true">
+ <a4j:actionparam name="testType" value="MANUAL_GENERAL_ATTRIBUTES"
+ assignTo="#{pageContent.testType}"></a4j:actionparam>
+ </a4j:commandLink>
+ <a4j:commandLink value="AutoGeneralAttribute" reRender="testPageID"
+ limitToList="true" immediate="true">
+ <a4j:actionparam name="testType" value="AUTO_GENERAL_ATTRIBUTES"
+ assignTo="#{pageContent.testType}"></a4j:actionparam>
+ </a4j:commandLink>
+ <a4j:commandLink value="AutoEventHandlers" reRender="testPageID"
+ limitToList="true" immediate="true">
+ <a4j:actionparam name="testType" value="AUTO_EVENTHANDLERS"
+ assignTo="#{pageContent.testType}"></a4j:actionparam>
+ </a4j:commandLink>
+ <a4j:commandLink value="AutoStylesClasses" reRender="testPageID"
+ limitToList="true" immediate="true">
+ <a4j:actionparam name="testType" value="AUTO_STYLES_CLASSES"
+ assignTo="#{pageContent.testType}"></a4j:actionparam>
+ </a4j:commandLink>
+ </h:panelGrid>
+
+ <a4j:outputPanel id="testPageID" layout="block"><jsp:include
+ page="#{pageContent.currentTestPage}" /></a4j:outputPanel>
+ </h:form>
+ </body>
+ </html>
+</f:view>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoEventHandlers.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoEventHandlers.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoEventHandlers.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,21 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="autoEventHandlersSubviewID">
+
+ <a4j:commandButton value="Get Event Handlers / Reset"
+ reRender="resultEventHandlersPanel"
+ action="#{autoEventHandlers.drawEventHandlersGrid}" ajaxSingle="true">
+ </a4j:commandButton>
+
+ <a4j:outputPanel id="resultEventHandlersPanel">
+ <h:panelGrid id="resultEventHandlersGrid"
+ binding="#{autoEventHandlers.resultEventHandlersGrid}" columns="2" />
+ </a4j:outputPanel>
+
+ <%--
+ <a4j:commandButton process="resultEventHandlersGrid"
+ value="Submit Results"></a4j:commandButton>
+--%>
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoGeneral.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoGeneral.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoGeneral.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,39 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="autoGeneralSubviewID">
+
+ <a4j:commandButton value="Get Automated General Attrs / Reset"
+ reRender="resultAutoGeneralPanel"
+ action="#{autoGeneral.drawAutoGeneralGrid}" ajaxSingle="true">
+ </a4j:commandButton>
+
+ <a4j:outputPanel id="resultAutoGeneralPanel">
+ <h:panelGrid id="resultAutoGeneralGrid"
+ binding="#{autoGeneral.resultAutoGeneralGrid}" columns="2" />
+ </a4j:outputPanel>
+
+ <a4j:commandButton value="TEST" oncomplete="checkMessage()"
+ reRender="componentID, resultAutoGeneralPanel"
+ action="#{autoGeneral.testAutoGeneral}"></a4j:commandButton>
+
+ <div class="notes"><b>NOTE: </b> For testing validator and
+ validatorMessage perform following steps please:
+ <ul>
+ <li>select "validator" value</li>
+ <li>click TEST button</li>
+ <li>select correct value</li>
+ <li>click TEST button again</li>
+ </ul>
+ The same for converter and converterMessage, excepting: "converter"
+ value should be selected.</div>
+
+ <h:inputHidden id="hiddenValidatorInput"
+ value="#{validation.validatorMessageTest}" />
+ <h:inputHidden id="hiddenConverterInput"
+ value="#{convertion.converterMessageTest}" />
+ <h:inputHidden id="hiddenRequiredInput"
+ value="#{validation.requiredMessageTest}" />
+
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoStylesClasses.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoStylesClasses.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/auto/autoStylesClasses.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,24 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="autoStylesClassesSubviewID">
+
+ <a4j:commandButton value="Get Styles and Classes / Reset"
+ reRender="resultStylesClassesPanel"
+ action="#{autoStylesClasses.drawStylesClassesGrid}" ajaxSingle="true">
+ </a4j:commandButton>
+
+ <a4j:outputPanel id="resultStylesClassesPanel">
+ <h:panelGrid id="resultStylesClassesGrid"
+ binding="#{autoStylesClasses.resultStylesClassesGrid}" columns="2" />
+ </a4j:outputPanel>
+
+ <div class="notes"><b>NOTE: </b>Tests for styles could return
+ wrong FAILED result in Firefox and Internet Explorer!</div>
+
+ <%--
+ <a4j:commandButton process="resultStylesClassesGrid"
+ value="Submit Results"></a4j:commandButton>
+--%>
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/_blank/_blank.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/_blank/_blank.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/_blank/_blank.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,3 @@
+<f:subview id="blankID">
+
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/_blank/_blankTestPage.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/_blank/_blankTestPage.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/_blank/_blankTestPage.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,3 @@
+<f:subview id="blankTestPageID">
+
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBox.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBox.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBox.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,70 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="comboBoxSubviewID">
+ <div>The <rich:comboBox> is a component, that provides
+ editable combo box element on a page.</div>
+ <br />
+ <rich:comboBox id="comboBoxID" value="#{comboBox.value}"
+ validator="#{validation.validate}"
+ validatorMessage="#{validation.validatorMessage}"
+ converter="#{convertion.convert}"
+ converterMessage="#{convertion.converterMessage}"
+ onblur="markEventAsWorkable('onblur');"
+ onchange="markEventAsWorkable('onchange');"
+ onclick="markEventAsWorkable('onclick');"
+ ondblclick="markEventAsWorkable('ondblclick');"
+ onfocus="markEventAsWorkable('onfocus');"
+ onkeydown="markEventAsWorkable('onkeydown');"
+ onkeypress="markEventAsWorkable('onkeypress');"
+ onkeyup="markEventAsWorkable('onkeyup');"
+ onlistcall="markEventAsWorkable('onlistcall');"
+ onlistclose="markEventAsWorkable('onlistclose');"
+ onmousedown="markEventAsWorkable('onmousedown');"
+ onmousemove="markEventAsWorkable('onmousemove');"
+ onmouseout="markEventAsWorkable('onmouseout');"
+ onmouseover="markEventAsWorkable('onmouseover');"
+ onmouseup="markEventAsWorkable('onmouseup');"
+ onselect="markEventAsWorkable('onselect');" style="style:style"
+ styleClass="styleClass-styleClass"
+ buttonClass="buttonClass-buttonClass"
+ buttonDisabledClass="buttonDisabledClass-buttonDisabledClass"
+ buttonDisabledStyle="buttonDisabledStyle:buttonDisabledStyle"
+ buttonInactiveClass="buttonInactiveClass-buttonInactiveClass"
+ buttonInactiveStyle="buttonInactiveStyle:buttonInactiveStyle"
+ buttonStyle="buttonStyle:buttonStyle"
+ inputClass="inputClass-inputClass"
+ inputDisabledClass="inputDisabledClass-inputDisabledClass"
+ inputDisabledStyle="inputDisabledStyle:inputDisabledStyle"
+ inputInactiveClass="inputInactiveClass-inputInactiveClass"
+ inputInactiveStyle="inputInactiveStyle:inputInactiveStyle"
+ inputStyle="inputStyle:inputStyle" itemClass="itemClass-itemClass"
+ itemSelectedClass="itemSelectedClass-itemSelectedClass"
+ listClass="listClass-listClass" listStyle="listStyle:listStyle"
+ required="#{comboBox.required}" requiredMessage="#{validation.requiredMessage}"
+ immediate="#{comboBox.immediate}">
+ <f:selectItem itemValue="validator" />
+ <f:selectItem itemValue="converter" />
+ <f:selectItems value="#{comboBox.items}" />
+ </rich:comboBox>
+ <br />
+ <h:panelGrid columns="2">
+ <rich:spacer width="200"></rich:spacer>
+ <h:panelGrid columns="2">
+ <h:commandLink
+ onclick="document.getElementById('formID:comboBoxSubviewID:comboBoxID').component.showList(); return false;"
+ value="showList" />
+ <h:commandLink
+ onclick="document.getElementById('formID:comboBoxSubviewID:comboBoxID').component.hideList(); return false;"
+ value="hideList" />
+ <h:commandLink
+ onclick="document.getElementById('formID:comboBoxSubviewID:comboBoxID').component.enable(); return false;"
+ value="enable" />
+ <h:commandLink
+ onclick="document.getElementById('formID:comboBoxSubviewID:comboBoxID').component.disable(); return false;"
+ value="disable" />
+ </h:panelGrid>
+ </h:panelGrid>
+ <br />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBoxManualGeneral.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBoxManualGeneral.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBoxManualGeneral.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,7 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="comboBoxManualGeneralSubviewID">
+ <h:outputText value="MANUAL_GENERAL_ATTRIBUTES" />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/dropDownMenu/dropDownMenu.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/dropDownMenu/dropDownMenu.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/dropDownMenu/dropDownMenu.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,51 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="dropDownMenuSubviewID">
+ <div>The <rich:dropDownMenu> component is used for creating
+ multilevel drop-down menus.</div>
+ <br />
+ <rich:dropDownMenu id="dropDownMenuID"
+ value="Click HERE to call the menu" submitMode="ajax"
+ oncollapse="markEventAsWorkable('oncollapse');"
+ onexpand="markEventAsWorkable('onexpand');"
+ ongroupactivate="markEventAsWorkable('ongroupactivate');"
+ onitemselect="markEventAsWorkable('onitemselect');"
+ onmousemove="markEventAsWorkable('onmousemove');"
+ onmouseout="markEventAsWorkable('onmouseout');"
+ onmouseover="markEventAsWorkable('onmouseover');" style="style:style"
+ styleClass="styleClass-styleClass"
+ disabledItemClass="disabledItemClass-disabledItemClass"
+ disabledItemStyle="disabledItemStyle:disabledItemStyle"
+ disabledLabelClass="disabledLabelClass-disabledLabelClass"
+ itemClass="itemClass-itemClass" itemStyle="itemStyle:itemStyle"
+ labelClass="labelClass-labelClass"
+ selectedLabelClass="selectedLabelClass-selectedLabelClass"
+ selectItemClass="selectItemClass-selectItemClass"
+ selectItemStyle="selectItemStyle:selectItemStyle">
+ <rich:menuItem value="it-1"></rich:menuItem>
+ <rich:menuItem disabled="true" value="it-2"></rich:menuItem>
+ <rich:menuGroup value="gr-1">
+ <rich:menuItem value="it-1.1"></rich:menuItem>
+ <rich:menuItem value="it-1.2"></rich:menuItem>
+ </rich:menuGroup>
+ <rich:menuGroup disabled="true" value="gr-2">
+ <rich:menuItem value="it-2.1"></rich:menuItem>
+ <rich:menuItem value="it-2.2"></rich:menuItem>
+ </rich:menuGroup>
+ </rich:dropDownMenu>
+ <rich:dropDownMenu id="dropDownMenuDisabledID" value="Disabled menu"
+ disabled="true"
+ disabledItemClass="disabledItemClass-disabledItemClass"
+ disabledItemStyle="disabledItemStyle:disabledItemStyle"
+ disabledLabelClass="disabledLabelClass-disabledLabelClass">
+ <rich:menuItem value="it-1"></rich:menuItem>
+ <rich:menuItem value="it-2"></rich:menuItem>
+ <rich:menuGroup value="gr-1">
+ <rich:menuItem value="it-1.1"></rich:menuItem>
+ <rich:menuItem value="it-1.2"></rich:menuItem>
+ </rich:menuGroup>
+ </rich:dropDownMenu>
+ <br />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/dropDownMenu/dropDownMenuManualGeneral.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/dropDownMenu/dropDownMenuManualGeneral.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/dropDownMenu/dropDownMenuManualGeneral.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,7 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="dropDownMenuManualGeneralSubviewID">
+ <h:outputText value="MANUAL_GENERAL_ATTRIBUTES dropDownMenu" />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/extendedDataTable/extendedDataTable.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/extendedDataTable/extendedDataTable.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/extendedDataTable/extendedDataTable.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,69 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="extendedDataTableSubviewID">
+ <div>The <rich:extendedDataTable> component is used for
+ tables extending standard component <rich:dataTable>.</div>
+ <br />
+ <rich:extendedDataTable id="extendedDataTableID"
+ value="#{extendedDataTable.value}" var="car"
+ onclick="markEventAsWorkable('onclick')"
+ ondblclick="markEventAsWorkable('ondblclick')"
+ onkeydown="markEventAsWorkable('onkeydown')"
+ onkeypress="markEventAsWorkable('onkeypress')"
+ onkeyup="markEventAsWorkable('onkeyup')"
+ onmousedown="markEventAsWorkable('onmousedown')"
+ onmousemove="markEventAsWorkable('onmousemove')"
+ onmouseout="markEventAsWorkable('onmouseout')"
+ onmouseover="markEventAsWorkable('onmouseover')"
+ onmouseup="markEventAsWorkable('onmouseup')"
+ onRowClick="markEventAsWorkable('onRowClick')"
+ onRowDblClick="markEventAsWorkable('onRowDblClick')"
+ onRowMouseDown="markEventAsWorkable('onRowMouseDown')"
+ onRowMouseMove="markEventAsWorkable('onRowMouseMove')"
+ onRowMouseOut="markEventAsWorkable('onRowMouseOut')"
+ onRowMouseOver="markEventAsWorkable('onRowMouseOver')"
+ onRowMouseUp="markEventAsWorkable('onRowMouseUp')"
+ onselectionchange="markEventAsWorkable('onselectionchange')"
+ activeClass="activeClass-activeClass"
+ captionClass="captionClass-captionClass"
+ captionStyle="captionStyle:captionStyle"
+ columnClasses="columnClasses-columnClasses"
+ footerClass="footerClass-footerClass"
+ headerClass="headerClass-headerClass"
+ rowClasses="rowClasses-rowClasses"
+ selectedClass="selectedClass-selectedClass"
+ styleClass="styleClass-styleClass" style="style:style">
+ <f:facet name="caption">
+ <h:outputText value="CAPTION" />
+ </f:facet>
+ <f:facet name="header">
+ <h:outputText value="HEADER" />
+ </f:facet>
+ <rich:column id="makeID" label="Make" sortBy="#{car.make}"
+ filterBy="#{car.make}">
+ <f:facet name="header">
+ <h:outputText value="Make" />
+ </f:facet>
+ <h:outputText value="#{car.make}" />
+ </rich:column>
+ <rich:column id="modelID" label="Model" sortBy="#{car.model}"
+ filterBy="#{car.model}">
+ <f:facet name="header">
+ <h:outputText value="Model" />
+ </f:facet>
+ <h:outputText value="#{car.model}" />
+ </rich:column>
+ <rich:column id="priceID" label="Price" sortBy="#{car.price}">
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="#{car.price}" />
+ </rich:column>
+ <f:facet name="footer">
+ <h:outputText value="Created by ADubovsky@" />
+ </f:facet>
+ </rich:extendedDataTable>
+ <br />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/extendedDataTable/extendedDataTableManualGeneral.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/extendedDataTable/extendedDataTableManualGeneral.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/extendedDataTable/extendedDataTableManualGeneral.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,7 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="extendedDataTableManualGeneralSubviewID">
+ <h:outputText value="extendedDataTable MANUAL_GENERAL_ATTRIBUTES" />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickList.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickList.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickList.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,49 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="pickListSubviewID">
+ <div>The <rich:pickList> component is used for moving
+ selected item(s) from one list into another.</div>
+ <rich:pickList id="pickListID" value="#{pickList.value}"
+ onblur="markEventAsWorkable('onblur');"
+ onclick="markEventAsWorkable('onclick');"
+ ondblclick="markEventAsWorkable('ondblclick');"
+ onfocus="markEventAsWorkable('onfocus');"
+ onkeydown="markEventAsWorkable('onkeydown');"
+ onkeypress="markEventAsWorkable('onkeypress');"
+ onkeyup="markEventAsWorkable('onkeyup');"
+ onlistchange="markEventAsWorkable('onlistchange');"
+ onlistchanged="markEventAsWorkable('onlistchanged');"
+ onmousedown="markEventAsWorkable('onmousedown');"
+ onmousemove="markEventAsWorkable('onmousemove');"
+ onmouseout="markEventAsWorkable('onmouseout');"
+ onmouseover="markEventAsWorkable('onmouseover');"
+ onmouseup="markEventAsWorkable('onmouseup');"
+ controlClass="controlClass-controlClass"
+ disabledStyle="disabledStyle:disabledStyle"
+ disabledStyleClass="disabledStyleClass-disabledStyleClass"
+ enabledStyle="enabledStyle:enabledStyle"
+ enabledStyleClass="enabledStyleClass-enabledStyleClass"
+ listClass="listClass-listClass" style="style:style"
+ styleClass="styleClass-styleClass" validator="#{validation.validate}"
+ validatorMessage="#{validation.validatorMessage}"
+ converter="#{convertion.convert}"
+ converterMessage="#{convertion.converterMessage}"
+ required="#{pickList.required}"
+ requiredMessage="#{validation.requiredMessage}"
+ immediate="#{pickList.immediate}">
+ <f:selectItems value="#{pickList.selectItems}" />
+ <f:selectItem itemLabel="validator" itemValue="validator" />
+ <f:selectItem itemLabel="converter" itemValue="converter" />
+ </rich:pickList>
+ <%-- converter select item should be the last in the list
+ because of https://jira.jboss.org/jira/browse/RF-7472 --%>
+
+ <rich:pickList id="pickListDisabledID" disabled="true"
+ value="#{pickList.value}" disabledStyle="disabledStyle:disabledStyle"
+ disabledStyleClass="disabledStyleClass-disabledStyleClass">
+ <f:selectItems value="#{pickList.selectItems}" />
+ </rich:pickList>
+ <br />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickListManualGeneral.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickListManualGeneral.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickListManualGeneral.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,7 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="pickListManualGeneralSubviewID">
+ <h:outputText value="MANUAL_GENERAL_ATTRIBUTES pickList" />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/suggestionBox/suggestionBox.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/suggestionBox/suggestionBox.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/suggestionBox/suggestionBox.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,48 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="suggestionBoxSubviewID">
+ <div>This element adds "on-keypress" suggestions capabilites to
+ any input text component (like <h:inputText>). It creates a
+ pop-up window for a input field component pointed to by the "for"
+ attribute. For an ordinary request, render a hidden HTML <div>
+ element and the necessary JavaScript code. When input to the target
+ field exceeds the "minChars" property (default is 1), perform an AJAX
+ request with the value current entered. If the AJAX request is detected
+ and the request parameters map contains the client ID of this
+ component, call a method defined by suggestionAction, and use it to
+ return a value as data for render table, same as <h:dataTable>.
+ In this case, the component then works the same as an ordinary
+ dataTable. The rendered table is inserted in the pop-up area and is
+ used for suggestion prompts for input element. If a user clicks on such
+ a table row, its text (or value defined by fetchValue) is inserted as
+ the value of the input field.</div>
+
+ <h:inputText id="sbText" value="#{suggestionBox.value}" />
+ <rich:suggestionbox id="suggestionBoxID" height="300" width="200"
+ for="sbText" suggestionAction="#{suggestionBox.suggestionAction}"
+ var="row" fetchValue="#{row.make}" usingSuggestObjects="true"
+ onbeforedomupdate="markEventAsWorkable('onbeforedomupdate');"
+ oncomplete="markEventAsWorkable('oncomplete');"
+ onobjectchange="markEventAsWorkable('onobjectchange');"
+ onselect="markEventAsWorkable('onselect');"
+ onsubmit="markEventAsWorkable('onsubmit');"
+ entryClass="entryClass-entryClass" popupClass="popupClass-popupClass"
+ popupStyle="popupStyle:popupStyle"
+ rowClasses="rowClasses-rowClasses1, rowClasses-rowClasses2"
+ selectedClass="selectedClass-selectedClass"
+ selectValueClass="selectValueClass-selectValueClass"
+ style="style:style" styleClass="styleClass-styleClass">
+ <rich:column>
+ <h:outputText value="#{row.make}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row.model}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row.price}" />
+ </rich:column>
+ </rich:suggestionbox>
+ <br />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/suggestionBox/suggestionBoxManualGeneral.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/suggestionBox/suggestionBoxManualGeneral.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/suggestionBox/suggestionBoxManualGeneral.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,7 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="suggestionBoxManualGeneralSubviewID">
+ <h:outputText value="MANUAL_GENERAL_ATTRIBUTES suggestionBox" />
+</f:subview>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/index.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/index.jsp (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/index.jsp 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,4 @@
+<%@ page session="false"%>
+<%
+ response.sendRedirect("applicationStructure/main.jsf");
+%>
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/javascript/jsTools.js
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/javascript/jsTools.js (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/javascript/jsTools.js 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,73 @@
+// Function for testing eventHandlers
+var count = 0;
+function markEventAsWorkable(eventName) {
+ var col = document.getElementById('formID:autoEventHandlersSubviewID:' + eventName + 'ID');
+ if (col != null) {
+ col.style.color = 'green';
+ col.value = 'PASSED - ' + count;
+ count++;
+ }
+ return true;
+}
+
+// Function for testing classes
+function markClassAsWorkable(className) {
+ if ((className.indexOf('Style', 1) == (className.length - 5))||(className == 'style'))
+ var selector = '.' + className + ':' + className;
+ else
+ var selector = '.' + className + '-' + className;
+ var counter = jQuery(selector).length;
+ var col = document.getElementById('formID:autoStylesClassesSubviewID:' + className + 'ID');
+ if (col != null) {
+ if (counter > 0) {
+ col.style.color = 'green';
+ col.value = 'PASSED - ' + counter;
+ } else {
+ var arrJS = jQuery('script');
+ var i = 0;
+ var found = false;
+ if ((className.indexOf('Style', 1) > -1)||(className == 'style'))
+ var txtSelector = className + ':' + className;
+ else
+ var txtSelector = className + '-' + className;
+ while ((!found)&&(i < arrJS.length)) {
+ if (arrJS[i].text.indexOf(txtSelector) > -1) {
+ found = true;
+ col.style.color = 'blue';
+ col.value = 'PASSED (found in JS)';
+ }
+ i++;
+ }
+ if (!found) {
+ var eHTML = jQuery('html');
+ if (eHTML[0].innerHTML.indexOf(txtSelector) > -1) {
+ found = true;
+ col.style.color = 'blue';
+ col.value = 'PASSED (found in HTML)';
+ }
+ }
+ if (!found) {
+ col.style.color = 'red';
+ col.value = 'FAILED';
+ }
+ }
+ }
+}
+
+// Function for testing messages
+function checkMessage() {
+ var mes = document.getElementById('formID:messagesID');
+ if (mes != null) {
+ var mesText = mes.innerHTML;
+ if (mesText.indexOf('validator')>-1) {
+ var inp = document.getElementById('formID:autoGeneralSubviewID:hiddenValidatorInput');
+ } else if (mesText.indexOf('converter')>-1) {
+ var inp = document.getElementById('formID:autoGeneralSubviewID:hiddenConverterInput');
+ } else if (mesText.indexOf('required')>-1) {
+ var inp = document.getElementById('formID:autoGeneralSubviewID:hiddenRequiredInput');
+ }
+ if (inp != null) {
+ inp.value = mesText;
+ }
+ }
+}
\ No newline at end of file
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/styles/layout.css
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/styles/layout.css (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/styles/layout.css 2009-07-10 12:44:24 UTC (rev 14881)
@@ -0,0 +1,10 @@
+.error {
+ color: red;
+}
+
+.notes {
+ border-width: 2px;
+ border-color: red;
+ border-style: solid;
+ width: 50%;
+}
\ No newline at end of file
15 years, 2 months
JBoss Rich Faces SVN: r14880 - in branches/community/3.3.X/ui/pickList/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-07-10 08:29:53 -0400 (Fri, 10 Jul 2009)
New Revision: 14880
Modified:
branches/community/3.3.X/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js
branches/community/3.3.X/ui/pickList/src/main/templates/htmlPickList.jspx
Log:
RF-7507
Modified: branches/community/3.3.X/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js
===================================================================
--- branches/community/3.3.X/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js 2009-07-10 12:29:16 UTC (rev 14879)
+++ branches/community/3.3.X/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js 2009-07-10 12:29:53 UTC (rev 14880)
@@ -1,12 +1,24 @@
if(!window.Richfaces) window.Richfaces = {};
Richfaces.PickList = Class.create(Richfaces.ListShuttle, {
- initialize : function($super, targetList, sourceList, clientId, controlIds, switchByClick, switchByDblClick, events, valueKeeperId) {
- $super(targetList, sourceList, clientId, controlIds, switchByClick, switchByDblClick, events);
- this.valueKeeper = $(valueKeeperId);
+ HANDLERS : {
+ copy: function (e) { this.moveItems(this.sourceList, this.targetList, this.sourceList.selectedItems); return false; },
+ copyAll: function (e) { this.moveItems(this.sourceList, this.targetList, this.sourceList.shuttleItems); return false; },
+ remove: function (e) { this.moveItems(this.targetList, this.sourceList, this.targetList.selectedItems); return false; },
+ removeAll: function (e) { this.moveItems(this.targetList, this.sourceList, this.targetList.shuttleItems); return false; }
+ },
+
+ initialize : function($super, id, options) {
+ $super(id, options);
+ this.valueKeeper = $(id + "valueKeeper");
//this.controlListManager();
},
+ createLists: function(id, options) {
+ this.sourceList = new Richfaces.PickList.Source(id, Richfaces.PickList.Source.SelectItem, options.classes);
+ this.targetList = new Richfaces.PickList.Target(id + "tl", Richfaces.PickList.Target.SelectItem, options.classes);
+ },
+
moveItems : function($super, sourceComponent, targetComponent, items) {
this.saveState(items, this.isAdd(sourceComponent));
$super(sourceComponent, targetComponent, items);
@@ -95,11 +107,4 @@
BEGIN: " rich-picklist-target-cell-first",
END: " rich-picklist-target-cell-last"
}
-};
-
-Richfaces.PickList.HANDLERS = {
- copy: function (e) { this.moveItems(this.sourceList, this.targetList, this.sourceList.selectedItems); return false; },
- copyAll: function (e) { this.moveItems(this.sourceList, this.targetList, this.sourceList.shuttleItems); return false; },
- remove: function (e) { this.moveItems(this.targetList, this.sourceList, this.targetList.selectedItems); return false; },
- removeAll: function (e) { this.moveItems(this.targetList, this.sourceList, this.targetList.shuttleItems); return false; }
};
\ No newline at end of file
Modified: branches/community/3.3.X/ui/pickList/src/main/templates/htmlPickList.jspx
===================================================================
--- branches/community/3.3.X/ui/pickList/src/main/templates/htmlPickList.jspx 2009-07-10 12:29:16 UTC (rev 14879)
+++ branches/community/3.3.X/ui/pickList/src/main/templates/htmlPickList.jspx 2009-07-10 12:29:53 UTC (rev 14880)
@@ -69,13 +69,7 @@
//variables.setVariable("selectionState", targetSelectionState);
//String encodedTargetRows = encodeRows(context, component, false);
ListStateFlags listStateFlags = new ListStateFlags();
-
- Boolean switchByClick = (Boolean) component.getAttributes().get("switchByClick");
- variables.setVariable("switchByClick", switchByClick);
-
- Boolean switchByDblClick = (Boolean) component.getAttributes().get("switchByDblClick");
- variables.setVariable("switchByDblClick", switchByDblClick);
-
+
variables.setVariable("baseClientId", component.getBaseClientId(context));
java.util.List<org.richfaces.renderkit.ConvertedSelectItem> convertedItems = getConvertedItems(context, component);
@@ -142,13 +136,13 @@
encodeHiddenField(context, component, convertedItems);
]]></jsp:scriptlet>
- <input id="#{clientId}tlFocusKeeper" type="button" value="" style="width: 1px; position: absolute; left: -32767px;"/>
+ <input id="#{clientId}tlfocusKeeper" type="button" value="" style="width: 1px; position: absolute; left: -32767px;"/>
- <table id="#{clientId}tlTable" cellpadding="0" cellspacing="0" class="rich-picklist-body">
+ <table id="#{clientId}tltable" cellpadding="0" cellspacing="0" class="rich-picklist-body">
<tbody>
<tr>
<td style="border:0px;padding : 0px;">
- <div id="#{clientId}tlHeaderBox" class="rich-picklist-list">
+ <div id="#{clientId}tlheaderBox" class="rich-picklist-list">
<jsp:scriptlet>
<![CDATA[
String trContentContainerStyle = "";
@@ -167,9 +161,9 @@
}
]]>
</jsp:scriptlet>
- <div id="#{clientId}tlContentBox" class="rich-picklist-list-content" style="#{trContentContainerStyle}">
- <table id="#{clientId}tlInternal_tab" class="rich-picklist-internal-tab" cellpadding="0" cellspacing="0">
- <tbody id="#{clientId}tlTbody">
+ <div id="#{clientId}tlcontentBox" class="rich-picklist-list-content" style="#{trContentContainerStyle}">
+ <table id="#{clientId}tlinternal_tab" class="rich-picklist-internal-tab" cellpadding="0" cellspacing="0">
+ <tbody id="#{clientId}tltbody">
<jsp:scriptlet>
<![CDATA[
encodeTargetRows(context, component, listStateFlags, convertedItems);
@@ -196,22 +190,26 @@
<f:call name="reRenderScript" />
<c:if test="#{!component.disabled}">
+ <c:scriptObject var="classes">
+ <c:scriptOption attributes="columnClasses, rowClasses" wrapper="asArray" />
+ </c:scriptObject>
+ <c:scriptObject var="internalOptions">
+ <c:scriptOption variables="classes" />
+ </c:scriptObject>
+ <c:scriptObject var="events">
+ <c:scriptOption attributes="onlistchanged, onlistchange, onfocus, onblur" wrapper="eventHandler" />
+ </c:scriptObject>
+ <c:scriptObject var="options">
+ <c:scriptOption attributes="switchByClick, switchByDblClick" />
+ <c:scriptOption variables="events, internalOptions" />
+ </c:scriptObject>
<script type="text/javascript">
-
- var clientId = '#{clientId}';
new Richfaces.PickList(
- new Richfaces.PickList.Target('#{clientId}', '#{clientId}tlInternal_tab', '#{clientId}tlInternal_header_tab', '#{clientId}tlFocusKeeper', undefined, Richfaces.PickList.Target.SelectItem, #{this:getColumnClassesAsJSArray(context, component)}, #{this:getRowClassesAsJSArray(context, component)}),
- new Richfaces.PickList.Source('#{clientId}', '#{clientId}internal_tab', '#{clientId}internal_header_tab', '#{clientId}focusKeeper', undefined, Richfaces.PickList.Source.SelectItem, #{this:getColumnClassesAsJSArray(context, component)}, #{this:getRowClassesAsJSArray(context, component)}),
- "#{clientId}",
- [['copy', 'discopy'], ['copyAll', 'discopyAll'], ['remove', 'disremove'], ['removeAll','disremoveAll']],
- "#{switchByClick}",
- "#{switchByDblClick}",
- {onlistchanged: #{this:getAsEventHandler(context, component, "onlistchanged")},
- onlistchange: #{this:getAsEventHandler(context, component, "onlistchange")},
- onfocus:#{this:getAsEventHandler(context, component, "onfocus")},
- onblur:#{this:getAsEventHandler(context, component, "onblur")}
- },
- "#{clientId}valueKeeper");
+ "#{clientId}"
+ <c:if test="#{not empty options}">
+ , <f:writeAsScript value="#{options}" />
+ </c:if>
+ );
</script>
</c:if>
</span>
15 years, 2 months
JBoss Rich Faces SVN: r14879 - in branches/community/3.3.X/ui/listShuttle/src: main/templates/org/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-07-10 08:29:16 -0400 (Fri, 10 Jul 2009)
New Revision: 14879
Modified:
branches/community/3.3.X/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
branches/community/3.3.X/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
branches/community/3.3.X/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
Log:
RF-7493
Modified: branches/community/3.3.X/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
===================================================================
--- branches/community/3.3.X/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2009-07-10 12:29:10 UTC (rev 14878)
+++ branches/community/3.3.X/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2009-07-10 12:29:16 UTC (rev 14879)
@@ -42,24 +42,30 @@
}
Richfaces.ListShuttle.prototype = {
- initialize: function(targetList, sourceList, clientId, controlIds, switchByClick, switchByDblClick, events) {
- this.containerId = clientId;
+ HANDLERS : {
+ copy: function (e) { this.copy(); return false; },
+ copyAll: function (e) { this.copyAll(); return false; },
+ remove: function (e) { this.remove(); return false; },
+ removeAll: function (e) { this.removeAll(); return false; }
+ },
+
+ initialize: function(id, options) {
+ options = options || {};
this["rich:destructor"] = "destroy";
- this.container = $(this.containerId);
+ var internalOptions = options.internalOptions || {};
+ this.createLists(id, internalOptions);
+
+ this.container = $(id);
this.container.component = this;
+ this.events = options.events || {};
- this.targetList = targetList;
- this.sourceList = sourceList;
-
- this.events = events;
-
this.isFocused = false;
this.wasMouseDown = false;
this.skipBlurEvent = false;
- this.targetLayoutManager = targetList.layoutManager;
- this.sourceLayoutManager = sourceList.layoutManager;
+ this.targetLayoutManager = this.targetList.layoutManager;
+ this.sourceLayoutManager = this.sourceList.layoutManager;
//for focus\blur custom events
this.container.observe("focus", function (e) {this.focusOrBlurHandlerLS(e);}.bindAsEventListener(this));
@@ -69,29 +75,29 @@
this.container.observe("click", function (e) {this.focusOrBlurHandlerLS(e);}.bindAsEventListener(this));
this.container.observe("blur", function (e) {this.focusOrBlurHandlerLS(e);}.bindAsEventListener(this));
- if (switchByClick == "true") {
+ if (options.switchByClick) {
this.targetList.shuttleTable.observe("click", function(e) {this.moveItemByClick(window.event||e, this.targetList, this.sourceList)}.bindAsEventListener(this));
this.sourceList.shuttleTable.observe("click", function(e) {this.moveItemByClick(window.event||e, this.sourceList, this.targetList)}.bindAsEventListener(this));
Event.stopObserving(this.sourceList.shuttleTable, "click", this.sourceList.clckHandler);
Event.stopObserving(this.targetList.shuttleTable, "click", this.targetList.clckHandler);
} else {
- if (switchByDblClick == "true"){
+ if (options.switchByDblClick){
this.targetList.shuttleTable.observe("dblclick", function(e) {this.moveItemByClick(window.event||e, this.targetList, this.sourceList)}.bindAsEventListener(this));
this.sourceList.shuttleTable.observe("dblclick", function(e) {this.moveItemByClick(window.event||e, this.sourceList, this.targetList)}.bindAsEventListener(this));
}
- sourceList._onclickHandler = sourceList.onclickHandler;
- sourceList.onclickHandler = function(e) { this.onclickHandler(e, sourceList); }.bindAsEventListener(this);
- targetList._onclickHandler = targetList.onclickHandler;
- targetList.onclickHandler = function(e) { this.onclickHandler(e, targetList); }.bindAsEventListener(this);
+ this.sourceList._onclickHandler = this.sourceList.onclickHandler;
+ this.sourceList.onclickHandler = function(e) { this.onclickHandler(e, this.sourceList); }.bindAsEventListener(this);
+ this.targetList._onclickHandler = this.targetList.onclickHandler;
+ this.targetList.onclickHandler = function(e) { this.onclickHandler(e, this.targetList); }.bindAsEventListener(this);
}
- sourceList._onkeydownHandler = sourceList.onkeydownHandler;
- sourceList.onkeydownHandler = function(e) { this.onkeydownHandler(e, sourceList); }.bindAsEventListener(this);
- targetList._onkeydownHandler = targetList.onkeydownHandler;
- targetList.onkeydownHandler = function(e) { this.onkeydownHandler(e, targetList); }.bindAsEventListener(this);
+ this.sourceList._onkeydownHandler = this.sourceList.onkeydownHandler;
+ this.sourceList.onkeydownHandler = function(e) { this.onkeydownHandler(e, this.sourceList); }.bindAsEventListener(this);
+ this.targetList._onkeydownHandler = this.targetList.onkeydownHandler;
+ this.targetList.onkeydownHandler = function(e) { this.onkeydownHandler(e, this.targetList); }.bindAsEventListener(this);
this.controlList = new Array();
- this.initControlList(clientId, controlIds);
+ this.initControlList(id);
for (var e in this.events) {
if (e && this.events[e]) {
@@ -100,23 +106,30 @@
}
},
+ createLists: function(id, options) {
+ this.sourceList = new Richfaces.ListShuttle.Source(id, Richfaces.ListShuttle.Source.SelectItem, options.classes);
+ options.idFuffix = "tl";
+ options.itemClass = Richfaces.ListShuttle.Target.SelectItem;
+ this.targetList = new Richfaces.ListShuttle.Target(id, options);
+ },
+
destroy: function() {
this.container.component = null;
this.targetList.destroy();
this.sourceList.destroy();
},
- initControlList : function(clientId, ids) {
+ initControlList : function(containerId, ids) {
+ var ids = ['copy', 'copyAll', 'remove', 'removeAll'];
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
- var node = $(clientId + id[0]);
- var disNode = $(clientId + id[1]);
+ var node = $(containerId + id);
+ var disNode = $(containerId + "dis" + id);
if (node && disNode) {
- node.observe("click", Richfaces.ListShuttle.HANDLERS[id[0]].bindAsEventListener(this));
- this.controlList[i] = new Richfaces.Control(node, disNode, false, false, id[0]);
+ node.observe('click', this.HANDLERS[id].bindAsEventListener(this));
+ this.controlList[i] = new Richfaces.Control(node, disNode, false, false, id);
}
}
- //this.controlListManager();
},
controlListManager : function() {
@@ -209,7 +222,7 @@
},
addItem : function(component, item) {
- item.doNormal(Richfaces.getExternalClass(item.rowIndex), component.columnsClasses);
+ item.doNormal(Richfaces.getExternalClass(item.rowIndex), component.columnClasses);
component.shuttleTbody.insertBefore(item._node, null);
component.shuttleItems.push(item);
@@ -339,11 +352,4 @@
this.isFocused = false;
this.container.fire("rich:onblur", {});
}
-};
-
-Richfaces.ListShuttle.HANDLERS = {
- copy: function (e) { this.copy(); return false; },
- copyAll: function (e) { this.copyAll(); return false; },
- remove: function (e) { this.remove(); return false; },
- removeAll: function (e) { this.removeAll(); return false; }
};
\ No newline at end of file
Modified: branches/community/3.3.X/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
--- branches/community/3.3.X/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2009-07-10 12:29:10 UTC (rev 14878)
+++ branches/community/3.3.X/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2009-07-10 12:29:16 UTC (rev 14879)
@@ -46,13 +46,7 @@
SelectionState targetSelectionState = new SelectionState();
variables.setVariable(SELECTION_STATE_VAR_NAME, targetSelectionState);
String encodedTargetRows = encodeRows(context, component, false);
-
- Boolean switchByClick = (Boolean) component.getAttributes().get("switchByClick");
- variables.setVariable("switchByClick", switchByClick);
-
- Boolean switchByDblClick = (Boolean) component.getAttributes().get("switchByDblClick");
- variables.setVariable("switchByDblClick", switchByDblClick);
-
+
variables.setVariable("baseClientId", component.getBaseClientId(context));
]]>
</jsp:scriptlet>
@@ -130,13 +124,13 @@
<div class="rich-shuttle-target-items #{component.listClass}" >
<input autocomplete="off" type="hidden" value=":" style="display: none;" name="#{baseClientId}" />
- <input id="#{clientId}tlFocusKeeper" type="button" value="" style="width: 1px; position: absolute; left: -32767px;"/>
+ <input id="#{clientId}tlfocusKeeper" type="button" value="" style="width: 1px; position: absolute; left: -32767px;"/>
- <table id="#{clientId}tlTable" cellpadding="0" cellspacing="0" class="rich-shuttle-body">
+ <table id="#{clientId}tltable" cellpadding="0" cellspacing="0" class="rich-shuttle-body">
<tbody>
<tr>
<td style="border:0px;padding : 0px;">
- <div id="#{clientId}tlHeaderBox" class="rich-shuttle-list">
+ <div id="#{clientId}tlheaderBox" class="rich-shuttle-list">
<jsp:scriptlet>
<![CDATA[
String trContentContainerStyle = "";
@@ -149,7 +143,7 @@
]]>
</jsp:scriptlet>
<div class="rich-shuttle-list-header" style="#{trContentContainerStyle}">
- <table id="#{clientId}tlInternal_header_tab" class="rich-shuttle-internal-header-tab" cellpadding="0" cellspacing="0">
+ <table id="#{clientId}tlinternal_header_tab" class="rich-shuttle-internal-header-tab" cellpadding="0" cellspacing="0">
<f:call name="encodeTLHeader"/>
</table>
</div>
@@ -162,9 +156,9 @@
}
]]>
</jsp:scriptlet>
- <div id="#{clientId}tlContentBox" class="rich-shuttle-list-content" style="#{trContentContainerStyle}">
- <table id="#{clientId}tlInternal_tab" class="rich-shuttle-internal-tab" cellpadding="0" cellspacing="0">
- <tbody id="#{clientId}tlTbody">
+ <div id="#{clientId}tlcontentBox" class="rich-shuttle-list-content" style="#{trContentContainerStyle}">
+ <table id="#{clientId}tlinternal_tab" class="rich-shuttle-internal-tab" cellpadding="0" cellspacing="0">
+ <tbody id="#{clientId}tltbody">
<jsp:scriptlet><![CDATA[
writer.write(encodedTargetRows);
encodedTargetRows = null;
@@ -186,49 +180,30 @@
]]></jsp:scriptlet>
</div>
+ <c:scriptObject var="internalEvents">
+ <c:scriptOption attributes="onorderchanged, onorderchange, ontopclick, onbottomclick, onupclick, ondownclick" wrapper="eventHandler" />
+ </c:scriptObject>
+ <c:scriptObject var="classes">
+ <c:scriptOption attributes="columnClasses, rowClasses" wrapper="asArray" />
+ </c:scriptObject>
+ <c:scriptObject var="internalOptions">
+ <c:scriptOption name="events" value="#{internalEvents}" />
+ <c:scriptOption variables="classes" />
+ </c:scriptObject>
+ <c:scriptObject var="events">
+ <c:scriptOption attributes="onlistchanged, onlistchange, oncopyallclick, oncopyclick, onremoveallclick, onremoveclick, onfocus, onblur" wrapper="eventHandler" />
+ </c:scriptObject>
+ <c:scriptObject var="options">
+ <c:scriptOption attributes="switchByClick, switchByDblClick" />
+ <c:scriptOption variables="events, internalOptions" />
+ </c:scriptObject>
<script type="text/javascript">
- var clientId = '#{clientId}';
- new Richfaces.ListShuttle(
- new Richfaces.ListShuttle.Target(
- '#{clientId}',
- '#{clientId}tlInternal_tab',
- '#{clientId}tlInternal_header_tab',
- '#{clientId}tlFocusKeeper',
- [['up', 'disup'], ['down', 'disdown'], ['last', 'dislast'], ['first','disfirst']],
- '#{clientId}sortLabel',
- {onorderchanged:#{this:getAsEventHandler(context, component, "onorderchanged")},
- onorderchange:#{this:getAsEventHandler(context, component, "onorderchange")},
- ontopclick:#{this:getAsEventHandler(context, component, "ontopclick")},
- onbottomclick:#{this:getAsEventHandler(context, component, "onbottomclick")},
- onupclick:#{this:getAsEventHandler(context, component, "onupclick")},
- ondownclick:#{this:getAsEventHandler(context, component, "ondownclick")}},
- Richfaces.ListShuttle.Target.SelectItem,
- #{this:getColumnClassesAsJSArray(context, component)},
- #{this:getRowClassesAsJSArray(context, component)}
- ),
- new Richfaces.ListShuttle.Source(
- '#{clientId}',
- '#{clientId}internal_tab',
- '#{clientId}internal_header_tab',
- '#{clientId}focusKeeper',
- undefined,
- Richfaces.ListShuttle.Source.SelectItem,
- #{this:getColumnClassesAsJSArray(context, component)},
- #{this:getRowClassesAsJSArray(context, component)}),
- "#{clientId}",
- [['copy', 'discopy'], ['copyAll', 'discopyAll'], ['remove', 'disremove'], ['removeAll','disremoveAll']],
- "#{switchByClick}",
- "#{switchByDblClick}",
- {onlistchanged:#{this:getAsEventHandler(context, component, "onlistchanged")},
- onlistchange:#{this:getAsEventHandler(context, component, "onlistchange")},
- oncopyallclick:#{this:getAsEventHandler(context, component, "oncopyallclick")},
- oncopyclick:#{this:getAsEventHandler(context, component, "oncopyclick")},
- onremoveallclick:#{this:getAsEventHandler(context, component, "onremoveallclick")},
- onremoveclick:#{this:getAsEventHandler(context, component, "onremoveclick")},
- onfocus:#{this:getAsEventHandler(context, component, "onfocus")},
- onblur:#{this:getAsEventHandler(context, component, "onblur")}
- }
- );
+ new Richfaces.ListShuttle(
+ "#{clientId}"
+ <c:if test="#{not empty options}">
+ , <f:writeAsScript value="#{options}" />
+ </c:if>
+ );
</script>
</td>
</tr>
Modified: branches/community/3.3.X/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
===================================================================
--- branches/community/3.3.X/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2009-07-10 12:29:10 UTC (rev 14878)
+++ branches/community/3.3.X/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2009-07-10 12:29:16 UTC (rev 14879)
@@ -202,7 +202,7 @@
assertNotNull(inputs);
assertEquals(1, inputs.size());
inputs = view.getDocumentHtmlElement().
- getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.id_ATTRIBUTE, listShuttle.getClientId(facesContext) + "tlFocusKeeper");
+ getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.id_ATTRIBUTE, listShuttle.getClientId(facesContext) + "tlfocusKeeper");
assertNotNull(inputs);
assertEquals(1, inputs.size());
15 years, 2 months
JBoss Rich Faces SVN: r14878 - in branches/community/3.3.X: ui/orderingList/src/main/java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-07-10 08:29:10 -0400 (Fri, 10 Jul 2009)
New Revision: 14878
Modified:
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
branches/community/3.3.X/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
branches/community/3.3.X/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
branches/community/3.3.X/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
branches/community/3.3.X/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
Log:
RF-7494
Modified: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-07-10 11:44:12 UTC (rev 14877)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-07-10 12:29:10 UTC (rev 14878)
@@ -51,6 +51,7 @@
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.util.HtmlDimensions;
+import org.richfaces.component.util.ComponentUtil;
/**
* Util class for common render operations - render passthru html attributes,
@@ -593,7 +594,20 @@
},
+
/**
+ * Convert parameter to array of srings.
+ */
+ AS_ARRAY {
+
+ @Override
+ Object wrap(Object o) {
+ return ComponentUtil.asArray(o);
+ }
+
+ },
+
+ /**
* Event handler functions wrapper. Wraps <pre>functionCode</pre> object into:
* <pre>function(event) {
* functionCode
Modified: branches/community/3.3.X/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
--- branches/community/3.3.X/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2009-07-10 11:44:12 UTC (rev 14877)
+++ branches/community/3.3.X/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2009-07-10 12:29:10 UTC (rev 14878)
@@ -611,47 +611,4 @@
}
return "display: none;";
}
-
- public String getAsEventHandler(FacesContext context,
- UIComponent component, String attributeName) {
- String event = (String) component.getAttributes().get(attributeName);
- ScriptString result = JSReference.NULL;
-
- if (event != null) {
- event = event.trim();
-
- if (event.length() != 0) {
- JSFunctionDefinition function = new JSFunctionDefinition();
- function.addParameter("event");
- function.addToBody(event);
-
- result = function;
- }
- }
-
- return ScriptUtils.toScript(result);
- }
-
- public String getColumnClassesAsJSArray(FacesContext context,
- UIComponent component) {
- return ScriptUtils.toScript(getClassesAsList(context, component,
- "columnClasses"));
- }
-
- public String getRowClassesAsJSArray(FacesContext context,
- UIComponent component) {
- return ScriptUtils.toScript(getClassesAsList(context, component,
- "rowClasses"));
- }
-
- protected List getClassesAsList(FacesContext context,
- UIComponent component, String attr) {
-
- String value = (String) ((UIDataAdaptor) component).getAttributes()
- .get(attr);
- if (value != null && (value.length() != 0)) {
- return Arrays.asList(value.split(","));
- }
- return null;
- }
}
Modified: branches/community/3.3.X/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
===================================================================
--- branches/community/3.3.X/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2009-07-10 11:44:12 UTC (rev 14877)
+++ branches/community/3.3.X/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2009-07-10 12:29:10 UTC (rev 14878)
@@ -31,16 +31,14 @@
Richfaces.ListBase.CONTROL_SET = ["A", "INPUT", "TEXTAREA", "SELECT", "OPTION", "BUTTON"];
Richfaces.ListBase.prototype = {
- initialize : function(containerId, contentTableId, headerTableId, focusKeeperId,
- onclickControlId, controlClass, columnsClasses, rowClasses) {
+ initialize : function(containerId, controlClass, classes) {
this["rich:destructor"] = "destroy";
this.selectedItems = new Array();
- //this.layoutManager = layoutManager;
- this.container = $(containerId);
+ var contentTableId = containerId + "internal_tab";
this.shuttleTable = $(contentTableId);
this.shuttleTable.onselectstart = Richfaces.disableSelectionText;
- this.focusKeeper = $(focusKeeperId);
+ this.focusKeeper = $(containerId + "focusKeeper");
this.focusKeeper.focused = false;
//this.setFocus();
this.focusKeeper.observe("keydown", (function(e) {this.onkeydownHandler(window.event || e)}).bindAsEventListener(this));
@@ -54,8 +52,7 @@
this.items = null;
//FIX
- this.rowClasses = rowClasses;
- this.columnsClasses = columnsClasses;
+ Object.extend(this, classes);
this.controlClass = controlClass;
this.retrieveShuttleItems(containerId, controlClass);
@@ -65,7 +62,7 @@
this.clckHandler = function(e) {this.onclickHandler(window.event || e)}.bindAsEventListener(this);
this.shuttleTable.observe("click", this.clckHandler);
- this.layoutManager = new LayoutManager(headerTableId, contentTableId);
+ this.layoutManager = new LayoutManager(containerId + "internal_header_tab", contentTableId);
//--- http://jira.jboss.com/jira/browse/RF-3830 FF3 & Safari only!
this.tableElement = document.getElementById(contentTableId);
var rows = this.tableElement.tBodies[0].rows;
@@ -79,7 +76,7 @@
//---
var synch = function() {this.layoutManager.widthSynchronization()}.bindAsEventListener(this);
RichShuttleUtils.execOnLoad(
- synch, RichShuttleUtils.Condition.ElementPresent(this.container), 100
+ synch, RichShuttleUtils.Condition.ElementPresent(this.shuttleTable.parentNode), 100
);
},
@@ -174,7 +171,7 @@
}
if (this.activeItem) {
- this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex), this.columnsClasses);
+ this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex), this.columnClasses);
}
},
@@ -223,7 +220,7 @@
if (event.ctrlKey) {
this.selectAll();
}
- this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex), this.columnsClasses);
+ this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex), this.columnClasses);
Event.stop(event);
break;
}
@@ -246,8 +243,8 @@
item.item.doNormal();
this.resetMarked();
- newItem.item.doSelect(this.getExtRowClass(newItem.rowIndex), this.columnsClasses);
- newItem.item.doActive(this.getExtRowClass(newItem.rowIndex), this.columnsClasses);
+ newItem.item.doSelect(this.getExtRowClass(newItem.rowIndex), this.columnClasses);
+ newItem.item.doActive(this.getExtRowClass(newItem.rowIndex), this.columnClasses);
this.setActiveItem(newItem);
this.selectedItems.push(newItem);
},
@@ -267,9 +264,9 @@
this.resetMarked();
if (activeItem.item.isSelected()) {
- activeItem.item.doNormal(this.getExtRowClass(activeItem.rowIndex), this.columnsClasses);
+ activeItem.item.doNormal(this.getExtRowClass(activeItem.rowIndex), this.columnClasses);
} else {
- activeItem.item.doSelect(this.getExtRowClass(activeItem.rowIndex), this.columnsClasses);
+ activeItem.item.doSelect(this.getExtRowClass(activeItem.rowIndex), this.columnClasses);
this.selectedItems[0] = markedShuttleItem; //TODO: delete
}
},
@@ -282,18 +279,18 @@
if (activeItem.item.isSelected()) {
this.selectedItems.remove(markedShuttleItem); //TODO :delete
- activeItem.item.doNormal(this.getExtRowClass(activeItem.rowIndex), this.columnsClasses);
+ activeItem.item.doNormal(this.getExtRowClass(activeItem.rowIndex), this.columnClasses);
} else {
- activeItem.item.doSelect(this.getExtRowClass(activeItem.rowIndex), this.columnsClasses);
+ activeItem.item.doSelect(this.getExtRowClass(activeItem.rowIndex), this.columnClasses);
this.selectedItems.push(markedShuttleItem); //TODO :delete
}
if ((this.activeItem != null) && (this.activeItem.rowIndex != activeItem.rowIndex)) {
//reset activity of an element
if (this.activeItem.item.isSelected()) {
- this.activeItem.item.doSelect(this.getExtRowClass(this.activeItem.rowIndex), this.columnsClasses);
+ this.activeItem.item.doSelect(this.getExtRowClass(this.activeItem.rowIndex), this.columnClasses);
} else {
- this.activeItem.item.doNormal(this.getExtRowClass(this.activeItem.rowIndex), this.columnsClasses);
+ this.activeItem.item.doNormal(this.getExtRowClass(this.activeItem.rowIndex), this.columnClasses);
}
}
},
@@ -323,7 +320,7 @@
selectItemRange : function(startIndex, endIndex) {
var rows = this.shuttleTbody.rows;
for (var i = startIndex; i <= endIndex; i++) {
- rows[i].item.doSelect(this.getExtRowClass(rows[i].rowIndex), this.columnsClasses);
+ rows[i].item.doSelect(this.getExtRowClass(rows[i].rowIndex), this.columnClasses);
this.selectedItems.push(rows[i]);
}
},
@@ -333,7 +330,7 @@
var length = rows.length;
for (var i = 0; i < length; i++) {
var shuttleItem = rows[i];
- shuttleItem.item.doNormal(this.getExtRowClass(shuttleItem.rowIndex), this.columnsClasses);
+ shuttleItem.item.doNormal(this.getExtRowClass(shuttleItem.rowIndex), this.columnClasses);
}
this.selectedItems.length = 0;
@@ -385,9 +382,9 @@
if (this.activeItem) {
if (this.activeItem.item.isSelected()) {
- this.activeItem.item.doSelect(this.getExtRowClass(this.activeItem.rowIndex), this.columnsClasses);
+ this.activeItem.item.doSelect(this.getExtRowClass(this.activeItem.rowIndex), this.columnClasses);
} else {
- this.activeItem.item.doNormal(this.getExtRowClass(this.activeItem.rowIndex), this.columnsClasses);
+ this.activeItem.item.doNormal(this.getExtRowClass(this.activeItem.rowIndex), this.columnClasses);
}
}
},
Modified: branches/community/3.3.X/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
===================================================================
--- branches/community/3.3.X/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2009-07-10 11:44:12 UTC (rev 14877)
+++ branches/community/3.3.X/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2009-07-10 12:29:10 UTC (rev 14878)
@@ -19,15 +19,17 @@
},
-Richfaces.OrderingList = Class.create(Richfaces.ListBase, {
- initialize: function($super, containerId, contentTableId, headerTableId, focusKeeperId, ids, onclickControlId, events, controlClass, columnsClasses, rowClasses) {
- $super(containerId, contentTableId, headerTableId, focusKeeperId, onclickControlId, controlClass, columnsClasses, rowClasses);
-
+Richfaces.OrderingList = Class.create(Richfaces.ListBase, {
+ initialize: function($super, id, options) {
+ options = options || {};
+ var containerId = id + (options.idFuffix || "");
+ $super(containerId, options.itemClass || Richfaces.OrderingListSelectItem, options.classes);
+ this.container = $(id);
this.container.component = this;
- this.events = events;
+ this.events = options.events || {};
this.controlList = new Array();
- this.initControlList(containerId, ids);
+ this.initControlList(id);
for (var e in this.events) {
if (e && this.events[e]) {
@@ -42,14 +44,15 @@
this.container.component = null;
},
- initControlList : function(containerId, ids) {
+ initControlList : function(containerId) {
+ var ids = ['up', 'down', 'last', 'first'];
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
- var node = $(containerId + id[0]);
- var disNode = $(containerId + id[1]);
+ var node = $(containerId + id);
+ var disNode = $(containerId + "dis" + id);
if (node && disNode) {
- node.observe('click', Richfaces.OrderingList.HANDLERS[id[0]].bindAsEventListener(this));
- this.controlList[i] = new Richfaces.Control(node, disNode, false, false, id[0]);
+ node.observe('click', Richfaces.OrderingList.HANDLERS[id].bindAsEventListener(this));
+ this.controlList[i] = new Richfaces.Control(node, disNode, false, false, id);
}
}
},
@@ -179,7 +182,7 @@
if (event.ctrlKey) {
this.selectAll();
}
- this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex), this.columnsClasses);
+ this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex), this.columnClasses);
this.controlListManager();
Event.stop(event);
break;
Modified: branches/community/3.3.X/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
===================================================================
--- branches/community/3.3.X/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2009-07-10 11:44:12 UTC (rev 14877)
+++ branches/community/3.3.X/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2009-07-10 12:29:10 UTC (rev 14878)
@@ -116,21 +116,21 @@
</table>
<f:clientId var="cId"/>
+ <c:scriptObject var="events">
+ <c:scriptOption attributes="onorderchanged, onorderchange, ontopclick, onbottomclick, onupclick, ondownclick" wrapper="eventHandler" />
+ </c:scriptObject>
+ <c:scriptObject var="classes">
+ <c:scriptOption attributes="columnClasses, rowClasses" wrapper="asArray" />
+ </c:scriptObject>
+ <c:scriptObject var="options">
+ <c:scriptOption variables="events, classes" />
+ </c:scriptObject>
<script type="text/javascript">
- var clientId = '#{cId}';
- new Richfaces.OrderingList('#{cId}', '#{cId}internal_tab',
- '#{cId}internal_header_tab', '#{cId}focusKeeper',
- [['up', 'disup'], ['down', 'disdown'], ['last', 'dislast'], ['first','disfirst']],
- '#{cId}sortLabel',
- {onorderchanged:#{this:getAsEventHandler(context, component, "onorderchanged")},
- onorderchange:#{this:getAsEventHandler(context, component, "onorderchange")},
- ontopclick:#{this:getAsEventHandler(context, component, "ontopclick")},
- onbottomclick:#{this:getAsEventHandler(context, component, "onbottomclick")},
- onupclick:#{this:getAsEventHandler(context, component, "onupclick")},
- ondownclick:#{this:getAsEventHandler(context, component, "ondownclick")}},
- Richfaces.OrderingListSelectItem,
- #{this:getColumnClassesAsJSArray(context, component)},
- #{this:getRowClassesAsJSArray(context, component)});
+ new Richfaces.OrderingList('#{cId}'
+ <c:if test="#{not empty options}">
+ , <f:writeAsScript value="#{options}" />
+ </c:if>
+ );
</script>
</div>
</f:root>
15 years, 2 months
JBoss Rich Faces SVN: r14877 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-07-10 07:44:12 -0400 (Fri, 10 Jul 2009)
New Revision: 14877
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/loadScript.xml
Log:
RF-7483:a4j:loadScript component description review
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/loadScript.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/loadScript.xml 2009-07-10 11:13:58 UTC (rev 14876)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/loadScript.xml 2009-07-10 11:44:12 UTC (rev 14877)
@@ -36,7 +36,7 @@
</table>
<section>
- <title>Creating on a page</title>
+ <title>Creating the Component with a Page Tag</title>
<para>To create the simplest variant on a page use the following syntax:</para>
<para>
@@ -58,28 +58,29 @@
]]></programlisting>
</section>
<section>
- <title>Key attributes and ways of usage</title>
+ <title>Details of usage</title>
<para>
- As it was mentioned <link linkend="loadScript">above</link> this component returns its value as the value of
- the <emphasis><property>"src"</property></emphasis> attribute passing it to the
- <code>getResourceURL()</code> method of the ViewHandler for this application, and passing
- the result through the <code>encodeResourceURL()</code> method of the ExternalContext.
+ The main attribute of the <emphasis role="bold"><property><a4j:loadScript></property></emphasis> is <emphasis><property>"src"</property></emphasis>, wich defines the context relative path to the script.
+ The value of the attribute does not require a prefix of an application.
+ Leading slash in the path means the root of the web context.
+ It is also possible to use <code>resource:///</code> prefix to access the script file using RichFaces resource framework.
</para>
- <para>
- It means that the Context is inserts automatically to the link. And calls
- like <code>resource://</code> is properly handled.
- </para>
- <para>
- Except this - you may be free to put your script links right from the child
- page while using <property>facelets templates</property>.
- </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="JAVA"><![CDATA[<a4j:loadScript src="resource:///org/mycompany/assets/script/focus.js" />]]></programlisting>
+ <para>
+ The <emphasis><property>"src"</property></emphasis> attribute passses value to the <code>getResourceURL()</code> method of the ViewHandler of the application,
+ The result is passed through the <code>encodeResourceURL()</code> method of the ExternalContext.
+ </para>
+
+
</section>
<section>
<title>Relevant resources links</title>
<para>
- <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/script.jsf?c=loadScript">On the component LiveDemo page</ulink> you can see the example of <emphasis role="bold"
- ><property><a4j:loadScript></property></emphasis> usage and sources for the given example.
+ Vizit the <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/script.jsf?c=loadScript">Script page at RichFaces LiveDemo</ulink> for examples of component usage abd their sources.
</para>
</section>
15 years, 2 months
JBoss Rich Faces SVN: r14876 - in branches/jsf2.0/ui: core and 14 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-10 07:13:58 -0400 (Fri, 10 Jul 2009)
New Revision: 14876
Added:
branches/jsf2.0/ui/core/src/main/config/component/queue.xml
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIQueue.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java
branches/jsf2.0/ui/core/src/test-new/
branches/jsf2.0/ui/core/src/test-new/java/
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/AjaxFormQueuesTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/ImplicitQueuesTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/LoadResourceComponentTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueDiscoveryTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueParallelTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueSimilarityTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueuedPollTest.java
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/component.js
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/component.xcss
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-ajax-form.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-disabled.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-discovery-base.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-both.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-form.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-view.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-implicit-global.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-legacy.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-parallel.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll-drop.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-similarity.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-size.xhtml
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/root
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/simulation.js
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/user.js
branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/user.xcss
Removed:
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
Modified:
branches/jsf2.0/ui/core/pom.xml
branches/jsf2.0/ui/core/src/main/config/component/commandLink.xml
branches/jsf2.0/ui/core/src/main/config/component/form.xml
branches/jsf2.0/ui/core/src/main/config/component/include.xml
branches/jsf2.0/ui/core/src/main/config/component/loadStyle.xml
branches/jsf2.0/ui/core/src/main/config/component/log.xml
branches/jsf2.0/ui/core/src/main/config/component/mediaOutput.xml
branches/jsf2.0/ui/core/src/main/config/component/outputPanel.xml
branches/jsf2.0/ui/core/src/main/config/component/page.xml
branches/jsf2.0/ui/core/src/main/config/component/poll.xml
branches/jsf2.0/ui/core/src/main/config/component/region.xml
branches/jsf2.0/ui/core/src/main/config/component/status.xml
branches/jsf2.0/ui/core/src/main/config/component/support.xml
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/KeepAlive.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UISelector.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxPushHandler.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java
branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java
branches/jsf2.0/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended.xcss
branches/jsf2.0/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended_classes.xcss
branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx
branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx
branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx
branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/LoadBundleComponentTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/UIAjaxFormTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxFormRendererTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxIncludeRendererTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRendererTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPageRendererTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPushRendererTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRendererTest.java
branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/MediaOutputRendererTest.java
branches/jsf2.0/ui/pom.xml
Log:
Merged changes r10515:14694 from community/3.3.X branch
Java code updated to compile with JSF 2.0 - some TODOs added fro this
Test sources folder changed to test-new
Modified: branches/jsf2.0/ui/core/pom.xml
===================================================================
--- branches/jsf2.0/ui/core/pom.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/pom.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>ui</artifactId>
<groupId>org.richfaces</groupId>
@@ -8,40 +9,48 @@
<groupId>org.richfaces.ui</groupId>
<artifactId>core</artifactId>
<name>Java Server Faces AJAX framework</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>maven-cdk-plugin</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <executions>
- <execution>
- <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>
- <uri>http://richfaces.org/a4j</uri>
- <shortName>a4j</shortName>
- <displayName>Core ajax components tags</displayName>
- </taglib>
- </library>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>3.3.1.GA</version>
+ <executions>
+ <execution>
+ <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>
+ <uri>http://richfaces.org/a4j</uri>
+ <shortName>a4j</shortName>
+ <displayName>Core ajax components tags</displayName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ <testSourceDirectory>src/test-new</testSourceDirectory>
+ </build>
<dependencies>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-test-base</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: branches/jsf2.0/ui/core/src/main/config/component/commandLink.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/commandLink.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/commandLink.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -71,7 +71,7 @@
&ui_command_attributes;
&html_events;
&html_universal_attributes;
- &html_anchor_attributes;
+ &html_anchor_attributes;
&html_style_attributes;
&ajax_component_attributes;
<property>
@@ -88,10 +88,10 @@
<classname>int</classname>
<description>Timeout ( in ms ) for request.</description>
</property>
- <property>
- <name>disabled</name>
- <classname>boolean</classname>
- <description>If true, disable this component on page.</description>
- </property>
+ <property>
+ <name>disabled</name>
+ <classname>boolean</classname>
+ <description>Disables the component on page. Boolean.</description>
+ </property>
</component>
</components>
\ No newline at end of file
Modified: branches/jsf2.0/ui/core/src/main/config/component/form.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/form.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/form.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -42,6 +42,7 @@
&ui_component_attributes;
&html_form_attributes;
&ajax_component_attributes;
+ &html_style_attributes;
<property>
<name>ajaxSubmit</name>
<classname>boolean</classname>
Modified: branches/jsf2.0/ui/core/src/main/config/component/include.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/include.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/include.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -44,7 +44,7 @@
<property>
<name>viewId</name>
<classname>java.lang.String</classname>
- <description>viewId for included page.</description>
+ <description>Specifies the view id of a page that is included.</description>
</property>
<property>
<name>layout</name>
@@ -58,7 +58,7 @@
where a child element has the property "rendered" set to "false".
In this case, we create an empty <span> element with same ID
as the child element to use as a placeholder for later
- processing.
+ processing. Default value is "inline"
]]>
</description>
<defaultvalue>"inline"</defaultvalue>
Modified: branches/jsf2.0/ui/core/src/main/config/component/loadStyle.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/loadStyle.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/loadStyle.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -34,7 +34,7 @@
<name>src</name>
<classname>java.lang.Object</classname>
<description><![CDATA[
- name of JavaScript resource to load.
+ Defines the context relative path to the style sheet file.
]]>
</description>
</property>
Modified: branches/jsf2.0/ui/core/src/main/config/component/log.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/log.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/log.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -40,14 +40,14 @@
<classname>java.lang.String</classname>
<description>
Keyboard key for activate ( in combination with
- CTRL+SHIFT ) log window.
+ CTRL+SHIFT ) log window. Default value is "L"
</description>
<defaultvalue>"L"</defaultvalue>
</property>
<property>
<name>name</name>
<classname>java.lang.String</classname>
- <description>name of pop-up window</description>
+ <description>Name of pop-up window. Default value is "LogWindow"</description>
<defaultvalue>"LogWindow"</defaultvalue>
</property>
<property>
Modified: branches/jsf2.0/ui/core/src/main/config/component/mediaOutput.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/mediaOutput.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/mediaOutput.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -55,7 +55,7 @@
<property>
<name>usemap</name>
<classname>java.lang.String</classname>
- <description>use client-side image map</description>
+ <description>Specifies an image as a client-side image-map</description>
</property>
<property>
<name>ismap</name>
@@ -84,12 +84,12 @@
<property>
<name>codetype</name>
<classname>java.lang.String</classname>
- <description>content type for code</description>
+ <description>Defines content type for code</description>
</property>
<property>
<name>archive</name>
<classname>java.lang.String</classname>
- <description>space-separated list of URIs</description>
+ <description> Specifies a space-separated list of URIs</description>
</property>
<property>
<name>standby</name>
@@ -135,8 +135,7 @@
<classname>javax.el.MethodExpression</classname>
<description>
<![CDATA[
- Method call expression to send generated resource to OutputStream. It must have two parameter with a type of java.io.OutputStream
- and java.lang.Object ( deserialized value of data attribute )
+ Attribute references to the method that will be used for content creating. The method accepts two parameters. The first parameter has an OutputStream type. It is a reference to the steam that should be used for output. The second parameter is a reference to a 'value' attribute of the component.
]]>
</description>
<methodargs>
@@ -167,7 +166,7 @@
<property>
<name>cacheable</name>
<classname>boolean</classname>
- <description>If "true", the resource is cached (on the server and the client sides).</description>
+ <description>Attribute is a flag that defines the caching strategy. If 'cacheable' is set to false, the response will not be cached. If it is set to true, it will be cached and the serialized value of 'value' attribute plays the role of a cache key.</description>
</property>
<property>
<name>expires</name>
Modified: branches/jsf2.0/ui/core/src/main/config/component/outputPanel.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/outputPanel.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/outputPanel.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -82,7 +82,7 @@
where a child element has the property "rendered" set to "false".
In this case, we create an empty <span> element with same ID
as the child element to use as a placeholder for later
- processing.
+ processing. Default value is "inline"
]]>
</description>
<defaultvalue>"inline"</defaultvalue>
@@ -98,7 +98,7 @@
region all content ( By default, all content in <f:verbatim>
tags and non-jsf elements in facelets, marked as transient -
since, self-rendered ajax regions don't plain output for ajax
- processing ).
+ processing ). Default value is "true"
]]>
</description>
<defaultvalue>true</defaultvalue>
Modified: branches/jsf2.0/ui/core/src/main/config/component/page.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/page.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/page.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -89,14 +89,14 @@
<name>onload</name>
<classname>java.lang.String</classname>
<description>
- JavaScript code to execute on a page load.
+ The client-side script method to be called before a page is loaded
</description>
</property>
<property>
<name>onunload</name>
<classname>java.lang.String</classname>
<description>
- JavaScript code to execute on a page unload.
+ The client-side script method to be called when a page is unloaded
</description>
</property>
<property>
Modified: branches/jsf2.0/ui/core/src/main/config/component/poll.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/poll.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/poll.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -55,8 +55,7 @@
<name>onsubmit</name>
<classname>java.lang.String</classname>
<description>
- JavaScript code for call before submission of ajax
- event
+ The client-side script method to be called before an ajax request is submitted
</description>
</property>
<property>
Copied: branches/jsf2.0/ui/core/src/main/config/component/queue.xml (from rev 14238, trunk/ui/core/src/main/config/component/queue.xml)
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/queue.xml (rev 0)
+++ branches/jsf2.0/ui/core/src/main/config/component/queue.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,117 @@
+<?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.ajax4jsf.Queue</name>
+ <family>org.ajax4jsf.Queue</family>
+ <classname>org.ajax4jsf.component.html.HtmlQueue</classname>
+ <superclass>org.ajax4jsf.component.UIQueue</superclass>
+ <test />
+ <description>
+ <![CDATA[The <a4j:queue> tag.]]>
+ </description>
+ <tag generate="true" bodyContent="empty">
+ <name>queue</name>
+ <classname>org.ajax4jsf.taglib.html.jsp.QueueTag</classname>
+ <superclass>org.ajax4jsf.webapp.taglib.HtmlComponentTagBase</superclass>
+ <test/>
+ </tag>
+ <renderer generate="false">
+ <name>org.ajax4jsf.QueueRenderer</name>
+ <classname>org.ajax4jsf.renderkit.html.QueueRenderer</classname>
+ </renderer>
+ <!--
+ <taghandler>
+ <classname>org.ajax4jsf.taglib.html.facelets.QueueHandler</classname>
+ </taghandler>
+ -->
+
+ &ui_component_attributes;
+
+ <property>
+ <name>size</name>
+ <classname>int</classname>
+ <description>Defines the number of requests allowed in the queue at one time.</description>
+ </property>
+ <property>
+ <name>name</name>
+ <classname>java.lang.String</classname>
+ <description>Specifies to name for the named queue.</description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+
+ <property >
+ <name>requestDelay</name>
+ <classname>int</classname>
+ <description>Attribute defines the time (in ms) the request will be waiting in the queue before it is ready to be sent.</description>
+ </property>
+ <property>
+ <name>ignoreDupResponses</name>
+ <classname>boolean</classname>
+ <description>Attribute allows you to ignore an Ajax response produced by a request if the newest 'similar' request is in the queue already.
+ ignoreDupResponses="true" does not cancel the request while it is processed on the server, but just allows avoiding unnecessary updates on the client side if the response isn't actual now</description>
+ </property>
+ <property>
+ <name>timeout</name>
+ <classname>int</classname>
+ <description>Waiting time for response on a particular request. If no response is received during this time, the request is aborted</description>
+ </property>
+ <property>
+ <name>disabled</name>
+ <classname>boolean</classname>
+ <description>If "true", disables this component on page.</description>
+ </property>
+
+ <property>
+ <name>onsubmit</name>
+ <classname>java.lang.String</classname>
+ <description>The client-side script method to be called before an ajax request is submitted</description>
+ </property>
+ <property>
+ <name>onbeforedomupdate</name>
+ <classname>java.lang.String</classname>
+ <description>The client-side script method to be called before DOM is updated</description>
+ </property>
+ <property>
+ <name>oncomplete</name>
+ <classname>java.lang.String</classname>
+ <description>The client-side script method to be called after the request is completed</description>
+ </property>
+ <property>
+ <name>onerror</name>
+ <classname>java.lang.String</classname>
+ <description>The client-side script method to be called whenever a JavaScript error occurs</description>
+ </property>
+ <property>
+ <name>sizeExceededBehavior</name>
+ <classname>java.lang.String</classname>
+ <description>Defines the strategies of the queue's behavior if the number of the requests waiting in the queue is exceeded.
+ There are four strategies: dropNext (by default), dropNew, fireNext , fireNew.</description>
+ </property>
+ <property>
+ <name>onsizeexceeded</name>
+ <classname>java.lang.String</classname>
+ <description>The client-side script method to be called when a size is exceeded</description>
+ </property>
+ <property>
+ <name>onrequestqueue</name>
+ <classname>java.lang.String</classname>
+ <description>The client-side script method to be called when the request is added to the queue</description>
+ </property>
+ <property>
+ <name>onrequestdequeue</name>
+ <classname>java.lang.String</classname>
+ <description>The client-side script method to be called after the request is removed from the queue</description>
+ </property>
+
+ <property>
+ <name>status</name>
+ <classname>java.lang.String</classname>
+ <description>ID (in format of call UIComponent.findComponent()) of Request status component</description>
+ </property>
+
+ <property hidden="true">
+ <name>rendered</name>
+ </property>
+ </component>
+</components>
Modified: branches/jsf2.0/ui/core/src/main/config/component/region.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/region.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/region.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -72,12 +72,8 @@
<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 "false".
+ Excludes all the components from the outside of the region from updating on the page on Renderer Response phase.
+ Default value is "false".
</description>
<defaultvalue>false</defaultvalue>
</property>
Modified: branches/jsf2.0/ui/core/src/main/config/component/status.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/status.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/status.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -104,7 +104,7 @@
<name>startText</name>
<classname>java.lang.String</classname>
<description>
- Text for display on starting request.
+ Text to display on starting request.
</description>
</property>
<property>
@@ -119,15 +119,14 @@
<name>startStyle</name>
<classname>java.lang.String</classname>
<description>
- CSS style class for the element displayed on the start
- of a request.
+ CSS style rules to be applied to the element displayed when a request is in progress
</description>
</property>
<property>
<name>stopStyle</name>
<classname>java.lang.String</classname>
<description>
- CSS style for element displayed on request completion.
+ CSS style rules to be applied to the element displayed on a request completion
</description>
</property>
@@ -144,31 +143,29 @@
<name>startStyleClass</name>
<classname>java.lang.String</classname>
<description>
- CSS style class for the element displayed on the start
- of a request.
+ Assigns one or more space-separated CSS class names to the element displayed when a request is in progress
</description>
</property>
<property>
<name>stopStyleClass</name>
<classname>java.lang.String</classname>
<description>
- CSS style class for element displayed on request
+ Assigns one or more space-separated CSS class names to the element displayed on a request completion
</description>
</property>
<property>
<name>onstart</name>
<classname>java.lang.String</classname>
<description>
- JavaScript code, called on the start
- of a request.
+ The client-side script method to be called at the start
+ of the request
</description>
</property>
<property>
<name>onstop</name>
<classname>java.lang.String</classname>
<description>
- JavaScript code, called on the stop
- of a request.
+ The client-side script method to be called when the request is finished
</description>
</property>
</component>
Modified: branches/jsf2.0/ui/core/src/main/config/component/support.xml
===================================================================
--- branches/jsf2.0/ui/core/src/main/config/component/support.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/config/component/support.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -85,8 +85,7 @@
<name>onsubmit</name>
<classname>java.lang.String</classname>
<description>
- JavaScript code for call before submission of ajax
- event
+ The client-side script method to be called before an ajax request is submitted
</description>
</property>
<property el="false">
@@ -102,7 +101,7 @@
<name>disableDefault</name>
<classname>boolean</classname>
<description>
- <![CDATA[Disables default action for target event ( append "return false;" to JavaScript )]]>
+ <![CDATA[Disables default action for target event ( append "return false;" to JavaScript ). Default value is "false"]]>
</description>
<defaultvalue>false</defaultvalue>
</property>
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/KeepAlive.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/KeepAlive.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/KeepAlive.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,25 +1,43 @@
-/**
- *
- */
-package org.ajax4jsf.component;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * @author asmirnov
- *
- */
-public class KeepAlive extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.KeepAlive";
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.KeepAlive";
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class KeepAlive extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.KeepAlive";
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.KeepAlive";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+}
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -42,7 +42,7 @@
* @version $Revision: 1.1.2.3 $ $Date: 2007/02/06 16:23:22 $
*
*/
-public abstract class UIAjaxForm extends UIForm implements AjaxComponent, AjaxSource
+public abstract class UIAjaxForm extends UIForm implements AjaxComponent, AjaxSource, IterationStateHolder
{
public static final String COMPONENT_TYPE = "org.ajax4jsf.Form";
@@ -171,4 +171,11 @@
public abstract void setAjaxSubmit(boolean ajax);
+ public Object getIterationState() {
+ return isSubmitted() ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+ public void setIterationState(Object state) {
+ setSubmitted(Boolean.TRUE.equals(state));
+ }
}
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -26,18 +26,14 @@
import java.util.Set;
import javax.el.MethodExpression;
-import javax.faces.FacesException;
import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.component.UIPanel;
-import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.context.AjaxContextImpl;
-import org.ajax4jsf.context.InvokerCallback;
import org.ajax4jsf.event.AjaxListener;
import org.ajax4jsf.renderkit.AjaxContainerRenderer;
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -95,7 +95,7 @@
buildOnEvent.append(onsubmit).append(";");
}
buildOnEvent.append(AjaxRendererUtils.buildOnEvent(this,
- getFacesContext(), getEvent()));
+ getFacesContext(), getEvent(), true));
String script = buildOnEvent.toString();
return script;
}
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -21,6 +21,8 @@
package org.ajax4jsf.component;
+import java.io.IOException;
+
import javax.el.ELContext;
import javax.el.ELException;
import javax.el.ValueExpression;
@@ -51,7 +53,7 @@
public static final String LAYOUT_BLOCK ="block";
public static final String LAYOUT_INLINE ="inline";
- private boolean _ajaxRendered = true;
+ private boolean _ajaxRendered = false;
private boolean _ajaxRenderedSet = false;
private boolean wasNavigation = false;
@@ -63,7 +65,7 @@
* @see org.ajax4jsf.framework.ajax.ViewIdHolder#skipNavigation(java.lang.String)
*/
public boolean skipNavigation(String ViewId) {
-// wasNavigation = true;
+ wasNavigation = true;
return true;
}
@@ -126,8 +128,12 @@
public boolean isAjaxRendered() {
Boolean value = null;
- if(!this._ajaxRenderedSet) {
- ValueExpression ve = getValueExpression("ajaxRendered");
+
+ if(this._ajaxRenderedSet) {
+ return this._ajaxRendered;
+ }
+
+ ValueExpression ve = getValueExpression("ajaxRendered");
if (ve != null) {
try {
value = (Boolean) ve.getValue(getFacesContext().getELContext());
@@ -135,10 +141,11 @@
throw new FacesException(e);
}
}
- }
+
if (null == value) {
- value = this._ajaxRendered;
+// value = this._ajaxRendered;
+ value = isWasNavigation();
}
return (!LAYOUT_NONE.equals(getLayout())) && value;
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,56 +1,73 @@
-/**
- *
- */
-package org.ajax4jsf.component;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author asmirnov
- *
- */
-public class UIPortlet extends UIComponentBase implements NamingContainer {
-
-
- private static final Log _log = LogFactory.getLog(UIPortlet.class);
- /**
- * <p>The standard component type for this component.</p>
- */
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Portlet";
-
-
- /**
- * <p>The standard component family for this component.</p>
- */
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.Portlet";
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily() {
- // TODO Auto-generated method stub
- return COMPONENT_FAMILY;
- }
-
- private String portletId = null;
-
- @Override
- public void setId(String id) {
- portletId = null;
- super.setId(id);
- }
-
- // ----------------------------------------------------- UIComponent Methods
- public String getClientId(FacesContext context) {
- if (portletId == null) {
- portletId = context.getExternalContext().encodeNamespace(super.getClientId(context));
- }
- return portletId;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class UIPortlet extends UIComponentBase implements NamingContainer {
+
+
+ private static final Log _log = LogFactory.getLog(UIPortlet.class);
+ /**
+ * <p>The standard component type for this component.</p>
+ */
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Portlet";
+
+
+ /**
+ * <p>The standard component family for this component.</p>
+ */
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Portlet";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return COMPONENT_FAMILY;
+ }
+
+ private String portletId = null;
+
+ @Override
+ public void setId(String id) {
+ portletId = null;
+ super.setId(id);
+ }
+
+ // ----------------------------------------------------- UIComponent Methods
+ public String getClientId(FacesContext context) {
+ if (portletId == null) {
+ portletId = context.getExternalContext().encodeNamespace(super.getClientId(context));
+ }
+ return portletId;
+ }
+
+}
Copied: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIQueue.java (from rev 14238, trunk/ui/core/src/main/java/org/ajax4jsf/component/UIQueue.java)
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIQueue.java (rev 0)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UIQueue.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,124 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIForm;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public abstract class UIQueue extends UIComponentBase {
+
+ public static final String GLOBAL_QUEUE_NAME = "org.richfaces.queue.global";
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Queue";
+
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Queue";
+
+ public abstract String getName();
+ public abstract void setName(String name);
+
+ public abstract String getOnsubmit();
+ public abstract void setOnsubmit(String onsubmit);
+
+ public abstract String getOncomplete();
+ public abstract void setOncomplete(String oncomplete);
+
+ public abstract String getOnbeforedomupdate();
+ public abstract void setOnbeforedomupdate(String onbeforedomupdate);
+
+ public abstract String getOnerror();
+ public abstract void setOnerror(String onerror);
+
+ public abstract String getOnsizeexceeded();
+ public abstract void setOnsizeexceeded(String onsizeexceeded);
+
+ public abstract boolean isDisabled();
+ public abstract void setDisabled(boolean disabled);
+
+ public abstract int getSize();
+ public abstract void setSize(int size);
+
+ public abstract String getSizeExceededBehavior();
+ public abstract void setSizeExceededBehavior(String behavior);
+
+ public abstract int getTimeout();
+ public abstract void setTimeout(int timeout);
+
+ public abstract int getRequestDelay();
+ public abstract void setRequestDelay(int requestDelay);
+
+ public abstract boolean isIgnoreDupResponses();
+ public abstract void setIgnoreDupResponses(boolean ignoreDupResponses);
+
+ public abstract String getOnrequestqueue();
+ public abstract void setOnrequestqueue(String onrequestqueue);
+
+ public abstract String getOnrequestdequeue();
+ public abstract void setOnrequestdequeue(String onrequestdequeue);
+
+ public abstract String getStatus();
+ public abstract void setStatus(String status);
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ private UIComponent findParentForm() {
+ UIComponent component = getParent();
+ while (component != null && !(component instanceof UIForm)) {
+ component = component.getParent();
+ }
+
+ return component;
+ }
+
+ public String getClientName(FacesContext context) {
+ UIComponent form = findParentForm();
+ String name = getName();
+ String clientName;
+
+ if (form != null) {
+ String formClientId = form.getClientId(context);
+
+ if (name != null && name.length() != 0) {
+ clientName = formClientId + NamingContainer.SEPARATOR_CHAR + name;
+ } else {
+ clientName = formClientId;
+ }
+ } else {
+ if (name == null || name.length() == 0) {
+ name = GLOBAL_QUEUE_NAME;
+ }
+
+ clientName = context.getExternalContext().encodeNamespace(name);
+ }
+
+ return clientName;
+ }
+}
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UISelector.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UISelector.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/component/UISelector.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -47,7 +47,7 @@
private static final AjaxChildrenRenderer childrenRenderer = new AjaxChildrenRenderer() {
- protected Class getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return UISelector.class;
}
@@ -74,20 +74,19 @@
* @see org.ajax4jsf.framework.ajax.AjaxChildrenEncoder#encodeAjaxChild(javax.faces.context.FacesContext,
* java.lang.String, java.util.Set, java.util.Set)
*/
- public void encodeAjaxChild(FacesContext context, String path, Set ids,
- Set renderedAreas) throws IOException {
+ public void encodeAjaxChild(FacesContext context, String path,
+ Set<String> ids, Set<String> renderedAreas) throws IOException {
if (getChildCount() != 1) {
- throw new FacesException(
- "Selector component must have one, and only one, child");
+ throw new FacesException("Selector component must have one, and only one, child");
}
UIComponent child = (UIComponent) getChildren().get(0);
- Set ajaxKeys = getAjaxKeys();
+ Set<Object> ajaxKeys = getAjaxKeys();
if (null != ajaxKeys) {
String iterationProperty = getIterationProperty();
try {
Object savedKey = PropertyUtils.getProperty(child,
iterationProperty);
- for (Iterator iter = ajaxKeys.iterator(); iter.hasNext();) {
+ for (Iterator<Object> iter = ajaxKeys.iterator(); iter.hasNext();) {
Object key = (Object) iter.next();
PropertyUtils.setProperty(child, iterationProperty, key);
if (true) {
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -22,7 +22,7 @@
package org.ajax4jsf.renderkit;
import java.io.IOException;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
@@ -62,7 +62,7 @@
Set<String> toProcess = AjaxRendererUtils.asSet(ajaxComponent
.getProcess());
if (null != toProcess) {
- HashSet<String> componentIdsToProcess = new HashSet<String>();
+ Set<String> componentIdsToProcess = new LinkedHashSet<String>();
for (String componentId : toProcess) {
UIComponent component = getUtils().findComponentFor(uiComponent, componentId);
if(null != component){
@@ -80,7 +80,7 @@
public String getOnClick(FacesContext context, UIComponent component) {
StringBuffer onClick;
if (!getUtils().isBooleanAttribute(component, "disabled")) {
- onClick = AjaxRendererUtils.buildOnClick(component, context);
+ onClick = AjaxRendererUtils.buildOnClick(component, context, true);
if (!"reset".equals(component.getAttributes().get("type"))) {
onClick.append(";return false;");
}
@@ -125,7 +125,7 @@
return false;
}
String clientId = uiComponent.getClientId(facesContext);
- Map paramMap = facesContext.getExternalContext()
+ Map<String, String> paramMap = facesContext.getExternalContext()
.getRequestParameterMap();
Object value = paramMap.get(clientId);
boolean submitted = null != value;
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -25,6 +25,7 @@
import java.util.Iterator;
import java.util.Map;
+import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
@@ -46,29 +47,33 @@
*
* @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
*/
- protected Class getComponentClass() {
- // TODO Auto-generated method stub
+ protected Class<? extends UIComponent> getComponentClass() {
return null;
}
public String getFunction(FacesContext context, UIAjaxFunction component) {
- StringBuffer script = new StringBuffer(component.getName()).append("=");
+ String functionName = component.getName();
+ if (functionName == null) {
+ throw new FacesException("Value of 'name' attribute of a4j:jsFunction component is null!");
+ }
+
+ StringBuffer script = new StringBuffer(functionName).append("=");
JSFunctionDefinition func = new JSFunctionDefinition();
//func.setName(component.getName());
// 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, true);
+ 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: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -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: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -22,7 +22,6 @@
package org.ajax4jsf.renderkit.html;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -38,6 +37,7 @@
import org.ajax4jsf.component.UIAjaxForm;
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
@@ -132,7 +132,7 @@
component, context,
AJAX_FORM_FUNCTION_NAME);
ajaxFunction.addParameter(AjaxRendererUtils.buildEventOptions(
- context, component));
+ context, component, false));
ajaxFunction.appendScript(onSubmit);
writer.writeURIAttribute("action", onSubmit, "action");
} else {
@@ -238,6 +238,7 @@
Object value) throws IOException {
writer.startElement(HTML.INPUT_ELEM, null);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(HTML.autocomplete_ATTRIBUTE, "off", null);
writer.writeAttribute(HTML.NAME_ATTRIBUTE, name, null);
writer.writeAttribute(HTML.value_ATTRIBUTE, value != null?value:"", null);
writer.endElement(HTML.INPUT_ELEM);
@@ -300,7 +301,7 @@
script.append("\n}");
script.append("\n");
script.append("function ").append("clearFormHiddenParams_").append(
- getValidJavascriptName(formName));
+ ScriptUtils.getValidJavascriptName(formName));
script.append("(){").append(functionName).append("();}\n");
// MyFaces 1.1.5 clear form function name
@@ -335,59 +336,7 @@
* @return String
*/
public String getClearHiddenCommandFormParamsFunctionName(String formName) {
- return "clear_" + getValidJavascriptName(formName);
+ return "clear_" + ScriptUtils.getValidJavascriptName(formName);
}
- public String getValidJavascriptName(String s) {
-
- StringBuffer buf = null;
- for (int i = 0, len = s.length(); i < len; i++) {
- char c = s.charAt(i);
-
- if (Character.isLetterOrDigit(c)||c=='_' ) {
- // allowed char
- if (buf != null)
- buf.append(c);
- } else {
- if (buf == null) {
- buf = new StringBuffer(s.length() + 10);
- buf.append(s.substring(0, i));
- }
-
- buf.append('_');
- if (c < 16) {
- // pad single hex digit values with '0' on the left
- buf.append('0');
- }
-
- if (c < 128) {
- // first 128 chars match their byte representation in UTF-8
- buf.append(Integer.toHexString(c).toUpperCase());
- } else {
- byte[] bytes;
- try {
- bytes = Character.toString(c).getBytes("UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
-
- for (int j = 0; j < bytes.length; j++) {
- int intVal = bytes[j];
- if (intVal < 0) {
- // intVal will be >= 128
- intVal = 256 + intVal;
- } else if (intVal < 16) {
- // pad single hex digit values with '0' on the left
- buf.append('0');
- }
- buf.append(Integer.toHexString(intVal).toUpperCase());
- }
- }
- }
-
- }
-
- return buf == null ? s : buf.toString();
- }
-
}
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -59,7 +59,7 @@
StringBuffer script = new StringBuffer("\n");
if(poll.isEnabled()){
JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_POLL_FUNCTION);
- Map options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map options = AjaxRendererUtils.buildEventOptions(context, component, true);
Integer interval = new Integer(poll.getInterval());
options.put("pollinterval", interval);
options.put("pollId", component.getClientId(context));
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -69,7 +69,7 @@
if(push.isEnabled()){
JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_PUSH_FUNCTION);
// Set dummy form id, if nessesary.
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component, false);
options.put("dummyForm", component.getClientId(context)+RendererUtils.DUMMY_FORM_ID);
int interval = push.getInterval();
if(interval == Integer.MIN_VALUE){
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -36,9 +36,11 @@
import javax.faces.event.ActionEvent;
import org.ajax4jsf.Messages;
+import org.ajax4jsf.javascript.AjaxScript;
import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.InternetResource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -49,14 +51,20 @@
* @author shura
*
*/
-public class HtmlCommandLinkRenderer extends RendererBase {
+public class HtmlCommandLinkRenderer extends HeaderResourcesRendererBase {
private static final Log _log = LogFactory.getLog(HtmlCommandLinkRenderer.class);
private static final String[] LINK_EXCLUSIONS = {"onclick","target","href"};
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+
+ private InternetResource[] scripts = null;
+ private static final String FORM_SCRIPT = "/org/ajax4jsf/javascript/scripts/form.js";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
*/
protected void doDecode(FacesContext context, UIComponent component) {
UIForm form = getUtils().getNestingForm(context,component);
@@ -120,7 +128,19 @@
Object child = iter.next();
if (child instanceof UIParameter) {
UIParameter param = (UIParameter) child;
- parameters.put(param.getName(),param.getValue());
+ String name = ((UIParameter) child).getName();
+ Object value = ((UIParameter) child).getValue();
+
+ if (name == null) {
+ throw new IllegalArgumentException(Messages.getMessage(
+ Messages.UNNAMED_PARAMETER_ERROR, component.getClientId(context)));
+ }
+
+ if (value == null) {
+ value = "";
+ }
+
+ parameters.put(name,value);
}
}
@@ -216,4 +236,18 @@
writer.writeText(valueString,null);
}
}
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.HeaderResourcesRendererBase#getScripts()
+ */
+ protected InternetResource[] getScripts() {
+ synchronized (this) {
+ if (scripts == null) {
+ scripts = new InternetResource[1];
+ scripts[0] = getResource(FORM_SCRIPT);
+ }
+ }
+
+ return scripts;
+ }
}
Copied: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java (from rev 14238, trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java)
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java (rev 0)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,190 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.component.QueueRegistry;
+import org.ajax4jsf.component.UIQueue;
+import org.ajax4jsf.javascript.AjaxScript;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.renderkit.html.scripts.QueueScript;
+import org.ajax4jsf.resource.InternetResource;
+import org.richfaces.component.util.MessageUtil;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueRenderer extends HeaderResourcesRendererBase {
+
+ private static final String SIZE_EXCEEDED_BEHAVIOR = "sizeExceededBehavior";
+
+ private static final String SIZE = "size";
+
+ private static final String QUEUE_ONSUBMIT_ATTRIBUTE = "queueonsubmit";
+
+ private static final String QUEUE_ONBEFOREDOMUPDATE_ATTRIBUTE = "queueonbeforedomupdate";
+
+ private static final String QUEUE_ONCOMPLETE_ATTRIBUTE = "queueoncomplete";
+
+ private static final String QUEUE_ONERROR_ATTRIBUTE = "queueonerror";
+
+ public static final String BEHAVIOR_DROP_NEXT = "dropNext";
+
+ public static final String BEHAVIOR_DROP_NEW = "dropNew";
+
+ public static final String BEHAVIOR_FIRE_NEXT = "fireNext";
+
+ public static final String BEHAVIOR_FIRE_NEW = "fireNew";
+
+ private static final String[] REQUEST_ATTRIBUTES = new String[] {
+ "ignoreDupResponses",
+ "requestDelay",
+ "timeout"
+ };
+
+ private InternetResource[] scripts = new InternetResource[] {
+ getResource(AjaxScript.class.getName()),
+ getResource(QueueScript.class.getName())
+ };
+
+ @Override
+ protected InternetResource[] getScripts() {
+ return scripts;
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIQueue.class;
+ }
+
+ private static final RendererUtils utils = RendererUtils.getInstance();
+
+ private boolean isValidBehaviorValue(String value) {
+ return BEHAVIOR_DROP_NEW.equals(value) || BEHAVIOR_DROP_NEXT.equals(value) ||
+ BEHAVIOR_FIRE_NEW.equals(value) || BEHAVIOR_FIRE_NEXT.equals(value);
+ }
+
+ private QueueRendererData createRendererData(FacesContext context, UIQueue queue) {
+ Map<String, Object> attributes = queue.getAttributes();
+
+ QueueRendererData data = new QueueRendererData();
+
+ int size = queue.getSize();
+ if (utils.shouldRenderAttribute(size)) {
+ data.addQueueAttribute(SIZE, size);
+ }
+
+ String sizeExceededBehavior = (String) attributes.get(SIZE_EXCEEDED_BEHAVIOR);
+ if (utils.shouldRenderAttribute(sizeExceededBehavior)) {
+ if (!isValidBehaviorValue(sizeExceededBehavior)) {
+ throw new IllegalArgumentException(sizeExceededBehavior + " value of " +
+ SIZE_EXCEEDED_BEHAVIOR + " attribute is not a legal one for component: " +
+ MessageUtil.getLabel(context, queue));
+ }
+
+ data.addQueueAttribute(SIZE_EXCEEDED_BEHAVIOR, sizeExceededBehavior);
+ }
+
+ String onsizeexceeded = queue.getOnsizeexceeded();
+ if (utils.shouldRenderAttribute(onsizeexceeded)) {
+ data.addQueueAttribute("onsizeexceeded", new JSFunctionDefinition("query", "options", "event").addToBody(onsizeexceeded));
+ }
+
+ String onrequestqueue = queue.getOnrequestqueue();
+ if (utils.shouldRenderAttribute(onrequestqueue)) {
+ data.addQueueAttribute("onrequestqueue", new JSFunctionDefinition("query", "options", "event").addToBody(onrequestqueue));
+ }
+
+ String onrequestdequeue = queue.getOnrequestdequeue();
+ if (utils.shouldRenderAttribute(onrequestdequeue)) {
+ data.addQueueAttribute("onrequestdequeue", new JSFunctionDefinition("query", "options", "event").addToBody(onrequestdequeue));
+ }
+
+ for (String attributeName : REQUEST_ATTRIBUTES) {
+ Object value = attributes.get(attributeName);
+ if (utils.shouldRenderAttribute(value)) {
+ data.addRequestAttribute(attributeName, value);
+ }
+ }
+
+ String status = AjaxRendererUtils.getAjaxStatus(queue);
+ if (utils.shouldRenderAttribute(status)) {
+ data.addRequestAttribute(AjaxRendererUtils.STATUS_ATTR_NAME, status);
+ }
+
+ String onBeforeDomUpdate = queue.getOnbeforedomupdate();
+ if (utils.shouldRenderAttribute(onBeforeDomUpdate)) {
+ data.addRequestAttribute(QUEUE_ONBEFOREDOMUPDATE_ATTRIBUTE, AjaxRendererUtils.buildAjaxOnBeforeDomUpdate(onBeforeDomUpdate));
+ }
+
+ String oncomplete = queue.getOncomplete();
+ if (utils.shouldRenderAttribute(oncomplete)) {
+ data.addRequestAttribute(QUEUE_ONCOMPLETE_ATTRIBUTE, AjaxRendererUtils.buildAjaxOncomplete(oncomplete));
+ }
+
+ String onsubmit = queue.getOnsubmit();
+ if (utils.shouldRenderAttribute(onsubmit)) {
+ JSFunctionDefinition onsubmitFunction = new JSFunctionDefinition("request");
+ onsubmitFunction.addToBody(onsubmit);
+
+ data.addRequestAttribute(QUEUE_ONSUBMIT_ATTRIBUTE, onsubmitFunction);
+ }
+
+ String onerror = queue.getOnerror();
+ if (utils.shouldRenderAttribute(onerror)) {
+ JSFunctionDefinition onerrorFunction = new JSFunctionDefinition("request", "status", "message");
+ onerrorFunction.addToBody(onerror);
+
+ data.addRequestAttribute(QUEUE_ONERROR_ATTRIBUTE, onerrorFunction);
+ }
+
+ return data;
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+ super.encodeBegin(context, component);
+ }
+
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException {
+ super.encodeEnd(context, component);
+
+ UIQueue queue = (UIQueue) component;
+ if (!queue.isDisabled()) {
+ QueueRegistry.getInstance(context).registerQueue(context,
+ queue.getClientName(context),
+ createRendererData(context, queue));
+ }
+ }
+}
Copied: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java (from rev 14238, trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java)
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java (rev 0)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRendererData.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,61 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author Denis Morozov
+ * @since 3.3.0
+ */
+public class QueueRendererData {
+
+ private Map<String, Object> queueAttributes;
+
+ private Map<String, Object> requestAttributes;
+
+ public void addQueueAttribute(String key, Object value) {
+ if (queueAttributes == null) {
+ queueAttributes = new LinkedHashMap<String, Object>();
+ }
+
+ queueAttributes.put(key, value);
+ }
+
+ public void addRequestAttribute(String key, Object value) {
+ if (requestAttributes == null) {
+ requestAttributes = new LinkedHashMap<String, Object>();
+ }
+
+ requestAttributes.put(key, value);
+ }
+
+ public Map<String, Object> getQueueAttributes() {
+ return queueAttributes;
+ }
+
+ public Map<String, Object> getRequestAttributes() {
+ return requestAttributes;
+ }
+}
Copied: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts (from rev 14238, trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts)
Deleted: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java 2009-05-18 14:55:17 UTC (rev 14238)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,52 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html.scripts;
-
-import org.ajax4jsf.resource.InternetResourceBase;
-import org.ajax4jsf.resource.ResourceContext;
-import org.ajax4jsf.resource.ResourceRenderer;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class QueueScript extends InternetResourceBase {
-
- private static final ResourceRenderer renderer = new QueueScriptResourceRenderer();
-
- private String key = getClass().getName();
-
- @Override
- public String getKey() {
- return key;
- }
-
- @Override
- public ResourceRenderer getRenderer(ResourceContext resourceContext) {
- return renderer;
- }
-
- @Override
- public boolean isCacheable(ResourceContext resourceContext) {
- return false;
- }
-}
Copied: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java (from rev 14238, trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java)
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java (rev 0)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScript.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,52 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html.scripts;
+
+import org.ajax4jsf.resource.InternetResourceBase;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.resource.ResourceRenderer;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueScript extends InternetResourceBase {
+
+ private static final ResourceRenderer renderer = new QueueScriptResourceRenderer();
+
+ private String key = getClass().getName();
+
+ @Override
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public ResourceRenderer getRenderer(ResourceContext resourceContext) {
+ return renderer;
+ }
+
+ @Override
+ public boolean isCacheable(ResourceContext resourceContext) {
+ return false;
+ }
+}
Deleted: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2009-05-18 14:55:17 UTC (rev 14238)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,165 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html.scripts;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.component.QueueRegistry;
-import org.ajax4jsf.component.UIQueue;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSObject;
-import org.ajax4jsf.javascript.ScriptUtils;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.renderkit.html.QueueRendererData;
-import org.ajax4jsf.resource.BaseResourceRenderer;
-import org.ajax4jsf.resource.InternetResource;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class QueueScriptResourceRenderer extends BaseResourceRenderer {
-
- public static final String QUEUE_SCRIPT_ID = "org.ajax4jsf.queue_script";
-
- private void encodeQueue(ResponseWriter writer, String queueName, QueueRendererData queueData)
- throws IOException {
-
- Map<String, Object> queueAttributes = null;
- Map<String, Object> requestAttributes = null;
-
- if (queueData != null) {
- queueAttributes = queueData.getQueueAttributes();
- requestAttributes = queueData.getRequestAttributes();
- }
-
- writer.writeText("if (!EventQueue.getQueue(" + ScriptUtils.toScript(queueName) + ")) { EventQueue.addQueue(", null);
- writer.writeText(
- new JSObject("EventQueue",
- queueName,
- queueAttributes,
- requestAttributes
- ).toScript(), null);
- writer.writeText(") };", null);
- }
-
- @Override
- protected void customEncode(InternetResource resource,
- FacesContext context, Object data) throws IOException {
- super.customEncode(resource, context, data);
-
- Map<String, Object> queues = (Map<String, Object>) data;
- ResponseWriter writer = context.getResponseWriter();
-
- writer.writeText("if (typeof A4J != 'undefined') { if (A4J.AJAX) { with (A4J.AJAX) {", null);
- for (Entry<String, Object> entry : queues.entrySet()) {
- encodeQueue(writer, entry.getKey(), (QueueRendererData) entry.getValue());
- }
- writer.writeText("}}};", null);
- }
-
- protected void doEncode(InternetResource resource, FacesContext context,
- Object data, Map<String, Object> attributes) throws IOException {
-
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
-
- String resourceKey = resource.getKey();
- if (requestMap.get(resourceKey) == null) {
- requestMap.put(resourceKey, Boolean.TRUE);
-
- QueueRegistry queueRegistry = QueueRegistry.getInstance(context);
- if (queueRegistry.isShouldCreateDefaultGlobalQueue()) {
- String encodedGlobalQueueName = context.getExternalContext().encodeNamespace(
- UIQueue.GLOBAL_QUEUE_NAME);
-
- if (!queueRegistry.containsQueue(encodedGlobalQueueName)) {
- queueRegistry.registerQueue(context, encodedGlobalQueueName, null);
- }
- }
-
- if (queueRegistry.hasQueuesToEncode()) {
- super.encode(resource, context, queueRegistry.getRegisteredQueues(context), attributes);
- }
- }
- }
-
- private String encodeQueueScriptId(FacesContext context) {
- String encodedId = QUEUE_SCRIPT_ID;
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- if (!ajaxContext.isAjaxRequest()) {
- encodedId = context.getExternalContext().encodeNamespace(encodedId);
- }
-
- return encodedId;
- }
-
- @Override
- public void encode(InternetResource resource, FacesContext context,
- Object data, Map<String, Object> attributes) throws IOException {
-
- Map<String,Object> newAttributes = new LinkedHashMap<String, Object>(attributes);
- newAttributes.put(HTML.id_ATTRIBUTE, encodeQueueScriptId(context));
-
- doEncode(resource, context, data, newAttributes);
- }
-
- @Override
- public void encode(InternetResource resource, FacesContext context,
- Object data) throws IOException {
-
- doEncode(resource, context, data,
- Collections.singletonMap(HTML.id_ATTRIBUTE, (Object) encodeQueueScriptId(context)));
- }
-
- @Override
- protected String[][] getCommonAttrs() {
- return new String[][] {
- {HTML.TYPE_ATTR, getContentType()},
- };
- }
-
- @Override
- protected String getHrefAttr() {
- return null;
- }
-
- @Override
- protected String getTag() {
- return HTML.SCRIPT_ELEM;
- }
-
- public String getContentType() {
- return "text/javascript";
- }
-
-}
Copied: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java (from rev 14238, trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java)
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java (rev 0)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/renderkit/html/scripts/QueueScriptResourceRenderer.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,165 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html.scripts;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.component.QueueRegistry;
+import org.ajax4jsf.component.UIQueue;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSObject;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.renderkit.html.QueueRendererData;
+import org.ajax4jsf.resource.BaseResourceRenderer;
+import org.ajax4jsf.resource.InternetResource;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueScriptResourceRenderer extends BaseResourceRenderer {
+
+ public static final String QUEUE_SCRIPT_ID = "org.ajax4jsf.queue_script";
+
+ private void encodeQueue(ResponseWriter writer, String queueName, QueueRendererData queueData)
+ throws IOException {
+
+ Map<String, Object> queueAttributes = null;
+ Map<String, Object> requestAttributes = null;
+
+ if (queueData != null) {
+ queueAttributes = queueData.getQueueAttributes();
+ requestAttributes = queueData.getRequestAttributes();
+ }
+
+ writer.writeText("if (!EventQueue.getQueue(" + ScriptUtils.toScript(queueName) + ")) { EventQueue.addQueue(", null);
+ writer.writeText(
+ new JSObject("EventQueue",
+ queueName,
+ queueAttributes,
+ requestAttributes
+ ).toScript(), null);
+ writer.writeText(") };", null);
+ }
+
+ @Override
+ protected void customEncode(InternetResource resource,
+ FacesContext context, Object data) throws IOException {
+ super.customEncode(resource, context, data);
+
+ Map<String, Object> queues = (Map<String, Object>) data;
+ ResponseWriter writer = context.getResponseWriter();
+
+ writer.writeText("if (typeof A4J != 'undefined') { if (A4J.AJAX) { with (A4J.AJAX) {", null);
+ for (Entry<String, Object> entry : queues.entrySet()) {
+ encodeQueue(writer, entry.getKey(), (QueueRendererData) entry.getValue());
+ }
+ writer.writeText("}}};", null);
+ }
+
+ protected void doEncode(InternetResource resource, FacesContext context,
+ Object data, Map<String, Object> attributes) throws IOException {
+
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+
+ String resourceKey = resource.getKey();
+ if (requestMap.get(resourceKey) == null) {
+ requestMap.put(resourceKey, Boolean.TRUE);
+
+ QueueRegistry queueRegistry = QueueRegistry.getInstance(context);
+ if (queueRegistry.isShouldCreateDefaultGlobalQueue()) {
+ String encodedGlobalQueueName = context.getExternalContext().encodeNamespace(
+ UIQueue.GLOBAL_QUEUE_NAME);
+
+ if (!queueRegistry.containsQueue(encodedGlobalQueueName)) {
+ queueRegistry.registerQueue(context, encodedGlobalQueueName, null);
+ }
+ }
+
+ if (queueRegistry.hasQueuesToEncode()) {
+ super.encode(resource, context, queueRegistry.getRegisteredQueues(context), attributes);
+ }
+ }
+ }
+
+ private String encodeQueueScriptId(FacesContext context) {
+ String encodedId = QUEUE_SCRIPT_ID;
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ if (!ajaxContext.isAjaxRequest()) {
+ encodedId = context.getExternalContext().encodeNamespace(encodedId);
+ }
+
+ return encodedId;
+ }
+
+ @Override
+ public void encode(InternetResource resource, FacesContext context,
+ Object data, Map<String, Object> attributes) throws IOException {
+
+ Map<String,Object> newAttributes = new LinkedHashMap<String, Object>(attributes);
+ newAttributes.put(HTML.id_ATTRIBUTE, encodeQueueScriptId(context));
+
+ doEncode(resource, context, data, newAttributes);
+ }
+
+ @Override
+ public void encode(InternetResource resource, FacesContext context,
+ Object data) throws IOException {
+
+ doEncode(resource, context, data,
+ Collections.singletonMap(HTML.id_ATTRIBUTE, (Object) encodeQueueScriptId(context)));
+ }
+
+ @Override
+ protected String[][] getCommonAttrs() {
+ return new String[][] {
+ {HTML.TYPE_ATTR, getContentType()},
+ };
+ }
+
+ @Override
+ protected String getHrefAttr() {
+ return null;
+ }
+
+ @Override
+ protected String getTag() {
+ return HTML.SCRIPT_ELEM;
+ }
+
+ public String getContentType() {
+ return "text/javascript";
+ }
+
+}
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -27,20 +27,19 @@
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.event.ActionEvent;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
import org.ajax4jsf.Messages;
import org.ajax4jsf.component.UIActionParameter;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.MetaRuleset;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagAttributeException;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-import com.sun.facelets.tag.jsf.ComponentHandler;
-
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:23 $
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxListenerHandler.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -27,21 +27,19 @@
import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
import org.ajax4jsf.Messages;
import org.ajax4jsf.event.AjaxListener;
import org.ajax4jsf.event.AjaxListenerHelper;
import org.ajax4jsf.event.AjaxSource;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.el.LegacyValueBinding;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagAttributeException;
-import com.sun.facelets.tag.TagConfig;
-import com.sun.facelets.tag.TagException;
-import com.sun.facelets.tag.TagHandler;
-
/**
* Register an ActionListener instance on the UIComponent associated with the
* closest parent UIComponent custom action. <p/> See <a target="_new"
@@ -101,7 +99,7 @@
ve = this.binding.getValueExpression(ctx,
AjaxListener.class);
// TODO - handle both JSF 1.2/1.1 cases.
- listener = new AjaxListenerHelper(new LegacyValueBinding(ve));
+ listener = new AjaxListenerHelper(ve);
}
if (listener == null) {
try {
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxPushHandler.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxPushHandler.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxPushHandler.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -23,17 +23,17 @@
import java.util.EventListener;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
import org.ajax4jsf.component.UIPush;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.MetaRuleset;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-import com.sun.facelets.tag.jsf.ComponentHandler;
-
/**
* @author shura (latest modification by $Author$)
* @version $Revision$ $Date$
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/AjaxSupportHandler.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -27,16 +27,15 @@
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagHandler;
import org.ajax4jsf.taglib.html.jsp.AjaxSupportTag;
import org.ajax4jsf.webapp.taglib.AjaxComponentHandler;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagHandler;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-
/**
* "proxy" class for creating UIAjaxSupport component as facet for it's parent.
* @author shura (latest modification by $Author: alexsmirnov $)
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/FacetHandler.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -27,16 +27,15 @@
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
import org.ajax4jsf.Messages;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagConfig;
-import com.sun.facelets.tag.TagException;
-import com.sun.facelets.tag.TagHandler;
-
/**
* Register a named facet on the UIComponent associated with the closest parent
* UIComponent custom action. <p/> See <a target="_new"
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeFaceletContext.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -35,11 +35,9 @@
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.TemplateClient;
-
/**
* @author shura
*
@@ -58,13 +56,14 @@
this.ids = new HashMap();
}
- /**
- * @param client
- * @see com.sun.facelets.FaceletContext#extendClient(com.sun.facelets.TemplateClient)
- */
- public void extendClient(TemplateClient client) {
- this.defaultContext.extendClient(client);
- }
+ //TODO JSF 2.0 analog?
+// /**
+// * @param client
+// * @see com.sun.facelets.FaceletContext#extendClient(com.sun.facelets.TemplateClient)
+// */
+// public void extendClient(TemplateClient client) {
+// this.defaultContext.extendClient(client);
+// }
/**
* @param base
@@ -157,19 +156,20 @@
return this.defaultContext.hashCode();
}
- /**
- * @param parent
- * @param name
- * @return
- * @throws IOException
- * @throws FaceletException
- * @throws FacesException
- * @throws ELException
- * @see com.sun.facelets.FaceletContext#includeDefinition(javax.faces.component.UIComponent, java.lang.String)
- */
- public boolean includeDefinition(UIComponent parent, String name) throws IOException, FaceletException, FacesException, ELException {
- return this.defaultContext.includeDefinition(parent, name);
- }
+ //TODO JSF 2.0 analog?
+// /**
+// * @param parent
+// * @param name
+// * @return
+// * @throws IOException
+// * @throws FaceletException
+// * @throws FacesException
+// * @throws ELException
+// * @see com.sun.facelets.FaceletContext#includeDefinition(javax.faces.component.UIComponent, java.lang.String)
+// */
+// public boolean includeDefinition(UIComponent parent, String name) throws IOException, FaceletException, FacesException, ELException {
+// return this.defaultContext.includeDefinition(parent, name);
+// }
/**
* @param parent
@@ -205,23 +205,24 @@
return this.defaultContext.isPropertyResolved();
}
- /**
- * @param client
- * @see com.sun.facelets.FaceletContext#popClient(com.sun.facelets.TemplateClient)
- */
- public void popClient(TemplateClient client) {
- this.defaultContext.popClient(client);
- }
+ //TODO JSF 2.0 analog?
+// /**
+// * @param client
+// * @see com.sun.facelets.FaceletContext#popClient(com.sun.facelets.TemplateClient)
+// */
+// public void popClient(TemplateClient client) {
+// this.defaultContext.popClient(client);
+// }
+//
+// /**
+// * @param client
+// * @see com.sun.facelets.FaceletContext#pushClient(com.sun.facelets.TemplateClient)
+// */
+// public void pushClient(TemplateClient client) {
+// this.defaultContext.pushClient(client);
+// }
/**
- * @param client
- * @see com.sun.facelets.FaceletContext#pushClient(com.sun.facelets.TemplateClient)
- */
- public void pushClient(TemplateClient client) {
- this.defaultContext.pushClient(client);
- }
-
- /**
* @param key
* @param contextObject
* @see javax.el.ELContext#putContext(java.lang.Class, java.lang.Object)
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -27,15 +27,13 @@
import javax.el.VariableMapper;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagAttribute;
import org.ajax4jsf.component.UIInclude;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.el.VariableMapperWrapper;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-import com.sun.facelets.tag.jsf.ComponentHandler;
-
/**
* @author shura
*
@@ -56,13 +54,13 @@
* javax.faces.component.UIComponent,
* javax.faces.component.UIComponent)
*/
- protected void onComponentCreated(FaceletContext ctx, UIComponent c,
+ public void onComponentCreated(FaceletContext ctx, UIComponent c,
UIComponent parent) {
// TODO Auto-generated method stub
super.onComponentCreated(ctx, c, parent);
}
- protected void applyNextHandler(FaceletContext ctx, UIComponent component)
+ public void applyNextHandler(FaceletContext ctx, UIComponent component)
throws IOException, FacesException, ELException {
String path;
if (component instanceof UIInclude) {
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/KeepAliveHandler.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -28,17 +28,16 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
import org.ajax4jsf.Messages;
import org.ajax4jsf.event.AjaxPhaseListener;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagAttributeException;
-import com.sun.facelets.tag.TagConfig;
-import com.sun.facelets.tag.TagHandler;
-
/**
* @author shura
*
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -23,17 +23,17 @@
import java.io.OutputStream;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
import org.ajax4jsf.component.UIMediaOutput;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.MetaRuleset;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-import com.sun.facelets.tag.jsf.ComponentHandler;
-
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/RowKeyConverterRule.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,85 +1,31 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.taglib.html.facelets;
-import javax.faces.convert.Converter;
-import org.ajax4jsf.component.UIDataAdaptor;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-
/**
* Apply rowKeyConverter to component
* @author Maksim Kaszynski
- *
*/
-public class RowKeyConverterRule extends MetaRule {
+@Deprecated
+public class RowKeyConverterRule extends org.ajax4jsf.webapp.taglib.RowKeyConverterRule {
- static final class DynamicConverterMetaData extends Metadata {
-
- private final TagAttribute attribute;
-
- public DynamicConverterMetaData(TagAttribute attribute) {
- super();
- this.attribute = attribute;
- }
-
- @Override
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIDataAdaptor) instance).setValueExpression("rowKeyConverter",
- attribute.getValueExpression(ctx, Converter.class));
-
- }
- }
-
- static final class StaticConverterMetadata extends Metadata {
-
- private final String converterId;
-
- public StaticConverterMetadata(String converterId) {
- super();
- this.converterId = converterId;
- }
-
- @Override
- public void applyMetadata(FaceletContext ctx, Object instance) {
- Converter converter = ctx.getFacesContext().getApplication()
- .createConverter(converterId);
- ((UIDataAdaptor) instance).setRowKeyConverter(converter);
-
- }
- }
-
- public static final RowKeyConverterRule INSTANCE = new RowKeyConverterRule();
-
-
- /*
- * (non-Javadoc)
- *
- * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String,
- * com.sun.facelets.tag.TagAttribute,
- * com.sun.facelets.tag.MetadataTarget)
- */
- @Override
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta) {
-
- if (meta.isTargetInstanceOf(UIDataAdaptor.class)) {
- if ("rowKeyConverter".equals(name)) {
- if (attribute.isLiteral()) {
- return new StaticConverterMetadata(attribute.getValue());
- } else {
- return new DynamicConverterMetaData(attribute);
- }
- }
- }
-
- return null;
- }
-
}
Added: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java (rev 0)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/VariableMapperWrapper.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,65 @@
+/**
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.ajax4jsf.taglib.html.facelets;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
+class VariableMapperWrapper extends VariableMapper {
+
+ private VariableMapper mapper;
+
+ private Map<String, ValueExpression> vars = null;
+
+ public VariableMapperWrapper(VariableMapper mapper) {
+ this.mapper = mapper;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.VariableMapper#resolveVariable(java.lang.String)
+ */
+ @Override
+ public ValueExpression resolveVariable(String variable) {
+ ValueExpression ve = null;
+ try {
+ if (this.vars != null) {
+ ve = (ValueExpression) this.vars.get(variable);
+ }
+ if (ve == null) {
+ return this.mapper.resolveVariable(variable);
+ }
+ return ve;
+ } catch (StackOverflowError e) {
+ throw new ELException("Could not Resolve Variable [Overflow]: " + variable, e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.VariableMapper#setVariable(java.lang.String, javax.el.ValueExpression)
+ */
+ @Override
+ public ValueExpression setVariable(String variable,
+ ValueExpression expression) {
+
+ if (this.vars == null) {
+ this.vars = new HashMap<String, ValueExpression>();
+ }
+ return (ValueExpression) this.vars.put(variable, expression);
+ }
+
+}
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxListenerTag.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -33,7 +33,6 @@
import org.ajax4jsf.event.AjaxListener;
import org.ajax4jsf.event.AjaxListenerHelper;
import org.ajax4jsf.event.AjaxSource;
-import org.richfaces.webapp.taglib.ValueBindingValueExpressionAdaptor;
/**
@@ -91,7 +90,7 @@
if (component instanceof AjaxSource) {
AjaxListener listener;
if(null != binding){
- listener = new AjaxListenerHelper(new ValueBindingValueExpressionAdaptor(binding));
+ listener = new AjaxListenerHelper(binding);
} else {
try {
String className = (String) type.getValue(FacesContext.getCurrentInstance().getELContext());
Modified: branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java
===================================================================
--- branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ServletResponseWrapperInclude.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,24 +1,3 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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
- */
-
/*
* Copyright 1999,2004 The Apache Software Foundation.
*
Modified: branches/jsf2.0/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended.xcss
===================================================================
--- branches/jsf2.0/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended.xcss 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended.xcss 2009-07-10 11:13:58 UTC (rev 14876)
@@ -113,11 +113,11 @@
</u:style>
</u:selector>
- <u:selector name="*|textarea[disabled]">
+ <u:selector name="*|textarea[disabled], *|select[disabled]">
<u:style name="color" skin="panelBorderColor" />
</u:selector>
- <u:selector name="textarea[type="textarea"][disabled], input[type="text"][disabled], input[type="password"][disabled]">
+ <u:selector name="textarea[type="textarea"][disabled], input[type="text"][disabled], input[type="password"][disabled], select[disabled]">
<u:style name="color" skin="panelBorderColor" />
</u:selector>
Modified: branches/jsf2.0/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended_classes.xcss
===================================================================
--- branches/jsf2.0/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended_classes.xcss 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/resources/org/richfaces/renderkit/html/css/extended_classes.xcss 2009-07-10 11:13:58 UTC (rev 14876)
@@ -57,7 +57,7 @@
.rich-container button[type="submit"], .rich-button-submit,
.rich-container input[type="reset"], .rich-input-reset,
.rich-container input[type="submit"], .rich-input-submit,
- .rich-container input[type="button"], .rich-input-button,
+ .rich-container input[type="button"], .rich-input-button
">
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="font-size" skin="generalSizeFont" />
@@ -146,13 +146,14 @@
</u:style>
</u:selector>
- <u:selector name=".rich-container *|textarea[disabled]">
+ <u:selector name=".rich-container *|textarea[disabled], .rich-container *|select[disabled]">
<u:style name="color" skin="panelBorderColor" />
</u:selector>
-
- <u:selector name=".rich-textarea-disabled, .rich-container textarea[type="textarea"][disabled], .rich-textarea-textarea-disabled,
+
+ <u:selector name=".rich-textarea-disabled, .rich-container textarea[type="textarea"][disabled], .rich-textarea-textarea-disabled,
.rich-container input[type="text"][disabled], .rich-input-text-disabled,
- .rich-container input[type="password"][disabled], .rich-input-password-disabled">
+ .rich-container input[type="password"][disabled], .rich-input-password-disabled,
+ .rich-container select[disabled], .rich-select-disabled">
<u:style name="color" skin="panelBorderColor" />
</u:selector>
</f:template>
\ No newline at end of file
Modified: branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx
===================================================================
--- branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx 2009-07-10 11:13:58 UTC (rev 14876)
@@ -47,4 +47,4 @@
<jsp:scriptlet>encodeTypeAndImage(context,component);</jsp:scriptlet>
</input>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx
===================================================================
--- branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx 2009-07-10 11:13:58 UTC (rev 14876)
@@ -21,4 +21,4 @@
#{this:getFunction(context,component)};
//]]>
</script>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx
===================================================================
--- branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx 2009-07-10 11:13:58 UTC (rev 14876)
@@ -18,7 +18,7 @@
type="#{component.attributes['type']}"
x:passThruWithExclusions="value,name,onclick,type,href,id"
onclick="#{this:getOnClick(context,component)}"
- href="#"
+ href="#"
class="#{component.attributes['styleClass']}"
>
#{this:getValue(component)}
@@ -27,4 +27,4 @@
</vcp:body>
</a>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx
===================================================================
--- branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx 2009-07-10 11:13:58 UTC (rev 14876)
@@ -24,10 +24,10 @@
x:style='width:#{component.width};height:#{component.height};overflow:auto;#{component.attributes["style"]}'
x:passThruWithExclusions="value,name,id,style"
>
- <button onclick="LOG.clear()">Clear</button><br />
- <script type="text/javascript">
- LOG.LEVEL = LOG.#{component.level};
+ <button onclick="LOG.clear()">Clear</button><br />
+ <script type="text/javascript">
+ LOG.LEVEL = LOG.#{component.level};
</script>
</div>
<jsp:scriptlet> } </jsp:scriptlet>
-</f:root>
\ No newline at end of file
+</f:root>
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/AbstractQueueComponentTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,595 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.UserResourceRenderer2;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.ResourceNotFoundException;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.mozilla.javascript.FunctionObject;
+import org.mozilla.javascript.NativeArray;
+import org.mozilla.javascript.NativeObject;
+import org.mozilla.javascript.ScriptableObject;
+import org.mozilla.javascript.Undefined;
+
+import com.gargoylesoftware.htmlunit.AlertHandler;
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.ScriptPreProcessor;
+import com.gargoylesoftware.htmlunit.ScriptResult;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
+import com.sun.facelets.Facelet;
+import com.sun.facelets.FaceletFactory;
+import com.sun.facelets.compiler.Compiler;
+import com.sun.facelets.compiler.SAXCompiler;
+import com.sun.facelets.impl.DefaultFaceletFactory;
+import com.sun.facelets.impl.ResourceResolver;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public abstract class AbstractQueueComponentTest extends AbstractAjax4JsfTestCase {
+
+ private static final String COMPONENT_TYPE = AjaxSubmitFunctionComponent.class.getName();
+
+ private static final String AJAX_SUBMIT = "ajaxSubmit";
+
+ public static final int DEFAULT_REQUEST_TIME = 1000;
+
+ protected HtmlPage page;
+
+ public final static class AjaxSubmitFunctionComponent extends UIComponentBase {
+
+ @Override
+ public String getRendererType() {
+ return COMPONENT_TYPE;
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_TYPE;
+ }
+
+ }
+
+ private final static class AjaxSubmitFunctionResourceRenderer extends
+ Renderer implements UserResourceRenderer2 {
+
+ public void encodeToHead(FacesContext facesContext, UIComponent component)
+ throws IOException {
+ JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, facesContext);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(facesContext, component, true);
+ options.put("requestDelay", new JSReference("options.requestDelay"));
+ options.put("similarityGroupingId", new JSReference("options.similarityGroupingId || '" +
+ component.getClientId(facesContext) + "'"));
+ options.put("data", new JSReference("data"));
+ options.put("requestTime", new JSReference("options.requestTime"));
+ options.put("timeout", new JSReference("options.timeout"));
+ options.put("eventsQueue", new JSReference("options.eventsQueue"));
+ options.put("implicitEventsQueue", new JSReference("options.implicitEventsQueue"));
+ options.put("ignoreDupResponses", new JSReference("options.ignoreDupResponses"));
+
+ ajaxFunction.addParameter(options);
+
+ ResponseWriter responseWriter = facesContext.getResponseWriter();
+ responseWriter.startElement(HTML.SCRIPT_ELEM, component);
+ responseWriter.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ responseWriter.writeText("var " + AJAX_SUBMIT + " = function(data, options) {" + ajaxFunction.toScript() + "};", null);
+ responseWriter.endElement(HTML.SCRIPT_ELEM);
+ }
+
+ }
+
+ public AbstractQueueComponentTest(String name) {
+ super(name);
+ }
+
+ private static final String SIMULATION_SCRIPT_NAME = "org/ajax4jsf/component/simulation.js";
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+ try {
+ resourceBuilder.getResource(SIMULATION_SCRIPT_NAME);
+ } catch (ResourceNotFoundException e) {
+ resourceBuilder.createResource(null, SIMULATION_SCRIPT_NAME);
+ }
+
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ UIResource resource;
+
+ UIComponent form = application.createComponent(UIForm.COMPONENT_TYPE);
+ viewRoot.getChildren().add(form);
+ final UIComponent commandButton = application.createComponent(UIAjaxCommandButton.COMPONENT_TYPE);
+ form.getChildren().add(commandButton);
+
+ facesContext.getRenderKit().addRenderer(COMPONENT_TYPE, COMPONENT_TYPE, new AjaxSubmitFunctionResourceRenderer());
+ form.getChildren().add(new AjaxSubmitFunctionComponent());
+
+ resource = (UIResource) application.createComponent("org.ajax4jsf.LoadScript");
+ resource.setSrc("resource:///" + SIMULATION_SCRIPT_NAME);
+ viewRoot.getChildren().add(resource);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ this.page = null;
+ super.tearDown();
+ }
+
+ protected static final class ParametersBuilder {
+ private Map<String, Object> parameters;
+
+ private ParametersBuilder() {
+ this.parameters = new HashMap<String, Object>();
+ }
+
+ private ParametersBuilder(Map<String, Object> parameters) {
+ this.parameters = new HashMap<String, Object>(parameters);
+ }
+
+ private ParametersBuilder put(String key, Object value) {
+ this.parameters.put(key, value);
+ return this;
+ }
+
+ protected Map<String, Object> getParameters() {
+ return parameters;
+ }
+
+ /**
+ * Sets value of requestDelay parameter
+ * @param value
+ * @return
+ */
+ public ParametersBuilder requestDelay(double value) {
+ return new ParametersBuilder(this.parameters).put("requestDelay", value);
+ }
+
+ /**
+ * Sets value of similarityGroupingId parameter
+ * @param id
+ * @return
+ */
+ public ParametersBuilder similarityGroupingId(Object id) {
+ return new ParametersBuilder(this.parameters).put("similarityGroupingId", id);
+ }
+
+ /**
+ * Defines how long this request will be executed on server
+ * @param value
+ * @return
+ */
+ public ParametersBuilder requestTime(double value) {
+ return new ParametersBuilder(this.parameters).put("requestTime", value);
+ }
+
+ /**
+ * Sets value of timeout parameter
+ * @param value
+ * @return
+ */
+ public ParametersBuilder timeout(double value) {
+ return new ParametersBuilder(this.parameters).put("timeout", value);
+ }
+
+ /**
+ * Sets value of eventsQueue parameter
+ * @param name
+ * @return
+ */
+ public ParametersBuilder eventsQueue(String name) {
+ return new ParametersBuilder(this.parameters).put("eventsQueue", name);
+ }
+
+ /**
+ * Sets value of implicitEventsQueue parameter
+ * @param name
+ * @return
+ */
+ public ParametersBuilder implicitEventsQueue(String name) {
+ return new ParametersBuilder(this.parameters).put("implicitEventsQueue", name);
+ }
+
+ /**
+ * Sets value of ignoreDupResponses parameter
+ * @param value
+ * @return
+ */
+ public ParametersBuilder ignoreDupResponses(boolean value) {
+ return new ParametersBuilder(this.parameters).put("ignoreDupResponses", value);
+ }
+ }
+
+ protected ParametersBuilder createAjaxParameters() {
+ return new ParametersBuilder();
+ }
+
+ protected static final class TestsResult {
+ private List<RequestData> dataList = new ArrayList<RequestData>();
+
+ private double currentTime;
+
+ public void addData(RequestData data) {
+ this.dataList.add(data);
+ }
+
+ public List<RequestData> getDataList() {
+ return dataList;
+ }
+
+ public void setCurrentTime(double number) {
+ this.currentTime = number;
+ }
+
+ public double getCurrentTime() {
+ return currentTime;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append("[\n");
+ for (RequestData data : dataList) {
+ builder.append(" ");
+ builder.append(data);
+ builder.append("\n");
+ }
+ builder.append("]\n");
+ builder.append("Current time: " + this.currentTime);
+
+ return builder.toString();
+ }
+ }
+
+ protected static final class RequestData {
+ private boolean aborted;
+
+ private double startTime;
+
+ private double endTime;
+
+ private String data;
+
+ public RequestData(String data, double startTime, double endTime,
+ boolean aborted) {
+ super();
+ this.data = data;
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.aborted = aborted;
+ }
+
+ public boolean isAborted() {
+ return aborted;
+ }
+
+ public double getStartTime() {
+ return startTime;
+ }
+
+ public double getEndTime() {
+ return endTime;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append("data: ");
+ builder.append(data);
+ builder.append(", ");
+
+ builder.append("startTime: ");
+ builder.append(startTime);
+ builder.append(", ");
+
+ builder.append("endTime: ");
+ builder.append(endTime);
+
+ if (isAborted()) {
+ builder.append(", aborted: ");
+ builder.append(true);
+ }
+
+ return builder.toString();
+ }
+ };
+
+ protected void checkRequestData(RequestData requestData, String data,
+ double startTime, double endTime, boolean aborted) {
+
+ assertEquals("Data check failed for " + requestData, data, requestData.getData());
+ assertEquals("Start time check failed for " + requestData, startTime, requestData.getStartTime());
+ assertEquals("End time check failed for " + requestData, endTime, requestData.getEndTime());
+ assertEquals("Aborted check failed for " + requestData, aborted, requestData.isAborted());
+
+ }
+
+ /**
+ * Execute simulated ajax request starting on given time and having data and paramaters passed as arguments.
+ * For simulated requests defaut value of data is id of the element firing request and default request time
+ * is 1000
+ *
+ * @param time
+ * @param data
+ * @param builder
+ */
+ protected void ajax(int time, String data, ParametersBuilder builder) {
+ JSFunction function = new JSFunction("simulationContext.ajax", time, data, builder.getParameters());
+ page.executeJavaScript(function.toScript());
+ }
+
+ protected void executeOnTime(int time, String expression) {
+ JSFunction function = new JSFunction("simulationContext.executeOnTime",
+ time, new JSFunctionDefinition().addToBody(expression));
+
+ page.executeJavaScript(function.toScript());
+ }
+
+ private String buildClickExpression(String id) {
+ return "document.getElementById('" + id + "').click()";
+ }
+
+ protected void clickOnTime(int time, String id) {
+ JSFunction function = new JSFunction("simulationContext.executeOnTime",
+ time, new JSFunctionDefinition().addToBody(buildClickExpression(id)));
+
+ page.executeJavaScript(function.toScript());
+ }
+
+ protected String getRootContextPath() {
+ return this.getClass().getPackage().getName().replace('.', '/');
+ }
+
+ protected ResourceResolver createResourceResolver() {
+ return new ResourceResolver() {
+
+ public URL resolveUrl(String path) {
+ return Thread.currentThread().getContextClassLoader().getResource(getRootContextPath() + path);
+ }
+
+ };
+ }
+
+ private static final Compiler compiler = new SAXCompiler();
+
+ protected void buildView(String viewId) throws IOException {
+ FaceletFactory factory = new DefaultFaceletFactory(compiler, createResourceResolver());
+ FaceletFactory.setInstance(factory);
+
+ FaceletFactory f = FaceletFactory.getInstance();
+ Facelet at = f.getFacelet(viewId);
+
+ UIViewRoot root = facesContext.getViewRoot();
+ root.setViewId(viewId);
+ at.apply(facesContext, root);
+ }
+
+ protected void preRenderView() throws Exception {
+ StringBuilder builder = new StringBuilder("<script type='text/javascript'>");
+ builder.append("DEFAULT_REQUEST_TIME = " + DEFAULT_REQUEST_TIME + ";");
+ builder.append("window.simulationContext = new SimulationContext(");
+ builder.append(AJAX_SUBMIT);
+ builder.append(");</script>");
+
+ HtmlOutputText text = new HtmlOutputText();
+ text.setEscape(false);
+ text.setValue(builder.toString());
+
+ List<UIComponent> childList = facesContext.getViewRoot().getChildren();
+ childList.add(childList.size(), text);
+ }
+
+ protected void postRenderView() throws Exception {
+ ScriptableObject scriptableObject = (ScriptableObject) this.page.executeJavaScript("window.LOG").getJavaScriptResult();
+ scriptableObject.defineProperty("out", systemOut, ScriptableObject.READONLY);
+ }
+
+ private static final ScriptableObject systemOut = new ScriptableObject() {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8574162538513136625L;
+
+ @Override
+ public String getClassName() {
+ return "systemOut";
+ }
+
+ @SuppressWarnings("unused")
+ public void println(String s) {
+ System.out.println(s);
+ }
+ };
+
+ static {
+ try {
+ systemOut.defineProperty("println",
+ new FunctionObject(null, systemOut.getClass().getMethod("println", String.class), systemOut),
+ ScriptableObject.READONLY);
+ } catch (SecurityException e) {
+ throw new IllegalStateException(e.getMessage(), e);
+ } catch (NoSuchMethodException e) {
+ throw new IllegalStateException(e.getMessage(), e);
+ }
+ }
+
+ protected HtmlPage renderView(String viewId) throws Exception {
+ buildView(viewId);
+ preRenderView();
+ this.page = super.renderView();
+ postRenderView();
+
+ return this.page;
+ }
+
+ @Override
+ protected HtmlPage renderView() throws Exception {
+ preRenderView();
+ this.page = super.renderView();
+ postRenderView();
+
+ return this.page;
+ }
+
+ protected void click(String id) {
+ executeJavaScript(buildClickExpression(id));
+ }
+
+ protected Object executeJavaScript(String expression) {
+ return page.executeJavaScript(expression).getJavaScriptResult();
+ }
+
+ protected void executeTimer() {
+ page.executeJavaScript("Timer.execute();");
+ }
+
+ protected TestsResult getTestsResult() {
+ TestsResult result = new TestsResult();
+
+ executeTimer();
+ ScriptResult scriptResult = page.executeJavaScript("window.simulationContext.results");
+ NativeArray array = (NativeArray) scriptResult.getJavaScriptResult();
+
+ for (int i = 0; i < array.getLength(); i++) {
+ NativeObject object = (NativeObject) array.get(i, array);
+
+ String data = null;
+
+ Object dataObject = object.get("data", object);
+ if (!(dataObject instanceof Undefined)) {
+ data = (String) dataObject;
+ }
+
+ Double startTime = (Double) object.get("startTime", object);
+ Double endTime = (Double) object.get("endTime", object);
+
+ Object aborted = object.get("aborted", object);
+ boolean abortedBoolean = aborted instanceof Boolean && (Boolean) aborted;
+
+ result.addData(new RequestData(data, startTime, endTime, abortedBoolean));
+ }
+
+ scriptResult = page.executeJavaScript("Timer.currentTime");
+ result.setCurrentTime((Double) scriptResult.getJavaScriptResult());
+
+ return result;
+ }
+
+ @Override
+ protected void setupWebClient() {
+ super.setupWebClient();
+ webClient.setJavaScriptEngine(new JavaScriptEngine(webClient));
+ webClient.setScriptPreProcessor(new UnescapingScriptPreprocessor());
+ webClient.setThrowExceptionOnScriptError(true);
+ webClient.setAlertHandler(new AlertHandler() {
+
+ public void handleAlert(Page page, String message) {
+ fail(message);
+ }
+ });
+ }
+}
+
+class UnescapingScriptPreprocessor implements ScriptPreProcessor {
+
+ private static final Map<String, String> ENTITIES_MAP = new HashMap<String, String>();
+
+ static {
+ ENTITIES_MAP.put("'", "\"");
+ ENTITIES_MAP.put(""", "'");
+ ENTITIES_MAP.put("&", "&");
+ ENTITIES_MAP.put("<", "<");
+ ENTITIES_MAP.put(">", ">");
+ }
+
+ private static final Pattern ENTITIES_PATTERN;
+
+ static {
+ StringBuilder sb = new StringBuilder();
+
+ for (String entity : ENTITIES_MAP.keySet()) {
+ if (sb.length() != 0) {
+ sb.append('|');
+ }
+
+ sb.append(Pattern.quote(entity));
+ }
+
+ ENTITIES_PATTERN = Pattern.compile("(" + sb.toString() + ")");
+ }
+
+ public String preProcess(HtmlPage htmlPage, String sourceCode,
+ String sourceName, HtmlElement htmlElement) {
+
+ if (sourceName != null && !sourceName.startsWith("http:/")) {
+ Matcher m = ENTITIES_PATTERN.matcher(sourceCode);
+ StringBuffer sb = new StringBuffer();
+ while (m.find()) {
+ String entity = m.group(1);
+ m.appendReplacement(sb, ENTITIES_MAP.get(entity));
+ }
+
+ m.appendTail(sb);
+
+ return sb.toString();
+ } else {
+ return sourceCode;
+ }
+
+ }
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/AjaxFormQueuesTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/AjaxFormQueuesTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/AjaxFormQueuesTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/AjaxFormQueuesTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,66 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ *
+ */
+public class AjaxFormQueuesTest extends AbstractQueueComponentTest {
+
+ /**
+ * @param name
+ */
+ public AjaxFormQueuesTest(String name) {
+ super(name);
+ }
+
+ protected void checkForm(String formName) throws Exception {
+ renderView("/queue-ajax-form.xhtml");
+ click(formName + ":link");
+ executeTimer();
+
+ Object resultObject = executeJavaScript("window.testResults." + formName);
+
+ assertTrue(formName, resultObject instanceof Boolean && (Boolean) resultObject);
+ }
+
+ public void testViewDefault() throws Exception {
+ checkForm("viewDefault");
+ }
+
+ public void testViewNamed() throws Exception {
+ checkForm("viewNamed");
+ }
+
+ public void testFormDefault() throws Exception {
+ checkForm("formDefault");
+ }
+
+ public void testFormNamed() throws Exception {
+ checkForm("formNamed");
+ }
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/ImplicitQueuesTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/ImplicitQueuesTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/ImplicitQueuesTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/ImplicitQueuesTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,115 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import java.util.List;
+
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ *
+ */
+public class ImplicitQueuesTest extends AbstractQueueComponentTest {
+
+ /**
+ * @param name
+ */
+ public ImplicitQueuesTest(String name) {
+ super(name);
+ }
+
+ public void testImplicitGlobalQueueEnabled() throws Exception {
+ servletContext.addInitParameter("org.richfaces.queue.global.enabled", "true");
+
+ renderView();
+
+ ajax(0, "a", createAjaxParameters().requestTime(1000));
+ ajax(0, "b", createAjaxParameters().requestTime(1000));
+
+ TestsResult result = getTestsResult();
+ assertEquals(2000d, result.getCurrentTime());
+ }
+
+ public void testImplicitGlobalQueueDefault() throws Exception {
+ renderView();
+
+ ajax(0, "a", createAjaxParameters().requestTime(1000));
+ ajax(0, "b", createAjaxParameters().requestTime(1000));
+
+ TestsResult result = getTestsResult();
+ assertEquals(1000d, result.getCurrentTime());
+ }
+
+ public void testLegacyQueuesRequestDelay() throws Exception {
+ renderView("/queue-legacy.xhtml");
+
+ clickOnTime(0, "form:buttonDelayed");
+ clickOnTime(500, "form:buttonDelayed");
+ clickOnTime(750, "form:buttonDelayed");
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(1, dataList.size());
+
+ //request time set to 5000 in .xhtml file
+ RequestData data = dataList.get(0);
+ checkRequestData(data, "form:buttonDelayed", 1750, 6750, false);
+
+ assertEquals(6750d, result.getCurrentTime());
+ }
+
+ public void testLegacyQueuesIgnoreDupResponces() throws Exception {
+ renderView("/queue-legacy.xhtml");
+
+ clickOnTime(0, "form:buttonIgnoreDupResponces");
+ clickOnTime(500, "form:buttonIgnoreDupResponces");
+
+ executeTimer();
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ //RF-5788
+ //assertEquals(3, dataList.size());
+ assertEquals(2, dataList.size());
+
+ //request time set to 5000 in .xhtml file
+ checkRequestData(dataList.get(0), "form:buttonIgnoreDupResponces", 0, 5000, false);
+ checkRequestData(dataList.get(1), "form:buttonIgnoreDupResponces", 5000, 10000, false);
+
+ //RF-5788
+ //checkRequestData(dataList.get(2), "form:buttonIgnoreDupResponces", 750, 5750, false);
+
+ //RF-5788
+ //assertEquals(5750d, result.getCurrentTime());
+ assertEquals(10000d, result.getCurrentTime());
+
+ Double requestsCompletedCounter = (Double) executeJavaScript("counter");
+ assertEquals(1d, requestsCompletedCounter);
+
+ Double requestsCompletionTime = (Double) executeJavaScript("time");
+
+ //RF-5788
+ //assertEquals(5750d, requestsCompletionTime);
+ assertEquals(10000d, requestsCompletionTime);
+ }
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,86 +1,86 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.component;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlForm;
-
-public class IncludeComponentTest extends org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
- private UIInclude include = null;
- private UIForm form = null;
-
- public IncludeComponentTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- include = (UIInclude) application.createComponent(UIInclude.COMPONENT_TYPE);
- include.setId("include");
- include.setLayout(UIInclude.LAYOUT_NONE);
-
- form.getChildren().add(include);
-
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- form = null;
- include = null;
- }
-
- public void testState() throws Exception {
-
- }
-
- public void testViewId() throws Exception {
- include.setViewId(null);
- assertNull(include.getViewId());
-
- String viewId = "viewId";
- include.setViewId(viewId);
- String newViewId = include.getViewId();
- assertNotNull(newViewId);
- assertEquals(viewId, newViewId);
- }
-
- public void testLayout() throws Exception {
- include.setLayout(null);
- assertNull(include.getLayout());
-
- include.setLayout(UIInclude.LAYOUT_BLOCK);
- String newLayout = include.getLayout();
- assertNotNull(newLayout);
- assertEquals(UIInclude.LAYOUT_BLOCK, newLayout);
- }
-
- public void testAjaxRendered() throws Exception {
- assertFalse(include.isAjaxRendered());
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+
+public class IncludeComponentTest extends org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
+ private UIInclude include = null;
+ private UIForm form = null;
+
+ public IncludeComponentTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ include = (UIInclude) application.createComponent(UIInclude.COMPONENT_TYPE);
+ include.setId("include");
+ include.setLayout(UIInclude.LAYOUT_NONE);
+
+ form.getChildren().add(include);
+
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ form = null;
+ include = null;
+ }
+
+ public void testState() throws Exception {
+
+ }
+
+ public void testViewId() throws Exception {
+ include.setViewId(null);
+ assertNull(include.getViewId());
+
+ String viewId = "viewId";
+ include.setViewId(viewId);
+ String newViewId = include.getViewId();
+ assertNotNull(newViewId);
+ assertEquals(viewId, newViewId);
+ }
+
+ public void testLayout() throws Exception {
+ include.setLayout(null);
+ assertNull(include.getLayout());
+
+ include.setLayout(UIInclude.LAYOUT_BLOCK);
+ String newLayout = include.getLayout();
+ assertNotNull(newLayout);
+ assertEquals(UIInclude.LAYOUT_BLOCK, newLayout);
+ }
+
+ public void testAjaxRendered() throws Exception {
+ assertFalse(include.isAjaxRendered());
+ }
+
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/LoadBundleComponentTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/LoadBundleComponentTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/LoadBundleComponentTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,144 +1,144 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.component;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlForm;
-
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class LoadBundleComponentTest extends org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
- private UIForm form;
- private UILoadBundle bundle = null;
- private static final String BUNDLE_NAME = "testBundle";
-
- public LoadBundleComponentTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- bundle = (UILoadBundle) application.createComponent(UILoadBundle.COMPONENT_TYPE);
- if (null != bundle) {
- bundle.setId("loadBundle");
- bundle.setVar(BUNDLE_NAME);
- bundle.setBasename("org.ajax4jsf.component.test_skin");
- form.getChildren().add(bundle);
- }
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- form = null;
- bundle = null;
- }
-
- public void testLoadBundle() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
- assertNotNull(loadedMap);
-
- assertEquals("non-existent key", loadedMap.get("non-existent key"));
-
- assertEquals("#000000", loadedMap.get("shadowBackgroundColor"));
- }
-
- public void testSize() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
- assertNotNull(loadedMap);
-
- assertEquals(0, loadedMap.size());
- }
-
- public void testContainsKey() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
- assertNotNull(loadedMap);
-
- assertTrue(loadedMap.containsKey("shadowBackgroundColor"));
-
- assertFalse(loadedMap.containsKey("non-existent key"));
- }
-
- public void testFakeFunctions() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
- assertNotNull(loadedMap);
-
- assertFalse(loadedMap.isEmpty());
-
- assertFalse(loadedMap.containsValue(null));
- assertFalse(loadedMap.containsValue("any-string"));
-
- try {
- loadedMap.put("key1", "value1");
- assertFalse("UnsupportedOperationException was not thrown", true);
- } catch (UnsupportedOperationException e) {
-
- }
-
- try {
- loadedMap.putAll(new HashMap());
- assertFalse("UnsupportedOperationException was not thrown", true);
- } catch (UnsupportedOperationException e) {
-
- }
-
- try {
- loadedMap.remove("key1");
- assertFalse("UnsupportedOperationException was not thrown", true);
- } catch (UnsupportedOperationException e) {
-
- }
-
- try {
- loadedMap.clear();
- assertFalse("UnsupportedOperationException was not thrown", true);
- } catch (UnsupportedOperationException e) {
-
- }
-
- assertNull(loadedMap.keySet());
-
- assertNull(loadedMap.values());
-
- assertNull(loadedMap.entrySet());
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class LoadBundleComponentTest extends org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
+ private UIForm form;
+ private UILoadBundle bundle = null;
+ private static final String BUNDLE_NAME = "testBundle";
+
+ public LoadBundleComponentTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ bundle = (UILoadBundle) application.createComponent(UILoadBundle.COMPONENT_TYPE);
+ if (null != bundle) {
+ bundle.setId("loadBundle");
+ bundle.setVar(BUNDLE_NAME);
+ bundle.setBasename("org.ajax4jsf.component.test_skin");
+ form.getChildren().add(bundle);
+ }
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ form = null;
+ bundle = null;
+ }
+
+ public void testLoadBundle() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
+ assertNotNull(loadedMap);
+
+ assertEquals("non-existent key", loadedMap.get("non-existent key"));
+
+ assertEquals("#000000", loadedMap.get("shadowBackgroundColor"));
+ }
+
+ public void testSize() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
+ assertNotNull(loadedMap);
+
+ assertEquals(0, loadedMap.size());
+ }
+
+ public void testContainsKey() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
+ assertNotNull(loadedMap);
+
+ assertTrue(loadedMap.containsKey("shadowBackgroundColor"));
+
+ assertFalse(loadedMap.containsKey("non-existent key"));
+ }
+
+ public void testFakeFunctions() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
+ assertNotNull(loadedMap);
+
+ assertFalse(loadedMap.isEmpty());
+
+ assertFalse(loadedMap.containsValue(null));
+ assertFalse(loadedMap.containsValue("any-string"));
+
+ try {
+ loadedMap.put("key1", "value1");
+ assertFalse("UnsupportedOperationException was not thrown", true);
+ } catch (UnsupportedOperationException e) {
+
+ }
+
+ try {
+ loadedMap.putAll(new HashMap());
+ assertFalse("UnsupportedOperationException was not thrown", true);
+ } catch (UnsupportedOperationException e) {
+
+ }
+
+ try {
+ loadedMap.remove("key1");
+ assertFalse("UnsupportedOperationException was not thrown", true);
+ } catch (UnsupportedOperationException e) {
+
+ }
+
+ try {
+ loadedMap.clear();
+ assertFalse("UnsupportedOperationException was not thrown", true);
+ } catch (UnsupportedOperationException e) {
+
+ }
+
+ assertNull(loadedMap.keySet());
+
+ assertNull(loadedMap.values());
+
+ assertNull(loadedMap.entrySet());
+ }
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/LoadResourceComponentTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/LoadResourceComponentTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/LoadResourceComponentTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/LoadResourceComponentTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,364 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import static org.ajax4jsf.resource.InternetResource.RESOURCE_URI_PREFIX;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.javascript.AjaxScript;
+import org.ajax4jsf.renderkit.HeaderResourceProducer2;
+import org.ajax4jsf.renderkit.ProducerContext;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.InternetResource;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.ResourceNotFoundException;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlLink;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class LoadResourceComponentTest extends AbstractAjax4JsfTestCase {
+
+ private String componentJs;
+ private String userJs;
+
+ private String componentXcss;
+ private String userXcss;
+
+ /**
+ * @param name
+ */
+ public LoadResourceComponentTest(String name) {
+ super(name);
+ }
+
+ private void registerResource(String path) {
+ InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+
+ try {
+ resourceBuilder.getResource(path);
+ } catch (ResourceNotFoundException e) {
+ resourceBuilder.createResource(null, path);
+ }
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ renderKit.addRenderer(ResourceDependentComponent.COMPONENT_FAMILY,
+ ResourceDependentComponent.COMPONENT_TYPE, new ResourceDependentComponentRenderer());
+
+ String resourcePackage = getClass().getPackage().getName().replace('.', '/') + "/";
+ componentJs = resourcePackage + "component.js";
+ componentXcss = resourcePackage + "component.xcss";
+
+ userJs = resourcePackage + "user.js";
+ userXcss = resourcePackage + "user.xcss";
+
+ registerResource(componentJs);
+ registerResource(userJs);
+ registerResource(componentXcss);
+ registerResource(userXcss);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ componentJs = null;
+ userJs = null;
+
+ componentXcss = null;
+ userXcss = null;
+ }
+
+ private UIResource createLoadScriptComponent() {
+ return (UIResource) application.createComponent("org.ajax4jsf.LoadScript");
+ }
+
+ private UIResource createLoadStyleComponent() {
+ return (UIResource) application.createComponent("org.ajax4jsf.LoadStyle");
+ }
+
+ private List<HtmlScript> selectScriptsBySrc(HtmlPage page, String src) throws Exception {
+ return Collections.checkedList(page.getByXPath("//script[@src[contains(string(.), '" + src + "')]]"),
+ HtmlScript.class);
+ }
+
+ private List<HtmlLink> selectStylesByHhref(HtmlPage page, String src) throws Exception {
+ return Collections.checkedList(page.getByXPath("//link[@type = 'text/css'][@rel = 'stylesheet'][@href[contains(string(.), '" + src + "')]]"),
+ HtmlLink.class);
+ }
+
+ protected UIResource createAndAddScriptResource(Object src) {
+ UIResource scriptComponent = createLoadScriptComponent();
+ scriptComponent.setSrc(src);
+ facesContext.getViewRoot().getChildren().add(scriptComponent);
+
+ return scriptComponent;
+ }
+
+ protected UIResource createAndAddStyleResource(Object src) {
+ UIResource styleComponent = createLoadStyleComponent();
+ styleComponent.setSrc(src);
+ facesContext.getViewRoot().getChildren().add(styleComponent);
+
+ return styleComponent;
+ }
+
+ public void testRenderScript() throws Exception {
+ createAndAddScriptResource(RESOURCE_URI_PREFIX + userJs);
+ createAndAddScriptResource(RESOURCE_URI_PREFIX + componentJs).setRendered(false);
+
+ HtmlPage page = renderView();
+ List<HtmlScript> scripts;
+
+ scripts = selectScriptsBySrc(page, userJs);
+ assertEquals(1, scripts.size());
+
+ scripts = selectScriptsBySrc(page, componentJs);
+ assertEquals(0, scripts.size());
+ }
+
+ public void testRenderScriptResource() throws Exception {
+ InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+ createAndAddScriptResource(resourceBuilder.getResourceForKey(userJs));
+ createAndAddScriptResource(resourceBuilder.getResourceForKey(componentJs)).setRendered(false);
+
+ HtmlPage page = renderView();
+ List<HtmlScript> scripts;
+
+ scripts = selectScriptsBySrc(page, userJs);
+ assertEquals(1, scripts.size());
+
+ scripts = selectScriptsBySrc(page, componentJs);
+ assertEquals(1, scripts.size());
+ }
+
+ public void testRenderStyle() throws Exception {
+ createAndAddStyleResource(RESOURCE_URI_PREFIX + userXcss);
+ createAndAddStyleResource(RESOURCE_URI_PREFIX + componentXcss).setRendered(false);
+
+ HtmlPage page = renderView();
+ List<HtmlLink> styles;
+ HtmlLink userLink;
+
+ styles = selectStylesByHhref(page, userXcss);
+ assertEquals(1, styles.size());
+ userLink = styles.get(0);
+ assertEquals("user", userLink.getClassAttribute());
+ assertEquals("", userLink.getMediaAttribute());
+
+ styles = selectStylesByHhref(page, componentXcss);
+ assertEquals(0, styles.size());
+ }
+
+ public void testRenderStyleResource() throws Exception {
+ InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+ createAndAddStyleResource(resourceBuilder.getResourceForKey(userXcss));
+ createAndAddStyleResource(resourceBuilder.getResourceForKey(componentXcss)).setRendered(false);
+
+ UIResource styleComponent = createLoadStyleComponent();
+ styleComponent.setSrc(InternetResourceBuilder.getInstance().getResourceForKey(userXcss));
+ facesContext.getViewRoot().getChildren().add(styleComponent);
+
+ HtmlPage page = renderView();
+ List<HtmlLink> styles;
+ HtmlLink userLink;
+
+ styles = selectStylesByHhref(page, userXcss);
+ assertEquals(1, styles.size());
+ userLink = styles.get(0);
+ assertEquals("user", userLink.getClassAttribute());
+ assertEquals("", userLink.getMediaAttribute());
+
+ styles = selectStylesByHhref(page, componentXcss);
+ assertEquals(1, styles.size());
+ userLink = styles.get(0);
+ assertEquals("user", userLink.getClassAttribute());
+ assertEquals("", userLink.getMediaAttribute());
+ }
+
+ public void testRenderMedia() throws Exception {
+ createAndAddStyleResource(RESOURCE_URI_PREFIX + userXcss).
+ getAttributes().put(HTML.media_ATTRIBUTE, "screen print");
+
+ HtmlPage page = renderView();
+ List<HtmlLink> styles = selectStylesByHhref(page, userXcss);
+ assertEquals(1, styles.size());
+ HtmlLink userLink = styles.get(0);
+ assertEquals("user", userLink.getClassAttribute());
+ assertEquals("screen print", userLink.getMediaAttribute());
+ }
+
+ public void testRenderOverridenScript() throws Exception {
+ List<UIComponent> childrenList = facesContext.getViewRoot().getChildren();
+
+ UIResource userJsComponent = createLoadScriptComponent();
+ userJsComponent.setSrc(RESOURCE_URI_PREFIX + userJs);
+ childrenList.add(userJsComponent);
+
+ InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+
+ childrenList.add(new ResourceDependentComponent(true,
+ resourceBuilder.getResourceForKey(componentJs),
+ resourceBuilder.getResourceForKey(userJs)));
+
+ UIResource componentJsComponent = createLoadScriptComponent();
+ componentJsComponent.setSrc(RESOURCE_URI_PREFIX + componentJs);
+ childrenList.add(componentJsComponent);
+
+ HtmlPage page = renderView();
+ List<HtmlScript> userScripts = selectScriptsBySrc(page, userJs);
+ assertEquals(1, userScripts.size());
+ List<HtmlScript> componentScripts = selectScriptsBySrc(page, componentJs);
+ assertEquals(1, componentScripts.size());
+ }
+
+ public void testRenderOverridenStyle() throws Exception {
+ List<UIComponent> childrenList = facesContext.getViewRoot().getChildren();
+
+ UIResource userXcssComponent = createLoadStyleComponent();
+ userXcssComponent.setSrc(RESOURCE_URI_PREFIX + userXcss);
+ childrenList.add(userXcssComponent);
+
+ InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+
+ childrenList.add(new ResourceDependentComponent(false,
+ resourceBuilder.getResourceForKey(componentXcss),
+ resourceBuilder.getResourceForKey(userXcss)));
+
+ UIResource componentXcssComponent = createLoadStyleComponent();
+ componentXcssComponent.setSrc(RESOURCE_URI_PREFIX + componentXcss);
+ childrenList.add(componentXcssComponent);
+
+ HtmlPage page = renderView();
+ List<HtmlLink> styles = selectStylesByHhref(page, userXcss);
+ assertEquals(2, styles.size());
+ assertEquals("component", styles.get(0).getClassAttribute());
+ assertEquals("user", styles.get(1).getClassAttribute());
+
+ styles = selectStylesByHhref(page, componentXcss);
+ assertEquals(2, styles.size());
+ assertEquals("component", styles.get(0).getClassAttribute());
+ assertEquals("user", styles.get(1).getClassAttribute());
+ }
+
+ public void testRenderOverridenAjaxScript() throws Exception {
+ UIResource userComponent = createLoadScriptComponent();
+ userComponent.setSrc(RESOURCE_URI_PREFIX + "/org/ajax4jsf/javascript/scripts/AJAX.js");
+
+ List<UIComponent> childrenList = facesContext.getViewRoot().getChildren();
+ childrenList.add(userComponent);
+
+ childrenList.add(new ResourceDependentComponent(true, new AjaxScript()));
+
+ HtmlPage page = renderView();
+ List<HtmlScript> scripts = selectScriptsBySrc(page, "AjaxScript");
+ assertEquals(1, scripts.size());
+
+ scripts = selectScriptsBySrc(page, "AJAX.js");
+ //TODO change to 0 after related issue resolution
+ assertEquals(1, scripts.size());
+ }
+}
+
+class ResourceDependentComponent extends UIComponentBase {
+
+ static String COMPONENT_TYPE = "org.ajax4jsf.component.Test$ResourceDependentComponent";
+
+ static String COMPONENT_FAMILY = COMPONENT_TYPE;
+
+ private InternetResource[] resources;
+
+ private boolean useScripts;
+
+ public ResourceDependentComponent(boolean useScripts, InternetResource... resources) {
+ this.useScripts = useScripts;
+ this.resources = resources;
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ @Override
+ public String getRendererType() {
+ return COMPONENT_TYPE;
+ }
+
+ public InternetResource[] getScripts() {
+ return useScripts ? resources : null;
+ }
+
+ public InternetResource[] getStyles() {
+ return useScripts ? null : resources;
+ }
+}
+
+class ResourceDependentComponentRenderer extends RendererBase implements HeaderResourceProducer2 {
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return ResourceDependentComponent.class;
+ }
+
+ public void encodeToHead(FacesContext context, UIComponent component,
+ ProducerContext pc) throws IOException {
+
+ ResourceDependentComponent resourceDependentComponent = (ResourceDependentComponent) component;
+
+ if (pc.isProcessScripts()) {
+ InternetResource[] scripts = resourceDependentComponent.getScripts();
+ if (scripts != null) {
+ for (InternetResource script : scripts) {
+ script.encode(context, null);
+ }
+ }
+ }
+
+ if (pc.isProcessStyles()) {
+ InternetResource[] styles = resourceDependentComponent.getStyles();
+ if (styles != null) {
+ for (InternetResource script : styles) {
+ script.encode(context, null);
+ }
+ }
+ }
+ }
+
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueDiscoveryTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueDiscoveryTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueDiscoveryTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueDiscoveryTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,210 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.mozilla.javascript.NativeArray;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ *
+ */
+public class QueueDiscoveryTest extends AbstractQueueComponentTest {
+
+ /**
+ * @param name
+ */
+ public QueueDiscoveryTest(String name) {
+ super(name);
+ }
+
+ protected void assertListsEqual(List<String> list1, List<String> list2)
+ throws Exception {
+
+ assertEquals(list1 + ":" + list2, list1, list2);
+ }
+
+ protected List<String> getResults(HtmlPage page) {
+ List<String> result = new ArrayList<String>();
+
+ executeJavaScript("Timer.execute()");
+ NativeArray array = (NativeArray) executeJavaScript("window.testResult");
+ for (int i = 0; i < array.getLength(); i++) {
+ result.add((String) array.get(i, array));
+ }
+
+ return result;
+ }
+
+ public void testGlobalViewQueue() throws Exception {
+ renderView("/queue-global-view.xhtml");
+
+ List<String> list = new ArrayList<String>();
+ assertListsEqual(list, getResults(page));
+
+ list.add("button");
+ click("form:button");
+ assertListsEqual(list, getResults(page));
+
+ list.add("implicitQueue");
+ click("form:implicitQueue");
+ assertListsEqual(list, getResults(page));
+
+ list.add("alternativeQueueButton");
+ list.add("alt:alternativeQueueButton");
+ click("form:alternativeQueueButton");
+ assertListsEqual(list, getResults(page));
+
+ list.add("function");
+ executeJavaScript("ajaxFunction()");
+ assertListsEqual(list, getResults(page));
+
+ list.add("implicitDelayedQueue");
+ click("form2:implicitDelayedQueue");
+ assertListsEqual(list, getResults(page));
+ }
+
+ public void testGlobalFormQueue() throws Exception {
+ renderView("/queue-global-form.xhtml");
+
+ List<String> list = new ArrayList<String>();
+ assertListsEqual(list, getResults(page));
+
+ list.add("alternativeQueueButton");
+ list.add("alt:alternativeQueueButton");
+ click("form2:alternativeQueueButton");
+ assertListsEqual(list, getResults(page));
+
+ list.add("alternativeQueueButton");
+ click("form:alternativeQueueButton");
+ assertListsEqual(list, getResults(page));
+
+ list.add("buttonFormQueue");
+ click("form:button");
+ assertListsEqual(list, getResults(page));
+
+ list.add("implicitQueue");
+ click("form:implicitQueue");
+ assertListsEqual(list, getResults(page));
+
+ list.add("alternativeQueue1Button");
+ list.add("alt1:alternativeQueue1Button");
+ click("form:alternativeQueue1Button");
+ assertListsEqual(list, getResults(page));
+
+ list.add("buttonForm2Queue");
+ click("form2:button");
+ assertListsEqual(list, getResults(page));
+
+ list.add("implicitDelayedQueue");
+ click("form2:implicitDelayedQueue");
+ assertListsEqual(list, getResults(page));
+
+ list.add("ajaxFunction");
+ executeJavaScript("ajaxFunction()");
+ assertListsEqual(list, getResults(page));
+ }
+
+ public void testGlobalFormBoth() throws Exception {
+ renderView("/queue-global-both.xhtml");
+
+ List<String> list = new ArrayList<String>();
+ assertListsEqual(list, getResults(page));
+
+ list.add("buttonFormQueue");
+ click("form:button");
+ assertListsEqual(list, getResults(page));
+
+ list.add("implicitDelayedQueue");
+ click("form:implicitDelayedQueue");
+ assertListsEqual(list, getResults(page));
+
+ list.add("implicitQueue");
+ click("form2:implicitQueue");
+ assertListsEqual(list, getResults(page));
+
+ list.add("viewQueue:viewQueueButton");
+ click("form:viewQueueButton");
+ assertListsEqual(list, getResults(page));
+
+ list.add("form2Button");
+ click("form2:button");
+ assertListsEqual(list, getResults(page));
+
+ list.add("anotherImplicitQueue");
+ click("form3:anotherImplicitQueue");
+ assertListsEqual(list, getResults(page));
+
+ list.add("form3Button");
+ click("form3:button");
+ assertListsEqual(list, getResults(page));
+
+ list.add("functionFormQueue");
+ executeJavaScript("ajaxFunction()");
+ assertListsEqual(list, getResults(page));
+ }
+
+ public void testDisabled() throws Exception {
+ renderView("/queue-disabled.xhtml");
+
+ List<String> list = new ArrayList<String>();
+ assertListsEqual(list, getResults(page));
+
+ list.add("button");
+ click("form:button");
+ assertListsEqual(list, getResults(page));
+
+ list.add("formQueueButton");
+ click("form:formQueueButton");
+ assertListsEqual(list, getResults(page));
+
+ list.add("button2");
+ list.add("form2-global:button2");
+ click("form2:button2");
+ assertListsEqual(list, getResults(page));
+
+ list.add("formQueueButton2");
+ list.add("form2-queue:formQueueButton2");
+ click("form2:formQueueButton2");
+ assertListsEqual(list, getResults(page));
+
+ list.add("global");
+ click("form3:global");
+ assertListsEqual(list, getResults(page));
+
+ list.add("globalNamed");
+ click("form3:globalNamed");
+ assertListsEqual(list, getResults(page));
+
+ list.add("globalNamedX");
+ list.add("viewNamedX:globalNamedX");
+ click("form3:globalNamedX");
+ assertListsEqual(list, getResults(page));
+ }
+
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueParallelTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueParallelTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueParallelTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueParallelTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,47 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class QueueParallelTest extends AbstractQueueComponentTest {
+
+ /**
+ * @param name
+ */
+ public QueueParallelTest(String name) {
+ super(name);
+ }
+
+ public void testParallel() throws Exception {
+ renderView("/queue-parallel.xhtml");
+
+ clickOnTime(0, "form:asyncButton");
+ clickOnTime(0, "form:asyncButton1");
+ clickOnTime(0, "form:asyncButton2");
+
+
+ }
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueRendererTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,252 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+
+import org.ajax4jsf.renderkit.html.scripts.QueueScriptResourceRenderer;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.jaxen.JaxenException;
+
+import com.gargoylesoftware.htmlunit.html.DomText;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class QueueRendererTest extends AbstractAjax4JsfTestCase {
+
+ private UIForm form;
+
+ private static final String dry(String s) {
+ return s.replace(" ", "");
+ }
+
+ /**
+ * @param name
+ */
+ public QueueRendererTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ UIViewRoot root = facesContext.getViewRoot();
+ List<UIComponent> children = root.getChildren();
+
+ form = (UIForm) application.createComponent(UIForm.COMPONENT_TYPE);
+ form.setId("theform");
+ form.getChildren().add(application.createComponent(UIInput.COMPONENT_TYPE));
+ children.add(form);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ form = null;
+ }
+
+ private String getQueueScript(HtmlPage page) throws JaxenException {
+ List<?> list = page.getByXPath("//head/script[@id='" + QueueScriptResourceRenderer.QUEUE_SCRIPT_ID + "']/text()");
+ DomText text = (DomText) list.get(0);
+ String scriptData = text.getData();
+
+ return scriptData.replaceAll("^\\Qif (typeof A4J != 'undefined') { if (A4J.AJAX) { with (A4J.AJAX) {\\E|\\Q}}};\\E$", "");
+ }
+
+ private String[] splitScript(String s) {
+ String[] split = s.split(";");
+ for (int i = 0; i < split.length; i++) {
+ split[i] = split[i] + ";";
+ }
+
+ return split;
+ }
+
+ private String createQueueInitString(String queueName, String queueParams, String requestParams) {
+ StringBuilder builder = new StringBuilder("if (!EventQueue.getQueue('").append(queueName).append("')) { EventQueue.addQueue(new EventQueue('").
+ append(queueName).append("'");
+
+ builder.append(",");
+ builder.append(String.valueOf(queueParams));
+
+ builder.append(",");
+ builder.append(String.valueOf(requestParams));
+
+ builder.append(")) };");
+
+ return builder.toString();
+ }
+
+ public void testViewQueueName() throws Exception {
+ UIQueue queue = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+ queue.setName("test_view_queue");
+ facesContext.getViewRoot().getChildren().add(queue);
+
+ HtmlPage page = renderView();
+ String queueScript = getQueueScript(page);
+
+ assertEquals(createQueueInitString("test_view_queue", null, null), queueScript);
+ }
+
+ public void testViewQueueDefaultName() throws Exception {
+ UIQueue queue = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+ facesContext.getViewRoot().getChildren().add(queue);
+
+ HtmlPage page = renderView();
+ String queueScript = getQueueScript(page);
+ assertEquals(createQueueInitString(UIQueue.GLOBAL_QUEUE_NAME, null, null), queueScript);
+ }
+
+ public void testFormQueueName() throws Exception {
+ UIQueue queue = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+ queue.setName("test_view_queue");
+ form.getChildren().add(queue);
+
+ HtmlPage page = renderView();
+ String queueScript = getQueueScript(page);
+ assertEquals(createQueueInitString("theform:test_view_queue", null, null), queueScript);
+ }
+
+ public void testFormQueueDefaultName() throws Exception {
+ UIQueue queue = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+ form.getChildren().add(queue);
+
+ HtmlPage page = renderView();
+ String queueScript = getQueueScript(page);
+ assertEquals(createQueueInitString("theform", null, null), queueScript);
+ }
+
+ public void testRenderQueueAttributes() throws Exception {
+ UIQueue queue1 = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+
+ queue1.setSize(10);
+ queue1.setOnsizeexceeded("sizeexceeded_handler()");
+ queue1.setSizeExceededBehavior("dropNext");
+ queue1.setOnrequestqueue("request_queue_handler()");
+ queue1.setOnrequestdequeue("request_de_queue_handler()");
+ form.getChildren().add(queue1);
+
+ UIQueue queue2 = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+ queue2.setSize(-1);
+ queue2.setName("unsizedQueue");
+ form.getChildren().add(queue2);
+
+ UIQueue queue3 = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+ queue3.setName("defaultSizeQueue");
+ form.getChildren().add(queue3);
+
+ HtmlPage page = renderView();
+ String queueScript = dry(getQueueScript(page));
+ String[] scripts = splitScript(queueScript);
+ assertEquals(3, scripts.length);
+
+ assertEquals(dry(createQueueInitString("theform",
+ "{'size':10,'sizeExceededBehavior':'dropNext','onsizeexceeded':function(query,options,event){sizeexceeded_handler()},'onrequestqueue':function(query,options,event){request_queue_handler()},'onrequestdequeue':function(query,options,event){request_de_queue_handler()}}",
+ null)),
+ scripts[0]);
+
+ assertEquals(dry(createQueueInitString("theform:unsizedQueue", "{'size':-1}", null)), scripts[1]);
+
+ assertEquals(dry(createQueueInitString("theform:defaultSizeQueue", null, null)), scripts[2]);
+ }
+
+ public void testRenderRequestAttributes() throws Exception {
+ UIQueue queue1 = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+
+ queue1.setName("queue1");
+ queue1.setTimeout(50021);
+ queue1.setOnerror("error_queue_handler()");
+ queue1.setOnsubmit("submit_queue_handler()");
+ queue1.setIgnoreDupResponses(false);
+ form.getChildren().add(queue1);
+
+ UIQueue queue2 = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+
+ queue2.setName("queue2");
+ queue2.setRequestDelay(600);
+ queue2.setIgnoreDupResponses(true);
+ queue2.setOnbeforedomupdate("beforedomupdate_handler()");
+ queue2.setOncomplete("complete_handler()");
+ queue2.setStatus("mystatus");
+ form.getChildren().add(queue2);
+
+ HtmlPage page = renderView();
+ String queueScript = dry(getQueueScript(page));
+ String[] scripts = splitScript(queueScript);
+ assertEquals(2, scripts.length);
+
+ assertEquals(dry(createQueueInitString("theform:queue1", null,
+ "{'timeout':50021,'queueonsubmit':function(request){submit_queue_handler()},'queueonerror':function(request,status,message){error_queue_handler()}}")), scripts[0]);
+ assertEquals(dry(createQueueInitString("theform:queue2", null,
+ "{'ignoreDupResponses':true,'requestDelay':600,'status':'mystatus','queueonbeforedomupdate':function(request,event,data){beforedomupdate_handler()},'queueoncomplete':function(request,event,data){complete_handler()}}")),
+ scripts[1]);
+ }
+
+ public void testInvalidSizeExceededBehavior() throws Exception {
+ UIQueue queue = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+ queue.setSizeExceededBehavior("unknownBehavior");
+ form.getChildren().add(queue);
+
+ try {
+ renderView();
+ fail();
+ } catch (IllegalArgumentException e) {
+ //ok
+ }
+ }
+
+ public void testDuplicateQueues() throws Exception {
+ UIQueue queue1 = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+ queue1.setName("testQueue");
+ queue1.setSize(2);
+ form.getChildren().add(queue1);
+
+ UIQueue queue2 = (UIQueue) application.createComponent(UIQueue.COMPONENT_TYPE);
+ queue2.setName("testQueue");
+ queue2.setSize(5);
+ form.getChildren().add(queue2);
+
+ HtmlPage page = renderView();
+
+ String queueScript = dry(getQueueScript(page));
+ String[] scripts = splitScript(queueScript);
+ assertEquals(1, scripts.length);
+
+ assertEquals(dry(createQueueInitString("theform:testQueue", "{'size':2}",null)), scripts[0]);
+ }
+
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,257 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import java.util.List;
+
+import org.mozilla.javascript.NativeArray;
+
+/**
+ * @author Denis Morozov
+ * @author Nick Belaevski
+ */
+public class QueueScriptedTest extends AbstractQueueComponentTest {
+
+ private static final String QUEUE_NAME = "testQueue";
+
+ private static final String VIEW_NAME = "/queue-scripted.xhtml";
+
+ public QueueScriptedTest(String name) {
+ super(name);
+ }
+
+ public void testRequestDelayDefined() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().
+ eventsQueue("queueRequestDelay").requestTime(5);
+
+ ajax(0, "a", parametersBuilder);
+ ajax(25, "b", parametersBuilder);
+ ajax(50, "c", parametersBuilder.requestDelay(30));
+ ajax(90, "d", parametersBuilder.requestDelay(10));
+ ajax(95, "d", parametersBuilder.requestDelay(50));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(4, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 15, 20, false);
+ checkRequestData(dataList.get(1), "b", 40, 45, false);
+ checkRequestData(dataList.get(2), "c", 80, 85, false);
+ checkRequestData(dataList.get(3), "d", 145, 150, false);
+ }
+
+ public void testRequestDelayDefault() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue("queueDefaults").
+ requestTime(100);
+
+ ajax(0, "a", parametersBuilder.requestDelay(100));
+ ajax(300, "b", parametersBuilder);
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(2, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 100, 200, false);
+ checkRequestData(dataList.get(1), "b", 300, 400, false);
+ }
+
+ public void testTimeout() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().
+ eventsQueue("queueTimeout").requestDelay(0);
+
+ ajax(0, "a", parametersBuilder.requestTime(4999));
+ ajax(10000, "b", parametersBuilder.requestTime(5001).similarityGroupingId("b"));
+ ajax(10000, "c", parametersBuilder.requestTime(100).similarityGroupingId("c"));
+ ajax(20000, "d", parametersBuilder.requestTime(10000).timeout(10000));
+ ajax(40000, "e", parametersBuilder.requestTime(10001).timeout(10000));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(5, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 0, 4999, false);
+ checkRequestData(dataList.get(1), "b", 10000, 15000, true);
+ checkRequestData(dataList.get(2), "c", 15000, 15100, false);
+ checkRequestData(dataList.get(3), "d", 20000, 30000, false);
+ checkRequestData(dataList.get(4), "e", 40000, 50000, true);
+
+ }
+
+ public void testIgnoreDupResponses() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().
+ eventsQueue("queueIgnoreDupResponses").requestDelay(0).requestTime(1000);
+
+ ajax(0, "a", parametersBuilder.similarityGroupingId("a"));
+ ajax(500, "b", parametersBuilder.similarityGroupingId("a"));
+ ajax(2500, "c", parametersBuilder.similarityGroupingId("a"));
+ ajax(3000, "d", parametersBuilder.similarityGroupingId("a").ignoreDupResponses(false));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(4, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 0, 1000, false);
+ checkRequestData(dataList.get(1), "b", 1000, 2000, false);
+
+ checkRequestData(dataList.get(2), "c", 2500, 3500, false);
+ checkRequestData(dataList.get(3), "d", 3500, 4500, false);
+
+ NativeArray array = (NativeArray) executeJavaScript("queueIgnoreDupResponsesTest");
+ long length = array.getLength();
+ assertEquals(3, length);
+
+ assertEquals("b:2000", (String) array.get(0, array));
+ assertEquals("c:3500", (String) array.get(1, array));
+ assertEquals("d:4500", (String) array.get(2, array));
+ }
+
+ public void testIgnoreDupResponsesDefault() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().
+ eventsQueue("queueDefaults").requestTime(500);
+
+ ajax(0, "a", parametersBuilder);
+ ajax(250, "b", parametersBuilder);
+ ajax(750, "c", parametersBuilder.ignoreDupResponses(true));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(3, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 0, 500, false);
+ checkRequestData(dataList.get(1), "b", 500, 1000, false);
+ checkRequestData(dataList.get(2), "c", 1000, 1500, false);
+ }
+
+ public void testIgnoreDupResponsesTimeout() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().
+ eventsQueue("queueTimeout").ignoreDupResponses(true).requestDelay(0).requestTime(1000);
+
+ ajax(0, "a", parametersBuilder.timeout(500));
+ ajax(100, "b", parametersBuilder);
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(2, dataList.size());
+ checkRequestData(dataList.get(0), "a", 0, 500, true);
+ checkRequestData(dataList.get(1), "b", 500, 1500, false);
+ }
+
+ public void testSimpleAjax() throws Exception {
+ renderView(VIEW_NAME);
+
+ ajax(50, "a", createAjaxParameters().requestTime(100));
+ ajax(50, "b", createAjaxParameters().requestTime(150));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(2, dataList.size());
+ checkRequestData(dataList.get(0), "a", 50, 150, false);
+ checkRequestData(dataList.get(1), "b", 50, 200, false);
+
+ assertEquals(200d, result.getCurrentTime());
+ }
+
+ public void testSimpleQueuedAjax() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder queueParameters = createAjaxParameters().requestTime(500).eventsQueue(QUEUE_NAME);
+ ajax(50, "a", queueParameters.similarityGroupingId(0));
+ ajax(250, "b", queueParameters.similarityGroupingId(1));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(2, dataList.size());
+ checkRequestData(dataList.get(0), "a", 50, 550, false);
+ checkRequestData(dataList.get(1), "b", 550, 1050, false);
+
+ assertEquals(1050d, result.getCurrentTime());
+ }
+
+ public void testImplicitQueue() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder parameters = createAjaxParameters().
+ requestDelay(100).
+ implicitEventsQueue("myqueue").
+ requestTime(10);
+
+ ajax(0, "a", parameters);
+ ajax(10, "b", parameters);
+ ajax(20, "c", parameters.requestDelay(50));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(1, dataList.size());
+
+ RequestData requestData = dataList.get(0);
+ checkRequestData(requestData, "c", 70, 80, false);
+
+ assertEquals(80d, result.getCurrentTime());
+
+ }
+
+ public void testStatusIgnoreDupResponses() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder parameters = createAjaxParameters().requestDelay(0).eventsQueue("queueIgnoreDupResponses");
+
+ ajax(0, "a", parameters);
+ ajax(100, "b", parameters);
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(2, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 0, DEFAULT_REQUEST_TIME, false);
+ checkRequestData(dataList.get(1), "b", DEFAULT_REQUEST_TIME, 2 * DEFAULT_REQUEST_TIME, false);
+
+ NativeArray array = (NativeArray) executeJavaScript("window.statusData");
+ assertEquals(2, array.getLength());
+
+ NativeArray nestedArray = (NativeArray) array.get(0, array);
+ assertEquals(Double.valueOf(0), nestedArray.get(0, nestedArray));
+ assertEquals(Double.valueOf(DEFAULT_REQUEST_TIME), nestedArray.get(1, nestedArray));
+
+ nestedArray = (NativeArray) array.get(1, array);
+ assertEquals(Double.valueOf(DEFAULT_REQUEST_TIME), nestedArray.get(0, nestedArray));
+ assertEquals(Double.valueOf(2 * DEFAULT_REQUEST_TIME), nestedArray.get(1, nestedArray));
+ }
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueSimilarityTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSimilarityTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueSimilarityTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueSimilarityTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,161 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import java.util.List;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class QueueSimilarityTest extends AbstractQueueComponentTest {
+
+ /**
+ * @param name
+ */
+ public QueueSimilarityTest(String name) {
+ super(name);
+ }
+
+ private static final String VIEW_NAME = "/queue-similarity.xhtml";
+
+ public void testDefaultBehavior() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "form:button3");
+ clickOnTime(100, "form:button3");
+ clickOnTime(200, "form:button4");
+ clickOnTime(400, "form:button3");
+
+ clickOnTime(4000, "form:button3");
+ clickOnTime(4300, "form:button3");
+ clickOnTime(4500, "form:button3");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(4, dataList.size());
+
+ checkRequestData(dataList.get(0), "form:button3", 200, 1200, false);
+ checkRequestData(dataList.get(1), "form:button4", 1200, 2200, false);
+ checkRequestData(dataList.get(2), "form:button3", 2200, 3200, false);
+ checkRequestData(dataList.get(3), "form:button3", 5000, 6000, false);
+ }
+
+ public void testGrouping() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "form:button1");
+ clickOnTime(100, "form:button1");
+ clickOnTime(200, "form:button2");
+ clickOnTime(300, "form:button1");
+
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(1, dataList.size());
+
+ checkRequestData(dataList.get(0), "form:button1", 700, 1700, false);
+ }
+
+ public void testSizeExceededGroupingDropNext() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "dropNext:button1");
+ clickOnTime(100, "dropNext:button2");
+ clickOnTime(200, "dropNext:button1");
+ clickOnTime(300, "dropNext:button2");
+ clickOnTime(2000, "dropNext:button1");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(4, dataList.size());
+
+ checkRequestData(dataList.get(0), "dropNext:button1", 100, 1100, false);
+ checkRequestData(dataList.get(1), "dropNext:button1", 1100, 2100, false);
+ checkRequestData(dataList.get(2), "dropNext:button2", 2100, 3100, false);
+ checkRequestData(dataList.get(3), "dropNext:button1", 3100, 4100, false);
+ }
+
+ public void testSizeExceededGroupingDropNew() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "dropNew:button1");
+ clickOnTime(100, "dropNew:button2");
+ clickOnTime(200, "dropNew:button1");
+ clickOnTime(300, "dropNew:button2");
+ clickOnTime(2000, "dropNew:button1");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(4, dataList.size());
+ checkRequestData(dataList.get(0), "dropNew:button1", 100, 1100, false);
+ checkRequestData(dataList.get(1), "dropNew:button2", 1100, 2100, false);
+ checkRequestData(dataList.get(2), "dropNew:button1", 2100, 3100, false);
+ checkRequestData(dataList.get(3), "dropNew:button1", 3100, 4100, false);
+ }
+
+ public void testSizeExceededGroupingFireNext() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "fireNext:button1");
+ clickOnTime(100, "fireNext:button2");
+ clickOnTime(200, "fireNext:button1");
+ clickOnTime(300, "fireNext:button2");
+ clickOnTime(2000, "fireNext:button1");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(5, dataList.size());
+ checkRequestData(dataList.get(0), "fireNext:button1", 100, 1100, false);
+ checkRequestData(dataList.get(1), "fireNext:button2", 300, 1300, false);
+ checkRequestData(dataList.get(2), "fireNext:button1", 1100, 2100, false);
+ checkRequestData(dataList.get(3), "fireNext:button2", 2100, 3100, false);
+ checkRequestData(dataList.get(4), "fireNext:button1", 3100, 4100, false);
+ }
+
+ public void testSizeExceededGroupingFireNew() throws Exception {
+ renderView(VIEW_NAME);
+
+ clickOnTime(0, "fireNew:button1");
+ clickOnTime(100, "fireNew:button2");
+ clickOnTime(200, "fireNew:button1");
+ clickOnTime(300, "fireNew:button2");
+ clickOnTime(2000, "fireNew:button1");
+
+ TestsResult testsResult = getTestsResult();
+ List<RequestData> dataList = testsResult.getDataList();
+
+ assertEquals(5, dataList.size());
+ checkRequestData(dataList.get(0), "fireNew:button1", 100, 1100, false);
+ checkRequestData(dataList.get(1), "fireNew:button2", 300, 1300, false);
+
+ checkRequestData(dataList.get(2), "fireNew:button2", 1100, 2100, false);
+ checkRequestData(dataList.get(3), "fireNew:button1", 2100, 3100, false);
+ checkRequestData(dataList.get(4), "fireNew:button1", 3100, 4100, false);
+ }
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,422 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import java.text.NumberFormat;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+
+import org.mozilla.javascript.NativeArray;
+import org.mozilla.javascript.ScriptableObject;
+
+
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class QueueSizeTest extends AbstractQueueComponentTest {
+
+ public QueueSizeTest(String name) {
+ super(name);
+ }
+
+ private static final int numberOfEvents = 250;
+
+ private static abstract interface SequenceGenerator<T> {
+ public abstract T next();
+ }
+
+ protected TestsResult simulate(int numberOfEvents,
+ SequenceGenerator<Integer> userDelayGenerator,
+ SequenceGenerator<Integer> processTimeGenerator,
+ SequenceGenerator<String> requestIdGenerator) throws Exception {
+
+ NumberFormat numberFormat = NumberFormat.getInstance();
+ numberFormat.setGroupingUsed(false);
+ numberFormat.setMinimumIntegerDigits(String.valueOf(numberOfEvents).length());
+
+ renderView("/queue-size.xhtml");
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue("defaultSizeQueue");
+
+ int time = 0;
+
+ for (int i = 0; i < numberOfEvents; i++) {
+ int userDelay = userDelayGenerator.next();
+ int requestTime = processTimeGenerator.next();
+
+ time += userDelay;
+ ajax(time, numberFormat.format(i), parametersBuilder.similarityGroupingId(requestIdGenerator.next()).
+ requestTime(requestTime));
+
+ }
+
+ TestsResult result = getTestsResult();
+ return result;
+ }
+
+ protected void checkQueueOrdering(TestsResult result) throws Exception {
+ double time = 0;
+ String lastRequestId = "";
+
+ List<RequestData> dataList = result.getDataList();
+ Iterator<RequestData> itr = dataList.iterator();
+ while (itr.hasNext()) {
+ RequestData data = itr.next();
+
+ assertTrue(data.getStartTime() >= time);
+ assertTrue(data.getEndTime() >= data.getStartTime());
+ assertTrue(data.getData().compareTo(lastRequestId) > 0);
+
+ lastRequestId = data.getData();
+ time = data.getEndTime();
+ }
+ }
+
+ private static final class UUIDGenerator implements SequenceGenerator<String> {
+
+ public String next() {
+ return UUID.randomUUID().toString();
+ }
+
+ }
+
+ private static final class RandomSequenceGenerator implements SequenceGenerator<Integer> {
+
+ private int offset;
+
+ private int limit;
+
+ public RandomSequenceGenerator(int minimum, int maximum) {
+ super();
+
+ this.limit = maximum - minimum;
+ this.offset = minimum;
+ }
+
+ private Random random = new Random();
+
+ public Integer next() {
+ return random.nextInt(this.limit) + this.offset;
+ }
+
+ }
+
+ public void testUnlimitedOverload() throws Exception {
+ TestsResult result = simulate(numberOfEvents,
+ new RandomSequenceGenerator(5, 100),
+ new RandomSequenceGenerator(50, 300),
+ new UUIDGenerator()
+ );
+
+ checkQueueOrdering(result);
+ assertEquals(numberOfEvents, result.getDataList().size());
+ }
+
+ public void testUnlimitedUnderload() throws Exception {
+ TestsResult result = simulate(numberOfEvents,
+ new RandomSequenceGenerator(50, 300),
+ new RandomSequenceGenerator(5, 100),
+ new UUIDGenerator()
+ );
+
+ checkQueueOrdering(result);
+ assertEquals(numberOfEvents, result.getDataList().size());
+ }
+
+ private static final class TableRequestIdGenerator implements SequenceGenerator<String> {
+ private static final String[] requestIds = new String[] {
+ "aaa", "bbb", "ccc", "ddd", "eee", "fff"
+ };
+
+ private Random random = new Random();
+
+ private String lastValue;
+
+ private int uniqueIdsCounter = 0;
+
+ public String next() {
+ String newValue = requestIds[random.nextInt(requestIds.length)];
+
+ if (!newValue.equals(lastValue)) {
+ lastValue = newValue;
+ uniqueIdsCounter++;
+ }
+
+ return newValue;
+ }
+
+ public int getUniqueIdsCounter() {
+ return uniqueIdsCounter;
+ }
+ };
+
+
+ public void testUnlimitedEmulateUser() throws Exception {
+ TableRequestIdGenerator requestIdGenerator = new TableRequestIdGenerator();
+
+ TestsResult result = simulate(numberOfEvents,
+ new RandomSequenceGenerator(5, 100),
+ new RandomSequenceGenerator(5, 100),
+ requestIdGenerator
+ );
+
+ checkQueueOrdering(result);
+ assertTrue(requestIdGenerator.getUniqueIdsCounter() <= result.getDataList().size());
+ assertTrue(result.getDataList().size() <= numberOfEvents);
+ }
+
+ protected TestsResult checkQueue(String queueName) throws Exception {
+ renderView("/queue-size.xhtml");
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue(queueName).
+ requestDelay(300).requestTime(300);
+
+ ajax(0, "a", parametersBuilder.similarityGroupingId("a"));
+ ajax(100, "b", parametersBuilder.similarityGroupingId("b"));
+ ajax(200, "c", parametersBuilder.similarityGroupingId("c"));
+ ajax(300, "d", parametersBuilder.similarityGroupingId("d"));
+ ajax(500, "e", parametersBuilder.similarityGroupingId("e"));
+ ajax(600, "f", parametersBuilder.similarityGroupingId("f"));
+
+ TestsResult result = getTestsResult();
+ return result;
+ }
+
+ protected TestsResult checkSingleQueue(String queueName) throws Exception {
+ renderView("/queue-size.xhtml");
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue(queueName).
+ requestTime(300).requestDelay(200);
+
+ ajax(0, "a", parametersBuilder.similarityGroupingId("a"));
+ ajax(100, "b", parametersBuilder.similarityGroupingId("b"));
+ ajax(400, "c", parametersBuilder.similarityGroupingId("c"));
+ ajax(500, "d", parametersBuilder.similarityGroupingId("d"));
+ ajax(700, "e", parametersBuilder.similarityGroupingId("e"));
+
+ ajax(9800, "f", parametersBuilder.similarityGroupingId("f").requestTime(1000));
+ ajax(10100, "g", parametersBuilder.similarityGroupingId("f").requestTime(1500));
+
+ TestsResult result = getTestsResult();
+ return result;
+ }
+
+ public void testDropNext() throws Exception {
+ TestsResult result = checkQueue("dropNextQueue");
+ List<RequestData> dataList = result.getDataList();
+
+ for (RequestData requestData : dataList) {
+ System.out.println(" " + requestData);
+ }
+ System.out.println();
+
+ assertEquals(4, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 100, 400, false);
+ checkRequestData(dataList.get(1), "c", 400, 700, false);
+ checkRequestData(dataList.get(2), "e", 700, 1000, false);
+ checkRequestData(dataList.get(3), "f", 1000, 1300, false);
+ }
+
+ public void testDropNew() throws Exception {
+ TestsResult result = checkQueue("dropNewQueue");
+ List<RequestData> dataList = result.getDataList();
+
+ for (RequestData requestData : dataList) {
+ System.out.println(" " + requestData);
+ }
+ System.out.println();
+
+ assertEquals(4, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 100, 400, false);
+ checkRequestData(dataList.get(1), "b", 400, 700, false);
+ checkRequestData(dataList.get(2), "c", 700, 1000, false);
+ checkRequestData(dataList.get(3), "e", 1000, 1300, false);
+ }
+
+ public void testFireNext() throws Exception {
+ TestsResult result = checkQueue("fireNextQueue");
+ List<RequestData> dataList = result.getDataList();
+
+ for (RequestData requestData : dataList) {
+ System.out.println(" " + requestData);
+ }
+ System.out.println();
+
+ assertEquals(6, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 100, 400, false);
+ checkRequestData(dataList.get(1), "b", 300, 600, false);
+ checkRequestData(dataList.get(2), "c", 400, 700, false);
+ checkRequestData(dataList.get(3), "d", 600, 900, false);
+ checkRequestData(dataList.get(4), "e", 700, 1000, false);
+ checkRequestData(dataList.get(5), "f", 1000, 1300, false);
+ }
+
+ public void testFireNew() throws Exception {
+ TestsResult result = checkQueue("fireNewQueue");
+ List<RequestData> dataList = result.getDataList();
+
+ for (RequestData requestData : dataList) {
+ System.out.println(" " + requestData);
+ }
+ System.out.println();
+
+ assertEquals(6, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 100, 400, false);
+ checkRequestData(dataList.get(1), "d", 300, 600, false);
+ checkRequestData(dataList.get(2), "b", 400, 700, false);
+ checkRequestData(dataList.get(3), "f", 600, 900, false);
+ checkRequestData(dataList.get(4), "c", 700, 1000, false);
+ checkRequestData(dataList.get(5), "e", 1000, 1300, false);
+ }
+
+ public void testDropNextSingle() throws Exception {
+ TestsResult result = checkSingleQueue("dropNextQueueSingle");
+ List<RequestData> dataList = result.getDataList();
+
+ for (RequestData requestData : dataList) {
+ System.out.println(" " + requestData);
+ }
+ System.out.println();
+
+ assertEquals(3, dataList.size());
+
+ checkRequestData(dataList.get(0), "b", 300, 600, false);
+ checkRequestData(dataList.get(1), "e", 900, 1200, false);
+ checkRequestData(dataList.get(2), "f", 10000, 11000, false);
+ }
+
+ public void testDropNewSingle() throws Exception {
+ TestsResult result = checkSingleQueue("dropNewQueueSingle");
+ List<RequestData> dataList = result.getDataList();
+
+ for (RequestData requestData : dataList) {
+ System.out.println(" " + requestData);
+ }
+ System.out.println();
+
+ assertEquals(3, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 100, 400, false);
+ checkRequestData(dataList.get(1), "d", 700, 1000, false);
+ checkRequestData(dataList.get(2), "f", 10000, 11000, false);
+ }
+
+ public void testFireNextSingle() throws Exception {
+ TestsResult result = checkSingleQueue("fireNextQueueSingle");
+ List<RequestData> dataList = result.getDataList();
+
+ for (RequestData requestData : dataList) {
+ System.out.println(" " + requestData);
+ }
+ System.out.println();
+
+ assertEquals(7, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 100, 400, false);
+ checkRequestData(dataList.get(1), "b", 300, 600, false);
+ checkRequestData(dataList.get(2), "c", 400, 700, false);
+ checkRequestData(dataList.get(3), "d", 500, 800, false);
+ checkRequestData(dataList.get(4), "e", 900, 1200, false);
+
+ checkRequestData(dataList.get(5), "f", 10000, 11000, false);
+ checkRequestData(dataList.get(6), "g", 10100, 11600, false);
+ }
+
+ public void testFireNewSingle() throws Exception {
+ TestsResult result = checkSingleQueue("fireNewQueueSingle");
+ List<RequestData> dataList = result.getDataList();
+
+ for (RequestData requestData : dataList) {
+ System.out.println(" " + requestData);
+ }
+ System.out.println();
+
+ assertEquals(7, dataList.size());
+
+ checkRequestData(dataList.get(0), "b", 100, 400, false);
+ checkRequestData(dataList.get(1), "a", 100, 400, false);
+ checkRequestData(dataList.get(2), "c", 400, 700, false);
+ checkRequestData(dataList.get(3), "e", 700, 1000, false);
+ checkRequestData(dataList.get(4), "d", 700, 1000, false);
+
+ checkRequestData(dataList.get(5), "f", 10000, 11000, false);
+ checkRequestData(dataList.get(6), "g", 10100, 11600, false);
+ }
+
+ public void testOnSizeExceeded() throws Exception {
+ renderView("/queue-size.xhtml");
+
+ for (int i = 0; i <= 3; i++) {
+ clickOnTime(i, "form:button" + i);
+ }
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(2, dataList.size());
+
+ //dropNext is default
+ checkRequestData(dataList.get(0), "form:button0", 0, DEFAULT_REQUEST_TIME, false);
+ checkRequestData(dataList.get(1), "form:button3", DEFAULT_REQUEST_TIME, DEFAULT_REQUEST_TIME * 2, false);
+
+ NativeArray handlersData = (NativeArray) executeJavaScript("defaultExceededQueueResults");
+ assertEquals(2, handlersData.getLength());
+
+ ScriptableObject firstHandlerData = (ScriptableObject) handlersData.get(0, handlersData);
+ Double firstEventTime = (Double) firstHandlerData.get("_time", firstHandlerData);
+ assertEquals(2d, firstEventTime);
+
+ ScriptableObject secondHandlerData = (ScriptableObject) handlersData.get(1, handlersData);
+ Double secondEventTime = (Double) secondHandlerData.get("_time", secondHandlerData);
+ assertEquals(3d, secondEventTime);
+ }
+
+ public void testSingleSizedQueueIgnoreDupResponses() throws Exception {
+ renderView("/queue-size.xhtml");
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue("singleSizedDefaultQueue").
+ requestDelay(0);
+
+ ajax(0, "a", parametersBuilder);
+ ajax(500, "b", parametersBuilder);
+
+ TestsResult result = getTestsResult();
+ List<RequestData> list = result.getDataList();
+ assertEquals(1, list.size());
+
+ checkRequestData(list.get(0), "a", 0, DEFAULT_REQUEST_TIME, false);
+
+ NativeArray handlersData = (NativeArray) executeJavaScript("defaultSingleSizedQueueResults");
+ assertEquals(1, handlersData.getLength());
+
+ assertEquals("a", handlersData.get(0, handlersData));
+ }
+}
Copied: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueuedPollTest.java (from rev 14238, trunk/ui/core/src/test/java/org/ajax4jsf/component/QueuedPollTest.java)
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueuedPollTest.java (rev 0)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/QueuedPollTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,171 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public class QueuedPollTest extends AbstractQueueComponentTest {
+
+ /**
+ * @param name
+ */
+ public QueuedPollTest(String name) {
+ super(name);
+ }
+
+ private void setFlag(String name) {
+ Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+ requestMap.put(name, Boolean.TRUE);
+ }
+
+ public void testQueuedDefaultPollRequestDelay() throws Exception {
+ setFlag("queuedDefaultPollEnabled");
+ renderView("/queue-poll.xhtml");
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(1, dataList.size());
+ checkRequestData(dataList.get(0), "firstForm:queuedDefaultPoll", 600, 1600, false);
+ }
+
+ public void testQueuedPollRequestDelay() throws Exception {
+ setFlag("queuedDelayedPollEnabled");
+ renderView("/queue-poll.xhtml");
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(1, dataList.size());
+ checkRequestData(dataList.get(0), "firstForm:queuedDelayedPoll", 300, 1300, false);
+ }
+
+ public void testDelayedQueueDefaultPollRequestDelay() throws Exception {
+ setFlag("delayedQueueDefaultPollEnabled");
+ renderView("/queue-poll.xhtml");
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(1, dataList.size());
+ checkRequestData(dataList.get(0), "secondForm:delayedQueueDefaultPoll", 1500, 2500, false);
+ }
+
+ public void testDelayedQueuePollRequestDelay() throws Exception {
+ setFlag("delayedQueueDelayedPollEnabled");
+ renderView("/queue-poll.xhtml");
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(1, dataList.size());
+ checkRequestData(dataList.get(0), "secondForm:delayedQueueDelayedPoll", 2400, 3400, false);
+ }
+
+ public void testUnqueuedDefaultPollRequestDelay() throws Exception {
+ setFlag("unqueuedDefaultPollEnabled");
+ renderView("/queue-poll.xhtml");
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(1, dataList.size());
+ checkRequestData(dataList.get(0), "thirdForm:unqueuedDefaultPoll", 700, 1700, false);
+ }
+
+ public void testunQueuedPollRequestDelay() throws Exception {
+ setFlag("unqueuedDelayedPollEnabled");
+ renderView("/queue-poll.xhtml");
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+
+ assertEquals(1, dataList.size());
+ checkRequestData(dataList.get(0), "thirdForm:unqueuedDelayedPoll", 950, 1950, false);
+ }
+
+ public void testDropNextDroppedPoll() throws Exception {
+ setFlag("renderDropNext");
+ renderView("/queue-poll-drop.xhtml");
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue("dropNextQueue").
+ requestDelay(0);
+
+ ajax(0, "a", parametersBuilder.similarityGroupingId(1).requestTime(3000));
+
+ //poll has 2000 interval, so ajax request at 2100 will make queue drop it from list
+ ajax(2500, "b", parametersBuilder.similarityGroupingId(2).requestTime(500));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(3, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 0, 3000, false);
+ checkRequestData(dataList.get(1), "b", 3000, 3500, false);
+
+ //poll has been kicked from queue at 2500, requeued in 2000
+ checkRequestData(dataList.get(2), "firstForm:poll", 2500 + 2000, 2500 + 2000 + 1000 /* default request time */,
+ false);
+ }
+
+ public void testDropNextDroppedPollSingle() throws Exception {
+ setFlag("renderDropNextSingle");
+ renderView("/queue-poll-drop.xhtml");
+
+ ajax(0, "a", createAjaxParameters().requestTime(3000).requestDelay(0).eventsQueue("dropNextQueueSingle"));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(2, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 0, 3000, false);
+ checkRequestData(dataList.get(1), "thirdForm:poll", 4000, 5000, false);
+ }
+
+ public void testDropNewDroppedPoll() throws Exception {
+ setFlag("renderDropNew");
+ renderView("/queue-poll-drop.xhtml");
+
+ ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue("dropNewQueue").
+ requestDelay(0);
+
+ ajax(0, "a", parametersBuilder.similarityGroupingId(1).requestTime(3000));
+
+ //poll has 2500 interval, so ajax request at 2000 will make queue drop it from the list
+ ajax(2000, "b", parametersBuilder.similarityGroupingId(2).requestTime(500));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(3, dataList.size());
+
+ checkRequestData(dataList.get(0), "a", 0, 3000, false);
+ checkRequestData(dataList.get(1), "b", 3000, 3500, false);
+ checkRequestData(dataList.get(2), "secondForm:poll", 5000, 6000, false);
+ }
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/UIAjaxFormTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/UIAjaxFormTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/component/UIAjaxFormTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.component;
import java.io.Serializable;
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxFormRendererTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxFormRendererTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxFormRendererTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,144 +1,144 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.ajax4jsf.component.UIAjaxForm;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.commons.lang.StringUtils;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-public class AjaxFormRendererTest extends AbstractAjax4JsfTestCase {
- private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
- private static Set javaScripts = new HashSet();
-
- static {
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
- javaScripts.add("org/ajax4jsf/javascript/scripts/form.js");
- }
-
- private UIAjaxForm form1;
- private UIAjaxForm form2;
-
- public AjaxFormRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form1 = (UIAjaxForm) application.createComponent(UIAjaxForm.COMPONENT_TYPE);
- form1.setId("form1");
- form1.setAjaxSubmit(true);
-
- form2 = (UIAjaxForm) application.createComponent(UIAjaxForm.COMPONENT_TYPE);
- form2.setId("form2");
- form2.setAjaxSubmit(false);
-
- facesContext.getViewRoot().getChildren().add(form1);
- facesContext.getViewRoot().getChildren().add(form2);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * Test script rendering
- *
- * @throws Exception
- */
- public void testRenderScript() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
- }
-
- /**
- * Test rendering
- *
- * @throws Exception
- */
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement htmlForm1 = page.getHtmlElementById(form1.getClientId(facesContext));
- assertNotNull(htmlForm1);
- assertEquals("form", htmlForm1.getTagName());
-
- String action = htmlForm1.getAttributeValue("action");
- assertNotNull(action);
- assertTrue(action.startsWith("javascript:A4J.AJAX.SubmitForm"));
-
- HtmlElement htmlForm2 = page.getHtmlElementById(form2.getClientId(facesContext));
- assertNotNull(htmlForm2);
- assertEquals("form", htmlForm2.getTagName());
-
- action = htmlForm2.getAttributeValue("action");
- assertNotNull(action);
- assertTrue(action.startsWith("/"));
- }
-
- /**
- * Test rendering hidden inputs
- *
- * @throws Exception
- */
- public void testRenderHiddenInputs() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement htmlForm1 = page.getHtmlElementById(form1.getClientId(facesContext));
- List inputs = htmlForm1.getHtmlElementsByTagName("input");
- assertNotNull(inputs);
- boolean foundId = false;
- boolean foundAutoscroll = false;
- for (Iterator it = inputs.iterator(); it.hasNext();) {
- HtmlElement input = (HtmlElement) it.next();
- String name = input.getAttributeValue("name");
- assertNotNull(name);
- if (!foundId && name.equals(form1.getClientId(facesContext))) {
- foundId = true;
- }
- if (!foundAutoscroll && name.equals("autoScroll")) {
- foundAutoscroll = true;
- }
- }
- assertTrue(foundId);
- assertTrue(foundAutoscroll);
-
- HtmlElement htmlForm2 = page.getHtmlElementById(form2.getClientId(facesContext));
- assertNotNull(htmlForm2);
- assertEquals("form", htmlForm2.getTagName());
-
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.ajax4jsf.component.UIAjaxForm;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+public class AjaxFormRendererTest extends AbstractAjax4JsfTestCase {
+ private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
+ private static Set javaScripts = new HashSet();
+
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ javaScripts.add("org/ajax4jsf/javascript/scripts/form.js");
+ }
+
+ private UIAjaxForm form1;
+ private UIAjaxForm form2;
+
+ public AjaxFormRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form1 = (UIAjaxForm) application.createComponent(UIAjaxForm.COMPONENT_TYPE);
+ form1.setId("form1");
+ form1.setAjaxSubmit(true);
+
+ form2 = (UIAjaxForm) application.createComponent(UIAjaxForm.COMPONENT_TYPE);
+ form2.setId("form2");
+ form2.setAjaxSubmit(false);
+
+ facesContext.getViewRoot().getChildren().add(form1);
+ facesContext.getViewRoot().getChildren().add(form2);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test script rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
+ }
+
+ /**
+ * Test rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement htmlForm1 = page.getHtmlElementById(form1.getClientId(facesContext));
+ assertNotNull(htmlForm1);
+ assertEquals("form", htmlForm1.getTagName());
+
+ String action = htmlForm1.getAttributeValue("action");
+ assertNotNull(action);
+ assertTrue(action.startsWith("javascript:A4J.AJAX.SubmitForm"));
+
+ HtmlElement htmlForm2 = page.getHtmlElementById(form2.getClientId(facesContext));
+ assertNotNull(htmlForm2);
+ assertEquals("form", htmlForm2.getTagName());
+
+ action = htmlForm2.getAttributeValue("action");
+ assertNotNull(action);
+ assertTrue(action.startsWith("/"));
+ }
+
+ /**
+ * Test rendering hidden inputs
+ *
+ * @throws Exception
+ */
+ public void testRenderHiddenInputs() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement htmlForm1 = page.getHtmlElementById(form1.getClientId(facesContext));
+ List inputs = htmlForm1.getHtmlElementsByTagName("input");
+ assertNotNull(inputs);
+ boolean foundId = false;
+ boolean foundAutoscroll = false;
+ for (Iterator it = inputs.iterator(); it.hasNext();) {
+ HtmlElement input = (HtmlElement) it.next();
+ String name = input.getAttributeValue("name");
+ assertNotNull(name);
+ if (!foundId && name.equals(form1.getClientId(facesContext))) {
+ foundId = true;
+ }
+ if (!foundAutoscroll && name.equals("autoScroll")) {
+ foundAutoscroll = true;
+ }
+ }
+ assertTrue(foundId);
+ assertTrue(foundAutoscroll);
+
+ HtmlElement htmlForm2 = page.getHtmlElementById(form2.getClientId(facesContext));
+ assertNotNull(htmlForm2);
+ assertEquals("form", htmlForm2.getTagName());
+
+ }
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxIncludeRendererTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxIncludeRendererTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxIncludeRendererTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,103 +1,103 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.UIOutput;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIInclude;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.ElementNotFoundException;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class AjaxIncludeRendererTest extends AbstractAjax4JsfTestCase {
- private UIInclude include1 = null;
- private UIInclude include2 = null;
- private UIInclude include3 = null;
- private UIForm form;
-
- public AjaxIncludeRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- include1 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
- include1.setId("include1");
- include1.setLayout(UIInclude.LAYOUT_NONE);
-
- UIOutput output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
- output.setRendered(true);
- output.setId("output");
- output.setValue("output");
- include1.getChildren().add(output);
-
- include2 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
- include2.setId("include2");
- include2.setLayout(UIInclude.LAYOUT_BLOCK);
-
- include3 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
- include3.setId("include3");
- include3.setLayout(UIInclude.LAYOUT_INLINE);
-
- form.getChildren().add(include1);
- form.getChildren().add(include2);
- form.getChildren().add(include3);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- include1 = null;
- include2 = null;
- include3 = null;
- }
-
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- try {
- HtmlElement empty = page.getHtmlElementById(include1.getClientId(facesContext));
- assertFalse("ElementNotFoundException was not thrown", true);
- } catch (ElementNotFoundException e) {
-
- }
-
- HtmlElement div = page.getHtmlElementById(include2.getClientId(facesContext));
- assertNotNull(div);
- assertEquals("div", div.getNodeName());
-
- HtmlElement span = page.getHtmlElementById(include3.getClientId(facesContext));
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIInclude;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.ElementNotFoundException;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class AjaxIncludeRendererTest extends AbstractAjax4JsfTestCase {
+ private UIInclude include1 = null;
+ private UIInclude include2 = null;
+ private UIInclude include3 = null;
+ private UIForm form;
+
+ public AjaxIncludeRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ include1 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
+ include1.setId("include1");
+ include1.setLayout(UIInclude.LAYOUT_NONE);
+
+ UIOutput output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ output.setRendered(true);
+ output.setId("output");
+ output.setValue("output");
+ include1.getChildren().add(output);
+
+ include2 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
+ include2.setId("include2");
+ include2.setLayout(UIInclude.LAYOUT_BLOCK);
+
+ include3 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
+ include3.setId("include3");
+ include3.setLayout(UIInclude.LAYOUT_INLINE);
+
+ form.getChildren().add(include1);
+ form.getChildren().add(include2);
+ form.getChildren().add(include3);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ include1 = null;
+ include2 = null;
+ include3 = null;
+ }
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ try {
+ HtmlElement empty = page.getHtmlElementById(include1.getClientId(facesContext));
+ assertFalse("ElementNotFoundException was not thrown", true);
+ } catch (ElementNotFoundException e) {
+
+ }
+
+ HtmlElement div = page.getHtmlElementById(include2.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+
+ HtmlElement span = page.getHtmlElementById(include3.getClientId(facesContext));
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+ }
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRendererTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRendererTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRendererTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,119 +1,119 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.UIOutput;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIAjaxOutputPanel;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.ElementNotFoundException;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class AjaxOutputPanelRendererTest extends AbstractAjax4JsfTestCase {
- private UIForm form = null;
- private UIAjaxOutputPanel panel1 = null;
- private UIAjaxOutputPanel panel2 = null;
- private UIAjaxOutputPanel panel3 = null;
- private UIAjaxOutputPanel panel4 = null;
- private UIOutput output = null;
-
- public AjaxOutputPanelRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- panel1 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
- panel1.setId("panel1");
- panel1.setLayout("none");
- form.getChildren().add(panel1);
-
- panel2 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
- panel2.setId("panel2");
- panel2.setLayout("block");
- form.getChildren().add(panel2);
-
- panel3 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
- panel3.setId("panel3");
- panel3.setLayout("inline");
- form.getChildren().add(panel3);
-
- panel4 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
- panel4.setId("panel4");
- panel4.setLayout("none");
-
- output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
- output.setId("output");
- output.setValue("output");
- output.setTransient(true);
- panel4.getChildren().add(output);
-
- form.getChildren().add(panel4);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- output = null;
- panel1 = null;
- panel2 = null;
- panel3 = null;
- form = null;
- }
-
- public void testRender() throws Exception{
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- try {
- HtmlElement empty = page.getHtmlElementById(panel1.getClientId(facesContext));
- assertFalse("ElementNotFoundException was not thrown", true);
- } catch (ElementNotFoundException e) {
-
- }
-
- HtmlElement div = page.getHtmlElementById(panel2.getClientId(facesContext));
- assertNotNull(div);
- assertEquals("div", div.getNodeName());
-
- HtmlElement span = page.getHtmlElementById(panel3.getClientId(facesContext));
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
-
- span = page.getHtmlElementById(output.getClientId(facesContext));
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
-
- assertFalse(output.isTransient());
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIAjaxOutputPanel;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.ElementNotFoundException;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class AjaxOutputPanelRendererTest extends AbstractAjax4JsfTestCase {
+ private UIForm form = null;
+ private UIAjaxOutputPanel panel1 = null;
+ private UIAjaxOutputPanel panel2 = null;
+ private UIAjaxOutputPanel panel3 = null;
+ private UIAjaxOutputPanel panel4 = null;
+ private UIOutput output = null;
+
+ public AjaxOutputPanelRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ panel1 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
+ panel1.setId("panel1");
+ panel1.setLayout("none");
+ form.getChildren().add(panel1);
+
+ panel2 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
+ panel2.setId("panel2");
+ panel2.setLayout("block");
+ form.getChildren().add(panel2);
+
+ panel3 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
+ panel3.setId("panel3");
+ panel3.setLayout("inline");
+ form.getChildren().add(panel3);
+
+ panel4 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
+ panel4.setId("panel4");
+ panel4.setLayout("none");
+
+ output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ output.setId("output");
+ output.setValue("output");
+ output.setTransient(true);
+ panel4.getChildren().add(output);
+
+ form.getChildren().add(panel4);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ output = null;
+ panel1 = null;
+ panel2 = null;
+ panel3 = null;
+ form = null;
+ }
+
+ public void testRender() throws Exception{
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ try {
+ HtmlElement empty = page.getHtmlElementById(panel1.getClientId(facesContext));
+ assertFalse("ElementNotFoundException was not thrown", true);
+ } catch (ElementNotFoundException e) {
+
+ }
+
+ HtmlElement div = page.getHtmlElementById(panel2.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+
+ HtmlElement span = page.getHtmlElementById(panel3.getClientId(facesContext));
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+
+ span = page.getHtmlElementById(output.getClientId(facesContext));
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+
+ assertFalse(output.isTransient());
+ }
+
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPageRendererTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPageRendererTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPageRendererTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,114 +1,127 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-
-import javax.faces.component.UIOutput;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.commons.lang.StringUtils;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-public class AjaxPageRendererTest extends AbstractAjax4JsfTestCase{
-
- private org.ajax4jsf.component.html.HtmlPage ajaxPage = null;
- private static Set<String> javaScripts = new HashSet<String>();
-
- static {
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
- }
-
- private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
-
- public AjaxPageRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- ajaxPage = (org.ajax4jsf.component.html.HtmlPage) application.createComponent(org.ajax4jsf.component.html.HtmlPage.COMPONENT_TYPE);
- ajaxPage.setId("page");
-
- UIOutput head = new UIOutput();
- head.setValue("HEAD");
- ajaxPage.getFacets().put("head", head);
-
- UIOutput content = new UIOutput();
- content.setValue("content");
- ajaxPage.getChildren().add(content);
-
- ajaxPage.setFormat("xhtml");
- ajaxPage.setPageTitle("title");
-
- facesContext.getViewRoot().setLocale(new Locale("be", "BY"));
-
- facesContext.getViewRoot().getChildren().add(ajaxPage);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- HtmlElement html = (HtmlElement)page.getFirstChild();
- assertNotNull(html);
- assertEquals("html", html.getTagName());
-
- String lang = html.getAttributeValue("lang");
- assertNotNull(lang);
- assertEquals(lang, "be_BY");
-
- HtmlElement title = (HtmlElement) html.getHtmlElementsByTagName("title").get(0);
- assertNotNull(title);
-
- assertEquals("title", title.getFirstChild().asText());
-
- HtmlElement meta = (HtmlElement) html.getHtmlElementsByTagName("meta").get(0);
-
- assertNotNull(meta);
- String httpEquiv = meta.getAttributeValue("http-equiv");
- assertEquals(httpEquiv, "Content-Type");
-
- String content = meta.getAttributeValue("content");
- assertEquals(content, "application/xhtml+xml");
- }
-
- public void testRenderScript() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class AjaxPageRendererTest extends AbstractAjax4JsfTestCase{
+
+ private org.ajax4jsf.component.html.HtmlPage ajaxPage = null;
+ private static Set<String> javaScripts = new HashSet<String>();
+
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ }
+
+ private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
+
+ public AjaxPageRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ ajaxPage = (org.ajax4jsf.component.html.HtmlPage) application.createComponent(org.ajax4jsf.component.html.HtmlPage.COMPONENT_TYPE);
+ ajaxPage.setId("page");
+
+ UIOutput head = new UIOutput();
+ head.setValue("HEAD");
+ ajaxPage.getFacets().put("head", head);
+
+ UIOutput content = new UIOutput();
+ content.setValue("content");
+ ajaxPage.getChildren().add(content);
+
+ ajaxPage.setFormat("xhtml");
+ ajaxPage.setPageTitle("title");
+
+ facesContext.getViewRoot().setLocale(new Locale("be", "BY"));
+
+ facesContext.getViewRoot().getChildren().add(ajaxPage);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement html = (HtmlElement)page.getFirstChild();
+ assertNotNull(html);
+ assertEquals("html", html.getTagName());
+
+ String lang = html.getAttributeValue("lang");
+ assertNotNull(lang);
+ assertEquals(lang, "be_BY");
+
+ HtmlElement title = (HtmlElement) html.getHtmlElementsByTagName("title").get(0);
+ assertNotNull(title);
+
+ assertEquals("title", title.getFirstChild().asText());
+
+ HtmlElement meta = (HtmlElement) html.getHtmlElementsByTagName("meta").get(0);
+
+ assertNotNull(meta);
+ String httpEquiv = meta.getAttributeValue("http-equiv");
+ assertEquals(httpEquiv, "Content-Type");
+
+ String content = meta.getAttributeValue("content");
+ assertEquals(content, "application/xhtml+xml");
+ }
+
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
+ }
+
+ @Override
+ protected void encodeDocumentProlog(FacesContext context,
+ UIViewRoot viewRoot, ResponseWriter writer) throws IOException {
+
+ //do nothing as a4j:page encodes full page structure
+ }
+
+ @Override
+ protected void encodeDocumentEpilog(FacesContext context,
+ UIViewRoot viewRoot, ResponseWriter writer) throws IOException {
+
+ //do nothing as a4j:page encodes full page structure
+ }
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPushRendererTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPushRendererTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPushRendererTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,140 +1,140 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIPush;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.commons.lang.StringUtils;
-
-import com.gargoylesoftware.htmlunit.html.DomText;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-public class AjaxPushRendererTest extends AbstractAjax4JsfTestCase {
-
- private static Set<String> javaScripts = new HashSet<String>();
- private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
-
- static {
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
- }
- private UIForm form = null;
- private UIPush push1 = null;
- private UIPush push2 = null;
-
- public AjaxPushRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- push1 = (UIPush) application.createComponent(UIPush.COMPONENT_TYPE);
- push1.setId("push1");
- push1.setEnabled(true);
- form.getChildren().add(push1);
-
- push2 = (UIPush) application.createComponent(UIPush.COMPONENT_TYPE);
- push2.setId("push2");
- push2.setEnabled(false);
- form.getChildren().add(push2);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- push1 = null;
- push2 = null;
- form = null;
- }
-
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- HtmlElement span1 = page.getHtmlElementById(push1.getClientId(facesContext));
- assertNotNull(span1);
- assertEquals("span", span1.getTagName());
- String style = span1.getAttributeValue("style");
- assertNotNull(style);
- assertTrue(style.matches("display\\s*\\:\\s*none\\s*\\;\\s*"));
-
- HtmlElement span2 = page.getHtmlElementById(push2.getClientId(facesContext));
- assertNotNull(span2);
- assertEquals("span", span2.getTagName());
- style = span2.getAttributeValue("style");
- assertNotNull(style);
- assertTrue(style.matches("display\\s*\\:\\s*none\\s*\\;\\s*"));
- }
-
- public void testRenderScript() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
- assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
-
- HtmlElement span1 = page.getHtmlElementById(push1.getClientId(facesContext));
- assertNotNull(span1);
- scripts = span1.getHtmlElementsByTagName("script");
- int i = 0;
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
- DomText text = (DomText) item.getFirstChild();
-
- assertNotNull(text);
- assertTrue(text.asText().contains("A4J.AJAX.Push"));
-
- i++;
- }
- assertEquals(1, i);
-
- HtmlElement span2 = page.getHtmlElementById(push2.getClientId(facesContext));
- assertNotNull(span2);
- scripts = span2.getHtmlElementsByTagName("script");
- i = 0;
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
- DomText text = (DomText) item.getFirstChild();
-
- assertNotNull(text);
- assertTrue(text.asText().contains("A4J.AJAX.StopPush"));
-
- i++;
- }
- assertEquals(1, i);
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIPush;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+
+import com.gargoylesoftware.htmlunit.html.DomText;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+public class AjaxPushRendererTest extends AbstractAjax4JsfTestCase {
+
+ private static Set<String> javaScripts = new HashSet<String>();
+ private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
+
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ }
+ private UIForm form = null;
+ private UIPush push1 = null;
+ private UIPush push2 = null;
+
+ public AjaxPushRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ push1 = (UIPush) application.createComponent(UIPush.COMPONENT_TYPE);
+ push1.setId("push1");
+ push1.setEnabled(true);
+ form.getChildren().add(push1);
+
+ push2 = (UIPush) application.createComponent(UIPush.COMPONENT_TYPE);
+ push2.setId("push2");
+ push2.setEnabled(false);
+ form.getChildren().add(push2);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ push1 = null;
+ push2 = null;
+ form = null;
+ }
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement span1 = page.getHtmlElementById(push1.getClientId(facesContext));
+ assertNotNull(span1);
+ assertEquals("span", span1.getTagName());
+ String style = span1.getAttributeValue("style");
+ assertNotNull(style);
+ assertTrue(style.matches("display\\s*\\:\\s*none\\s*\\;\\s*"));
+
+ HtmlElement span2 = page.getHtmlElementById(push2.getClientId(facesContext));
+ assertNotNull(span2);
+ assertEquals("span", span2.getTagName());
+ style = span2.getAttributeValue("style");
+ assertNotNull(style);
+ assertTrue(style.matches("display\\s*\\:\\s*none\\s*\\;\\s*"));
+ }
+
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+ assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
+
+ HtmlElement span1 = page.getHtmlElementById(push1.getClientId(facesContext));
+ assertNotNull(span1);
+ scripts = span1.getHtmlElementsByTagName("script");
+ int i = 0;
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ DomText text = (DomText) item.getFirstChild();
+
+ assertNotNull(text);
+ assertTrue(text.asText().contains("A4J.AJAX.Push"));
+
+ i++;
+ }
+ assertEquals(1, i);
+
+ HtmlElement span2 = page.getHtmlElementById(push2.getClientId(facesContext));
+ assertNotNull(span2);
+ scripts = span2.getHtmlElementsByTagName("script");
+ i = 0;
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ DomText text = (DomText) item.getFirstChild();
+
+ assertNotNull(text);
+ assertTrue(text.asText().contains("A4J.AJAX.StopPush"));
+
+ i++;
+ }
+ assertEquals(1, i);
+ }
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,151 +1,153 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html;
-
-import java.util.Iterator;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.UIGraphic;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIAjaxStatus;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class AjaxStatusRendererTest extends AbstractAjax4JsfTestCase {
- private UIForm form = null;
- private UIAjaxStatus status1 = null;
- private UIAjaxStatus status2 = null;
-
- public AjaxStatusRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- application.addComponent("org.ajax4jsf.AjaxStatus", "org.ajax4jsf.component.html.HtmlAjaxStatus");
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- status1 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
- status1.setId("status1");
- status1.setStartStyle("color: red;");
- status1.setStartStyleClass("A B C D");
- status1.setStopStyle("color: green;");
- status1.setStopStyleClass("X Y Z");
- status1.setStartText("startText");
- status1.setStopText("stopText");
- status1.getAttributes().put("layout", "block");
-
- status2 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
- status2.setId("status2");
- status2.setStartStyle("color: red;");
- status2.setStartStyleClass("A B C D");
- status2.setStopStyle("color: green;");
- status2.setStopStyleClass("X Y Z");
- status2.getAttributes().put("layout", "inline");
-
- UIGraphic startImage = new UIGraphic();
- startImage.setValue("start.png");
- status2.getFacets().put("start", startImage);
-
- UIGraphic stopGraphic = new UIGraphic();
- stopGraphic.setValue("stop.png");
- status2.getFacets().put("stop", stopGraphic);
-
- form.getChildren().add(status1);
- form.getChildren().add(status2);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- status1 = null;
- status2 = null;
- form = null;
- }
-
- /**
- * Test rendering
- *
- * @throws Exception
- */
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement div = page.getHtmlElementById(status1.getClientId(facesContext));
- assertNotNull(div);
- assertEquals("div", div.getNodeName());
-
- Iterator childIterator = div.getChildIterator();
- int i = 0;
- while (childIterator.hasNext()) {
- i++;
- HtmlElement element = (HtmlElement) childIterator.next();
- assertEquals("div", element.getNodeName());
- }
- assertEquals(2, i);
-
- HtmlElement div1 = page.getHtmlElementById(status1.getClientId(facesContext) + ".start");
- assertNotNull(div1);
- String style1 = div1.getAttributeValue("style");
- assertNotNull(style1);
- assertTrue(style1.contains("color: red;"));
- String class1 = div1.getAttributeValue("class");
- assertNotNull(class1);
- assertEquals(class1, "A B C D");
-
- HtmlElement div2 = page.getHtmlElementById(status1.getClientId(facesContext) + ".stop");
- assertNotNull(div2);
- String style2 = div2.getAttributeValue("style");
- assertNotNull(style2);
- assertTrue(style2.contains("color: green;"));
- String class2 = div2.getAttributeValue("class");
- assertNotNull(class2);
- assertEquals(class2, "X Y Z");
-
- form.getChildren().remove(0);
- page = renderView();
- System.out.println(page.asXml());
-
- HtmlElement span = (HtmlElement) div.getNextSibling();
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
-
- childIterator = span.getChildIterator();
- i = 0;
- while (childIterator.hasNext()) {
- i++;
- HtmlElement element = (HtmlElement) childIterator.next();
- assertEquals("span", element.getNodeName());
- assertEquals("img", element.getFirstChild().getNodeName());
- }
- assertEquals(2, i);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.UIGraphic;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIAjaxStatus;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class AjaxStatusRendererTest extends AbstractAjax4JsfTestCase {
+ private UIForm form = null;
+ private UIAjaxStatus status1 = null;
+ private UIAjaxStatus status2 = null;
+
+ public AjaxStatusRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ application.addComponent("org.ajax4jsf.AjaxStatus", "org.ajax4jsf.component.html.HtmlAjaxStatus");
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ status1 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
+ status1.setId("status1");
+ status1.setStartStyle("color: red;");
+ status1.setStartStyleClass("A B C D");
+ status1.setStopStyle("color: green;");
+ status1.setStopStyleClass("X Y Z");
+ status1.setStartText("startText");
+ status1.setStopText("stopText");
+ status1.getAttributes().put("layout", "block");
+
+ status2 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
+ status2.setId("status2");
+ status2.setStartStyle("color: red;");
+ status2.setStartStyleClass("A B C D");
+ status2.setStopStyle("color: green;");
+ status2.setStopStyleClass("X Y Z");
+ status2.getAttributes().put("layout", "inline");
+
+ UIGraphic startImage = new UIGraphic();
+ startImage.setValue("start.png");
+ startImage.getAttributes().put("alt", "alt");
+ status2.getFacets().put("start", startImage);
+
+ UIGraphic stopGraphic = new UIGraphic();
+ stopGraphic.setValue("stop.png");
+ stopGraphic.getAttributes().put("alt", "alt");
+ status2.getFacets().put("stop", stopGraphic);
+
+ form.getChildren().add(status1);
+ form.getChildren().add(status2);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ status1 = null;
+ status2 = null;
+ form = null;
+ }
+
+ /**
+ * Test rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement div = page.getHtmlElementById(status1.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+
+ Iterator childIterator = div.getChildIterator();
+ int i = 0;
+ while (childIterator.hasNext()) {
+ i++;
+ HtmlElement element = (HtmlElement) childIterator.next();
+ assertEquals("div", element.getNodeName());
+ }
+ assertEquals(2, i);
+
+ HtmlElement div1 = page.getHtmlElementById(status1.getClientId(facesContext) + ".start");
+ assertNotNull(div1);
+ String style1 = div1.getAttributeValue("style");
+ assertNotNull(style1);
+ assertTrue(style1.contains("color: red;"));
+ String class1 = div1.getAttributeValue("class");
+ assertNotNull(class1);
+ assertEquals(class1, "A B C D");
+
+ HtmlElement div2 = page.getHtmlElementById(status1.getClientId(facesContext) + ".stop");
+ assertNotNull(div2);
+ String style2 = div2.getAttributeValue("style");
+ assertNotNull(style2);
+ assertTrue(style2.contains("color: green;"));
+ String class2 = div2.getAttributeValue("class");
+ assertNotNull(class2);
+ assertEquals(class2, "X Y Z");
+
+ form.getChildren().remove(0);
+ page = renderView();
+ System.out.println(page.asXml());
+
+ HtmlElement span = (HtmlElement) div.getNextSibling();
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+
+ childIterator = span.getChildIterator();
+ i = 0;
+ while (childIterator.hasNext()) {
+ i++;
+ HtmlElement element = (HtmlElement) childIterator.next();
+ assertEquals("span", element.getNodeName());
+ assertEquals("img", element.getFirstChild().getNodeName());
+ }
+ assertEquals(2, i);
+ }
+
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRendererTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRendererTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRendererTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,96 +1,139 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlCommandLink;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class HtmlCommandLinkRendererTest extends AbstractAjax4JsfTestCase {
- private UIForm form = null;
- private HtmlCommandLink link1 = null;
- private HtmlCommandLink link2 = null;
-
- public HtmlCommandLinkRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- facesContext.getRenderKit().addRenderer(HtmlCommandLink.COMPONENT_FAMILY, "org.ajax4jsf.Link", new HtmlCommandLinkRenderer());
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- link1 = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
- link1.setId("link1");
- link1.setValue("link1");
- link1.getAttributes().put("disabled", Boolean.FALSE);
- link1.setRendererType("org.ajax4jsf.Link");
- form.getChildren().add(link1);
-
- link2 = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
- link2.setId("link2");
- link2.setValue("link2");
- link2.getAttributes().put("disabled", Boolean.TRUE);
- link2.setRendererType("org.ajax4jsf.Link");
- form.getChildren().add(link2);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- link1 = null;
- link2 = null;
- form = null;
- }
-
- public void testRendered() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- HtmlElement href = page.getHtmlElementById(link1.getClientId(facesContext));
- assertNotNull(href);
- assertEquals("a", href.getTagName());
-
- String onclick = href.getAttributeValue("onclick");
- assertNotNull(onclick);
- assertTrue(onclick.contains(AjaxFormRenderer.FORM_SUBMIT_FUNCTION_NAME));
-
- HtmlElement span = page.getHtmlElementById(link2.getClientId(facesContext));
- assertNotNull(span);
- assertEquals("span", span.getTagName());
-
- String disabled = span.getAttributeValue("disabled");
- assertNotNull(disabled);
- assertEquals("disabled", disabled);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+public class HtmlCommandLinkRendererTest extends AbstractAjax4JsfTestCase {
+ /** Set with required javascripts for Editor */
+ private static Set<String> javaScripts = new HashSet<String>();
+
+ static {
+ javaScripts.add("org/ajax4jsf/javascript/scripts/form.js");
+ }
+
+ private UIForm form = null;
+ private HtmlCommandLink link1 = null;
+ private HtmlCommandLink link2 = null;
+
+ public HtmlCommandLinkRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ facesContext.getRenderKit().addRenderer(HtmlCommandLink.COMPONENT_FAMILY, "org.ajax4jsf.Link", new HtmlCommandLinkRenderer());
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ link1 = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
+ link1.setId("link1");
+ link1.setValue("link1");
+ link1.getAttributes().put("disabled", Boolean.FALSE);
+ link1.setRendererType("org.ajax4jsf.Link");
+ form.getChildren().add(link1);
+
+ link2 = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
+ link2.setId("link2");
+ link2.setValue("link2");
+ link2.getAttributes().put("disabled", Boolean.TRUE);
+ link2.setRendererType("org.ajax4jsf.Link");
+ form.getChildren().add(link2);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ link1 = null;
+ link2 = null;
+ form = null;
+ }
+
+ public void testRendered() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement href = page.getHtmlElementById(link1.getClientId(facesContext));
+ assertNotNull(href);
+ assertEquals("a", href.getTagName());
+
+ String onclick = href.getAttributeValue("onclick");
+ assertNotNull(onclick);
+ assertTrue(onclick.contains(AjaxFormRenderer.FORM_SUBMIT_FUNCTION_NAME));
+
+ HtmlElement span = page.getHtmlElementById(link2.getClientId(facesContext));
+ assertNotNull(span);
+ assertEquals("span", span.getTagName());
+
+ String disabled = span.getAttributeValue("disabled");
+ assertNotNull(disabled);
+ assertEquals("disabled", disabled);
+ }
+
+ /**
+ * Method to test if required scripts is present on page
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ public void testLinkScripts() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ List scripts = page.getDocumentHtmlElement().getHtmlElementsByTagName(
+ "script");
+
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+ assertTrue(found);
+ }
+ }
+ }
+
+}
Modified: branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/MediaOutputRendererTest.java
===================================================================
--- branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/MediaOutputRendererTest.java 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/core/src/test/java/org/ajax4jsf/renderkit/html/MediaOutputRendererTest.java 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,140 +1,141 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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.ajax4jsf.renderkit.html;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIParameter;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIMediaOutput;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class MediaOutputRendererTest extends AbstractAjax4JsfTestCase {
- UIForm form = null;
- UIMediaOutput media1 = null;
- UIMediaOutput media2 = null;
- UIMediaOutput media3 = null;
- UIMediaOutput media4 = null;
- UIMediaOutput media5 = null;
-
- public MediaOutputRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- application.addComponent("org.ajax4jsf.MMedia", "org.ajax4jsf.component.html.MediaOutput");
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- media1 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media1.setId("media1");
- media1.setElement("a");
- media1.setUriAttribute("href");
- form.getChildren().add(media1);
-
- media2 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media2.setId("media2");
- media2.setElement("img");
- media2.setUriAttribute("src");
- form.getChildren().add(media2);
-
- media3 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media3.setId("media3");
- media3.setElement("object");
- media3.setUriAttribute("data");
- form.getChildren().add(media3);
-
- media4 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media4.setId("media4");
- media4.setElement("a");
- UIParameter param = new UIParameter();
- param.setName("name");
- param.setValue("value");
- media4.getChildren().add(param);
- form.getChildren().add(media4);
-
- media5 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media5.setId("media5");
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- media1 = null;
- media2 = null;
- media3 = null;
- media4 = null;
- media5 = null;
- form = null;
- }
-
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- HtmlElement a = page.getHtmlElementById(media1.getClientId(facesContext));
- assertNotNull(a);
- assertEquals("a", a.getTagName());
- String href = a.getAttributeValue("href");
- assertNotNull(href);
-
- HtmlElement img = page.getHtmlElementById(media2.getClientId(facesContext));
- assertNotNull(img);
- assertEquals("img", img.getTagName());
- String src = img.getAttributeValue("src");
- assertNotNull(src);
-
- HtmlElement object = page.getHtmlElementById(media3.getClientId(facesContext));
- assertNotNull(object);
- assertEquals("object", object.getTagName());
- String data = object.getAttributeValue("data");
- assertNotNull(data);
-
- // Rendering without uriAttribute
- HtmlElement a2 = page.getHtmlElementById(media4.getClientId(facesContext));
- assertNotNull(a2);
- assertEquals("a", a2.getTagName());
- String href2 = a2.getAttributeValue("href");
- assertNotNull(href2);
- assertTrue(href2.endsWith("name=value"));
- }
-
- public void testRenderWithoutElement() throws Exception {
- form.getChildren().add(media5);
- try {
- renderView();
- assertTrue("'element' is undefined but exception was not thrown", false);
- } catch (FacesException e) {
-
- }
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIParameter;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIMediaOutput;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class MediaOutputRendererTest extends AbstractAjax4JsfTestCase {
+ UIForm form = null;
+ UIMediaOutput media1 = null;
+ UIMediaOutput media2 = null;
+ UIMediaOutput media3 = null;
+ UIMediaOutput media4 = null;
+ UIMediaOutput media5 = null;
+
+ public MediaOutputRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ application.addComponent("org.ajax4jsf.MMedia", "org.ajax4jsf.component.html.MediaOutput");
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ media1 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media1.setId("media1");
+ media1.setElement("a");
+ media1.setUriAttribute("href");
+ form.getChildren().add(media1);
+
+ media2 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media2.setId("media2");
+ media2.setElement("img");
+ media2.setUriAttribute("src");
+ media2.getAttributes().put("alt", "Generated value");
+ form.getChildren().add(media2);
+
+ media3 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media3.setId("media3");
+ media3.setElement("object");
+ media3.setUriAttribute("data");
+ form.getChildren().add(media3);
+
+ media4 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media4.setId("media4");
+ media4.setElement("a");
+ UIParameter param = new UIParameter();
+ param.setName("name");
+ param.setValue("value");
+ media4.getChildren().add(param);
+ form.getChildren().add(media4);
+
+ media5 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media5.setId("media5");
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ media1 = null;
+ media2 = null;
+ media3 = null;
+ media4 = null;
+ media5 = null;
+ form = null;
+ }
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement a = page.getHtmlElementById(media1.getClientId(facesContext));
+ assertNotNull(a);
+ assertEquals("a", a.getTagName());
+ String href = a.getAttributeValue("href");
+ assertNotNull(href);
+
+ HtmlElement img = page.getHtmlElementById(media2.getClientId(facesContext));
+ assertNotNull(img);
+ assertEquals("img", img.getTagName());
+ String src = img.getAttributeValue("src");
+ assertNotNull(src);
+
+ HtmlElement object = page.getHtmlElementById(media3.getClientId(facesContext));
+ assertNotNull(object);
+ assertEquals("object", object.getTagName());
+ String data = object.getAttributeValue("data");
+ assertNotNull(data);
+
+ // Rendering without uriAttribute
+ HtmlElement a2 = page.getHtmlElementById(media4.getClientId(facesContext));
+ assertNotNull(a2);
+ assertEquals("a", a2.getTagName());
+ String href2 = a2.getAttributeValue("href");
+ assertNotNull(href2);
+ assertTrue(href2.endsWith("name=value"));
+ }
+
+ public void testRenderWithoutElement() throws Exception {
+ form.getChildren().add(media5);
+ try {
+ renderView();
+ assertTrue("'element' is undefined but exception was not thrown", false);
+ } catch (FacesException e) {
+
+ }
+ }
+
+}
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/component.js (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/component.js)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/component.js (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/component.js 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1 @@
+/* dependency of org.ajax4jsf.component.LoadResourceComponentTest */
\ No newline at end of file
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/component.xcss (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/component.xcss)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/component.xcss (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/component.xcss 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:template xmlns:f='http:/jsf.exadel.com/template'
+ xmlns:u='http:/jsf.exadel.com/template/util'
+ xmlns="http://www.w3.org/1999/xhtml">
+
+ <!-- dependency of org.ajax4jsf.component.LoadResourceComponentTest -->
+
+</f:template>
\ No newline at end of file
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-ajax-form.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-ajax-form.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-ajax-form.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-ajax-form.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,42 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <head>
+ <title>a4j:form check page</title>
+ </head>
+ <body>
+ <f:view>
+ <script type="text/javascript">
+ window.testResults = {};
+ </script>
+
+ <a4j:status startText="...running..." startStyle="color: green" />
+
+ <a4j:queue oncomplete="window.testResults.viewDefault = true"/>
+
+ <a4j:form ajaxSubmit="true" id="viewDefault">
+ <h:commandButton value="view default queue" id="link" />
+ </a4j:form>
+
+ <a4j:queue oncomplete="window.testResults.viewNamed = true" name="viewNamed" />
+
+ <a4j:form ajaxSubmit="true" eventsQueue="viewNamed" id="viewNamed">
+ <h:commandButton value="view named queue" id="link" />
+ </a4j:form>
+
+ <a4j:form ajaxSubmit="true" id="formDefault">
+ <a4j:queue oncomplete="window.testResults.formDefault = true" />
+
+ <h:commandButton value="form default queue" id="link" />
+ </a4j:form>
+
+ <a4j:form ajaxSubmit="true" eventsQueue="formQueue" id="formNamed">
+ <a4j:queue oncomplete="window.testResults.formNamed = true" name="formQueue" />
+
+ <h:commandButton value="form named queue" id="link" />
+ </a4j:form>
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-disabled.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-disabled.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-disabled.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-disabled.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,59 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <body>
+ <f:view>
+ <ui:include src="queue-discovery-base.xhtml" />
+
+ <h:form id="form">
+ <a4j:commandButton id="button" oncomplete="addResult('button')">
+ <f:param name="data" value="button" />
+ </a4j:commandButton>
+ <a4j:commandButton id="formQueueButton" oncomplete="addResult('formQueueButton')" eventsQueue="form">
+ <f:param name="data" value="formQueueButton" />
+ </a4j:commandButton>
+
+ <a4j:queue oncomplete="addResult('disabled')" disabled="true" />
+ <a4j:queue oncomplete="addResult('disabledForm')" name="form" disabled="true" />
+ </h:form>
+
+ <h:form id="form2">
+ <a4j:commandButton id="button2" oncomplete="addResult('button2')">
+ <f:param name="data" value="button2" />
+ </a4j:commandButton>
+ <a4j:commandButton id="formQueueButton2" oncomplete="addResult('formQueueButton2')" eventsQueue="form2">
+ <f:param name="data" value="formQueueButton2" />
+ </a4j:commandButton>
+
+ <a4j:queue oncomplete="addResult('disabledA')" disabled="true" />
+ <a4j:queue oncomplete="addResult('form2-global:' + request.options.parameters.data)" />
+ <a4j:queue oncomplete="addResult('disabledB')" disabled="true" />
+
+ <a4j:queue oncomplete="addResult('disabledA1')" disabled="true" name="form2" />
+ <a4j:queue oncomplete="addResult('form2-queue:' + request.options.parameters.data)" name="form2"/>
+ <a4j:queue oncomplete="addResult('disabledB1')" disabled="true" name="form2" />
+ </h:form>
+
+ <h:form id="form3">
+ <a4j:commandButton id="global" oncomplete="addResult('global')">
+ <f:param name="data" value="global" />
+ </a4j:commandButton>
+ <a4j:commandButton id="globalNamed" oncomplete="addResult('globalNamed')" eventsQueue="viewNamed">
+ <f:param name="data" value="globalNamed" />
+ </a4j:commandButton>
+ <a4j:commandButton id="globalNamedX" oncomplete="addResult('globalNamedX')" eventsQueue="viewNamedX">
+ <f:param name="data" value="globalNamedX" />
+ </a4j:commandButton>
+ </h:form>
+
+ <a4j:queue oncomplete="addResult('disabled:' + request.options.parameters.data)" disabled="true" />
+ <a4j:queue oncomplete="addResult('viewNamed:' + request.options.parameters.data)" name="viewNamed" disabled="true" />
+
+ <a4j:queue oncomplete="addResult('viewNamedXA:' + request.options.parameters.data)" name="viewNamedX" disabled="true" />
+ <a4j:queue oncomplete="addResult('viewNamedX:' + request.options.parameters.data)" name="viewNamedX" />
+ <a4j:queue oncomplete="addResult('viewNamedXB:' + request.options.parameters.data)" name="viewNamedX" disabled="true" />
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-discovery-base.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-discovery-base.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-discovery-base.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-discovery-base.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,18 @@
+<ui:composition xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+
+ <script type="text/javascript">
+ window.testResult = new Array();
+
+ function addResult(value) {
+ window.testResult.push(value);
+ }
+
+ function stub() {
+ }
+ </script>
+
+ <a4j:status startText="...running..." startStyle="color: green" />
+</ui:composition>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-both.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-both.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-both.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-both.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,65 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <body>
+ <f:view>
+ <ui:include src="queue-discovery-base.xhtml" />
+
+ <a4j:queue oncomplete="addResult(request.options.parameters.data)"/>
+
+ <h:form id="form">
+ <a4j:queue oncomplete="addResult('buttonFormQueue')"/>
+
+ <a4j:commandButton id="button" oncomplete="stub()">
+ <f:param name="data" value="button" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="viewQueueButton" oncomplete="stub()" eventsQueue="viewQueue">
+ <f:param name="data" value="viewQueueButton" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="implicitDelayedQueue" requestDelay="500"
+ eventsQueue="implicitDelayedQueue" oncomplete="addResult('implicitDelayedQueue')">
+ <f:param name="data" value="implicitDelayedQueue" />
+ </a4j:commandButton>
+ </h:form>
+
+ <h:form id="form2">
+ <a4j:commandButton id="formQueueButton" eventsQueue="formQueue" requestDelay="1000" oncomplete="stub()">
+ <f:param name="data" value="formQueueButton" />
+ </a4j:commandButton>
+
+ <a4j:queue oncomplete="addResult('formQueue:' + request.options.parameters.data)" name="formQueue"/>
+
+ <a4j:commandButton id="button" requestDelay="1000" oncomplete="stub()">
+ <f:param name="data" value="form2Button" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="implicitQueue" eventsQueue="implicitQueue" oncomplete="addResult('implicitQueue')">
+ <f:param name="data" value="implicitQueue" />
+ </a4j:commandButton>
+ </h:form>
+
+ <h:form id="form3">
+
+ <a4j:commandButton id="button">
+ <f:param name="data" value="form3Button" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="anotherImplicitQueue" ignoreDupResponses="true" eventsQueue="anotherImplicitQueue" oncomplete="addResult('anotherImplicitQueue')">
+ <f:param name="data" value="anotherImplicitQueue" />
+ </a4j:commandButton>
+ </h:form>
+
+ <h:form>
+ <a4j:queue oncomplete="addResult('functionFormQueue')"/>
+
+ <a4j:jsFunction name="ajaxFunction" />
+ </h:form>
+
+ <a4j:queue oncomplete="addResult('viewQueue:' + request.options.parameters.data)" name="viewQueue"/>
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-form.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-form.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-form.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-form.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,53 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <body>
+ <f:view>
+ <ui:include src="queue-discovery-base.xhtml" />
+
+ <h:form id="form">
+ <a4j:queue oncomplete="addResult('alt1:' + request.options.parameters.data)" name="alternativeQueue1" />
+ <a4j:queue oncomplete="addResult('buttonFormQueue')"/>
+
+ <a4j:commandButton id="button" oncomplete="stub()">
+ <f:param name="data" value="button" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="implicitQueue" eventsQueue="implicitQueue" oncomplete="addResult('implicitQueue')">
+ <f:param name="data" value="implicitQueue" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="alternativeQueueButton" eventsQueue="alternativeQueue" oncomplete="addResult('alternativeQueueButton')">
+ <f:param name="data" value="alternativeQueueButton" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="alternativeQueue1Button" eventsQueue="alternativeQueue1" oncomplete="addResult('alternativeQueue1Button')">
+ <f:param name="data" value="alternativeQueue1Button" />
+ </a4j:commandButton>
+
+ </h:form>
+
+ <h:form>
+ <a4j:jsFunction name="ajaxFunction" oncomplete="addResult('ajaxFunction')"/>
+ </h:form>
+
+
+ <h:form id="form2">
+ <a4j:commandButton id="button" requestDelay="1000" oncomplete="stub()" />
+ <a4j:commandButton id="implicitDelayedQueue" requestDelay="500"
+ eventsQueue="implicitDelayedQueue" oncomplete="addResult('implicitDelayedQueue')">
+ <f:param name="data" value="implicitDelayedQueue" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="alternativeQueueButton" eventsQueue="alternativeQueue" oncomplete="addResult('alternativeQueueButton')">
+ <f:param name="data" value="alternativeQueueButton" />
+ </a4j:commandButton>
+
+ <a4j:queue oncomplete="addResult('buttonForm2Queue')"/>
+ <a4j:queue oncomplete="addResult('alt:' + request.options.parameters.data)" name="alternativeQueue" />
+ </h:form>
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-view.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-view.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-view.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-global-view.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,40 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <body>
+ <f:view>
+ <ui:include src="queue-discovery-base.xhtml" />
+
+ <h:form id="form">
+ <a4j:commandButton id="button" oncomplete="stub()" requestDelay="100">
+ <f:param name="data" value="button" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="alternativeQueueButton" eventsQueue="alternativeQueue" oncomplete="addResult('alternativeQueueButton')">
+ <f:param name="data" value="alternativeQueueButton" />
+ </a4j:commandButton>
+
+ <a4j:commandButton id="implicitQueue" eventsQueue="implicitQueue" oncomplete="addResult('implicitQueue')">
+ <f:param name="data" value="implicitQueue" />
+ </a4j:commandButton>
+ </h:form>
+
+ <h:form id="form2">
+ <a4j:jsFunction name="ajaxFunction" oncomplete="stub()">
+ <f:param name="data" value="function" />
+ </a4j:jsFunction>
+
+ <a4j:commandButton id="implicitDelayedQueue" requestDelay="500"
+ eventsQueue="implicitDelayedQueue" oncomplete="addResult('implicitDelayedQueue')">
+ <f:param name="data" value="implicitDelayedQueue" />
+ </a4j:commandButton>
+ </h:form>
+
+ <a4j:queue oncomplete="addResult(request.options.parameters.data)"/>
+ <a4j:queue oncomplete="addResult('alt:' + request.options.parameters.data)" name="alternativeQueue" />
+
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-implicit-global.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-implicit-global.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-implicit-global.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-implicit-global.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,10 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <body>
+ <f:view>
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-legacy.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-legacy.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-legacy.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-legacy.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,20 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <body>
+ <f:view>
+ <script type="text/javascript">
+ XMLHttpRequest.defaultRequestTime = 5000;
+
+ var counter = 0;
+ var time = 0;
+ </script>
+ <h:form id="form">
+ <a4j:commandButton id="buttonDelayed" requestDelay="1000" />
+ <a4j:commandButton id="buttonIgnoreDupResponces" ignoreDupResponses="true" oncomplete="counter++;time = Timer.currentTime;"/>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-parallel.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-parallel.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-parallel.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-parallel.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,24 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jstl/core">
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <a4j:status startText="...running..." stopText="stopped" startStyle="color: green" />
+
+ <h:form id="form">
+ <a4j:queue name="queue" />
+
+ <a4j:commandButton id="asyncButton" />
+
+ <a4j:commandButton id="syncButton1" eventsQueue="queue" />
+ <a4j:commandButton id="syncButton2" eventsQueue="queue" />
+ </h:form>
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll-drop.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll-drop.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll-drop.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll-drop.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,26 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <body>
+ <f:view>
+ <a4j:queue size="2" name="dropNextQueue" sizeExceededBehavior="dropNext" />
+ <a4j:queue size="2" name="dropNewQueue" sizeExceededBehavior="dropNew" />
+ <a4j:queue size="1" name="dropNextQueueSingle" sizeExceededBehavior="dropNext" />
+
+ <h:form id="firstForm" rendered="#{renderDropNext}">
+ <a4j:poll interval="2000" id="poll" eventsQueue="dropNextQueue" />
+ </h:form>
+
+ <h:form id="secondForm" rendered="#{renderDropNew}">
+ <a4j:poll interval="2500" id="poll" eventsQueue="dropNewQueue" />
+ </h:form>
+
+ <h:form id="thirdForm" rendered="#{renderDropNextSingle}">
+ <a4j:poll interval="2000" id="poll" eventsQueue="dropNextQueueSingle" />
+ </h:form>
+
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-poll.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,29 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <body>
+ <f:view>
+
+ <h:form id="firstForm">
+ <a4j:queue />
+
+ <a4j:poll id="queuedDefaultPoll" enabled="#{queuedDefaultPollEnabled}" interval="600" />
+ <a4j:poll id="queuedDelayedPoll" enabled="#{queuedDelayedPollEnabled}" interval="200" requestDelay="100" />
+ </h:form>
+
+ <h:form id="secondForm">
+ <a4j:queue requestDelay="10000" />
+
+ <a4j:poll id="delayedQueueDefaultPoll" enabled="#{delayedQueueDefaultPollEnabled}" interval="1500" />
+ <a4j:poll id="delayedQueueDelayedPoll" enabled="#{delayedQueueDelayedPollEnabled}" interval="2000" requestDelay="400" />
+ </h:form>
+
+ <h:form id="thirdForm">
+ <a4j:poll id="unqueuedDefaultPoll" enabled="#{unqueuedDefaultPollEnabled}" interval="700" />
+ <a4j:poll id="unqueuedDelayedPoll" enabled="#{unqueuedDelayedPollEnabled}" interval="900" requestDelay="50" />
+ </h:form>
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,35 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jstl/core">
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <a4j:status startText="...running..." stopText="stopped" startStyle="color: green" />
+
+ <a4j:status id="queueStatus" forceId="true" onstart="window.startStatusTime = Timer.currentTime;"
+ onstop="statusData.push([window.startStatusTime, Timer.currentTime]); window.startStatusTime = undefined;" />
+
+ <a4j:queue name="queueDefaults" />
+
+ <a4j:queue name="queueRequestDelay" requestDelay="15" />
+
+ <a4j:queue name="queueTimeout" timeout="5000" />
+
+ <script type="text/javascript">
+ //LOG.LEVEL = LOG.ALL;
+ window.queueIgnoreDupResponsesTest = new Array();
+ window.statusData = new Array();
+ </script>
+
+ <a4j:queue status="queueStatus" name="queueIgnoreDupResponses" ignoreDupResponses="true" oncomplete="queueIgnoreDupResponsesTest.push(data + ':' + Timer.currentTime)" />
+
+ <a4j:queue name="testQueue" />
+
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-similarity.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-similarity.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-similarity.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-similarity.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,50 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jstl/core">
+ <body>
+ <f:view>
+ <h:form id="form">
+ <a4j:queue name="queue" />
+
+ <a4j:commandButton requestDelay="400" value="Button 1" id="button1" eventsQueue="queue"
+ similarityGroupingId="buttons" />
+
+ <a4j:commandButton requestDelay="400" value="Button 2" id="button2" eventsQueue="queue"
+ similarityGroupingId="buttons" />
+
+ <a4j:commandButton value="Button 3" requestDelay="500" id="button3" eventsQueue="queue" />
+ <a4j:commandButton value="Button 4" requestDelay="500" id="button4" eventsQueue="queue" />
+
+ </h:form>
+
+ <h:form id="dropNext">
+ <a4j:queue name="dropNextQueue" size="3" sizeExceededBehavior="dropNext" />
+
+ <a4j:commandButton value="Button 1" requestDelay="500" id="button1" eventsQueue="dropNextQueue" />
+ <a4j:commandButton value="Button 2" requestDelay="500" id="button2" eventsQueue="dropNextQueue" />
+ </h:form>
+ <h:form id="dropNew">
+ <a4j:queue name="dropNewQueue" size="3" sizeExceededBehavior="dropNew" />
+
+ <a4j:commandButton value="Button 1" requestDelay="500" id="button1" eventsQueue="dropNewQueue" />
+ <a4j:commandButton value="Button 2" requestDelay="500" id="button2" eventsQueue="dropNewQueue" />
+ </h:form>
+ <h:form id="fireNext">
+ <a4j:queue name="fireNextQueue" size="3" sizeExceededBehavior="fireNext" />
+
+ <a4j:commandButton value="Button 1" requestDelay="500" id="button1" eventsQueue="fireNextQueue" />
+ <a4j:commandButton value="Button 2" requestDelay="500" id="button2" eventsQueue="fireNextQueue" />
+ </h:form>
+ <h:form id="fireNew">
+ <a4j:queue name="fireNewQueue" size="3" sizeExceededBehavior="fireNew" />
+
+ <a4j:commandButton value="Button 1" requestDelay="500" id="button1" eventsQueue="fireNewQueue" />
+ <a4j:commandButton value="Button 2" requestDelay="500" id="button2" eventsQueue="fireNewQueue" />
+ </h:form>
+
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-size.xhtml (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-size.xhtml)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-size.xhtml (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/queue-size.xhtml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,56 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <body>
+ <f:view>
+ <a4j:queue name="defaultSizeQueue" />
+
+ <a4j:queue name="dropNextQueue" sizeExceededBehavior="dropNext" size="3" />
+ <a4j:queue name="dropNextQueueSingle" sizeExceededBehavior="dropNext" size="1" />
+
+ <a4j:queue name="fireNextQueue" sizeExceededBehavior="fireNext" size="3" />
+ <a4j:queue name="fireNextQueueSingle" sizeExceededBehavior="fireNext" size="1" />
+
+ <a4j:queue name="dropNewQueue" sizeExceededBehavior="dropNew" size="3" />
+ <a4j:queue name="dropNewQueueSingle" sizeExceededBehavior="dropNew" size="1" />
+
+ <a4j:queue name="fireNewQueue" sizeExceededBehavior="fireNew" size="3" />
+ <a4j:queue name="fireNewQueueSingle" sizeExceededBehavior="fireNew" size="1" />
+
+ <script type="text/javascript">
+ defaultExceededQueueResults = new Array();
+
+ function addEventData(queue, query, options, event) {
+ if (!queue) {
+ throw "queue not defined";
+ }
+ if (!query) {
+ throw "query not defined";
+ }
+ if (!options) {
+ throw "options not defined";
+ }
+ if (!event) {
+ throw "event not defined";
+ }
+
+ defaultExceededQueueResults.push({queue: queue, query: query, options: options, event: event, _time: Timer.currentTime});
+ }
+
+ defaultSingleSizedQueueResults = new Array();
+ </script>
+
+ <a4j:queue onsizeexceeded="addEventData(this, query, options, event)" size="2" name="defaultExceededQueue" />
+ <h:form id="form">
+ <a4j:commandButton id="button0" eventsQueue="defaultExceededQueue" value="button" />
+ <a4j:commandButton id="button1" eventsQueue="defaultExceededQueue" value="button" />
+ <a4j:commandButton id="button2" eventsQueue="defaultExceededQueue" value="button" />
+ <a4j:commandButton id="button3" eventsQueue="defaultExceededQueue" value="button" />
+ </h:form>
+
+ <a4j:queue name="singleSizedDefaultQueue" size="1" ignoreDupResponses="true" oncomplete="defaultSingleSizedQueueResults.push(data)" />
+ </f:view>
+ </body>
+</html>
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/root (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/root)
===================================================================
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/simulation.js (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/simulation.js)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/simulation.js (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/simulation.js 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,217 @@
+LOG.LEVEL = LOG.INFO;
+LOG._logToConsole = function(message, level) {
+ //TODO deal with this nasty message
+ if (message != "No information in response about elements to replace") {
+ LOG.out.println(level.name + ': ' + message)
+ }
+};
+
+var Timer = {
+
+ _eventCounter: 0,
+
+ currentTime: 0,
+
+ maxTime: 10000000,
+
+ events: new Array(),
+
+ addEventToTimer: function(callback, delay) {
+ var eventTime = this.currentTime + delay;
+
+ var i = 0;
+
+ while (this.events[i] && (this.events[i].eventTime <= eventTime)) {
+ i++;
+ }
+
+ var eventId = this._eventCounter++;
+
+ this.events.splice(i, 0, {eventTime: eventTime, callback: callback, eventId: eventId});
+
+ return eventId;
+ },
+
+ removeEventFromTimer: function(eventId) {
+ for ( var i = 0; i < this.events.length; i++) {
+ if (this.events[i].eventId == eventId) {
+ this.events.splice(i, 1);
+
+ break;
+ }
+ }
+ },
+
+ execute: function() {
+ while (this.events.length > 0) {
+
+ var eventData = this.events.shift();
+
+ this.currentTime = eventData.eventTime;
+ if (this.currentTime > this.maxTime) {
+ throw "Maximum execution time reached, aborting timer";
+ }
+
+ try {
+
+ eventData.callback();
+ } catch (e) {
+ alert(e.message);
+ }
+ }
+ },
+
+ isEmpty: function() {
+ return this.events.length == 0;
+ }
+};
+
+window.setTimeout = function(callback, delay) {
+ return Timer.addEventToTimer(callback, delay);
+}
+
+window.clearTimeout = function(timerId) {
+ Timer.removeEventFromTimer(timerId);
+}
+
+var SimulationContext = function(submitFunction) {
+ this.results = new Array();
+
+ this.submitFunction = submitFunction;
+};
+
+SimulationContext.prototype.ajax = function() {
+ var args = new Array();
+ for (var i = 1; i < arguments.length; i++) {
+ args.push(arguments[i]);
+ }
+ var _this = this;
+
+ Timer.addEventToTimer(function() {
+ _this.submitFunction.apply(this, args);
+ }, arguments[0]);
+};
+
+SimulationContext.prototype.executeOnTime = function(time, code) {
+ Timer.addEventToTimer(function() {
+ code();
+ }, time);
+};
+
+window.simulationContext = undefined;
+
+window.XMLHttpRequest = function() {
+ this.requestTime = XMLHttpRequest.requestTime || 0;
+ this.data = XMLHttpRequest.data;
+
+ this.responseText = null;
+ this.responseXML = null;
+
+ this.readyState = 0;
+}
+
+window.XMLHttpRequest.UNSENT = 0;
+window.XMLHttpRequest.OPENED = 1;
+window.XMLHttpRequest.HEADERS_RECEIVED = 2;
+window.XMLHttpRequest.LOADING = 3;
+window.XMLHttpRequest.DONE = 4;
+
+XMLHttpRequest.prototype.abort = function() {
+ if (this.timerId) {
+ clearTimeout(this.timerId);
+ }
+
+ window.simulationContext.results[this.requestId].endTime = Timer.currentTime;
+ window.simulationContext.results[this.requestId].aborted = true;
+};
+
+XMLHttpRequest.prototype.getAllResponseHeaders = function() {
+ return "";
+};
+XMLHttpRequest.prototype.getResponseHeader = function(name) {
+ if ("Ajax-Response" == name) {
+ return "true";
+ }
+
+ return "";
+};
+XMLHttpRequest.prototype.open = function(method, url, async, user, password) {
+ this.readyState = XMLHttpRequest.OPENED;
+};
+
+XMLHttpRequest.prototype.send = function(contentType) {
+ var length = window.simulationContext.results.push({data: this.data, startTime: Timer.currentTime});
+ this.requestId = length - 1;
+
+ var _this = this;
+ this.timerId = setTimeout(function() {
+ _this.status = 200;
+ _this.statusText = "Success";
+ _this.readyState = window.XMLHttpRequest.DONE;
+
+ var responseTextArray = new Array();
+ responseTextArray.push("<html><head></head><body>");
+ if (_this.data) {
+
+ responseTextArray.push("<span id='_ajax:data'>");
+ if (typeof _this.data == 'string') {
+ responseTextArray.push("'");
+ responseTextArray.push(_this.data);
+ responseTextArray.push("'");
+ } else {
+ responseTextArray.push(_this.data);
+ }
+ responseTextArray.push("</span>");
+ }
+ responseTextArray.push("</body></html>");
+
+ _this.responseText = responseTextArray.join('');
+
+ var doc = new ActiveXObject("MSXML.DOMDocument");
+ doc.loadXML(_this.responseText);
+
+ //hack to make it work with current HTMLUnit
+ delete doc.getElementById;
+ doc.getElementById = function(id){
+ var nodes = this.selectNodes("//*");
+ for (var i = 0; i < nodes.length; i++) {
+ if (nodes[i].getAttribute("id") == id) {
+ return nodes[i];
+ }
+ }
+ };
+
+ _this.responseXML = doc;
+
+ window.simulationContext.results[_this.requestId].endTime = Timer.currentTime;
+ _this.onreadystatechange();
+ }, this.requestTime);
+};
+
+XMLHttpRequest.prototype.setRequestHeader = function(name, value) {
+
+};
+
+var oldSubmitQuery = A4J.AJAX.SubmitQuery;
+
+var DEFAULT_REQUEST_TIME;
+
+A4J.AJAX.SubmitQuery = function(query, options, event) {
+ var defaultRequestTime = XMLHttpRequest.defaultRequestTime;
+ if (typeof defaultRequestTime == "function") {
+ defaultRequestTime = defaultRequestTime(query, options, event);
+ }
+
+ XMLHttpRequest.requestTime = options.requestTime || defaultRequestTime || DEFAULT_REQUEST_TIME;
+ XMLHttpRequest.data = options.data || (event && event.srcElement.id) || options.pollId;
+
+ try {
+ var req = oldSubmitQuery.apply(this, arguments);
+
+ return req;
+ } finally {
+ XMLHttpRequest.requestTime = undefined;
+ XMLHttpRequest.data = undefined;
+ }
+}
+
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/user.js (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/user.js)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/user.js (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/user.js 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1 @@
+/* dependency of org.ajax4jsf.component.LoadResourceComponentTest */
\ No newline at end of file
Copied: branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/user.xcss (from rev 14238, trunk/ui/core/src/test/resources/org/ajax4jsf/component/user.xcss)
===================================================================
--- branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/user.xcss (rev 0)
+++ branches/jsf2.0/ui/core/src/test/resources/org/ajax4jsf/component/user.xcss 2009-07-10 11:13:58 UTC (rev 14876)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:template xmlns:f='http:/jsf.exadel.com/template'
+ xmlns:u='http:/jsf.exadel.com/template/util'
+ xmlns="http://www.w3.org/1999/xhtml">
+
+ <!-- dependency of org.ajax4jsf.component.LoadResourceComponentTest -->
+
+</f:template>
\ No newline at end of file
Modified: branches/jsf2.0/ui/pom.xml
===================================================================
--- branches/jsf2.0/ui/pom.xml 2009-07-10 11:04:14 UTC (rev 14875)
+++ branches/jsf2.0/ui/pom.xml 2009-07-10 11:13:58 UTC (rev 14876)
@@ -1,11 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
+ <!--parent>
<artifactId>root</artifactId>
<groupId>org.richfaces</groupId>
<version>4.0.0-SNAPSHOT</version>
- </parent>
+ </parent-->
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces</groupId>
+ <version>4.0.0-SNAPSHOT</version>
<artifactId>ui</artifactId>
<packaging>pom</packaging>
<name>RichFaces Components</name>
@@ -122,16 +123,16 @@
</dependency>
<dependency>
<groupId>org.richfaces.framework</groupId>
- <artifactId>richfaces-test</artifactId>
+ <artifactId>richfaces-test-base</artifactId>
<version>4.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>1.1.14</version>
<optional>true</optional>
- </dependency>
+ </dependency-->
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
@@ -164,7 +165,7 @@
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
- <artifactId>mojarra-jsf-api</artifactId>
+ <artifactId>jsf-api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
15 years, 2 months