JBoss Rich Faces SVN: r15787 - in root: framework/trunk/impl/src/main/java/org/ajax4jsf/application and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-10-30 19:28:08 -0400 (Fri, 30 Oct 2009)
New Revision: 15787
Added:
root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UISelector.java
Removed:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/ComponentUtils.java
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UISelector.java
Modified:
root/framework/trunk/impl/pom.xml
root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/DebugOutputMaker.java
root/framework/trunk/version-matrix/pom.xml
root/ui-sandbox/trunk/components/tables/ui/
Log:
https://jira.jboss.org/jira/browse/RF-8059
https://jira.jboss.org/jira/browse/RF-7556
Modified: root/framework/trunk/impl/pom.xml
===================================================================
--- root/framework/trunk/impl/pom.xml 2009-10-30 14:55:22 UTC (rev 15786)
+++ root/framework/trunk/impl/pom.xml 2009-10-30 23:28:08 UTC (rev 15787)
@@ -124,10 +124,6 @@
<dependencies>
<dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </dependency>
- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>richfaces-api</artifactId>
</dependency>
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/DebugOutputMaker.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/DebugOutputMaker.java 2009-10-30 14:55:22 UTC (rev 15786)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/application/DebugOutputMaker.java 2009-10-30 23:28:08 UTC (rev 15787)
@@ -21,30 +21,32 @@
package org.ajax4jsf.application;
-import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
+import java.util.Map.Entry;
+import javax.el.Expression;
+import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.application.Resource;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
import javax.faces.event.PhaseId;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.Messages;
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.commons.beanutils.PropertyUtils;
/**
@@ -56,10 +58,10 @@
private final static String LT = "<";
private final static String GT = ">";
// Attributes that should not be printed
- static public final HashSet IGNORE_ATTRIBUTES;
+ static public final Set<String> IGNORE_ATTRIBUTES;
static {
- IGNORE_ATTRIBUTES = new HashSet();
+ IGNORE_ATTRIBUTES = new HashSet<String>();
IGNORE_ATTRIBUTES.add("attributes");
IGNORE_ATTRIBUTES.add("children");
IGNORE_ATTRIBUTES.add("childCount");
@@ -265,21 +267,20 @@
out.println("<dd id='"+clientId+"' style='display:none;' class='tree' ><ul class='tree'>");
// out bean properties
try {
- PropertyDescriptor propertyDescriptors[] = PropertyUtils.getPropertyDescriptors(component);
- for (int i = 0; i < propertyDescriptors.length; i++) {
- if (PropertyUtils.isReadable(component,propertyDescriptors[i].getName())) {
- String name = propertyDescriptors[i].getName();
- ValueBinding vb = component.getValueBinding(name);
- if (vb != null) {
- writeAttribute(out, name, vb.getExpressionString());
- } else {
- if (!IGNORE_ATTRIBUTES.contains(name)) {
- try {
- String value = BeanUtils.getProperty(component,name);
- writeAttribute(out, name, value);
- } catch (Exception e) {
- writeAttribute(out, name, null);
- }
+ Map<String, Object> attributes = component.getAttributes();
+ List<String> attributeNamesList = new ArrayList<String>(attributes.keySet());
+ Collections.sort(attributeNamesList);
+ for (String attributeName : attributeNamesList) {
+ ValueExpression ve = component.getValueExpression(attributeName);
+ if (ve != null) {
+ writeAttribute(out, attributeName, ve.getExpressionString());
+ } else {
+ if (!IGNORE_ATTRIBUTES.contains(attributeName)) {
+ try {
+ Object value = attributes.get(attributeName);
+ writeAttribute(out, attributeName, value);
+ } catch (Exception e) {
+ writeAttribute(out, attributeName, null);
}
}
}
@@ -290,27 +291,29 @@
// out bindings
// out attributes map
- for (Iterator it = component.getAttributes().entrySet().iterator(); it
+ for (Iterator<Entry<String, Object>> it = component.getAttributes().entrySet().iterator(); it
.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- writeAttribute(out, (String) entry.getKey(), entry.getValue());
+ Entry<String, Object> entry = it.next();
+ writeAttribute(out, entry.getKey(), entry.getValue());
}
// out listeners
out.println("</ul></dd>");
- if (component.getFacetsAndChildren().hasNext()) {
+ if (component.getFacetCount() > 0 || component.getChildCount() > 0) {
out.println("<dd class='tree_childs'><dl class='tree_childs'>");
// out childs of this component
// facets
- for (Iterator facetEntry = component.getFacets().entrySet()
- .iterator(); facetEntry.hasNext();) {
- Map.Entry entry = (Map.Entry) facetEntry.next();
- writeComponent(context, out,
- (UIComponent) entry.getValue(), (String) entry.getKey());
+ Map<String, UIComponent> facetsMap = component.getFacets();
+ List<String> facetNamesList = new ArrayList<String>(facetsMap.keySet());
+ Collections.sort(facetNamesList);
+
+ for (String nextFacetName : facetNamesList) {
+ writeComponent(context, out, facetsMap.get(nextFacetName), nextFacetName);
}
+
// childs components
- for (Iterator childIter = component.getChildren().iterator(); childIter
+ for (Iterator<UIComponent> childIter = component.getChildren().iterator(); childIter
.hasNext();) {
- UIComponent child = (UIComponent) childIter.next();
+ UIComponent child = childIter.next();
writeComponent(context, out, child, null);
}
out.println("</dl></dd>");
@@ -333,10 +336,8 @@
out.print("[id:");
out.print(((UIComponent) value).getId());
out.print(']');
- } else if (value instanceof MethodBinding) {
- out.print(((MethodBinding) value).getExpressionString());
- } else if (value instanceof ValueBinding) {
- out.print(((ValueBinding) value).getExpressionString());
+ } else if (value instanceof Expression) {
+ out.print(((Expression) value).getExpressionString());
} else {
out.print(value.toString());
}
@@ -356,17 +357,17 @@
writeVariables(out, ctx.getApplicationMap(), "Application Attributes");
}
- private void writeVariables(PrintWriter out, Map vars, String caption) {
+ private <K, V> void writeVariables(PrintWriter out, Map<K, V> vars, String caption) {
out.print("<table><caption>");
out.print(caption);
out.println("</caption><thead><tr><th style=\"width: 10%; \">Name</th><th style=\"width: 90%; \">Value</th></tr></thead><tbody>");
boolean written = false;
if (!vars.isEmpty()) {
- SortedMap map = new TreeMap(vars);
- Map.Entry entry = null;
+ SortedMap<K, V> map = new TreeMap<K, V>(vars);
+ Map.Entry<K, V> entry = null;
String key = null;
- for (Iterator itr = map.entrySet().iterator(); itr.hasNext(); ) {
- entry = (Map.Entry) itr.next();
+ for (Iterator<Entry<K, V>> itr = map.entrySet().iterator(); itr.hasNext(); ) {
+ entry = itr.next();
key = entry.getKey().toString();
if (key.indexOf('.') == -1) {
out.println("<tr><td>");
@@ -375,26 +376,28 @@
Object value = entry.getValue();
out.println(value.toString().replaceAll("<", LT).replaceAll(">", GT));
out.println("</span>");
- try {
- PropertyDescriptor propertyDescriptors[] = PropertyUtils.getPropertyDescriptors(value);
- if (propertyDescriptors.length>0) {
- out.print("<div class='properties'><ul class=\'properties\'>");
- for (int i = 0; i < propertyDescriptors.length; i++) {
- String beanPropertyName = propertyDescriptors[i].getName();
- if (PropertyUtils.isReadable(value,beanPropertyName
- )) {
- out.print("<li class=\'properties\'>");
- out.print(beanPropertyName+" = "+BeanUtils.getProperty(value,beanPropertyName));
- out.print("</li>");
+
+ //TODO - commented after beanutils dependency removed - review
+// try {
+// PropertyDescriptor propertyDescriptors[] = PropertyUtils.getPropertyDescriptors(value);
+// if (propertyDescriptors.length>0) {
+// out.print("<div class='properties'><ul class=\'properties\'>");
+// for (int i = 0; i < propertyDescriptors.length; i++) {
+// String beanPropertyName = propertyDescriptors[i].getName();
+// if (PropertyUtils.isReadable(value,beanPropertyName
+// )) {
+// out.print("<li class=\'properties\'>");
+// out.print(beanPropertyName+" = "+BeanUtils.getProperty(value,beanPropertyName));
+// out.print("</li>");
+//
+// }
+// }
+// out.print("</ul></div>");
+// }
+// } catch (Exception e) {
+// // TODO: log exception
+// }
- }
- }
- out.print("</ul></div>");
- }
- } catch (Exception e) {
- // TODO: log exception
- }
-
out.println("</td></tr>");
written = true;
}
Deleted: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/ComponentUtils.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/ComponentUtils.java 2009-10-30 14:55:22 UTC (rev 15786)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/ComponentUtils.java 2009-10-30 23:28:08 UTC (rev 15787)
@@ -1,134 +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;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-
-import javax.el.MethodNotFoundException;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.Messages;
-import org.apache.commons.beanutils.MethodUtils;
-
-/**
- * Utils for working with tempates
- * @author ayukhovich(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:52 $
- */
-public class ComponentUtils {
- private final static String UTILS_PREFIX = "util.";
- /**
- *
- * @param className
- * @param functionName
- * @param parameters
- * @return
- */
- public static Object callFunction( FacesContext context, UIComponent component, RendererBase renderer, String functionName, Object[] parameters ) {
-
- Object returnObject = null;
-
- int sizeParameters = 0;
- int sizeArrayParameters = 2;
- if ( parameters != null ) {
- sizeParameters = parameters.length;
- sizeArrayParameters = 3;
- }
-
- Object[][] arrayParameters = new Object[sizeArrayParameters][];
- arrayParameters[0] = new Object[sizeParameters+2];
- arrayParameters[1] = new Object[sizeParameters+1];
-
- if ( sizeParameters != 0 ) {
- arrayParameters[2] = new Object[sizeParameters];
- }
-
- arrayParameters[0][0] = context;
- arrayParameters[0][1] = component;
- arrayParameters[1][0] = component;
-
- if ( parameters != null ) {
- for (int iParameter=0;iParameter<parameters.length;iParameter++) {
- arrayParameters[0][iParameter+2] = parameters;
- arrayParameters[1][iParameter+1] = parameters;
- arrayParameters[2][iParameter] = parameters;
- }
- }
-
- String methodName;
- Object object;
- if(functionName.startsWith(UTILS_PREFIX)){
- methodName = functionName.substring(UTILS_PREFIX.length());
- object = renderer.getUtils();
- } else {
- object = renderer;
- methodName = functionName;
- }
-
-
- returnObject = invokeMethod(object, methodName, arrayParameters );
-
- return returnObject;
- }
-
- /**
- * Invoke a named method whose parameter type matches the object type.
- * @param objects - invoke method on this object
- * @param methodName - get method with this name
- * @param arrayParameters - use these arguments - treat null as empty array
- * @return
- */
- private static Object invokeMethod(Object object, String methodName, Object[][] arrayParameters) {
-
- try {
- for (int iParameter = 0; iParameter < arrayParameters.length; iParameter++) {
- try {
- return MethodUtils.invokeMethod(object, methodName, arrayParameters[iParameter]);
- } catch (NoSuchMethodException e) {
- continue;
- }
- }
- } catch (InvocationTargetException e) {
- throw new FacesException(Messages.getMessage(Messages.METHOD_CALL_ERROR_2b, methodName, e.getCause().getMessage()), e);
- } catch (IllegalAccessException e) {
- throw new FacesException(Messages.getMessage(Messages.METHOD_CALL_ERROR_4b, methodName, e.getMessage()), e);
- }
- throw new MethodNotFoundException(Messages.getMessage(Messages.METHOD_CALL_ERROR_6b, methodName, object));
- }
-
- /**
- * Write html-attribute
- * @param writer
- * @param attribute
- * @param value
- * @throws IOException
- */
- public static void writeAttribute(ResponseWriter writer, String attribute, Object value ) throws IOException {
- if ( (value != null) && (value.toString().length()!=0) ) {
- writer.writeAttribute(attribute, value.toString(), attribute );
- }
- }
-}
Modified: root/framework/trunk/version-matrix/pom.xml
===================================================================
--- root/framework/trunk/version-matrix/pom.xml 2009-10-30 14:55:22 UTC (rev 15786)
+++ root/framework/trunk/version-matrix/pom.xml 2009-10-30 23:28:08 UTC (rev 15787)
@@ -231,11 +231,6 @@
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.7.0</version>
- </dependency>
<!-- -->
<!-- TODO: legacy dependnecies -->
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UISelector.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UISelector.java 2009-10-30 14:55:22 UTC (rev 15786)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UISelector.java 2009-10-30 23:28:08 UTC (rev 15787)
@@ -1,114 +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.component;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.component.AjaxDataEncoder;
-import org.ajax4jsf.renderkit.AjaxChildrenRenderer;
-import org.apache.commons.beanutils.PropertyUtils;
-
-/**
- * Base class for component, performed AJAX encoding on selected values in
- * iterable components ( UIData, trees etc )
- *
- * @author shura
- *
- */
-public abstract class UISelector extends UIComponentBase implements
- AjaxDataEncoder {
-
- private static final AjaxChildrenRenderer childrenRenderer = new AjaxChildrenRenderer() {
-
- protected Class<? extends UIComponent> getComponentClass() {
- return UISelector.class;
- }
-
- };
-
- /**
- * Name of serRow ( or simple ) method for setup current value in iterable
- * component
- *
- * @parameter
- * @return the acceptClass
- */
- public abstract String getIterationProperty();
-
- /**
- * @param newSelectMethod
- * the value to set
- */
- public abstract void setIterationProperty(String newSelectMethod);
-
- /*
- * (non-Javadoc)
- *
- * @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<String> ids, Set<String> renderedAreas) throws IOException {
- if (getChildCount() != 1) {
- throw new FacesException("Selector component must have one, and only one, child");
- }
- UIComponent child = (UIComponent) getChildren().get(0);
- Set<Object> ajaxKeys = getAjaxKeys();
- if (null != ajaxKeys) {
- String iterationProperty = getIterationProperty();
- try {
- Object savedKey = PropertyUtils.getProperty(child,
- iterationProperty);
- for (Iterator<Object> iter = ajaxKeys.iterator(); iter.hasNext();) {
- Object key = (Object) iter.next();
- PropertyUtils.setProperty(child, iterationProperty, key);
- if (true) {
- childrenRenderer.encodeAjaxChildren(context, this, path,
- ids, renderedAreas);
- }
-
- }
- PropertyUtils.setProperty(child, iterationProperty, savedKey);
-
- } catch (IllegalAccessException e) {
- throw new FacesException(
- "Illegal access to iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e);
- } catch (InvocationTargetException e) {
- throw new FacesException(
- "Error in iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e.getCause());
- } catch (NoSuchMethodException e) {
- throw new FacesException(
- "No iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e);
- }
- }
-
- }
-
-}
Copied: root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UISelector.java (from rev 15786, root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UISelector.java)
===================================================================
--- root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UISelector.java (rev 0)
+++ root/ui-sandbox/trunk/components/core/src/main/java/org/ajax4jsf/component/UISelector.java 2009-10-30 23:28:08 UTC (rev 15787)
@@ -0,0 +1,114 @@
+/**
+ * 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.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.component.AjaxDataEncoder;
+import org.ajax4jsf.renderkit.AjaxChildrenRenderer;
+import org.apache.commons.beanutils.PropertyUtils;
+
+/**
+ * Base class for component, performed AJAX encoding on selected values in
+ * iterable components ( UIData, trees etc )
+ *
+ * @author shura
+ *
+ */
+public abstract class UISelector extends UIComponentBase implements
+ AjaxDataEncoder {
+
+ private static final AjaxChildrenRenderer childrenRenderer = new AjaxChildrenRenderer() {
+
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UISelector.class;
+ }
+
+ };
+
+ /**
+ * Name of serRow ( or simple ) method for setup current value in iterable
+ * component
+ *
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract String getIterationProperty();
+
+ /**
+ * @param newSelectMethod
+ * the value to set
+ */
+ public abstract void setIterationProperty(String newSelectMethod);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @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<String> ids, Set<String> renderedAreas) throws IOException {
+ if (getChildCount() != 1) {
+ throw new FacesException("Selector component must have one, and only one, child");
+ }
+ UIComponent child = (UIComponent) getChildren().get(0);
+ Set<Object> ajaxKeys = getAjaxKeys();
+ if (null != ajaxKeys) {
+ String iterationProperty = getIterationProperty();
+ try {
+ Object savedKey = PropertyUtils.getProperty(child,
+ iterationProperty);
+ for (Iterator<Object> iter = ajaxKeys.iterator(); iter.hasNext();) {
+ Object key = (Object) iter.next();
+ PropertyUtils.setProperty(child, iterationProperty, key);
+ if (true) {
+ childrenRenderer.encodeAjaxChildren(context, this, path,
+ ids, renderedAreas);
+ }
+
+ }
+ PropertyUtils.setProperty(child, iterationProperty, savedKey);
+
+ } catch (IllegalAccessException e) {
+ throw new FacesException(
+ "Illegal access to iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e);
+ } catch (InvocationTargetException e) {
+ throw new FacesException(
+ "Error in iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e.getCause());
+ } catch (NoSuchMethodException e) {
+ throw new FacesException(
+ "No iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e);
+ }
+ }
+
+ }
+
+}
Property changes on: root/ui-sandbox/trunk/components/tables/ui
___________________________________________________________________
Name: svn:ignore
- target
.classpath
.project
.settings
+ target
.classpath
.project
.settings
.clover
15 years, 1 month
JBoss Rich Faces SVN: r15786 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/user-extensions and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-10-30 10:55:22 -0400 (Fri, 30 Oct 2009)
New Revision: 15786
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/user-extensions/rfqa-extensions.js
Log:
- richfaces-demo ftest - fixed jQuery migration - opens components' pages using newly implemented :textEquals(text) jQuery's predicate instead of using built-in :contains(text) (also added two similar predicates :textStartsWith and :textEndsWith)
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-10-30 14:49:48 UTC (rev 15785)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-10-30 14:55:22 UTC (rev 15786)
@@ -280,11 +280,9 @@
*/
protected void openComponent(final String componentName) {
- final String LOC_MENU_ITEM = format(
- "jquery=table.left_menu td.text a > span:contains('{0}')",
- componentName);
+ final String LOC_MENU_ITEM = format("jquery=table.left_menu td.text a > span:textEquals('{0}')", componentName);
- // TODO needs to open clean page, see {@link
+ // TODO needs to open clean page, see {@link
// https://jira.jboss.org/jira/browse/RF-7640}
selenium.getEval("selenium.doDeleteAllVisibleCookies()");
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/user-extensions/rfqa-extensions.js
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/user-extensions/rfqa-extensions.js 2009-10-30 14:49:48 UTC (rev 15785)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/user-extensions/rfqa-extensions.js 2009-10-30 14:55:22 UTC (rev 15786)
@@ -1,21 +1,89 @@
/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat, Inc. and
+ * individual contributors by the
+ *
+ * @authors tag. See the copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software 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 software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ ******************************************************************************/
+
+/**
+ * Extension to String.
+ *
+ * Finds out if string object starts with given string.
+ *
+ * @return true if underlying string objects starts with given string; otherwise
+ * returns false
+ */
+String.prototype.startsWith = function(str) {
+ return (this.match("^" + str) == str);
+}
+
+/**
+ * Extension to String.
+ *
+ * Finds out if string object ends with given string.
+ *
+ * @return true if underlying string objects ends with given string; otherwise
+ * returns false
+ */
+String.prototype.endsWith = function(str) {
+ return (this.match(str + "$") == str)
+}
+
+/**
+ * Extensions to JQuery Expressions
+ *
+ * Adds filter expression :textEquals(text) to JQuery selectors.
+ *
+ * Usage: span:textEquals('some text')
+ *
+ * Text of the element is trimmed before comparison to equality.
+ */
+jQuery.expr.filters['textEquals'] = function(elem, i, match, array) {
+ return jQuery.trim(elem.textContent || elem.innerText || "") === match[3];
+}
+
+/**
+ * Extensions to JQuery Expressions
+ *
+ * Adds filter expression :textStartsWith(text) to JQuery selectors.
+ *
+ * Usage: span:textStartsWith('abc')
+ *
+ * Text of the element is trimmed before matching if the text starts with given
+ * string.
+ */
+jQuery.expr.filters['textStartsWith'] = function(elem, i, match, array) {
+ return jQuery.trim(elem.textContent || elem.innerText || "").startsWith(
+ match[3]);
+}
+
+/**
+ * Extensions to JQuery Expressions
+ *
+ * Adds filter expression :textEndsWith(text) to JQuery selectors.
+ *
+ * Usage: span:textEndsWith('abc')
+ *
+ * Text of the element is trimmed before matching if the text ends with given
+ * string.
+ */
+jQuery.expr.filters['textEndsWith'] = function(elem, i, match, array) {
+ return jQuery.trim(elem.textContent || elem.innerText || "").endsWith(
+ match[3]);
+}
15 years, 1 month
JBoss Rich Faces SVN: r15785 - branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-10-30 10:49:48 -0400 (Fri, 30 Oct 2009)
New Revision: 15785
Added:
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/ByteSequenceMatcher.java
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/FileParam.java
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/Param.java
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/ValueParam.java
Modified:
branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
Log:
https://jira.jboss.org/jira/browse/RF-7927
Added: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/ByteSequenceMatcher.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/ByteSequenceMatcher.java (rev 0)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/ByteSequenceMatcher.java 2009-10-30 14:49:48 UTC (rev 15785)
@@ -0,0 +1,185 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.ajax4jsf.request;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ByteSequenceMatcher {
+
+ public interface BytesHandler {
+
+ public void handle(byte[] bytes, int length) throws IOException;
+
+ }
+
+ private static final int ZERO_READS_NUMBER = 20;
+
+ private byte[] buffer;
+
+ private int readLength = 0;
+
+ private int zeroReadCounter = ZERO_READS_NUMBER;
+
+ private boolean bufferEOF = false;
+
+ private boolean isEOF = false;
+
+ private boolean isMatched = false;
+
+ private InputStream inputStream;
+
+ private BytesHandler bytesHandler;
+
+ public ByteSequenceMatcher(InputStream inputStream, int bufferSize) {
+ this.inputStream = inputStream;
+ this.buffer = new byte[bufferSize];
+ }
+
+ public BytesHandler getBytesHandler() {
+ return bytesHandler;
+ }
+
+ public void setBytesHandler(BytesHandler bytesHandler) {
+ this.bytesHandler = bytesHandler;
+ }
+
+ protected void prefillBuffer(int usedLength) throws IOException {
+ if (usedLength > readLength) {
+ throw new IllegalArgumentException();
+ }
+
+ if (usedLength != readLength && usedLength != 0) {
+ System.arraycopy(buffer, usedLength, buffer, 0, readLength - usedLength);
+ }
+
+ readLength -= usedLength;
+
+ int remaining;
+
+ while (!bufferEOF && (remaining = (buffer.length - readLength)) > 0) {
+ int read = inputStream.read(buffer, readLength, remaining);
+
+ if (read > 0) {
+ readLength += read;
+ } else if (read == 0) {
+ --zeroReadCounter;
+
+ if (zeroReadCounter == 0) {
+ throw new IllegalStateException("Maximum number of zero reads reached");
+ }
+ } else if (read < 0) {
+ bufferEOF = true;
+ }
+ }
+ }
+
+ private boolean match(int startOffset, byte[]...sequences) {
+ int index = startOffset;
+
+ for (byte[] bs : sequences) {
+ for (byte b : bs) {
+
+ if (index >= readLength) {
+ return false;
+ }
+
+ if (buffer[index] != b) {
+ return false;
+ }
+
+ index++;
+ }
+ }
+
+ return true;
+ }
+
+ public void findSequence(int limit, byte[]... sequences) throws IOException {
+ isMatched = false;
+
+ int userLimit = limit;
+ if (userLimit <= 0) {
+ userLimit = Integer.MAX_VALUE;
+ }
+
+ prefillBuffer(0);
+
+ int sequencesLength = 0;
+ for (byte[] bs : sequences) {
+ sequencesLength += bs.length;
+ }
+
+ int i = 0;
+
+ while (!isMatched && i <= readLength - sequencesLength) {
+ if (match(i, sequences)) {
+ isMatched = true;
+ bytesHandler.handle(buffer, i);
+ prefillBuffer(i + sequencesLength);
+ } else {
+ int sequenceLimit = readLength - sequencesLength + 1;
+ int realLimit;
+
+ if (sequenceLimit < userLimit) {
+ realLimit = sequenceLimit;
+ } else {
+ realLimit = userLimit;
+ }
+
+ if (realLimit > 0 && i == realLimit - 1) {
+ //report limit
+ bytesHandler.handle(buffer, realLimit);
+ prefillBuffer(realLimit);
+
+ i = 0;
+ } else {
+ i++;
+ }
+ }
+ }
+
+ if (!isMatched) {
+ if (readLength > 0) {
+ bytesHandler.handle(buffer, readLength);
+ prefillBuffer(readLength);
+ }
+ }
+
+ if (this.readLength == 0) {
+ this.isEOF = true;
+ }
+ }
+
+ public boolean isEOF() {
+ return isEOF;
+ }
+
+ public boolean isMatched() {
+ return isMatched;
+ }
+
+ public boolean isMatchedAndNotEOF() {
+ return isMatched() && !isEOF();
+ }
+}
Added: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/FileParam.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/FileParam.java (rev 0)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/FileParam.java 2009-10-30 14:49:48 UTC (rev 15785)
@@ -0,0 +1,205 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.ajax4jsf.request;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.rmi.server.UID;
+
+import org.ajax4jsf.exception.FileUploadException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+class FileParam extends Param {
+
+ private static final Log logger = LogFactory.getLog(FileParam.class);
+
+ private String filename;
+ private String contentType;
+ private int fileSize;
+
+ private ByteArrayOutputStream bOut = null;
+ private FileOutputStream fOut = null;
+ private File tempFile = null;
+
+ public FileParam(String name) {
+ super(name);
+ }
+
+ public Object getFile() {
+ if (null != tempFile) {
+ return tempFile;
+ } else if (null != bOut) {
+ return bOut.toByteArray();
+ }
+ return null;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public int getFileSize() {
+ return fileSize;
+ }
+
+ public File createTempFile() {
+ try {
+ tempFile = File.createTempFile(new UID().toString().replace(
+ ":", "-"), ".upload");
+ fOut = new FileOutputStream(tempFile);
+ } catch (IOException ex) {
+ if (fOut != null) {
+ try {
+ fOut.close();
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ throw new FileUploadException("Could not create temporary file");
+ }
+ return tempFile;
+ }
+
+ public void deleteFile() {
+ try {
+ if (fOut != null) {
+ fOut.close();
+ }
+ if (tempFile != null) {
+ tempFile.delete();
+ }
+ } catch (Exception e) {
+ throw new FileUploadException("Could not delete temporary file");
+ }
+ }
+
+ public byte[] getData() {
+ if (bOut != null) {
+ return bOut.toByteArray();
+ } else if (tempFile != null) {
+ if (tempFile.exists()) {
+ FileInputStream fIn = null;
+ try {
+ long fileLength = tempFile.length();
+ if (fileLength > Integer.MAX_VALUE) {
+ throw new IllegalArgumentException("File content is too long to be allocated as byte[]");
+ }
+
+ fIn = new FileInputStream(tempFile);
+
+ byte[] fileData = new byte[(int)fileLength];
+ int totalRead = 0;
+ int read = 0;
+ do {
+ read = fIn.read(fileData, totalRead, fileData.length - totalRead);
+ if (read > 0) {
+ totalRead += read;
+ }
+ } while (read > 0);
+
+ return fileData;
+ } catch (IOException ex) { /* too bad? */
+ logger.error(ex.getMessage(), ex);
+ } finally {
+ if (fIn != null) {
+ try {
+ fIn.close();
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public InputStream getInputStream() {
+ if (bOut != null) {
+ return new ByteArrayInputStream(bOut.toByteArray());
+ } else if (tempFile != null) {
+ try {
+ return new FileInputStream(tempFile) {
+ @Override
+ public void close() throws IOException {
+ super.close();
+ tempFile.delete();
+ }
+ };
+ } catch (FileNotFoundException ex) {
+ logger.error(ex.getMessage(), ex);
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public void complete() throws IOException {
+ if (fOut != null) {
+ try {
+ fOut.close();
+ } catch (IOException ex) {
+ logger.error(ex.getMessage(), ex);
+ }
+ fOut = null;
+ }
+ }
+
+ public void handle(byte[] bytes, int length)
+ throws IOException {
+ // read += length;
+ if (fOut != null) {
+ fOut.write(bytes, 0, length);
+ fOut.flush();
+ } else {
+ if (bOut == null) {
+ bOut = new ByteArrayOutputStream();
+ }
+ bOut.write(bytes, 0, length);
+ }
+
+ fileSize += length;
+ }
+}
\ No newline at end of file
Modified: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2009-10-30 05:08:36 UTC (rev 15784)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2009-10-30 14:49:48 UTC (rev 15785)
@@ -21,17 +21,13 @@
package org.ajax4jsf.request;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
+import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
-import java.rmi.server.UID;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
@@ -48,7 +44,10 @@
import javax.servlet.http.HttpServletRequestWrapper;
import org.ajax4jsf.exception.FileUploadException;
+import org.ajax4jsf.request.ByteSequenceMatcher.BytesHandler;
import org.ajax4jsf.webapp.BaseXMLFilter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.richfaces.component.FileUploadConstants;
import org.richfaces.model.UploadItem;
@@ -63,8 +62,11 @@
private static final String PARAM_CONTENT_TYPE = "Content-Type";
private static final int BUFFER_SIZE = 2048;
- private static final int CHUNK_SIZE = 512;
+ private static final int CHUNK_SIZE = 1024;
+ private static final int MAX_HEADER_SIZE = 32768;
+ private static final Log logger = LogFactory.getLog(MultipartRequest.class);
+
private boolean createTempFiles;
private String uid;
@@ -74,242 +76,33 @@
private Integer contentLength = 0;
private int bytesRead = 0;
-
- private int read = 0;
//we shouldn't allow to stop until request reaches PhaseListener because of portlets
private volatile boolean canStop = false;
-
+
private Map<String, Param> parameters = null;
private Map<String, Object> percentMap = null;
-
+
private Map<String, Integer> requestSizeMap = null;
-
+
private Map<String, String> requestKeysMap = null;
-
+
private String requestKey = null;
-
+
private MultipartRequestRegistry requestRegistry;
-
+
private List<String> keys = new ArrayList<String>();
- private enum ReadState {
- BOUNDARY, HEADERS, DATA
- }
+ private byte[] boundaryMarker;
+ private ByteSequenceMatcher sequenceMatcher;
+
private static final byte CR = 0x0d;
private static final byte LF = 0x0a;
private static final byte[] CR_LF = { CR, LF };
+ private static final byte[] HYPHENS = { 0x2d, 0x2d }; //'--'
- private abstract class Param {
- private String name;
-
- public Param(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public abstract void appendData(byte[] data, int start, int length)
- throws IOException;
-
- }
-
- private class ValueParam extends Param {
- private Object value = null;
- private ByteArrayOutputStream buf = new ByteArrayOutputStream();
-
- public ValueParam(String name) {
- super(name);
- }
-
- @Override
- public void appendData(byte[] data, int start, int length)
- throws IOException {
- // read += length;
- buf.write(data, start, length);
- }
-
- public void complete() throws UnsupportedEncodingException {
- String val = encoding == null ? new String(buf.toByteArray())
- : new String(buf.toByteArray(), encoding);
- if (value == null) {
- value = val;
- } else {
- if (!(value instanceof List)) {
- List<String> v = new ArrayList<String>();
- v.add((String) value);
- value = v;
- }
-
- ((List) value).add(val);
- }
- buf.reset();
- }
-
- public Object getValue() {
- return value;
- }
- }
-
- private class FileParam extends Param {
- private String filename;
- private String contentType;
- private int fileSize;
-
- private ByteArrayOutputStream bOut = null;
- private FileOutputStream fOut = null;
- private File tempFile = null;
-
- public FileParam(String name) {
- super(name);
- keys.add(name);
- }
-
- public Object getFile() {
- if (null != tempFile) {
- if (fOut != null) {
- try {
- fOut.close();
- } catch (IOException ex) {
- }
- fOut = null;
- }
- return tempFile;
- } else if (null != bOut) {
- return bOut.toByteArray();
- }
- return null;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- public int getFileSize() {
- return fileSize;
- }
-
- public File createTempFile() {
- try {
-
- tempFile = File.createTempFile(new UID().toString().replace(
- ":", "-"), ".upload");
- // tempFile.deleteOnExit();
- fOut = new FileOutputStream(tempFile);
- } catch (IOException ex) {
- throw new FileUploadException("Could not create temporary file");
- }
- return tempFile;
- }
-
- public void deleteFile() {
- try {
- if (fOut != null) {
- fOut.close();
- if (tempFile != null) {
- tempFile.delete();
- }
- }
- } catch (Exception e) {
- throw new FileUploadException("Could not delete temporary file");
- }
- }
-
- @Override
- public void appendData(byte[] data, int start, int length)
- throws IOException {
- // read += length;
- if (fOut != null) {
- fOut.write(data, start, length);
- fOut.flush();
- } else {
- if (bOut == null)
- bOut = new ByteArrayOutputStream();
- bOut.write(data, start, length);
- }
-
- fileSize += length;
- }
-
- public byte[] getData() {
- if (fOut != null) {
- try {
- fOut.close();
- } catch (IOException ex) {
- }
- fOut = null;
- }
-
- if (bOut != null) {
- return bOut.toByteArray();
- } else if (tempFile != null) {
- if (tempFile.exists()) {
- try {
- FileInputStream fIn = new FileInputStream(tempFile);
- ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- byte[] buf = new byte[512];
- int read = fIn.read(buf);
- while (read != -1) {
- bOut.write(buf, 0, read);
- read = fIn.read(buf);
- }
- bOut.flush();
-
- fIn.close();
- tempFile.delete();
- return bOut.toByteArray();
- } catch (IOException ex) { /* too bad? */
- }
- }
- }
-
- return null;
- }
-
- public InputStream getInputStream() {
- if (fOut != null) {
- try {
- fOut.close();
- } catch (IOException ex) {
- }
- fOut = null;
- }
-
- if (bOut != null) {
- return new ByteArrayInputStream(bOut.toByteArray());
- } else if (tempFile != null) {
- try {
- return new FileInputStream(tempFile) {
- @Override
- public void close() throws IOException {
- super.close();
- tempFile.delete();
- }
- };
- } catch (FileNotFoundException ex) {
- }
- }
-
- return null;
- }
- }
-
private boolean shouldStop = false;
private boolean canceled;
@@ -330,6 +123,43 @@
}
}
+ private class ControlledProgressInputStream extends FilterInputStream {
+
+ protected ControlledProgressInputStream(InputStream in) {
+ super(in);
+ }
+
+ @Override
+ public int read() throws IOException {
+ int read = super.read();
+ if (read >= 0) {
+ bytesRead++;
+ fillProgressInfo();
+ }
+ return read;
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ int read = super.read(b);
+ if (read > 0) {
+ bytesRead += read;
+ fillProgressInfo();
+ }
+ return read;
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ int read = super.read(b, off, len);
+ if (read > 0) {
+ bytesRead += read;
+ fillProgressInfo();
+ }
+ return read;
+ }
+ }
+
private String decodeFileName(String name) {
String fileName = null;
@@ -361,7 +191,7 @@
public void cancel() {
this.canceled = true;
-
+
if (parameters != null) {
Iterator<Param> it = parameters.values().iterator();
while (it.hasNext()) {
@@ -373,191 +203,145 @@
}
}
- private byte[] boundaryMarker;
-
- private byte[] buffer;
-
- private ReadState readState;
-
- private InputStream input;
-
- private int pos = 0;
+ private void readNext() throws IOException {
+ Param p = readHeader();
+ if (p != null) {
+ try {
+ readData(p);
+ } finally {
+ try {
+ p.complete();
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ }
+ }
- private int zeroReadAttempts = 20; // 20 attempts to read not-readable data
-
- private void fillBuffer() throws IOException {
- if (pos < read) {
- // move the bytes that weren't read to the start of
- // the
- // buffer
- int bytesNotRead = read - pos;
-
- if (bytesNotRead != buffer.length) {
- System.arraycopy(buffer, pos, buffer, 0,
- bytesNotRead);
- read = input.read(buffer, bytesNotRead,
- buffer.length - bytesNotRead);
-
- if (read != 0 || --zeroReadAttempts != 0) {
- if (read > 0) {
- bytesRead += read;
- }
+ private Param createParam(Map<String, String> headers) {
+ Param param = null;
+ String paramName = headers.get(PARAM_NAME);
+ if (paramName != null) {
+ if (headers.containsKey(PARAM_FILENAME)) {
+ FileParam fp = new FileParam(paramName);
+ this.keys.add(paramName);
- read += bytesNotRead;
- } else {
- //read is already zero
- //read = 0;
+ if (createTempFiles) {
+ fp.createTempFile();
}
+ fp.setContentType(headers.get(PARAM_CONTENT_TYPE));
+ fp.setFilename(decodeFileName(headers.get(PARAM_FILENAME)));
+ param = fp;
} else {
- read = bytesNotRead;
+ if (parameters.containsKey(paramName)) {
+ param = parameters.get(paramName);
+ } else {
+ param = new ValueParam(paramName, encoding);
+ }
}
- } else {
- read = input.read(buffer);
- if (read > 0) {
- bytesRead += read;
+ if (!parameters.containsKey(paramName)) {
+ parameters.put(paramName, param);
}
}
-
- fillProgressInfo();
- pos = 0;
+
+ return param;
}
-
- private void readNext() throws IOException {
- Param p = readHeader();
- readData(p);
- }
- private void readData(Param p) throws IOException {
- int localRead = this.read;
-
- while (localRead > 0) {
- for (int i = this.pos; i < localRead; i++) {
- // If we've encountered another boundary...
- if (checkSequence(buffer, i - boundaryMarker.length
- - CR_LF.length, CR_LF)
- && checkSequence(buffer, i, boundaryMarker)) {
- // Write any data before the boundary (that
- // hasn't
- // already been written) to the param
- if (pos < i - boundaryMarker.length
- - CR_LF.length - 1) {
- p.appendData(buffer, pos, i - pos
- - boundaryMarker.length
- - CR_LF.length - 1);
- }
+ private boolean initialized = false;
- if (p instanceof ValueParam)
- ((ValueParam) p).complete();
+ private static final BytesHandler NOOP_HANDLER = new BytesHandler() {
+ public void handle(byte[] bytes, int length) {
+ //do nothing
+ }
+ };
- if (checkSequence(buffer, i + CR_LF.length,
- CR_LF)) {
- i += CR_LF.length;
- pos = i + 1;
- } else {
- pos = i;
- }
+ private class HeadersHandler implements BytesHandler {
- readState = ReadState.HEADERS;
- break;
- }
- // Otherwise write whatever data we have to the
- // param
- else if (i > (pos + boundaryMarker.length
- + CHUNK_SIZE + CR_LF.length)) {
- p.appendData(buffer, pos, CHUNK_SIZE);
- pos += CHUNK_SIZE;
+ private ByteArrayOutputStream baos = new ByteArrayOutputStream(BUFFER_SIZE);
+ public void handle(byte[] bytes, int length) throws IOException {
+ if (length != 0) {
+ if (baos.size() + length > MAX_HEADER_SIZE) {
+ throw new IOException("Header section is too big");
}
+
+ baos.write(bytes, 0, length);
}
-
- if (ReadState.DATA.equals(readState)) {
- fillBuffer();
- localRead = this.read;
+ }
+
+ public boolean dataEquals(byte[] bytes) {
+ return (baos.size() == bytes.length) && Arrays.equals(HYPHENS, baos.toByteArray());
+ }
+
+ public String asString() throws UnsupportedEncodingException {
+ if (encoding != null) {
+ return baos.toString(encoding);
} else {
- break;
+ return baos.toString();
}
}
+
+ public void reset() {
+ baos.reset();
+ }
+
}
-
+
+ private HeadersHandler headersHandler = null;
+
private Param readHeader() throws IOException {
- Param p = null;
+ if (sequenceMatcher.isEOF()) {
+ return null;
+ }
- Map<String, String> headers = new HashMap<String, String>();
+ if (headersHandler == null) {
+ headersHandler = new HeadersHandler();
+ } else {
+ headersHandler.reset();
+ }
- int localRead = this.read;
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
-
- while (localRead > 0) {
- for (int i = this.pos; i < localRead; i++) {
- if (checkSequence(buffer, i, CR_LF)) {
- baos.write(buffer, pos, i - pos - 1);
+ sequenceMatcher.setBytesHandler(headersHandler);
+ sequenceMatcher.findSequence(-1, CR_LF);
- String param = (encoding == null) ?
- new String(baos.toByteArray()) :
- new String(baos.toByteArray(), encoding);
+ if (sequenceMatcher.isMatchedAndNotEOF() && !headersHandler.dataEquals(HYPHENS)) {
+ headersHandler.reset();
+
+ sequenceMatcher.findSequence(-1, CR_LF, CR_LF);
+
+ if (!sequenceMatcher.isMatchedAndNotEOF()) {
+ throw new IOException("Request header cannot be read");
+ }
- parseParams(param, "; ", headers);
-
- if (checkSequence(buffer, i + CR_LF.length,
- CR_LF)) {
- readState = ReadState.DATA;
- i += CR_LF.length;
- pos = i + 1;
-
- String paramName = headers.get(PARAM_NAME);
- if (paramName != null) {
- if (headers.containsKey(PARAM_FILENAME)) {
- FileParam fp = new FileParam(
- paramName);
- if (createTempFiles)
- fp.createTempFile();
- fp.setContentType(headers
- .get(PARAM_CONTENT_TYPE));
- fp
- .setFilename(decodeFileName(headers
- .get(PARAM_FILENAME)));
- p = fp;
- } else {
- if (parameters
- .containsKey(paramName)) {
- p = parameters.get(paramName);
- } else {
- p = new ValueParam(paramName);
- }
- }
-
- if (!parameters.containsKey(paramName)) {
- parameters.put(paramName, p);
- }
- }
-
- headers.clear();
- baos.reset();
-
- break;
- } else {
- pos = i + 1;
- baos.reset();
- }
- }
+ String headersString = headersHandler.asString();
+ Map<String, String> headers = new HashMap<String, String>();
+ String[] split = headersString.split("\r\n");
+ for (String headerString : split) {
+ parseParams(headerString, "; ", headers);
}
- if (ReadState.HEADERS.equals(readState)) {
- baos.write(buffer, pos, read - pos);
- pos = read;
- fillBuffer();
- localRead = this.read;
- } else {
- break;
- }
+ return createParam(headers);
}
- return p;
+
+ return null;
}
- boolean initialized = false;
-
+ private void readProlog() throws IOException {
+ sequenceMatcher.setBytesHandler(NOOP_HANDLER);
+ sequenceMatcher.findSequence(-1, HYPHENS, boundaryMarker);
+ if (!sequenceMatcher.isMatchedAndNotEOF()) {
+ throw new IOException("Request prolog cannot be read");
+ }
+ }
+
+ private void readData(final Param param) throws IOException {
+ sequenceMatcher.setBytesHandler(param);
+ sequenceMatcher.findSequence(CHUNK_SIZE, CR_LF, HYPHENS, boundaryMarker);
+ if (!this.sequenceMatcher.isMatchedAndNotEOF()) {
+ throw new IOException("Request data cannot be read");
+ }
+ }
+
private void initialize() throws IOException {
if (!initialized) {
initialized = true;
@@ -567,61 +351,39 @@
throw new FileUploadException("The request was rejected because "
+ "no multipart boundary was found");
}
-
+
+ if (HYPHENS.length + boundaryMarker.length + CHUNK_SIZE + CR_LF.length > BUFFER_SIZE) {
+ throw new FileUploadException("Boundary marker is too long");
+ }
+
this.encoding = getCharacterEncoding();
this.parameters = new HashMap<String, Param>();
- this.buffer = new byte[BUFFER_SIZE];
+ InputStream input = new ControlledProgressInputStream(getInputStream());
- this.readState = ReadState.BOUNDARY;
+ this.sequenceMatcher = new ByteSequenceMatcher(input, BUFFER_SIZE);
- this.input = getInputStream();
-
setupProgressData();
-
- fillBuffer();
- int localRead = this.read;
-
- while (localRead > 0) {
- for (int i = 0; i < localRead; i++) {
- if (checkSequence(buffer, i, boundaryMarker)
- && checkSequence(buffer, i + 2, CR_LF)) {
- readState = ReadState.HEADERS;
- i += 2;
- pos = i + 1;
-
- break;
- }
- }
-
- if (ReadState.BOUNDARY.equals(readState)) {
- pos = read - (boundaryMarker.length + CR_LF.length) + 1;
- fillBuffer();
- localRead = this.read;
- } else {
- break;
- }
- }
-
+
+ readProlog();
}
}
-
+
public void parseRequest() {
canStop = true;
-
+
setupProgressData();
-
+
try {
initialize();
-
- while (read > 0) {
+
+ while (!sequenceMatcher.isEOF()) {
readNext();
}
-
} catch (IOException e) {
this.cancel();
-
+
if (!this.shouldStop) {
throw new FileUploadException("IO Error parsing multipart request", e);
}
@@ -629,9 +391,10 @@
canStop = false;
}
}
-
+
public static MultipartRequest lookupRequest(FacesContext context, String uploadId) {
Map<String, Object> sessionMap = context.getExternalContext().getSessionMap();
+ @SuppressWarnings("unchecked")
Map<String, String> requestKeys = (Map<String, String>) sessionMap.get(FileUploadConstants.REQUEST_KEYS_BEAN_NAME);
if (requestKeys != null) {
String requestKey = requestKeys.get(uploadId);
@@ -645,10 +408,10 @@
}
}
}
-
+
return null;
}
-
+
@SuppressWarnings("unchecked")
private void setupProgressData() {
if (percentMap == null || requestSizeMap == null || requestKeysMap == null) {
@@ -676,17 +439,17 @@
sessionMap.put(FileUploadConstants.REQUEST_SIZE_BEAN_NAME, requestSizeMap);
}
}
-
+
if (requestKeysMap == null) {
requestKeysMap = (Map<String, String>) sessionMap.get(FileUploadConstants.REQUEST_KEYS_BEAN_NAME);
if (requestKeysMap == null) {
requestKeysMap = new ConcurrentHashMap<String, String>();
sessionMap.put(FileUploadConstants.REQUEST_KEYS_BEAN_NAME, requestKeysMap);
}
-
+
}
}
-
+
percentMap.put(uploadId, Double.valueOf(0));
requestSizeMap.put(uploadId, getSize());
@@ -703,7 +466,7 @@
private void fillProgressInfo() {
setupProgressData();
-
+
if (percentMap != null) {
Double percent = (Double) (100.0 * this.bytesRead / this.contentLength);
percentMap.put(uid, percent);
@@ -715,8 +478,9 @@
Map<String, String> params = parseParams(contentType, ";");
String boundaryStr = (String) params.get("boundary");
- if (boundaryStr == null)
+ if (boundaryStr == null) {
return null;
+ }
try {
return boundaryStr.getBytes("ISO-8859-1");
@@ -725,33 +489,11 @@
}
}
- /**
- * Checks if a specified sequence of bytes ends at a specific position
- * within a byte array.
- *
- * @param data
- * @param pos
- * @param seq
- * @return boolean indicating if the sequence was found at the specified
- * position
- */
- private boolean checkSequence(byte[] data, int pos, byte[] seq) {
- if (pos - seq.length < -1 || pos >= data.length)
- return false;
-
- for (int i = 0; i < seq.length; i++) {
- if (data[(pos - seq.length) + i + 1] != seq[i])
- return false;
- }
-
- return true;
- }
-
private static final Pattern PARAM_VALUE_PATTERN = Pattern
- .compile("^\\s*([^\\s=]+)\\s*[=:]\\s*(.+)\\s*$");
+ .compile("^\\s*([^\\s=]+)\\s*[=:]\\s*(.+)\\s*$");
private static final Pattern FILE_NAME_PATTERN = Pattern
- .compile(".*filename=\"(.*)\"");
+ .compile(".*filename=\"(.*)\"");
private Map<String, String> parseParams(String paramStr, String separator) {
Map<String, String> paramMap = new HashMap<String, String>();
@@ -799,13 +541,13 @@
if (parameters != null) {
param = parameters.get(name);
}
-
+
if (param == null) {
if (!canceled) {
try {
initialize();
- while (param == null && read > 0) {
+ while (param == null && !sequenceMatcher.isEOF()) {
readNext();
param = parameters.get(name);
}
@@ -815,7 +557,7 @@
}
}
}
-
+
return param;
}
@@ -824,9 +566,11 @@
}
@Override
+ @SuppressWarnings("unchecked")
public Enumeration getParameterNames() {
- if (parameters == null)
+ if (parameters == null) {
parseRequest();
+ }
return Collections.enumeration(parameters.keySet());
}
@@ -872,8 +616,9 @@
Param p = getParam(name);
if (p != null && p instanceof ValueParam) {
ValueParam vp = (ValueParam) p;
- if (vp.getValue() instanceof String)
+ if (vp.getValue() instanceof String) {
return (String) vp.getValue();
+ }
} else if (p != null && p instanceof FileParam) {
return "---BINARY DATA---";
} else {
@@ -886,12 +631,13 @@
@Override
public String[] getParameterValues(String name) {
parseRequest();
-
+
Param p = getParam(name);
if (p != null && p instanceof ValueParam) {
ValueParam vp = (ValueParam) p;
- if (vp.getValue() instanceof List) {
- List vals = (List) vp.getValue();
+ if (vp.getValue() instanceof List<?>) {
+ @SuppressWarnings("unchecked")
+ List<String> vals = (List<String>) vp.getValue();
String[] values = new String[vals.size()];
vals.toArray(values);
return values;
@@ -904,12 +650,13 @@
}
@Override
+ @SuppressWarnings("unchecked")
public Map getParameterMap() {
- if (parameters == null)
+ if (parameters == null) {
parseRequest();
+ }
- Map<String, Object> params = new HashMap<String, Object>(super
- .getParameterMap());
+ Map<String, Object> params = new HashMap<String, Object>(super.getParameterMap());
for (String name : parameters.keySet()) {
Param p = parameters.get(name);
@@ -925,7 +672,7 @@
return params;
}
-
+
public List<UploadItem> getUploadItems () {
List <UploadItem> uploadItems = new ArrayList<UploadItem>();
for (String k : keys) {
@@ -933,16 +680,16 @@
}
return uploadItems;
}
-
+
public boolean isFormUpload() {
return "_richfaces_form_upload".equals(uid);
}
-
+
@Override
public String getHeader(String name) {
if (!"Accept".equals(name)) {
return super.getHeader(name);
- }else {
+ } else {
return BaseXMLFilter.TEXT_HTML;
}
}
@@ -952,16 +699,16 @@
shouldStop = true;
}
}
-
+
public boolean isStopped() {
return this.shouldStop;
}
-
+
public boolean isDone() {
return !(this.shouldStop && (this.canceled ||
this.contentLength != null && this.contentLength.intValue() != this.bytesRead));
}
-
+
@Override
public String getContentType() {
return "application/x-www-form-urlencoded";
@@ -970,18 +717,18 @@
protected String getUploadId() {
return uid;
}
-
+
public void clearRequestData() {
String uploadId = getUploadId();
-
+
if (percentMap != null) {
percentMap.remove(uploadId);
}
-
+
if (requestSizeMap != null) {
requestSizeMap.remove(uploadId);
}
-
+
if (requestKeysMap != null) {
requestKeysMap.remove(uploadId);
}
Added: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/Param.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/Param.java (rev 0)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/Param.java 2009-10-30 14:49:48 UTC (rev 15785)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.ajax4jsf.request;
+
+import java.io.IOException;
+
+import org.ajax4jsf.request.ByteSequenceMatcher.BytesHandler;
+
+abstract class Param implements BytesHandler {
+ private String name;
+
+ public Param(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public abstract void complete() throws IOException;
+}
\ No newline at end of file
Added: branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/ValueParam.java
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/ValueParam.java (rev 0)
+++ branches/community/3.3.X/framework/impl/src/main/java/org/ajax4jsf/request/ValueParam.java 2009-10-30 14:49:48 UTC (rev 15785)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.ajax4jsf.request;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+class ValueParam extends Param {
+
+ private Object value = null;
+ private ByteArrayOutputStream buf = new ByteArrayOutputStream();
+ private String encoding;
+
+ public ValueParam(String name, String encoding) {
+ super(name);
+ this.encoding = encoding;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void complete() throws IOException {
+ String val = this.encoding == null ? new String(buf.toByteArray())
+ : new String(buf.toByteArray(), this.encoding);
+ if (value == null) {
+ value = val;
+ } else {
+ if (!(value instanceof List<?>)) {
+ List<String> v = new ArrayList<String>();
+ v.add((String) value);
+ value = v;
+ }
+
+ ((List<String>) value).add(val);
+ }
+ buf.reset();
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void handle(byte[] bytes, int length)
+ throws IOException {
+ // read += length;
+ buf.write(bytes, 0, length);
+ }
+}
\ No newline at end of file
15 years, 1 month
JBoss Rich Faces SVN: r15784 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2009-10-30 01:08:36 -0400 (Fri, 30 Oct 2009)
New Revision: 15784
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_column.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_dataTable.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_extendedDataTable.xml
Log:
RF-7847: Added differences between rich:dataTable and rich:extendedDataTable
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_column.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_column.xml 2009-10-30 00:11:27 UTC (rev 15783)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_column.xml 2009-10-30 05:08:36 UTC (rev 15784)
@@ -53,7 +53,13 @@
<link linkend="filter">Filtering column values</link>
</para>
</listitem>
- </itemizedlist>
+ </itemizedlist>
+ <important>
+ <title>Important</title>
+ <para>
+ The <property>"colspan"</property>, <property>"rowspan"</property>, and <property>"breakbefore"</property> attributes only affect columns in a <emphasis role="bold"><property><rich:dataTable></property></emphasis>, not those in a <emphasis role="bold"><property><rich:extendedDataTable></property></emphasis>.
+ </para>
+ </important>
</section>
<section>
<title>Details of Usage</title>
@@ -619,4 +625,4 @@
<ulink url="http://www.jboss.org/community/docs/DOC-9607">RichFaces Cookbook article</ulink>.
</para>
</section>
-</section>
\ No newline at end of file
+</section>
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_dataTable.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_dataTable.xml 2009-10-30 00:11:27 UTC (rev 15783)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_dataTable.xml 2009-10-30 05:08:36 UTC (rev 15784)
@@ -43,6 +43,9 @@
<para><link linkend="sort">Sorting</link> and <link linkend="filter">filtering</link> functionalities for a table columns</para>
</listitem>
</itemizedlist>
+ <para>
+ Extended table features, such as scrollable data, row selection, and column re-ordering, require the use of the <emphasis role="bold"><property><rich:extendedDataTable></property></emphasis> component instead of <emphasis role="bold"><property><rich:dataTable></property></emphasis>. Refer to the <emphasis role="bold"><property><rich:extendedDataTable></property></emphasis> section for details on the differences between the two components.
+ </para>
</section>
<section>
<title>Details of Usage</title>
@@ -435,4 +438,4 @@
<ulink url="http://www.jboss.org/community/wiki/RichfacesDatatableCheckbox">"Richfaces Datatable Checkbox"</ulink> article helps you to create a Richface Datatable with Checkbox Column and an CheckAll Checkbox in Header.
</para>
</section>
-</section>
\ No newline at end of file
+</section>
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_extendedDataTable.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_extendedDataTable.xml 2009-10-30 00:11:27 UTC (rev 15783)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_extendedDataTable.xml 2009-10-30 05:08:36 UTC (rev 15784)
@@ -55,6 +55,58 @@
<para>Possibility to combine rows to groups</para>
</listitem>
</itemizedlist>
+ <para>
+ <emphasis role="bold"><property moreinfo="none"><rich:extendedDataTable></property></emphasis> includes the following attributes not included with <emphasis role="bold"><property moreinfo="none"><rich:dataTable></property></emphasis>:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <property moreinfo="none">activeClass</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">activeRowKey</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">enableContextMenu</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">groupingColumn</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">height</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">noDataLabel</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">onselectionchange</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">selectedClass</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">selection</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">selectionMode</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">tableState</property>
+ </listitem>
+ </itemizedlist>
+ <para>
+ <emphasis role="bold"><property moreinfo="none"><rich:extendedDataTable></property></emphasis> does <emphasis>not</emphasis> include the following attributes available with <emphasis role="bold"><property moreinfo="none"><rich:dataTable></property></emphasis>:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <property moreinfo="none">columns</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">columnsWidth</property>
+ </listitem>
+ <listitem>
+ <property moreinfo="none">onRowContextMenu</property>
+ </listitem>
+ </itemizedlist>
</section>
<section>
<title>Details of Usage</title>
@@ -623,4 +675,4 @@
Some additional information about the component usage can be found
<ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/extendedDataTable.jsf...">on its LiveDemo page</ulink>.</para>
</section>
-</section>
\ No newline at end of file
+</section>
15 years, 1 month
JBoss Rich Faces SVN: r15783 - in root/examples-sandbox/trunk: backwardCompatibility/src/main/webapp/WEB-INF and 14 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-10-29 20:11:27 -0400 (Thu, 29 Oct 2009)
New Revision: 15783
Added:
root/examples-sandbox/trunk/testapps/ajax/
root/examples-sandbox/trunk/testapps/ajax/.svnignore
root/examples-sandbox/trunk/testapps/ajax/pom.xml
root/examples-sandbox/trunk/testapps/ajax/src/
root/examples-sandbox/trunk/testapps/ajax/src/main/
root/examples-sandbox/trunk/testapps/ajax/src/main/java/
root/examples-sandbox/trunk/testapps/ajax/src/main/java/JSFUnitTest.java
root/examples-sandbox/trunk/testapps/ajax/src/main/resources/
root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/
root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/META-INF/
root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/META-INF/MANIFEST.MF
root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/WEB-INF/
root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/WEB-INF/lib/
root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/WEB-INF/web.xml
root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/index.jsp
root/examples-sandbox/trunk/testapps/ajax/src/test/
root/examples-sandbox/trunk/testapps/ajax/src/test/java/
root/examples-sandbox/trunk/testapps/ajax/src/test/java/JSFUnitTest.java
root/examples-sandbox/trunk/testapps/pom.xml
Modified:
root/examples-sandbox/trunk/backwardCompatibility/pom.xml
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/web.xml
root/examples-sandbox/trunk/components/ajax/pom.xml
root/examples-sandbox/trunk/components/ajax/src/main/java/declarativeajax/Bean.java
root/examples-sandbox/trunk/components/ajax/src/main/webapp/home.xhtml
root/examples-sandbox/trunk/components/ajax/src/test/java/org/richfaces/test/ajax/UIDataTest.java
Log:
jsfunit testapp
Modified: root/examples-sandbox/trunk/backwardCompatibility/pom.xml
===================================================================
--- root/examples-sandbox/trunk/backwardCompatibility/pom.xml 2009-10-29 14:35:47 UTC (rev 15782)
+++ root/examples-sandbox/trunk/backwardCompatibility/pom.xml 2009-10-30 00:11:27 UTC (rev 15783)
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><!--
<parent>
<artifactId>examples-sandbox</artifactId>
<groupId>org.richfaces</groupId>
<version>4.0.0-SNAPSHOT</version>
</parent>
- <modelVersion>4.0.0</modelVersion>
+ --><modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.examples-sandbox</groupId>
<artifactId>backwardCompatibility</artifactId>
<packaging>war</packaging>
<name>seamIntegration Maven Webapp</name>
+ <version>4.0.0-SNAPSHOT</version>
<properties>
<seam.version>2.2.0.GA</seam.version>
- <richfaces.version>3.3.2.GA</richfaces.version>
+ <richfaces.version>3.3.2.SR1</richfaces.version>
</properties>
<build>
<finalName>backwardCompatibility</finalName>
@@ -116,7 +117,7 @@
<artifactId>jboss-seam-debug</artifactId>
<version>${seam.version}</version>
<scope>runtime</scope>
- </dependency>
+ </dependency><!--
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
@@ -130,5 +131,21 @@
<scope>provided</scope>
</dependency>
+ -->
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_13</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>1.2_13</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/web.xml
===================================================================
--- root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/web.xml 2009-10-29 14:35:47 UTC (rev 15782)
+++ root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/web.xml 2009-10-30 00:11:27 UTC (rev 15783)
@@ -11,6 +11,10 @@
</context-param>
-->
<context-param>
+ <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
<param-name>org.ajax4jsf.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
@@ -18,6 +22,9 @@
<param-name>facelets.VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
<!-- Seam -->
<listener>
Modified: root/examples-sandbox/trunk/components/ajax/pom.xml
===================================================================
--- root/examples-sandbox/trunk/components/ajax/pom.xml 2009-10-29 14:35:47 UTC (rev 15782)
+++ root/examples-sandbox/trunk/components/ajax/pom.xml 2009-10-30 00:11:27 UTC (rev 15783)
@@ -66,12 +66,6 @@
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.1-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <groupId>org.jvnet.wagon-svn</groupId>
- <artifactId>wagon-svn</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
Modified: root/examples-sandbox/trunk/components/ajax/src/main/java/declarativeajax/Bean.java
===================================================================
--- root/examples-sandbox/trunk/components/ajax/src/main/java/declarativeajax/Bean.java 2009-10-29 14:35:47 UTC (rev 15782)
+++ root/examples-sandbox/trunk/components/ajax/src/main/java/declarativeajax/Bean.java 2009-10-30 00:11:27 UTC (rev 15783)
@@ -36,44 +36,33 @@
package declarativeajax;
-import javax.faces.component.UIComponent;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
import javax.faces.component.UIForm;
import javax.faces.component.UIInput;
import javax.faces.component.UIOutput;
-import javax.faces.component.UIPanel;
-import javax.faces.component.UISelectMany;
-import javax.faces.component.html.HtmlInputText;
import javax.faces.component.html.HtmlSelectOneMenu;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
-import javax.faces.model.ManagedBean;
-import javax.faces.model.SessionScoped;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
/**
* <p>This bean has the methods that are used to illustrate
* the <code>JSF 2.0 declarative ajax</code>. * <p/>
*
*/
-@ManagedBean(name="bean")
-@SessionScoped
+(a)javax.faces.bean.ManagedBean(name="bean")
+(a)javax.faces.bean.SessionScoped
public class Bean {
- private static final Logger LOGGER = Logger.getLogger("declarativeajax");
+// private static final Logger LOGGER = Logger.getLogger("declarativeajax");
//
// Relationship Instance Variables
@@ -81,21 +70,21 @@
private Map<String,String> stateMap = null;
- private List stateOptions = null;
+ private List<SelectItem> stateOptions = null;
//
// Constructors
//
public Bean() {
- stateMap = new HashMap<String,String>();
+ stateMap = new HashMap<String,String>(5);
stateMap.put("CA", "California");
stateMap.put("CT", "Connecticut");
stateMap.put("MA", "Massachusetts");
stateMap.put("NJ", "New Jersey");
stateMap.put("NY", "New York");
- stateOptions = new ArrayList();
+ stateOptions = new ArrayList<SelectItem>(5);
stateOptions.add(new SelectItem("CA","CA","CA"));
stateOptions.add(new SelectItem("CT","CT","CT"));
stateOptions.add(new SelectItem("MA","MA","MA"));
@@ -104,13 +93,13 @@
}
- public Collection getStateOptions() {
+ public Collection<SelectItem> getStateOptions() {
return stateOptions;
}
- public void setStateOptions(Collection newOptions) {
- stateOptions = new ArrayList(newOptions);
+ public void setStateOptions(Collection<SelectItem> newOptions) {
+ stateOptions = new ArrayList<SelectItem>(newOptions);
}
public void beanAction(ActionEvent event) {
Modified: root/examples-sandbox/trunk/components/ajax/src/main/webapp/home.xhtml
===================================================================
--- root/examples-sandbox/trunk/components/ajax/src/main/webapp/home.xhtml 2009-10-29 14:35:47 UTC (rev 15782)
+++ root/examples-sandbox/trunk/components/ajax/src/main/webapp/home.xhtml 2009-10-30 00:11:27 UTC (rev 15783)
@@ -35,121 +35,131 @@
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets">
-<f:view contentType="text/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">
+<f:view contentType="text/html" />
<h:head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Ajax Request</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>Ajax Request</title>
</h:head>
<h:body>
-<!-- Ajaxify Individual Controls -->
+ <!-- Ajaxify Individual Controls -->
- <h:form id="form1" >
- <h:panelGrid styleClass="title-panel">
- <h:outputText value="D e c l a r a t i v e A j a x " styleClass="title-panel-text"/>
- <h:outputText value="Powered By JavaServer Faces 2.0 " styleClass="title-panel-subtext"/>
- </h:panelGrid>
- <h:panelGrid border="1">
- <h:panelGrid columns="3" >
- <h:outputText value=""/>
- <h:outputText value="Panel1 : Ajaxify Individual Controls"/>
- <h:outputText value=""/>
- </h:panelGrid>
- <h:panelGrid columns="3">
- <h:outputText value="Name: "/>
- <h:inputText id="name" required="true" label="Name" valueChangeListener="#{bean.displayText}">
- <f:ajax />
- </h:inputText>
- <h:outputText id="nameout"/>
- <h:outputText value="Address: "/>
- <h:inputText id="address" required="true" label="Address" valueChangeListener="#{bean.displayText}">
- <f:ajax />
- </h:inputText>
- <h:outputText id="addressout"/>
- <h:outputText value="City: "/>
- <h:inputText id="city" required="true" label="City" valueChangeListener="#{bean.displayText}">
- <f:ajax />
- </h:inputText>
- <h:outputText id="cityout"/>
- <h:outputText value="State: "/>
- <h:selectOneMenu id="state" valueChangeListener="#{bean.displayState}">
- <f:selectItems value="#{bean.stateOptions}" />
- <f:ajax render="form1:stateout"/>
- </h:selectOneMenu>
- <h:outputText id="stateout" />
- <h:outputText value="Zip: "/>
- <h:inputText id="zip" required="true" label="Zip" valueChangeListener="#{bean.displayText}">
- <f:ajax />
- </h:inputText>
- <h:outputText id="zipout"/>
- <h:panelGrid>
- <h:commandButton value="Submit">
- <f:ajax />
- </h:commandButton>
- </h:panelGrid>
- </h:panelGrid>
- <h:panelGrid id="msgPanel">
- <h:message for="form1:name"/>
- <h:message for="form1:address"/>
- <h:message for="form1:city"/>
- <h:message for="form1:state"/>
- <h:message for="form1:zip"/>
- </h:panelGrid>
- </h:panelGrid>
+ <h:form id="form1">
+ <h:panelGrid styleClass="title-panel">
+ <h:outputText value="D e c l a r a t i v e A j a x "
+ styleClass="title-panel-text" />
+ <h:outputText value="Powered By JavaServer Faces 2.0 "
+ styleClass="title-panel-subtext" />
+ </h:panelGrid>
+ <h:panelGrid border="1">
+ <h:panelGrid columns="3">
+ <h:outputText value="" />
+ <h:outputText value="Panel1 : Ajaxify Individual Controls" />
+ <h:outputText value="" />
+ </h:panelGrid>
+ <h:panelGrid columns="3">
+ <h:outputText value="Name: " />
+ <h:inputText id="name" required="true" label="Name"
+ valueChangeListener="#{bean.displayText}">
+ <f:ajax />
+ </h:inputText>
+ <h:outputText id="nameout" />
+ <h:outputText value="Address: " />
+ <h:inputText id="address" required="true" label="Address"
+ valueChangeListener="#{bean.displayText}">
+ <f:ajax />
+ </h:inputText>
+ <h:outputText id="addressout" />
+ <h:outputText value="City: " />
+ <h:inputText id="city" required="true" label="City"
+ valueChangeListener="#{bean.displayText}">
+ <f:ajax />
+ </h:inputText>
+ <h:outputText id="cityout" />
+ <h:outputText value="State: " />
+ <h:selectOneMenu id="state"
+ valueChangeListener="#{bean.displayState}">
+ <f:selectItems value="#{bean.stateOptions}" />
+ <f:ajax render="form1:stateout" />
+ </h:selectOneMenu>
+ <h:outputText id="stateout" />
+ <h:outputText value="Zip: " />
+ <h:inputText id="zip" required="true" label="Zip"
+ valueChangeListener="#{bean.displayText}">
+ <f:ajax />
+ </h:inputText>
+ <h:outputText id="zipout" />
+ <h:panelGrid>
+ <h:commandButton value="Submit">
+ <f:ajax />
+ </h:commandButton>
+ </h:panelGrid>
+ </h:panelGrid>
+ <h:panelGrid id="msgPanel">
+ <h:message for="form1:name" />
+ <h:message for="form1:address" />
+ <h:message for="form1:city" />
+ <h:message for="form1:state" />
+ <h:message for="form1:zip" />
+ </h:panelGrid>
+ </h:panelGrid>
-<!-- Ajaxify Panel -->
+ <!-- Ajaxify Panel -->
- <h:panelGrid border="1">
- <f:ajax/>
- <h:panelGrid columns="3" >
- <h:outputText value=""/>
- <h:outputText value="Panel2 : Ajaxify Panel"/>
- <h:outputText value=""/>
- </h:panelGrid>
- <h:panelGrid columns="3">
- <h:outputText value="Favorite programming language?"/>
- <h:selectOneRadio layout="lineDirection" valueChangeListener="#{bean.displayRadio}">
- <f:selectItem itemValue="Java" itemLabel="Java"/>
- <f:selectItem itemValue="C#" itemLabel="C#"/>
- <f:selectItem itemValue="C++" itemLabel="C++"/>
- <f:selectItem itemValue="C" itemLabel="C"/>
- </h:selectOneRadio>
- <h:outputText id="softwareLang" />
- </h:panelGrid>
- <h:panelGrid columns="3">
- <f:ajax/>
- <h:outputText value="Some months have 30 days. Some have 31 days. How many months have 28 days?"/>
- <h:selectOneListbox valueChangeListener="#{bean.displayList}">
- <f:selectItem itemValue="10" itemLabel="10" />
- <f:selectItem itemValue="8" itemLabel="8" />
- <f:selectItem itemValue="all" itemLabel="All of them" />
- </h:selectOneListbox>
- <h:outputText id="out1"/>
- </h:panelGrid>
- </h:panelGrid>
-
- <h:panelGrid border="1">
- <h:panelGrid columns="3" >
- <h:outputText value=""/>
- <h:outputText value="Panel2 : Manipulate Other Components"/>
- <h:outputText value=""/>
- </h:panelGrid>
- <h:panelGrid columns="1">
- <h:commandButton value="Reset Text Fields" actionListener="#{bean.beanAction}">
- <f:ajax execute="form1:name form1:address form1:city form1:zip"
- render="form1:name form1:address form1:city form1:zip form1:msgPanel"/>
- </h:commandButton>
- </h:panelGrid>
- </h:panelGrid>
+ <h:panelGrid border="1">
+ <h:panelGrid columns="3">
+ <h:outputText value="" />
+ <h:outputText value="Panel2 : Ajaxify Panel" />
+ <h:outputText value="" />
+ </h:panelGrid>
+ <h:panelGrid columns="3">
+ <h:outputText value="Favorite programming language?" />
+ <h:selectOneRadio layout="lineDirection"
+ valueChangeListener="#{bean.displayRadio}">
+ <f:selectItem itemValue="Java" itemLabel="Java" />
+ <f:selectItem itemValue="C#" itemLabel="C#" />
+ <f:selectItem itemValue="C++" itemLabel="C++" />
+ <f:selectItem itemValue="C" itemLabel="C" />
+ <f:ajax />
+ </h:selectOneRadio>
+ <h:outputText id="softwareLang" />
+ </h:panelGrid>
+ <h:panelGrid columns="3">
+ <h:outputText
+ value="Some months have 30 days. Some have 31 days. How many months have 28 days?" />
+ <h:selectOneListbox valueChangeListener="#{bean.displayList}">
+ <f:ajax />
+ <f:selectItem itemValue="10" itemLabel="10" />
+ <f:selectItem itemValue="8" itemLabel="8" />
+ <f:selectItem itemValue="all" itemLabel="All of them" />
+ </h:selectOneListbox>
+ <h:outputText id="out1" />
+ </h:panelGrid>
+ </h:panelGrid>
- <h:outputStylesheet name="stylesheet.css" />
- </h:form>
+ <h:panelGrid border="1">
+ <h:panelGrid columns="3">
+ <h:outputText value="" />
+ <h:outputText value="Panel2 : Manipulate Other Components" />
+ <h:outputText value="" />
+ </h:panelGrid>
+ <h:panelGrid columns="1">
+ <h:commandButton value="Reset Text Fields"
+ actionListener="#{bean.beanAction}">
+ <f:ajax execute="form1:name form1:address form1:city form1:zip"
+ render="form1:name form1:address form1:city form1:zip form1:msgPanel" />
+ </h:commandButton>
+ </h:panelGrid>
+ </h:panelGrid>
+ <h:outputStylesheet name="stylesheet.css" />
+ </h:form>
+
</h:body>
</html>
Modified: root/examples-sandbox/trunk/components/ajax/src/test/java/org/richfaces/test/ajax/UIDataTest.java
===================================================================
--- root/examples-sandbox/trunk/components/ajax/src/test/java/org/richfaces/test/ajax/UIDataTest.java 2009-10-29 14:35:47 UTC (rev 15782)
+++ root/examples-sandbox/trunk/components/ajax/src/test/java/org/richfaces/test/ajax/UIDataTest.java 2009-10-30 00:11:27 UTC (rev 15783)
@@ -27,6 +27,7 @@
import javax.faces.render.ResponseStateManager;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.richfaces.test.AbstractFacesTest;
import org.richfaces.test.DataBean;
@@ -144,7 +145,7 @@
.getName());
}
- @Test
+/* @Ignore
public void testCycleRequest() throws Exception {
setupFacesRequest();
facesContext.setViewRoot(createView());
@@ -166,5 +167,5 @@
assertEquals("bar", dataBean.getData().get(6).getItems().get(5)
.getName());
}
-
+*/
}
Property changes on: root/examples-sandbox/trunk/testapps/ajax
___________________________________________________________________
Name: svn:ignore
+ target
.externalToolBuilders
.project
.classpath
.settings
Added: root/examples-sandbox/trunk/testapps/ajax/.svnignore
===================================================================
--- root/examples-sandbox/trunk/testapps/ajax/.svnignore (rev 0)
+++ root/examples-sandbox/trunk/testapps/ajax/.svnignore 2009-10-30 00:11:27 UTC (rev 15783)
@@ -0,0 +1,5 @@
+target
+.externalToolBuilders
+.project
+.classpath
+.settings
Added: root/examples-sandbox/trunk/testapps/ajax/pom.xml
===================================================================
--- root/examples-sandbox/trunk/testapps/ajax/pom.xml (rev 0)
+++ root/examples-sandbox/trunk/testapps/ajax/pom.xml 2009-10-30 00:11:27 UTC (rev 15783)
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>testapps</artifactId>
+ <groupId>org.richfaces.examples-sandbox</groupId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.richfaces.examples-sandbox.testapps</groupId>
+ <artifactId>ajax</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>tables Maven Webapp</name>
+ <url>http://maven.apache.org</url>
+ <build>
+ <finalName>ajax</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+
+ <!-- We only want test to run during integration-test phase -->
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <systemProperties>
+ <property>
+ <name>cactus.contextURL</name>
+ <value>http://localhost:8080/${artifactId}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <configuration>
+ <wait>false</wait>
+ <configuration>
+ <deployables>
+ <deployable>
+ <location>${project.build.directory}/${artifactId}.war</location>
+ <type>war</type>
+ </deployable>
+ </deployables>
+ </configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>ajax</artifactId>
+ <type>war</type>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jsfunit</groupId>
+ <artifactId>jboss-jsfunit-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>el-impl</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+</project>
Added: root/examples-sandbox/trunk/testapps/ajax/src/main/java/JSFUnitTest.java
===================================================================
--- root/examples-sandbox/trunk/testapps/ajax/src/main/java/JSFUnitTest.java (rev 0)
+++ root/examples-sandbox/trunk/testapps/ajax/src/main/java/JSFUnitTest.java 2009-10-30 00:11:27 UTC (rev 15783)
@@ -0,0 +1,41 @@
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+
+import org.jboss.jsfunit.jsfsession.JSFClientSession;
+import org.jboss.jsfunit.jsfsession.JSFServerSession;
+import org.jboss.jsfunit.jsfsession.JSFSession;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+public class JSFUnitTest extends org.apache.cactus.ServletTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite( JSFUnitTest.class );
+ }
+
+ public void testInitialPage() throws IOException
+ {
+ // Send an HTTP request for the initial page
+ JSFSession jsfSession = new JSFSession("/home.jsf");
+
+ // A JSFClientSession emulates the browser and lets you test HTML
+ JSFClientSession client = jsfSession.getJSFClientSession();
+
+ // A JSFServerSession gives you access to JSF state
+ JSFServerSession server = jsfSession.getJSFServerSession();
+
+ // Test navigation to initial viewID
+ assertEquals("/home.xhtml", server.getCurrentViewID());
+
+ // Assert that the prompt component is in the component tree and rendered
+ UIComponent prompt = server.findComponent("msgPanel");
+ assertTrue(prompt.isRendered());
+
+ // Test a managed bean
+ assertNotNull(server.getManagedBeanValue("#{bean}"));
+ }
+}
Added: root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/META-INF/MANIFEST.MF (rev 0)
+++ root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/META-INF/MANIFEST.MF 2009-10-30 00:11:27 UTC (rev 15783)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added: root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/WEB-INF/web.xml
===================================================================
--- root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/WEB-INF/web.xml 2009-10-30 00:11:27 UTC (rev 15783)
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can obtain
+ a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ Sun designates this particular file as subject to the "Classpath" exception
+ as provided by Sun in the GPL Version 2 section of the License file that
+ accompanied this code. If applicable, add the following below the License
+ Header, with the fields enclosed by brackets [] replaced by your own
+ identifying information: "Portions Copyrighted [year]
+ [name of copyright owner]"
+
+ Contributor(s):
+
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ 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-app_2_5.xsd">
+
+ <display-name></display-name>
+ <description></description>
+
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Set this flag to true if you want the JavaServer Faces
+ Reference Implementation to validate the XML in your
+ faces-config.xml resources against the DTD. Default
+ value is false.
+ </description>
+ <param-name>com.sun.faces.validateXml</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <!-- 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 -->
+ <!--
+
+ This mapping identifies a jsp page as having JSF content. If a
+ request comes to the server for foo.faces, the container will
+ send the request to the FacesServlet, which will expect a
+ corresponding foo.jsp page to exist containing the content.
+
+ -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+<filter>
+ <filter-name>JSFUnitFilter</filter-name>
+ <filter-class>org.jboss.jsfunit.framework.JSFUnitFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JSFUnitFilter</filter-name>
+ <servlet-name>ServletTestRunner</servlet-name>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>JSFUnitFilter</filter-name>
+ <servlet-name>ServletRedirector</servlet-name>
+ </filter-mapping>
+
+ <servlet>
+ <servlet-name>ServletRedirector</servlet-name>
+ <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>ServletTestRunner</servlet-name>
+ <servlet-class>org.apache.cactus.server.runner.ServletTestRunner</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ServletRedirector</servlet-name>
+ <url-pattern>/ServletRedirector</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ServletTestRunner</servlet-name>
+ <url-pattern>/ServletTestRunner</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added: root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/index.jsp
===================================================================
--- root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/index.jsp (rev 0)
+++ root/examples-sandbox/trunk/testapps/ajax/src/main/webapp/index.jsp 2009-10-30 00:11:27 UTC (rev 15783)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
Added: root/examples-sandbox/trunk/testapps/ajax/src/test/java/JSFUnitTest.java
===================================================================
--- root/examples-sandbox/trunk/testapps/ajax/src/test/java/JSFUnitTest.java (rev 0)
+++ root/examples-sandbox/trunk/testapps/ajax/src/test/java/JSFUnitTest.java 2009-10-30 00:11:27 UTC (rev 15783)
@@ -0,0 +1,41 @@
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+
+import org.jboss.jsfunit.jsfsession.JSFClientSession;
+import org.jboss.jsfunit.jsfsession.JSFServerSession;
+import org.jboss.jsfunit.jsfsession.JSFSession;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+public class JSFUnitTest extends org.apache.cactus.ServletTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite( JSFUnitTest.class );
+ }
+
+ public void testInitialPage() throws IOException
+ {
+ // Send an HTTP request for the initial page
+ JSFSession jsfSession = new JSFSession("/home.jsf");
+
+ // A JSFClientSession emulates the browser and lets you test HTML
+ JSFClientSession client = jsfSession.getJSFClientSession();
+
+ // A JSFServerSession gives you access to JSF state
+ JSFServerSession server = jsfSession.getJSFServerSession();
+
+ // Test navigation to initial viewID
+ assertEquals("/home.xhtml", server.getCurrentViewID());
+
+ // Assert that the prompt component is in the component tree and rendered
+ UIComponent prompt = server.findComponent("msgPanel");
+ assertTrue(prompt.isRendered());
+
+ // Test a managed bean
+ assertNotNull(server.getManagedBeanValue("#{bean}"));
+ }
+}
Added: root/examples-sandbox/trunk/testapps/pom.xml
===================================================================
--- root/examples-sandbox/trunk/testapps/pom.xml (rev 0)
+++ root/examples-sandbox/trunk/testapps/pom.xml 2009-10-30 00:11:27 UTC (rev 15783)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <groupId>org.richfaces</groupId>
+ <artifactId>examples-sandbox</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.examples-sandbox</groupId>
+ <artifactId>testapps</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>ajax</module>
+ </modules>
+ <dependencyManagement>
+ <dependencies>
+<dependency>
+ <groupId>org.jboss.jsfunit</groupId>
+ <artifactId>jboss-jsfunit-core</artifactId>
+ <version>1.2.0.GA-SNAPSHOT</version>
+ <scope>compile</scope>
+</dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
\ No newline at end of file
15 years, 1 month
JBoss Rich Faces SVN: r15782 - branches/sandbox.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-10-29 10:35:47 -0400 (Thu, 29 Oct 2009)
New Revision: 15782
Added:
branches/sandbox/3.3.X_JSF2/
Log:
Create branch for richfaces to add some suppotrt to jsf2.0
Copied: branches/sandbox/3.3.X_JSF2 (from rev 15781, branches/community/3.3.X)
15 years, 1 month
JBoss Rich Faces SVN: r15778 - branches/sandbox.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-10-29 10:28:46 -0400 (Thu, 29 Oct 2009)
New Revision: 15778
Added:
branches/sandbox/rf-2.0support/
Log:
Create branch for richfaces to add some suppotrt to jsf2.0
Copied: branches/sandbox/rf-2.0support (from rev 15777, branches/community/3.3.X)
15 years, 1 month