JBoss Rich Faces SVN: r9653 - in trunk/framework/impl/src/main/java/org/ajax4jsf: context and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-07-17 09:00:42 -0400 (Thu, 17 Jul 2008)
New Revision: 9653
Removed:
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
Log:
Duplicate resources-handling code removed
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java 2008-07-17 13:00:34 UTC (rev 9652)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java 2008-07-17 13:00:42 UTC (rev 9653)
@@ -193,7 +193,6 @@
} else {
super.renderView(context, root);
}
- ajaxContext.processHeadResources(context);
}
/**
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-07-17 13:00:34 UTC (rev 9652)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-07-17 13:00:42 UTC (rev 9653)
@@ -32,18 +32,13 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import java.util.regex.Pattern;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.FactoryFinder;
-import javax.faces.application.Application;
import javax.faces.application.StateManager;
import javax.faces.application.ViewHandler;
-import javax.faces.application.StateManager.SerializedView;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
@@ -62,15 +57,8 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.ResourceNotFoundException;
-import org.ajax4jsf.util.ELUtils;
-import org.ajax4jsf.webapp.BaseFilter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-import org.richfaces.skin.SkinNotFoundException;
/**
* This class incapsulated
@@ -83,20 +71,8 @@
public static final String SERVLET_ERROR_EXCEPTION_ATTRIBUTE = "javax.servlet.error.exception";
- public static final String RESOURCES_PROCESSED = "org.ajax4jsf.framework.HEADER_PROCESSED";
-
- //we do not apply extended CSS styling for control for Opera & Safari
- //as they have their own advanced styling
- private static final Pattern USER_AGENTS = Pattern.compile(" AppleWebKit/|^Opera/| Opera ");
-
- private static final String INIT_PARAMETER_PREFIX = "_init_parameter_";
-
- //Object to put into application map as a value of cached parameter if it is null
- private static final Object NULL = new Object();
-
private static final Log log = LogFactory.getLog(AjaxContext.class);
-
Set<String> ajaxAreasToRender = new HashSet<String>();
Set<String> ajaxAreasToProcess = null;
@@ -267,237 +243,6 @@
out.endElement(HTML.HTML_ELEMENT);
}
- /**
- * @param context
- * @param root
- * @throws FacesException
- */
- public void processHeadResources(FacesContext context)
- throws FacesException {
- ExternalContext externalContext = context.getExternalContext();
- Map<String,Object> requestMap = externalContext.getRequestMap();
- if (!Boolean.TRUE.equals(requestMap.get(RESOURCES_PROCESSED))) {
- if (null != requestMap.get(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE)) {
- if (log.isDebugEnabled()) {
- log
- .debug("Process component tree for collect used scripts and styles");
- }
- UIViewRoot root = context.getViewRoot();
- ViewResources viewResources = new ViewResources();
- String skinStyleSheetUri = null;
- String skinExtendedStyleSheetUri = null;
- try {
- Skin skin = SkinFactory.getInstance().getSkin(context);
- // Set default style sheet for current skin.
- skinStyleSheetUri = (String) skin.getParameter(context,
- Skin.generalStyleSheet);
- // Set default style sheet for current skin.
- skinExtendedStyleSheetUri = (String) skin.getParameter(context,
- Skin.extendedStyleSheet);
- // For a "NULL" skin, do not collect components stylesheets
- if ("false".equals(skin.getParameter(context,
- Skin.loadStyleSheets))) {
- viewResources.setProcessStyles(false);
- }
- } catch (SkinNotFoundException e) {
- log.warn("Current Skin is not found", e);
- }
- InternetResourceBuilder internetResourceBuilder = InternetResourceBuilder
- .getInstance();
- // Check init parameters for a resources processing.
- String scriptStrategy = externalContext
- .getInitParameter(InternetResourceBuilder.LOAD_SCRIPT_STRATEGY_PARAM);
- if (null != scriptStrategy) {
- if (InternetResourceBuilder.LOAD_NONE
- .equals(scriptStrategy)) {
- viewResources.setProcessScripts(false);
- } else if (InternetResourceBuilder.LOAD_ALL
- .equals(scriptStrategy)) {
- viewResources.setProcessScripts(false);
- // For an "ALL" strategy, it is not necessary to load scripts in the ajax request
- if (!this.isAjaxRequest(context)) {
- try {
- viewResources
- .addScript(internetResourceBuilder
- .createResource(
- this,
- InternetResourceBuilder.COMMON_FRAMEWORK_SCRIPT)
- .getUri(context, null));
- viewResources
- .addScript(internetResourceBuilder
- .createResource(
- this,
- InternetResourceBuilder.COMMON_UI_SCRIPT)
- .getUri(context, null));
-
- } catch (ResourceNotFoundException e) {
- if (log.isWarnEnabled()) {
- log
- .warn("No aggregated javaScript library found "
- + e.getMessage());
- }
- }
-
- }
- }
- }
-
- boolean useStdControlsSkinning = false;
-
- String stdControlsSkinning = getInitParameterValue(context, InternetResourceBuilder.STD_CONTROLS_SKINNING_PARAM);
- if (stdControlsSkinning != null) {
- useStdControlsSkinning = InternetResourceBuilder.ENABLE.equals(stdControlsSkinning);
- }
-
- boolean useStdControlsSkinningClasses = true;
-
- String stdControlsSkinningClasses = getInitParameterValue(context, InternetResourceBuilder.STD_CONTROLS_SKINNING_CLASSES_PARAM);
- if (stdControlsSkinningClasses != null) {
- useStdControlsSkinningClasses = InternetResourceBuilder.ENABLE.equals(stdControlsSkinningClasses);
- }
-
- boolean useExtendedSkinning = isExtendedSkinningEnabled(externalContext);
-
- String styleStrategy = externalContext
- .getInitParameter(InternetResourceBuilder.LOAD_STYLE_STRATEGY_PARAM);
-
- if (InternetResourceBuilder.LOAD_NONE.equals(styleStrategy)) {
- viewResources.setProcessStyles(false);
- } else if (InternetResourceBuilder.LOAD_ALL
- .equals(styleStrategy)) {
- viewResources.setProcessStyles(false);
- // For an "ALL" strategy, it is not necessary to load styles
- // in the ajax request
- if (!this.isAjaxRequest(context)) {
- String commonStyle = InternetResourceBuilder.COMMON_STYLE_PREFIX;
-
- if (useStdControlsSkinning
- || useStdControlsSkinningClasses) {
- if (useExtendedSkinning) {
- commonStyle += "-ext";
- } else {
- commonStyle += "-bas";
- }
-
- if (useStdControlsSkinning
- && useStdControlsSkinningClasses) {
- commonStyle += "-both";
- } else if (useStdControlsSkinning) {
- commonStyle += "-styles";
- } else if (useStdControlsSkinningClasses) {
- commonStyle += "-classes";
- }
- }
-
- commonStyle += InternetResourceBuilder.COMMON_STYLE_EXTENSION;
-
- try {
- viewResources.addStyle(internetResourceBuilder
- .createResource(this, commonStyle).getUri(
- context, null));
-
- } catch (ResourceNotFoundException e) {
- if (log.isWarnEnabled()) {
- log.warn("No aggregated stylesheet found "
- + e.getMessage());
- }
- }
-
- }
- } else {
- if (useStdControlsSkinning) {
- viewResources.addStyle(
- internetResourceBuilder.createResource(
- this, InternetResourceBuilder.STD_CONTROLS_BASIC_STYLE)
- .getUri(context, null));
-
- if (useExtendedSkinning) {
- viewResources.addStyle(
- internetResourceBuilder.createResource(
- this, InternetResourceBuilder.STD_CONTROLS_EXTENDED_STYLE)
- .getUri(context, null));
- }
- }
-
- if (useStdControlsSkinningClasses) {
- viewResources.addStyle(
- internetResourceBuilder.createResource(
- this, InternetResourceBuilder.STD_CONTROLS_BASIC_CLASSES_STYLE)
- .getUri(context, null));
-
- if (useExtendedSkinning) {
- viewResources.addStyle(
- internetResourceBuilder.createResource(
- this, InternetResourceBuilder.STD_CONTROLS_EXTENDED_CLASSES_STYLE)
- .getUri(context, null));
- }
- }
- }
-
- viewResources.collect(context);
- Set<String> scripts = viewResources.getScripts();
- if (scripts.size() > 0) {
- if (log.isDebugEnabled()) {
- StringBuffer buff = new StringBuffer(
- "Scripts for insert into head : \n");
- for (Iterator<String> iter = scripts.iterator(); iter.hasNext();) {
- String script = iter.next();
- buff.append(script).append("\n");
- }
- log.debug(buff.toString());
- }
- requestMap.put(SCRIPTS_PARAMETER, scripts);
- }
-
- Set<String> styles = viewResources.getStyles();
- // Append Skin StyleSheet after a
- if (null != skinStyleSheetUri) {
- String resourceURL = context.getApplication()
- .getViewHandler().getResourceURL(context,
- skinStyleSheetUri);
- styles.add(resourceURL);
- }
-
- if (null != skinExtendedStyleSheetUri && useExtendedSkinning) {
- String resourceURL = context.getApplication().getViewHandler().getResourceURL(context,
- skinExtendedStyleSheetUri);
- styles.add(resourceURL);
- }
- if (styles.size() > 0) {
- if (log.isDebugEnabled()) {
- StringBuffer buff = new StringBuffer(
- "Styles for insert into head : \n");
- for (Iterator<String> iter = styles.iterator(); iter.hasNext();) {
- String style = (String) iter.next();
- buff.append(style).append("\n");
- }
- log.debug(buff.toString());
- }
- requestMap.put(STYLES_PARAMETER, styles);
- }
-
- Set<String> usersStyles = viewResources.getUserStyles();
- if (usersStyles.size() > 0) {
- if (log.isDebugEnabled()) {
- StringBuffer buff = new StringBuffer(
- "User styles for insert into head : \n");
- for (Iterator<String> iter = usersStyles.iterator(); iter.hasNext();) {
- String style = (String) iter.next();
- buff.append(style).append("\n");
- }
- log.debug(buff.toString());
- }
- requestMap.put(USER_STYLES_PARAMETER, usersStyles);
- }
- // Mark as processed.
- requestMap.put(RESOURCES_PROCESSED, Boolean.TRUE);
- // Save viewId for a parser selection
- requestMap.put(AjaxViewHandler.VIEW_ID_KEY, root.getViewId());
- }
-
- }
- }
-
public void saveViewState(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
StateManager stateManager = context.getApplication().getStateManager();
@@ -806,74 +551,4 @@
this.oncomplete = oncomplete;
}
- private boolean isExtendedSkinningEnabled(ExternalContext context) {
- String userAgent = context.getRequestHeaderMap().get("User-Agent");
- if (userAgent != null) {
- boolean apply = !USER_AGENTS.matcher(userAgent).find();
-
- if (log.isDebugEnabled()) {
- log.debug("Got User-Agent: " + userAgent);
- log.debug("Applying extended CSS controls styling = " + apply);
- }
-
- return apply;
- } else {
- if (log.isDebugEnabled()) {
- log.debug("User-Agent is null, applying extended CSS controls styling");
- }
-
- return true;
- }
- }
-
- private String evaluate(FacesContext context, Object parameterValue) {
- if (parameterValue == NULL || parameterValue == null) {
- return null;
- } else if (parameterValue instanceof ValueExpression) {
- ValueExpression expression = (ValueExpression) parameterValue;
-
- return (String) expression.getValue(context.getELContext());
- } else {
- return parameterValue.toString();
- }
- }
-
- private String getInitParameterValue(FacesContext context, String parameterName) {
-
- String key = INIT_PARAMETER_PREFIX + parameterName;
-
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> applicationMap = externalContext.getApplicationMap();
- Object mutex = externalContext.getRequest();
- Object parameterValue = null;
-
- synchronized (mutex) {
- parameterValue = applicationMap.get(key);
-
- if (parameterValue == null) {
-
- String initParameter = externalContext.getInitParameter(parameterName);
- if (initParameter != null) {
-
- if (ELUtils.isValueReference(initParameter)) {
- Application application = context.getApplication();
- ExpressionFactory expressionFactory = application.getExpressionFactory();
-
- parameterValue = expressionFactory.createValueExpression(context.getELContext(),
- initParameter,
- String.class);
- } else {
- parameterValue = initParameter;
- }
-
- } else {
- parameterValue = NULL;
- }
-
- applicationMap.put(key, parameterValue);
- }
- }
-
- return evaluate(context, parameterValue);
- }
}
Deleted: trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-07-17 13:00:34 UTC (rev 9652)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-07-17 13:00:42 UTC (rev 9653)
@@ -1,173 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.context;
-
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import javax.faces.FactoryFinder;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.render.RenderKit;
-import javax.faces.render.RenderKitFactory;
-import javax.faces.render.Renderer;
-
-import org.ajax4jsf.renderkit.HeaderResourceProducer;
-import org.ajax4jsf.renderkit.UserResourceRenderer;
-
-/**
- * @author asmirnov
- *
- */
-public class ViewResources {
-
- LinkedHashSet<String> scripts = new LinkedHashSet<String>();
- LinkedHashSet<String> styles = new LinkedHashSet<String>();
- LinkedHashSet<String> userScripts = new LinkedHashSet<String>();
- LinkedHashSet<String> userStyles = new LinkedHashSet<String>();
- boolean processStyles = true;
- boolean processScripts = true;
- RenderKit renderKit = null;
-
- public void collect(FacesContext context) {
- UIViewRoot root = context.getViewRoot();
- RenderKitFactory rkFactory = (RenderKitFactory) FactoryFinder
- .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- renderKit = rkFactory.getRenderKit(context, context
- .getViewRoot().getRenderKitId());
- processHeadResources(context, root);
- //styles.addAll(userStyles);
- scripts.addAll(userScripts);
- }
-
- /**
- * Append nessesary scripts and styles from component ( if renderer
- * implements {@link HeaderResourceProducer}) and recursive process all
- * facets and childrens.
- *
- * @param context
- * TODO
- * @param root
- */
- private void processHeadResources(FacesContext context, UIComponent root) {
- Renderer renderer = getRenderer(context, root);
- if (null != renderer) {
- if ((processScripts || processStyles ) && renderer instanceof HeaderResourceProducer) {
- HeaderResourceProducer producer = (HeaderResourceProducer) renderer;
- if (processScripts) {
- Set<String> set = producer.getHeaderScripts(context, root);
- if (null != set) {
- scripts.addAll(set);
- }
-
- }
- if (processStyles) {
- Set<String> set = producer.getHeaderStyles(context, root);
- if (null != set) {
- styles.addAll(set);
- }
-
- }
- } else if (renderer instanceof UserResourceRenderer) {
- UserResourceRenderer producer = (UserResourceRenderer) renderer;
- Set<String> set = producer.getHeaderScripts(context, root);
- if (null != set) {
- userScripts.addAll(set);
- }
- set = producer.getHeaderStyles(context, root);
- if (null != set) {
- userStyles.addAll(set);
- }
- }
-
- }
- for (Iterator<UIComponent> iter = root.getFacets().values().iterator(); iter
- .hasNext();) {
- UIComponent child = iter.next();
- processHeadResources(context, child);
- }
- for (Iterator<UIComponent> iter = root.getChildren().iterator(); iter.hasNext();) {
- UIComponent child = iter.next();
- processHeadResources(context, child);
- }
- }
-
- /**
- * Find renderer for given component.
- *
- * @param context
- * @param comp
- * @param renderKit
- * @return
- */
- private Renderer getRenderer(FacesContext context, UIComponent comp) {
-
- String rendererType = comp.getRendererType();
- if (rendererType != null) {
- return (renderKit.getRenderer(comp.getFamily(), rendererType));
- } else {
- return (null);
- }
-
- }
-
- /**
- * @return the processStyles
- */
- public boolean isProcessStyles() {
- return processStyles;
- }
-
- /**
- * @param processStyles the processStyles to set
- */
- public void setProcessStyles(boolean processStyles) {
- this.processStyles = processStyles;
- }
-
- /**
- * @return the processScripts
- */
- public boolean isProcessScripts() {
- return processScripts;
- }
-
- /**
- * @param processScripts the processScripts to set
- */
- public void setProcessScripts(boolean processScripts) {
- this.processScripts = processScripts;
- }
-
- /**
- * @return the scripts
- */
- public Set<String> getScripts() {
- return scripts;
- }
-
- /**
- * @return the styles
- */
- public Set<String> getStyles() {
- return styles;
- }
-
- /**
- * @return user styles
- */
- public Set<String> getUserStyles() {
- return userStyles;
- }
-
- public void addScript(String scriptUrl) {
- scripts.add(scriptUrl);
- }
-
- public void addStyle(String styleUrl) {
- styles.add(styleUrl);
- }
-}
16 years, 2 months
JBoss Rich Faces SVN: r9652 - trunk/framework/test/src/test/java/org/ajax4jsf/context.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-07-17 09:00:34 -0400 (Thu, 17 Jul 2008)
New Revision: 9652
Modified:
trunk/framework/test/src/test/java/org/ajax4jsf/context/MockAjaxContext.java
Log:
Duplicate resources-handling code removed
Modified: trunk/framework/test/src/test/java/org/ajax4jsf/context/MockAjaxContext.java
===================================================================
--- trunk/framework/test/src/test/java/org/ajax4jsf/context/MockAjaxContext.java 2008-07-17 13:00:31 UTC (rev 9651)
+++ trunk/framework/test/src/test/java/org/ajax4jsf/context/MockAjaxContext.java 2008-07-17 13:00:34 UTC (rev 9652)
@@ -7,7 +7,6 @@
import java.util.Map;
import java.util.Set;
-import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -206,16 +205,6 @@
}
/* (non-Javadoc)
- * @see org.ajax4jsf.context.AjaxContext#processHeadResources(javax.faces.context.FacesContext)
- */
- @Override
- public void processHeadResources(FacesContext context)
- throws FacesException {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
* @see org.ajax4jsf.context.AjaxContext#release()
*/
@Override
16 years, 2 months
JBoss Rich Faces SVN: r9651 - trunk/framework/api/src/main/java/org/ajax4jsf/context.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-07-17 09:00:31 -0400 (Thu, 17 Jul 2008)
New Revision: 9651
Modified:
trunk/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
Log:
Duplicate resources-handling code removed
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2008-07-17 11:47:03 UTC (rev 9650)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2008-07-17 13:00:31 UTC (rev 9651)
@@ -67,15 +67,10 @@
public abstract boolean isAjaxRequest();
- public abstract void processHeadResources(FacesContext context)
- throws FacesException;
-
public abstract void encodeAjaxEnd(FacesContext context) throws IOException;
public abstract void encodeAjaxBegin(FacesContext context) throws IOException;
-
-
public abstract void renderAjax(FacesContext context);
public abstract void decode(FacesContext context);
16 years, 2 months
JBoss Rich Faces SVN: r9650 - in trunk/test-applications/facelets/src/main: webapp and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-07-17 07:47:03 -0400 (Thu, 17 Jul 2008)
New Revision: 9650
Added:
trunk/test-applications/facelets/src/main/java/validator/Bean.java
trunk/test-applications/facelets/src/main/java/validator/DataBean.java
trunk/test-applications/facelets/src/main/java/validator/GraphValidatorBean.java
trunk/test-applications/facelets/src/main/java/validator/LengthBean.java
trunk/test-applications/facelets/src/main/java/validator/MaxBean.java
trunk/test-applications/facelets/src/main/java/validator/MinBean.java
trunk/test-applications/facelets/src/main/java/validator/MinMaxBean.java
trunk/test-applications/facelets/src/main/java/validator/NotEmptyBean.java
trunk/test-applications/facelets/src/main/java/validator/NotNullBean.java
trunk/test-applications/facelets/src/main/java/validator/TestValidable.java
trunk/test-applications/facelets/src/main/java/validator/Validable.java
trunk/test-applications/facelets/src/main/webapp/Validator/
trunk/test-applications/facelets/src/main/webapp/Validator/Validator.xhtml
trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorDefault.xhtml
trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorProperty.xhtml
trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorStraightforward.xhtml
Modified:
trunk/test-applications/facelets/src/main/java/validator/ValidatorBean.java
trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Validator.xml
trunk/test-applications/facelets/src/main/webapp/WEB-INF/web.xml
Log:
ajaxValidator & graphValidator
Added: trunk/test-applications/facelets/src/main/java/validator/Bean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/Bean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/Bean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,33 @@
+/**
+ * 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 validator;
+
+import org.hibernate.validator.Email;
+
+/**
+ * @author $Autor$
+ *
+ */
+public class Bean {
+
+
+}
\ No newline at end of file
Added: trunk/test-applications/facelets/src/main/java/validator/DataBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/DataBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/DataBean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,130 @@
+/**
+ *
+ */
+package validator;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Size;
+import org.hibernate.validator.Valid;
+import org.richfaces.component.UIGraphValidator;
+import util.componentInfo.ComponentInfo;
+import util.data.Data;
+/**
+ * @author mvitenkov
+ *
+ */
+public class DataBean {
+
+ private final List<Validable> beans;
+ private UIGraphValidator graphValidatorComponent = null;
+ private String bindLabel;
+ private boolean rendered;
+ @Size(min=2,max=5,message="Size validation failed!!!!")
+ private ArrayList<Data> data;
+ private int length;
+
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ public ArrayList<Data> getData() {
+ return data;
+ }
+
+ public void setData(ArrayList<Data> data) {
+ this.data = data;
+ }
+
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ public void checkBinding(ActionEvent actionEvent){
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = graphValidatorComponent.getClientId(context).toString();
+ }
+
+ public String add(){
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(graphValidatorComponent);
+ return null;
+ }
+ public String addNewItem() {
+ if (length < 0)
+ length = 0;
+ if (data.size() > length)
+ for (int i = length; i < data.size();)
+ data.remove(i);
+ else{
+ Random r = new Random();
+ for (int i = data.size() + 1; i <= length; i++)
+ data.add(new Data(i, r.nextInt(1000), Data.Random(6), r.nextInt(10000) + 98389, Data.Random(r.nextInt(10) + 1), r.nextInt(500000), Data.statusIcon[i % 5], Data.Random(3), false));
+ }
+ return null;
+ }
+
+ public String getBindLabel() {
+ return bindLabel;
+ }
+
+ public void setBindLabel(String bindLabel) {
+ this.bindLabel = bindLabel;
+ }
+
+ public UIGraphValidator getGraphValidatorComponent() {
+ return graphValidatorComponent;
+ }
+
+ public void setGraphValidatorComponent(UIGraphValidator graphValidatorComponent) {
+ this.graphValidatorComponent = graphValidatorComponent;
+ }
+
+ /**
+ * @return the beans
+ */
+ @Valid
+ public List<Validable> getBeans() {
+ return beans;
+ }
+
+ public DataBean() {
+ beans = new ArrayList<Validable>(6);
+ beans.add(new NotNullBean());
+ beans.add(new NotEmptyBean());
+ beans.add(new LengthBean());
+ beans.add(new MinBean());
+ beans.add(new MaxBean());
+ beans.add(new MinMaxBean());
+ this.bindLabel = "Click Binding";
+ this.rendered = true;
+ this.data = new ArrayList<Data>();
+ Random r = new Random();
+ for(int i = 0; i < 10; i++)
+ data.add(new Data(i, r.nextInt(1000), Data.Random(6), r.nextInt(10000) + 98389, Data.Random(r.nextInt(10) + 1), r.nextInt(500000), Data.statusIcon[i % 5], Data.Random(3), false)); //new Data(i, Data.Random(5), Data.statusIcon[i % 5], Data.Random(6), false));
+ }
+
+ @Max(value=20,message="Total value should be less then 20")
+ public int getTotal(){
+ int total = 0;
+ for (Validable bean : beans) {
+ total += bean.getIntValue();
+ }
+ return total;
+ }
+
+
+
+}
Added: trunk/test-applications/facelets/src/main/java/validator/GraphValidatorBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/GraphValidatorBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/GraphValidatorBean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,32 @@
+package validator;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.Valid;
+import org.richfaces.component.UIGraphValidator;
+
+public class GraphValidatorBean {
+
+ private final List<TestValidable> beans;
+
+ @Valid
+ public List<TestValidable> getBeans() {
+ return beans;
+ }
+
+ public GraphValidatorBean() {
+ beans = new ArrayList(1);
+ beans.add(new ValidatorBean());
+ }
+ @Max(value=50,message="total length > 50")
+ @Min(value=10,message="total length < 10")
+ public int getTotal(){
+ int total = 0;
+ for (TestValidable bean : beans) {
+ total += bean.getText().toString().length() + bean.getDateValue().toString().length();
+ }
+ return total;
+ }
+}
Added: trunk/test-applications/facelets/src/main/java/validator/LengthBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/LengthBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/LengthBean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,58 @@
+/**
+ *
+ */
+package validator;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LengthBean implements Validable {
+
+ @Length(max=10,min=4,message="incorrect field length")
+ private String text;
+
+ private int intValue;
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * @return the intValue
+ */
+ public int getIntValue() {
+ return intValue;
+ }
+
+ /**
+ * @param intValue the intValue to set
+ */
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public String getTextDescription() {
+ return "Validate String Length, for a range 4-10 chars";
+ }
+
+ public String getIntDescription() {
+ // TODO Auto-generated method stub
+ return "Integer Value, no restrictions";
+ }
+
+}
Added: trunk/test-applications/facelets/src/main/java/validator/MaxBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/MaxBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/MaxBean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,60 @@
+/**
+ *
+ */
+package validator;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class MaxBean implements Validable {
+
+ private String text;
+
+ @Max(10)
+ private int intValue;
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * @return the intValue
+ */
+ public int getIntValue() {
+ return intValue;
+ }
+
+ /**
+ * @param intValue the intValue to set
+ */
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public String getTextDescription() {
+ return "Text value, no restrictions";
+ }
+
+ public String getIntDescription() {
+ // TODO Auto-generated method stub
+ return "Integer Value, less then 10";
+ }
+
+}
Added: trunk/test-applications/facelets/src/main/java/validator/MinBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/MinBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/MinBean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,59 @@
+/**
+ *
+ */
+package validator;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class MinBean implements Validable {
+
+ private String text;
+
+ @Min(2)
+ private int intValue;
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * @return the intValue
+ */
+ public int getIntValue() {
+ return intValue;
+ }
+
+ /**
+ * @param intValue the intValue to set
+ */
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public String getTextDescription() {
+ return "Text value, no restrictions";
+ }
+
+ public String getIntDescription() {
+ // TODO Auto-generated method stub
+ return "Integer Value, more then 1";
+ }
+
+}
Added: trunk/test-applications/facelets/src/main/java/validator/MinMaxBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/MinMaxBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/MinMaxBean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,61 @@
+/**
+ *
+ */
+package validator;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class MinMaxBean implements Validable {
+
+ private String text;
+
+ @Min(2)
+ @Max(10)
+ private int intValue;
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * @return the intValue
+ */
+ public int getIntValue() {
+ return intValue;
+ }
+
+ /**
+ * @param intValue the intValue to set
+ */
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public String getTextDescription() {
+ return "Text Value, no restrictions";
+ }
+
+ public String getIntDescription() {
+ // TODO Auto-generated method stub
+ return "Integer Value, valid values from 2 to 10";
+ }
+
+}
Added: trunk/test-applications/facelets/src/main/java/validator/NotEmptyBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/NotEmptyBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/NotEmptyBean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package validator;
+
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class NotEmptyBean implements Validable {
+
+ @NotEmpty
+ private String text;
+
+ private int intValue;
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * @return the intValue
+ */
+ public int getIntValue() {
+ return intValue;
+ }
+
+ /**
+ * @param intValue the intValue to set
+ */
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public String getTextDescription() {
+ return "Text value, Not Empty Validation";
+ }
+
+ public String getIntDescription() {
+ // TODO Auto-generated method stub
+ return "Integer Value, no restrictions";
+ }
+
+}
Added: trunk/test-applications/facelets/src/main/java/validator/NotNullBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/NotNullBean.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/NotNullBean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,56 @@
+/**
+ *
+ */
+package validator;
+
+import org.hibernate.validator.NotNull;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class NotNullBean implements Validable {
+
+ @NotNull
+ private String text;
+
+ private int intValue;
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * @return the intValue
+ */
+ public int getIntValue() {
+ return intValue;
+ }
+
+ /**
+ * @param intValue the intValue to set
+ */
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public String getTextDescription() {
+ return "Text Value, Not Null Validation";
+ }
+
+ public String getIntDescription() {
+ // TODO Auto-generated method stub
+ return "Integer Value, no restrictions";
+ }
+
+}
Added: trunk/test-applications/facelets/src/main/java/validator/TestValidable.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/TestValidable.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/TestValidable.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,13 @@
+package validator;
+
+
+public interface TestValidable {
+
+ public String getText();
+
+ public int getIntValue();
+
+ public boolean isBooleanValue();
+
+ public String getDateValue();
+}
Added: trunk/test-applications/facelets/src/main/java/validator/Validable.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/Validable.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/validator/Validable.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,19 @@
+/**
+ *
+ */
+package validator;
+
+/**
+ * @author asmirnov
+ *
+ */
+public interface Validable {
+
+ public String getText();
+
+ public String getTextDescription();
+
+ public int getIntValue();
+
+ public String getIntDescription();
+}
Modified: trunk/test-applications/facelets/src/main/java/validator/ValidatorBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/validator/ValidatorBean.java 2008-07-17 11:45:10 UTC (rev 9649)
+++ trunk/test-applications/facelets/src/main/java/validator/ValidatorBean.java 2008-07-17 11:47:03 UTC (rev 9650)
@@ -1,16 +1,290 @@
package validator;
+import java.util.ArrayList;
+import java.util.Date;
+import javax.faces.event.ActionEvent;
+import javax.faces.model.SelectItem;
+import org.hibernate.validator.AssertFalse;
+import org.hibernate.validator.AssertTrue;
+import org.hibernate.validator.CreditCardNumber;
+import org.hibernate.validator.EAN;
+import org.hibernate.validator.Email;
+import org.hibernate.validator.Future;
+import org.hibernate.validator.Pattern;
+import org.hibernate.validator.Size;
+import org.richfaces.component.UIBeanValidator;
+import util.componentInfo.ComponentInfo;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-public class ValidatorBean implements Validator {
- public void validate(FacesContext context, UIComponent component,
- Object value) throws ValidatorException {
- // TODO Auto-generated method stub
+public class ValidatorBean implements TestValidable{
+ @Email(message="Mail validation failed!")
+ private String text;
+ @AssertFalse(message="AssertFalse validation failed!")
+ private boolean booleanValue;
+ @AssertTrue(message="Asserttrue validation failed!")
+ private boolean assertTrue;
+ @Future(message="Future validation failed!")
+ private String dateValue;
+ @Pattern(regex="^\b1234\b*$") //Searh "1234" as a whole word
+ private int intValue;
+ @EAN(message="EAN validation failed")
+ private String ean;
+ @CreditCardNumber(message="CreditCardNumber validation failed!")
+ private String creditValue;
+ @Size(min=1,max=5,message="Size validation failed!")
+ private ArrayList<SelectItem> sizeValues;
+ private String sizeValue;
+ private UIBeanValidator ajaxValidatorComponent = null;
+ private boolean ajaxSingle;
+ private String bindLabel;
+ private boolean disableDefault;
+ private String eventsQueue;
+ private boolean ignoreDupResponses;
+ private boolean immediate;
+ private boolean limitToList;
+ private UIComponent parentProperties = null;
+ private boolean rendered;
+ private boolean renderRegionOnly;
+ private int requestDelay;
+ private boolean selfRendered;
+ private boolean submitted;
+ private int timeout;
+
+ public int getTimeout() {
+ return timeout;
+ }
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
}
+ public boolean isSubmitted() {
+ return submitted;
+ }
+
+ public void setSubmitted(boolean submitted) {
+ this.submitted = submitted;
+ }
+
+ public boolean isSelfRendered() {
+ return selfRendered;
+ }
+
+ public void setSelfRendered(boolean selfRendered) {
+ this.selfRendered = selfRendered;
+ }
+
+ public int getRequestDelay() {
+ return requestDelay;
+ }
+
+ public void setRequestDelay(int requestDelay) {
+ this.requestDelay = requestDelay;
+ }
+
+ public boolean isRenderRegionOnly() {
+ return renderRegionOnly;
+ }
+
+ public void setRenderRegionOnly(boolean renderRegionOnly) {
+ this.renderRegionOnly = renderRegionOnly;
+ }
+
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+
+
+ public UIComponent getParentProperties() {
+ return parentProperties;
+ }
+
+ public void setParentProperties(UIComponent parentProperties) {
+ this.parentProperties = parentProperties;
+ }
+
+ public boolean isLimitToList() {
+ return limitToList;
+ }
+
+ public void setLimitToList(boolean limitToList) {
+ this.limitToList = limitToList;
+ }
+
+ public boolean isImmediate() {
+ return immediate;
+ }
+
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ public boolean isIgnoreDupResponses() {
+ return ignoreDupResponses;
+ }
+
+ public void setIgnoreDupResponses(boolean ignoreDupResponses) {
+ this.ignoreDupResponses = ignoreDupResponses;
+ }
+
+ public String getEventsQueue() {
+ return eventsQueue;
+ }
+
+ public void setEventsQueue(String eventsQueue) {
+ this.eventsQueue = eventsQueue;
+ }
+
+ public boolean isDisableDefault() {
+ return disableDefault;
+ }
+
+ public void setDisableDefault(boolean disableDefault) {
+ this.disableDefault = disableDefault;
+ }
+
+ public String getBindLabel() {
+ return bindLabel;
+ }
+
+ public void setBindLabel(String bindLabel) {
+ this.bindLabel = bindLabel;
+ }
+
+ public boolean isAjaxSingle() {
+ return ajaxSingle;
+ }
+
+ public void setAjaxSingle(boolean ajaxSingle) {
+ this.ajaxSingle = ajaxSingle;
+ }
+
+ public String add(){
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(ajaxValidatorComponent);
+ return null;
+ }
+
+ public UIBeanValidator getAjaxValidatorComponent() {
+ return ajaxValidatorComponent;
+ }
+
+ public void setAjaxValidatorComponent(UIBeanValidator ajaxValidatorComponent) {
+ this.ajaxValidatorComponent = ajaxValidatorComponent;
+ }
+
+ public String getSizeValue() {
+ return sizeValue;
+ }
+
+ public void setSizeValue(String sizeValue) {
+ this.sizeValue = sizeValue;
+ }
+
+ public ArrayList<SelectItem> getSizeValues() {
+ return sizeValues;
+ }
+
+ public void setSizeValues(ArrayList<SelectItem> sizeValues) {
+ this.sizeValues = sizeValues;
+ }
+
+ public String getCreditValue() {
+ return creditValue;
+ }
+
+ public void setCreditValue(String creditValue) {
+ this.creditValue = creditValue;
+ }
+
+ public String getEan() {
+ return ean;
+ }
+
+ public void setEan(String ean) {
+ this.ean = ean;
+ }
+
+ public ValidatorBean(){
+ this.ajaxSingle = true;
+ this.text = "mvitenkov(a)exadel.com";
+ this.intValue = 1234;
+ this.dateValue = (new Date()).toString();
+ this.booleanValue = false;
+ this.ean = "97 81550 41198 0";
+ this.creditValue = "visa maestro";
+ this.assertTrue = true;
+ this.sizeValues = new ArrayList<SelectItem>();
+ for(int i=0;i<6;i++){
+ sizeValues.add(new SelectItem("value_"+i,"label_"+i));
+ }
+ this.sizeValue = sizeValues.get(0).getValue().toString();
+ this.bindLabel = "click Binding";
+ this.disableDefault = false;
+ this.eventsQueue = "onchange";
+ this.ignoreDupResponses = true;
+ this.immediate = false;
+ this.limitToList = false;
+ this.rendered = true;
+ this.renderRegionOnly = true;
+ this.requestDelay = 500;
+ this.selfRendered = false;
+ this.submitted = false;
+ this.timeout = 3000;
+ }
+
+ public int getIntValue() {
+
+ return intValue;
+ }
+
+ public String getText() {
+
+ return text;
+ }
+
+ public String getDateValue() {
+
+ return dateValue;
+ }
+ public boolean isBooleanValue() {
+
+ return booleanValue;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public void setBooleanValue(boolean booleanValue) {
+ this.booleanValue = booleanValue;
+ }
+
+ public void setDateValue(String dateValue) {
+ this.dateValue = dateValue;
+ }
+
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public boolean isAssertTrue() {
+ return assertTrue;
+ }
+
+ public void setAssertTrue(boolean assertTrue) {
+ this.assertTrue = assertTrue;
+ }
+
+ public void checkBinding(ActionEvent actionEvent){
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = ajaxValidatorComponent.getClientId(context);
+ }
}
Added: trunk/test-applications/facelets/src/main/webapp/Validator/Validator.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Validator/Validator.xhtml (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Validator/Validator.xhtml 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,143 @@
+<f:subview xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich" id="validatorSubviewID">
+ <a4j:region>
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText>Single input field with label and message. Validated by AJAX on every changing.</h:outputText>
+ </f:facet>
+ <h:outputLabel for="ltext" value="#{lengthBean.textDescription}" />
+ <h:inputText id="ltext" value="#{lengthBean.text}">
+ <rich:ajaxValidator event="onchange" />
+ </h:inputText>
+ <rich:message for="ltext" showDetail="true" showSummary="true" />
+ </rich:panel>
+ <h2>Input fields with label and message in the JSF dataTable.
+ Each field validated by AJAX on "onchange" event</h2>
+ <rich:graphValidator value="#{data}"
+ binding="#{data.graphValidatorComponent}" id="graphValidatorID"
+ rendered="#{data.rendered}">
+ <rich:dataTable value="#{data.beans}" var="vBean" id="table">
+ <f:facet name="header">
+ <h:outputText
+ value="Validate values in the data table. Total sum for an all integer values validated for a value less then 20" />
+ </f:facet>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="text field" />
+ </f:facet>
+ <h:outputLabel for="text" value="#{vBean.textDescription}" />
+ <h:inputText id="text" value="#{vBean.text}">
+ <rich:ajaxValidator event="onchange" />
+ </h:inputText>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="integer field" />
+ </f:facet>
+ <h:outputLabel for="intValue" value="#{vBean.intDescription}" />
+ <h:inputText id="intValue" value="#{vBean.intValue}">
+ <rich:ajaxValidator event="onchange" />
+ </h:inputText>
+ <rich:message for="intValue" showDetail="true" showSummary="true" />
+ </h:column>
+ <f:facet name="footer">
+ <h:panelGroup>
+ <h:outputText>in addition to fields validation, total sum for an all integer values validated for a value less then 20.</h:outputText>
+ <a4j:commandButton value="Submit all fields"></a4j:commandButton>
+ </h:panelGroup>
+ </f:facet>
+ </rich:dataTable>
+ </rich:graphValidator>
+ </a4j:region>
+ <br />
+
+ <!--<rich:graphValidator value="#{graphValidator}">-->
+ <h:panelGrid columns="2" border="2" id="panelGridID">
+
+ <f:facet name="header">
+ <h:outputText value="Ajax Validator test" />
+ </f:facet>
+
+ <h:outputLabel for="mailValue" value="Mail validation:" />
+ <h:panelGroup>
+ <h:inputText value="#{validator.text}" id="mailValue">
+ <rich:ajaxValidator ajaxSingle="#{validator.ajaxSingle}"
+ binding="#{validator.ajaxValidatorComponent}"
+ data="{param1:'param1',param2:'param2'}"
+ disableDefault="#{validator.disableDefault}" event="onchange"
+ eventsQueue="#{validator.eventsQueue}" focus="mailValue"
+ id="ajaxValidatorID"
+ ignoreDupResponses="#{validator.ignoreDupResponses}"
+ immediate="#{validator.immediate}"
+ limitToList="#{validator.limitToList}"
+ onbeforedomupdate="#{event.onbeforedomupdate}"
+ oncomplete="#{event.oncomplete}" onsubmit="#{event.onsubmit}"
+ parentProperties="#{validator.parentProperties}"
+ process="mailValue,booleanValue,assertTrue,eanValue,creditValue"
+ rendered="#{validator.rendered}"
+ renderRegionOnly="#{validator.renderRegionOnly}"
+ requestDelay="#{validator.requestDelay}"
+ reRender="mailValue,booleanValue,assertTrue,eanValue,creditValue"
+ selfRendered="#{validator.selfRendered}" status="mailValue"
+ submitted="#{validator.submitted}" timeout="#{validator.timeout}"></rich:ajaxValidator>
+ </h:inputText>
+ <rich:message for="mailValue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="booleanValue" value="AssertFalse validation:" />
+ <h:panelGroup>
+ <h:selectBooleanCheckbox value="#{validator.booleanValue}"
+ id="booleanValue">
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:selectBooleanCheckbox>
+ <rich:message for="booleanValue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="assertTrue" value="AssertTrue validation:" />
+ <h:panelGroup>
+ <h:selectBooleanCheckbox value="#{validator.assertTrue}"
+ id="assertTrue">
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:selectBooleanCheckbox>
+ <rich:message for="assertTrue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="eanValue" value="EAN validation:" />
+ <h:panelGroup>
+ <h:inputText value="#{validator.ean}" id="eanValue">
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:inputText>
+ <rich:message for="eanValue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="creditValue" value="CreditCardNumber validation:" />
+ <h:panelGroup>
+ <h:inputText value="#{validator.creditValue}" id="creditValue">
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:inputText>
+ <rich:message for="creditValue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="sizeValues" value="Size validation:" />
+ <h:panelGroup>
+ <h:selectOneMenu value="#{validator.sizeValue}">
+ <f:selectItems id="sizeValues" value="#{validator.sizeValues}"></f:selectItems>
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:selectOneMenu>
+ <rich:message for="sizeValues" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputText value="total length should be less than 50" />
+ <a4j:commandButton value="validate all fields" reRender="panelGridID"></a4j:commandButton>
+
+ <f:facet name="footer">
+ <h:outputText value="...together with graphValidator" />
+ </f:facet>
+
+ </h:panelGrid>
+ <!--</rich:graphValidator>-->
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorDefault.xhtml
===================================================================
Added: trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorProperty.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorProperty.xhtml (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorProperty.xhtml 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,83 @@
+<f:subview xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich" id="validatorPropertySubviewID">
+ <h:commandButton value="add(ajaxValidator) test"
+ action="#{validator.add}"></h:commandButton>
+ <rich:spacer height="2" width="20"></rich:spacer>
+ <h:commandButton value="add(graphValidator) test" action="#{data.add}"></h:commandButton>
+ <br />
+ <br />
+ <h:panelGrid columns="2">
+ <h:outputText value="Ajax Validator test"
+ style="align:center; font-weight:bold;" />
+ <h:outputText value="Graph Validator test"
+ style="align:center; font-weight:bold;" />
+ <h:panelGrid columns="2" border="2">
+
+ <h:outputText value="ajaxSingle" />
+ <h:selectBooleanCheckbox value="#{validator.ajaxSingle}"
+ onchange="submit();" />
+
+ <h:commandButton actionListener="#{validator.checkBinding}"
+ value="Binding" />
+ <h:outputText value="#{validator.bindLabel}" />
+
+ <h:outputText value="disableDefault" />
+ <h:selectBooleanCheckbox value="#{validator.disableDefault}"
+ onchange="submit();" />
+
+ <h:outputText value="eventsQueue" />
+ <h:inputText value="#{validator.eventsQueue}">
+ <a4j:support event="onchange" reRender="ajaxValidatorID"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="ignoreDupResponces" />
+ <h:selectBooleanCheckbox value="#{validator.ignoreDupResponses}"
+ onchange="submit();" />
+
+ <h:outputText value="immediate" />
+ <h:selectBooleanCheckbox value="#{validator.immediate}"
+ onchange="submit();" />
+
+ <h:outputText value="limitToList" />
+ <h:selectBooleanCheckbox value="#{validator.limitToList}"
+ onchange="submit();" />
+
+ <h:outputText value="renderRegionOnly" />
+ <h:selectBooleanCheckbox value="#{validator.renderRegionOnly}"
+ onchange="submit();" />
+
+ <h:outputText value="requestDelay" />
+ <h:inputText value="#{validator.requestDelay}">
+ <a4j:support event="onchange" reRender="ajaxValidatorID"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="selfRendered" />
+ <h:selectBooleanCheckbox value="#{validator.selfRendered}"
+ onchange="submit();" />
+
+ <h:outputText value="submitted" />
+ <h:selectBooleanCheckbox value="#{validator.submitted}"
+ onchange="submit();" />
+
+ <h:outputText value="timeout" />
+ <h:inputText value="#{validator.timeout}">
+ <a4j:support event="onchange" reRender="ajaxValidatorID"></a4j:support>
+ </h:inputText>
+ </h:panelGrid>
+
+
+ <h:panelGrid columns="2" border="2" style="float:top;">
+ <h:commandButton actionListener="#{data.checkBinding}"
+ value="Binding" />
+ <h:outputText value="#{data.bindLabel}" />
+
+ <h:outputText value="rendered" />
+ <h:selectBooleanCheckbox value="#{data.rendered}"
+ onchange="submit();" />
+ </h:panelGrid>
+
+ </h:panelGrid>
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorStraightforward.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorStraightforward.xhtml (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Validator/ValidatorStraightforward.xhtml 2008-07-17 11:47:03 UTC (rev 9650)
@@ -0,0 +1,71 @@
+<f:subview xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ id="validatorStraightforwardSubviewID">
+ <a4j:region>
+ <rich:dataTable value="#{data.data}" var="data" id="SizeValidationID">
+ showSummary="true" />
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#1" />
+ </f:facet>
+ <a4j:commandLink value="Select" reRender="SizeValidationID"></a4j:commandLink>
+ <f:facet name="footer">
+ <h:outputText value="#1" />
+ </f:facet>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#4" />
+ </f:facet>
+ <h:outputText value="#{data.int2}"></h:outputText>
+ <f:facet name="footer">
+ <h:outputText value="#4" />
+ </f:facet>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#5" />
+ </f:facet>
+ <h:outputText value="#{data.str1}"></h:outputText>
+ <f:facet name="footer">
+ <h:outputText value="#5" />
+ </f:facet>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#7" />
+ </f:facet>
+ <h:graphicImage value="#{data.str2}"></h:graphicImage>
+ <h:outputText value="#{data.str2}"></h:outputText>
+ <f:facet name="footer">
+ <h:outputText value="#7" />
+ </f:facet>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#9" />
+ </f:facet>
+ <h:selectBooleanCheckbox value="#{data.bool0}"></h:selectBooleanCheckbox>
+ <f:facet name="footer">
+ <h:outputText value="#9" />
+ </f:facet>
+ </rich:column>
+ </rich:dataTable>
+ </a4j:region>
+ <br />
+ <a4j:region>
+ <h:outputText value="Enter quantity of lines [data]" />
+ <h:panelGroup>
+ <h:inputText value="#{data.length}"/>
+ <a4j:commandButton action="#{data.addNewItem}" value="ok"
+ reRender="SizeValidationID"></a4j:commandButton>
+ </h:panelGroup>
+ </a4j:region>
+</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Validator.xml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Validator.xml 2008-07-17 11:45:10 UTC (rev 9649)
+++ trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Validator.xml 2008-07-17 11:47:03 UTC (rev 9650)
@@ -3,9 +3,29 @@
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
<managed-bean>
- <managed-bean-name>validatorBean</managed-bean-name>
- <managed-bean-class>validator.ValidatorBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>validator.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>data</managed-bean-name>
+ <managed-bean-class>validator.DataBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>lengthBean</managed-bean-name>
+ <managed-bean-class>validator.LengthBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+<managed-bean>
+ <managed-bean-name>validator</managed-bean-name>
+ <managed-bean-class>validator.ValidatorBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>graphValidator</managed-bean-name>
+ <managed-bean-class>validator.GraphValidatorBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
</faces-config>
Modified: trunk/test-applications/facelets/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/WEB-INF/web.xml 2008-07-17 11:45:10 UTC (rev 9649)
+++ trunk/test-applications/facelets/src/main/webapp/WEB-INF/web.xml 2008-07-17 11:47:03 UTC (rev 9650)
@@ -41,7 +41,7 @@
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
- <param-value>/WEB-INF/faces-config-ComponentInfo.xml,/WEB-INF/faces-config-HotKey.xml,/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-INF/faces-config-Calendar.xml,/WEB-INF/faces-config-Gmap.xml,/WEB-INF/faces-config-DataFilterSlider.xml,/WEB-INF/faces-config-Separator.xml,/WEB-INF/faces-config-Spacer.xml,/WEB-INF/faces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.xml,/WEB-INF/faces-config-Message.xml!
,/WEB-INF/faces-config-VirtualEarth.xml,/WEB-INF/faces-config-Effect.xml,/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComponent.xml,/WEB-INF/faces-config-Event.xml,/WEB-INF/faces-config-ProgressBar.xml,/WEB-INF/faces-config-Options.xml,/WEB-INF/faces-config-SortingAndFiltering.xml,/WEB-INF/faces-config-Style.xml,/WEB-INF/faces-config-FileUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/faces-config-InplaceInput.xml,/WEB-INF/!
faces-config-Skinning.xml,/WEB-INF/faces-config-Custom.xml</param-valu
e>
+ <param-value>/WEB-INF/faces-config-Validator.xml,/WEB-INF/faces-config-ComponentInfo.xml,/WEB-INF/faces-config-HotKey.xml,/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-INF/faces-config-Calendar.xml,/WEB-INF/faces-config-Gmap.xml,/WEB-INF/faces-config-DataFilterSlider.xml,/WEB-INF/faces-config-Separator.xml,/WEB-INF/faces-config-Spacer.xml,/WEB-INF/faces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.x!
ml,/WEB-INF/faces-config-Message.xml,/WEB-INF/faces-config-VirtualEarth.xml,/WEB-INF/faces-config-Effect.xml,/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComponent.xml,/WEB-INF/faces-config-Event.xml,/WEB-INF/faces-config-ProgressBar.xml,/WEB-INF/faces-config-Options.xml,/WEB-INF/faces-config-SortingAndFiltering.xml,/WEB-INF/faces-config-Style.xml,/WEB-INF/faces-config-FileUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/fac!
es-config-InplaceInput.xml,/WEB-INF/faces-config-Skinning.xml,/WEB-INF
/faces-config-Custom.xml</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
16 years, 2 months
JBoss Rich Faces SVN: r9649 - in trunk/test-applications/jsp/src/main: webapp/SuggestionBox and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: adubovsky
Date: 2008-07-17 07:45:10 -0400 (Thu, 17 Jul 2008)
New Revision: 9649
Modified:
trunk/test-applications/jsp/src/main/java/sb/Sb.java
trunk/test-applications/jsp/src/main/webapp/SuggestionBox/SuggestionBoxProperty.jsp
Log:
changes in modalPanel
Modified: trunk/test-applications/jsp/src/main/java/sb/Sb.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/sb/Sb.java 2008-07-17 11:44:52 UTC (rev 9648)
+++ trunk/test-applications/jsp/src/main/java/sb/Sb.java 2008-07-17 11:45:10 UTC (rev 9649)
@@ -17,7 +17,7 @@
private ArrayList cities;
private ArrayList data;
- private int first;
+ private String first;
private int zindex;
private double frequency;
private String property;
@@ -91,7 +91,7 @@
shadowDepth = Integer.toString(SuggestionBoxRenderer.SHADOW_DEPTH);
zindex = 3;
rows = "0";
- first = 0;
+ first = "0";
cellspacing = "2";
cellpadding = "2";
minchars = "1";
@@ -197,15 +197,15 @@
this.cellspacing = cellspacing;
}
- public int getFirst() {
+ public String getFirst() {
return first;
}
- public int getIntFirst() {
+ public String getIntFirst() {
return first;
}
- public void setFirst(int first) {
+ public void setFirst(String first) {
this.first = first;
}
Modified: trunk/test-applications/jsp/src/main/webapp/SuggestionBox/SuggestionBoxProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/SuggestionBox/SuggestionBoxProperty.jsp 2008-07-17 11:44:52 UTC (rev 9648)
+++ trunk/test-applications/jsp/src/main/webapp/SuggestionBox/SuggestionBoxProperty.jsp 2008-07-17 11:45:10 UTC (rev 9649)
@@ -131,11 +131,6 @@
<h:outputText value="tokens:"></h:outputText>
<h:inputText value="#{sb.tokens}"></h:inputText>
- <f:verbatim>MinChars</f:verbatim>
- <h:inputText value="#{sb.minchars}">
- <a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
- </h:inputText>
-
<h:outputText value="Shadow Opacity"></h:outputText>
<h:selectOneRadio value="#{sb.shadowOpacity}">
<f:selectItem itemLabel="1" itemValue="1" />
16 years, 2 months
JBoss Rich Faces SVN: r9648 - in trunk/test-applications/facelets/src/main: webapp/SuggestionBox and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: adubovsky
Date: 2008-07-17 07:44:52 -0400 (Thu, 17 Jul 2008)
New Revision: 9648
Modified:
trunk/test-applications/facelets/src/main/java/sb/Sb.java
trunk/test-applications/facelets/src/main/webapp/SuggestionBox/SuggestionBox.xhtml
trunk/test-applications/facelets/src/main/webapp/SuggestionBox/SuggestionBoxProperty.xhtml
Log:
changes in modalPanel
Modified: trunk/test-applications/facelets/src/main/java/sb/Sb.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/sb/Sb.java 2008-07-17 11:16:52 UTC (rev 9647)
+++ trunk/test-applications/facelets/src/main/java/sb/Sb.java 2008-07-17 11:44:52 UTC (rev 9648)
@@ -5,6 +5,9 @@
import java.util.Iterator;
import java.util.List;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
import org.richfaces.component.html.HtmlSuggestionBox;
import org.richfaces.renderkit.html.SuggestionBoxRenderer;
@@ -37,7 +40,14 @@
private String value;
private String dir;
private int requestDelay;
- private HtmlSuggestionBox htmlSB = null;
+ private HtmlSuggestionBox mySuggestionBox = null;
+ private String bindLabel;
+ private boolean bypassUpdates;
+ private String frame;
+ private boolean ignoreDupResponses;
+ private boolean immediate;
+ private String nothingLabel;
+ private boolean usingSuggestObjects;
/*
* private static final String[] cit = { "Abba", "Abbeville", "Acworth",
@@ -58,14 +68,21 @@
private static final String[] citySEAsia = {"SouthEast Asia", "Ashmore and Cartier Islands", "Brunei", "Burma", "Cambodia", "Christmas Island", "Cocos (Keeling) Islands", "East Timor", "Hong Kong", "Indonesia", "Laos", "Malaysia", "Paracel Islands", "Philippines", "Singapore", "Spratly Islands", "Taiwan", "Thailand", "Vietnam"};
private static final String[] cityCaribbean = {"The Caribbean", "Anguilla", "Antigua and Barbuda", "Aruba", "Barbados", "British Virgin Islands", "Cayman Islands", "Cuba", "Dominica", "Dominican Republic", "Grenada", "Guadeloupe", "Haiti", "Jamaica", "Martinique", "Montserrat", "Navassa Island", "Netherlands Antilles", "Puerto Rico", "Saint Barthelemy", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "The Bahamas", "Trinidad and Tobago", "Turks and Caicos Islands", "Virgin Islands"};
-
+
+ public void addHtmlSuggestionBox(){
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(mySuggestionBox);
+ }
+
public Sb() {
+ ignoreDupResponses = true;
+ immediate = true;
dir = "LTR";
ajaxSingle = false;
rendered = true;
selfRendered = false;
value = "a, ";
- requestDelay = 100;
+ requestDelay = 500;
tokens = "[ ,";
border = "1";
width = "200";
@@ -73,7 +90,6 @@
shadowOpacity = "1";
shadowDepth = Integer.toString(SuggestionBoxRenderer.SHADOW_DEPTH);
zindex = 3;
- focus = true;
rows = "0";
first = 0;
cellspacing = "2";
@@ -81,9 +97,23 @@
minchars = "1";
frequency = 0;
rules = "none";
+ bindLabel = "Not checked";
+ bypassUpdates = true;
+ frame = "void";
+ nothingLabel = "Nothinf label works!";
+ usingSuggestObjects = true;
setCities(getAllData());
}
-
+
+ public void selectValue(ActionEvent actionEvent){
+ System.out.println("----inside selectValue(ActionEvent actionEvent)-----");
+ }
+
+ public void checkBinding(ActionEvent actionEvent) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = mySuggestionBox.getClientId(context) + "; param: " + mySuggestionBox.getParam();
+ }
+
public List autocomplete(Object event) {
String pref = event.toString();
ArrayList result = new ArrayList();
@@ -100,12 +130,6 @@
return result;
}
- public String add(){
- ComponentInfo info = ComponentInfo.getInstance();
- info.addField(htmlSB);
- return null;
- }
-
public ArrayList getCities() {
return cities;
}
@@ -414,11 +438,67 @@
this.dir = dir;
}
- public HtmlSuggestionBox getHtmlSB() {
- return htmlSB;
+ public HtmlSuggestionBox getMySuggestionBox() {
+ return mySuggestionBox;
}
- public void setHtmlSB(HtmlSuggestionBox htmlSB) {
- this.htmlSB = htmlSB;
+ public void setMySuggestionBox(HtmlSuggestionBox mySuggestionBox) {
+ this.mySuggestionBox = mySuggestionBox;
}
+
+ public String getBindLabel() {
+ return bindLabel;
+ }
+
+ public void setBindLabel(String bindLabel) {
+ this.bindLabel = bindLabel;
+ }
+
+ public boolean isBypassUpdates() {
+ return bypassUpdates;
+ }
+
+ public void setBypassUpdates(boolean bypassUpdates) {
+ this.bypassUpdates = bypassUpdates;
+ }
+
+ public String getFrame() {
+ return frame;
+ }
+
+ public void setFrame(String frame) {
+ this.frame = frame;
+ }
+
+ public boolean isIgnoreDupResponses() {
+ return ignoreDupResponses;
+ }
+
+ public void setIgnoreDupResponses(boolean ignoreDupResponses) {
+ this.ignoreDupResponses = ignoreDupResponses;
+ }
+
+ public boolean isImmediate() {
+ return immediate;
+ }
+
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ public String getNothingLabel() {
+ return nothingLabel;
+ }
+
+ public void setNothingLabel(String nothingLabel) {
+ this.nothingLabel = nothingLabel;
+ }
+
+ public boolean isUsingSuggestObjects() {
+ return usingSuggestObjects;
+ }
+
+ public void setUsingSuggestObjects(boolean usingSuggestObjects) {
+ this.usingSuggestObjects = usingSuggestObjects;
+ }
}
Modified: trunk/test-applications/facelets/src/main/webapp/SuggestionBox/SuggestionBox.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/SuggestionBox/SuggestionBox.xhtml 2008-07-17 11:16:52 UTC (rev 9647)
+++ trunk/test-applications/facelets/src/main/webapp/SuggestionBox/SuggestionBox.xhtml 2008-07-17 11:44:52 UTC (rev 9648)
@@ -1,21 +1,62 @@
<f:subview xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" id="suggestionBoxSubviewID">
- <h:messages showDetail="true" />
+<h:messages showDetail="true" />
<f:verbatim>Suggestion Box will suggest you Town's names if it's started with the "a" or "A" letter
<br />
</f:verbatim>
- <h:inputText value="#{sb.property}" id="text" />
- <rich:suggestionbox id="suggestionBoxId" eventsQueue="myEventsQueue" ajaxSingle="#{sb.ajaxSingle}" dir="#{sb.dir}"
- rendered="#{sb.rendered}" requestDelay="#{sb.requestDelay}" selfRendered="#{sb.selfRendered}" value="#{sb.value}" for="text"
- var="result" fetchValue="#{result.text}" suggestionAction="#{sb.autocomplete}" width="#{sb.width}" height="#{sb.height}"
- border="#{sb.border}" zindex="#{sb.zindex}" rules="#{sb.rules}" cellpadding="#{sb.cellpadding}"
- cellspacing="#{sb.cellspacing}" first="#{sb.first}" minChars="#{sb.minchars}" tokens="#{sb.tokens}" bgcolor="#{sb.bgColor}"
- focus="#{sb.forcus}" title="#{result.text}" summary="summary" shadowOpacity="#{sb.shadowOpacity}"
- shadowDepth="#{sb.shadowDepth}" selectValueClass="mousemove" frequency="#{sb.frequency}" nothingLabel="nothingLabel work! "
- entryClass="#{style.entryClass}" popupClass="#{style.popupClass}" popupStyle="#{style.popupStyle}" style="#{style.style}" styleClass="#{style.styleClass}" selectedClass="#{style.selectedClass}" rowClasses="#{style.rowClasses}"
- oncomplete="#{event.oncomplete}" onselect="#{event.onselect}" onbeforedomupdate="#{event.onbeforedomupdate}" onsubmit="#{event.onsubmit}"
- binding="#{sb.htmlSB}">
- <h:column>
+ <h:inputText value="#{sb.property}" id="text">
+ <f:validateLength minimum="0" maximum="30"/>
+ </h:inputText>
+ <rich:suggestionbox id="suggestionBoxId"
+ ajaxSingle="#{sb.ajaxSingle}"
+ bgcolor="#{sb.bgColor}"
+ binding="#{sb.mySuggestionBox}"
+ bypassUpdates="#{sb.bypassUpdates}"
+ cellpadding="#{sb.cellpadding}"
+ cellspacing="#{sb.cellspacing}"
+ dir="#{sb.dir}"
+ entryClass="#{style.entryClass}"
+ eventsQueue="myEventsQueue"
+ fetchValue="#{result.text}"
+ first="#{sb.first}"
+ for="text"
+ frame="#{sb.frame}"
+ frequency="#{sb.frequency}"
+ height="#{sb.height}"
+ ignoreDupResponses="#{sb.ignoreDupResponses}"
+ immediate="#{sb.immediate}"
+ limitToList="false"
+ minChars="#{sb.minchars}"
+ nothingLabel="#{sb.nothingLabel}"
+ onbeforedomupdate="#{event.onbeforedomupdate}"
+ oncomplete="#{event.oncomplete}"
+ onobjectchange="#{event.onobjectchange}"
+ onselect="#{event.onselect}"
+ onsubmit="#{event.onsubmit}"
+ popupStyle="background-color: black;"
+ usingSuggestObjects="#{sb.usingSuggestObjects}"
+ reRender="label"
+ rendered="#{sb.rendered}"
+ requestDelay="#{sb.requestDelay}"
+ selfRendered="#{sb.selfRendered}"
+ var="result"
+ suggestionAction="#{sb.autocomplete}"
+ width="#{sb.width}"
+ border="#{sb.border}"
+ zindex="#{sb.zindex}"
+ rules="#{sb.rules}"
+ tokens="#{sb.tokens}"
+ title="#{result.text}"
+ summary="summary"
+ shadowOpacity="#{sb.shadowOpacity}"
+ shadowDepth="#{sb.shadowDepth}"
+ selectValueClass="mousemove"
+ style="#{style.style}"
+ styleClass="#{style.styleClass}"
+ selectedClass="#{style.selectedClass}"
+ rowClasses="#{style.rowClasses}" >
+
+ <h:column>
<h:outputText value="#{result.city}" />
</h:column>
<h:column>
@@ -25,7 +66,7 @@
<h:outputText value="#{result.flag}" />
</h:column>
<h:column>
- <h:outputLink value="http://www.jboss.com/"><f:verbatim>Link</f:verbatim></h:outputLink>
+ <a4j:htmlCommandLink actionListener="#{sb.selectValue}" value="Click me!"/>
</h:column>
</rich:suggestionbox>
<div style="position: relative; font-size: 50px; z-index: 2; color: navy">z-index</div>
Modified: trunk/test-applications/facelets/src/main/webapp/SuggestionBox/SuggestionBoxProperty.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/SuggestionBox/SuggestionBoxProperty.xhtml 2008-07-17 11:16:52 UTC (rev 9647)
+++ trunk/test-applications/facelets/src/main/webapp/SuggestionBox/SuggestionBoxProperty.xhtml 2008-07-17 11:44:52 UTC (rev 9648)
@@ -5,94 +5,134 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
id="suggestionboxPropertySubviewID">
- <h:commandButton action="#{sb.add}" value="add test" />
+
+ <h:commandButton value="add test" action="#{sb.addHtmlSuggestionBox}"></h:commandButton>
<h:panelGrid columns="2" cellpadding="5px">
+ <h:outputText value="ajaxSingle"></h:outputText>
+ <h:selectBooleanCheckbox value="#{sb.ajaxSingle}" onchange="submit();"></h:selectBooleanCheckbox>
- <h:outputText value="z-index"></h:outputText>
- <h:selectOneRadio value="#{sb.zindex}">
- <f:selectItem itemLabel="1" itemValue="1" />
- <f:selectItem itemLabel="3" itemValue="3" />
- <a4j:support event="onclick" reRender="suggestionBoxId"></a4j:support>
- </h:selectOneRadio>
+ <h:outputText value="bgcolor"></h:outputText>
+ <h:selectOneMenu value="#{sb.bgColor}">
+ <f:selectItem itemLabel="none" itemValue="none" />
+ <f:selectItem itemLabel="aqua" itemValue="aqua" />
+ <f:selectItem itemLabel="blue" itemValue="blue" />
+ <f:selectItem itemLabel="fuchsia" itemValue="fuchsia" />
+ <f:selectItem itemLabel="gray" itemValue="gray" />
+ <f:selectItem itemLabel="lime" itemValue="lime" />
+ <f:selectItem itemLabel="maroon" itemValue="maroon" />
+ <f:selectItem itemLabel="purple" itemValue="purple" />
+ <f:selectItem itemLabel="red" itemValue="red" />
+ <f:selectItem itemLabel="silver" itemValue="silver" />
+ <f:selectItem itemLabel="teal" itemValue="teal" />
+ <f:selectItem itemLabel="yellow" itemValue="yellow" />
+ <f:selectItem itemLabel="white" itemValue="white" />
+ <a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
+ </h:selectOneMenu>
- <h:outputText value="requestDelay"></h:outputText>
- <h:inputText value="#{sb.requestDelay}">
+ <h:commandButton id="bindingButtonID"
+ actionListener="#{sb.checkBinding}" value="binding and param" />
+ <h:outputText value="#{sb.bindLabel}" />
+
+ <h:outputText value="border" />
+ <h:inputText value="#{sb.border}">
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="value" />
- <h:inputText value="#{sb.value}">
+ <h:outputText value="bypassUpdates"></h:outputText>
+ <h:selectBooleanCheckbox value="#{sb.bypassUpdates}"
+ onchange="submit();" />
+
+ <h:outputText value="cellpadding" />
+ <h:inputText value="#{sb.cellpadding}">
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="Frequency" />
- <h:inputText value="#{sb.frequency}">
+ <h:outputText value="cellspacing" />
+ <h:inputText value="#{sb.cellspacing}">
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="Border" />
- <h:inputText value="#{sb.border}">
+ <h:outputText value="dir"></h:outputText>
+ <h:selectOneMenu value="#{sb.dir}">
+ <f:selectItem itemLabel="RTL" itemValue="RTL" />
+ <f:selectItem itemLabel="LTR" itemValue="LTR" />
+ </h:selectOneMenu>
+
+ <h:outputText value="first" />
+ <h:inputText value="#{sb.first}">
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="Width" />
- <h:inputText value="#{sb.width}">
+ <h:outputText value="frame"></h:outputText>
+ <h:selectOneMenu value="#{sb.frame}">
+ <f:selectItem itemLabel="void" itemValue="void" />
+ <f:selectItem itemLabel="above" itemValue="above" />
+ <f:selectItem itemLabel="below" itemValue="below" />
+ <f:selectItem itemLabel="hsides" itemValue="hsides" />
+ <f:selectItem itemLabel="lhs" itemValue="lhs" />
+ <f:selectItem itemLabel="rhs" itemValue="rhs" />
+ <f:selectItem itemLabel="vsides" itemValue="vsides" />
+ <f:selectItem itemLabel="box" itemValue="box" />
+ <f:selectItem itemLabel="border " itemValue="border " />
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
+ </h:selectOneMenu>
+
+ <h:outputText value="frequency" />
+ <h:inputText value="#{sb.frequency}">
+ <a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="Height" />
+ <h:outputText value="height" />
<h:inputText value="#{sb.height}">
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="Cellpadding" />
- <h:inputText value="#{sb.cellpadding}">
+ <h:outputText value="ignoreDupResponses"></h:outputText>
+ <h:selectBooleanCheckbox value="#{sb.ignoreDupResponses}"
+ onchange="submit();"></h:selectBooleanCheckbox>
+
+ <h:outputText value="immediate"></h:outputText>
+ <h:selectBooleanCheckbox value="#{sb.immediate}" onchange="submit();"></h:selectBooleanCheckbox>
+
+ <h:outputText value="minChars" />
+ <h:inputText value="#{sb.minchars}">
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="Cellspacing" />
- <h:inputText value="#{sb.cellspacing}">
+ <h:outputText value="nothingLabel" />
+ <h:inputText value="#{sb.nothingLabel}">
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="First" />
- <h:inputText value="#{sb.first}">
+ <h:outputText value="usingSuggestObjects"></h:outputText>
+ <h:selectBooleanCheckbox value="#{sb.usingSuggestObjects}"
+ onchange="submit();"></h:selectBooleanCheckbox>
+
+ <h:outputText value="z-index"></h:outputText>
+ <h:selectOneRadio value="#{sb.zindex}">
+ <f:selectItem itemLabel="1" itemValue="1" />
+ <f:selectItem itemLabel="3" itemValue="3" />
+ <a4j:support event="onclick" reRender="suggestionBoxId"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="requestDelay"></h:outputText>
+ <h:inputText value="#{sb.requestDelay}">
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="tokens:"></h:outputText>
- <h:inputText value="#{sb.tokens}"></h:inputText>
+ <h:outputText value="value" />
+ <h:inputText value="#{sb.value}">
+ <a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
+ </h:inputText>
- <f:verbatim>MinChars</f:verbatim>
- <h:inputText value="#{sb.minchars}">
+ <h:outputText value="Width" />
+ <h:inputText value="#{sb.width}">
<a4j:support event="onchange" reRender="suggestionBoxId"></a4j:support>
</h:inputText>
- <h:outputText value="dir"></h:outputText>
- <h:selectOneMenu value="#{sb.dir}">
- <f:selectItem itemLabel="RTL" itemValue="RTL" />
- <f:selectItem itemLabel="LTR" itemValue="LTR" />
- </h:selectOneMenu>
+ <h:outputText value="tokens:"></h:outputText>
+ <h:inputText value="#{sb.tokens}"></h:inputText>
-
- <h:outputText value="Background Colour"></h:outputText>
- <h:selectOneMenu value="#{sb.bgColor}">
- <f:selectItem itemLabel="none" itemValue="none" />
- <f:selectItem itemLabel="aqua" itemValue="aqua" />
- <f:selectItem itemLabel="blue" itemValue="blue" />
- <f:selectItem itemLabel="fuchsia" itemValue="fuchsia" />
- <f:selectItem itemLabel="gray" itemValue="gray" />
- <f:selectItem itemLabel="lime" itemValue="lime" />
- <f:selectItem itemLabel="maroon" itemValue="maroon" />
- <f:selectItem itemLabel="purple" itemValue="purple" />
- <f:selectItem itemLabel="red" itemValue="red" />
- <f:selectItem itemLabel="silver" itemValue="silver" />
- <f:selectItem itemLabel="teal" itemValue="teal" />
- <f:selectItem itemLabel="yellow" itemValue="yellow" />
- <f:selectItem itemLabel="white" itemValue="white" />
- <a4j:support event="onclick" reRender="suggestionBoxId"></a4j:support>
- </h:selectOneMenu>
-
<h:outputText value="Shadow Opacity"></h:outputText>
<h:selectOneRadio value="#{sb.shadowOpacity}">
<f:selectItem itemLabel="1" itemValue="1" />
@@ -116,9 +156,6 @@
<a4j:support event="onclick" reRender="suggestionBoxId"></a4j:support>
</h:selectOneRadio>
- <h:outputText value="ajaxSingle"></h:outputText>
- <h:selectBooleanCheckbox value="#{sb.ajaxSingle}" onchange="submit();"></h:selectBooleanCheckbox>
-
<h:outputText value="selfRendered"></h:outputText>
<h:selectBooleanCheckbox value="#{sb.selfRendered}"
onchange="submit();"></h:selectBooleanCheckbox>
@@ -128,11 +165,4 @@
</h:panelGrid>
<br />
<br />
- <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
- <h:panelGrid columns="2">
- <a4j:commandLink value="getSubmitedValue" reRender="findID"></a4j:commandLink>
-
- <h:outputText id="findID"
- value="#{rich:findComponent('suggestionBoxId').submitedValue}" />
- </h:panelGrid>
</f:subview>
\ No newline at end of file
16 years, 2 months
JBoss Rich Faces SVN: r9647 - trunk/test-applications/jsp/src/main/webapp/Validator.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-07-17 07:16:52 -0400 (Thu, 17 Jul 2008)
New Revision: 9647
Modified:
trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorStraightforward.jsp
Log:
Modified: trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorStraightforward.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorStraightforward.jsp 2008-07-17 09:39:30 UTC (rev 9646)
+++ trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorStraightforward.jsp 2008-07-17 11:16:52 UTC (rev 9647)
@@ -3,6 +3,7 @@
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="validatorStraightforwardSubviewID">
+<a4j:region>
<rich:dataTable value="#{data.data}" var="data" id="SizeValidationID">
showSummary="true" />
<rich:column>
@@ -56,6 +57,7 @@
</f:facet>
</rich:column>
</rich:dataTable>
+ </a4j:region>
<br />
<a4j:region>
<h:outputText value="Enter quantity of lines [data]" />
16 years, 2 months
JBoss Rich Faces SVN: r9646 - in trunk/test-applications/jsp/src/main: webapp/Validator and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-07-17 05:39:30 -0400 (Thu, 17 Jul 2008)
New Revision: 9646
Added:
trunk/test-applications/jsp/src/main/java/validator/GraphValidatorBean.java
trunk/test-applications/jsp/src/main/java/validator/TestValidable.java
trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java
Removed:
trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java
Modified:
trunk/test-applications/jsp/src/main/java/validator/DataBean.java
trunk/test-applications/jsp/src/main/webapp/Validator/Validator.jsp
trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorProperty.jsp
trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorStraightforward.jsp
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Validator.xml
Log:
AjaxValidator & GraphValidator
Modified: trunk/test-applications/jsp/src/main/java/validator/DataBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/validator/DataBean.java 2008-07-17 08:07:38 UTC (rev 9645)
+++ trunk/test-applications/jsp/src/main/java/validator/DataBean.java 2008-07-17 09:39:30 UTC (rev 9646)
@@ -4,22 +4,94 @@
package validator;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-
+import java.util.Random;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
import org.hibernate.validator.Max;
+import org.hibernate.validator.Size;
import org.hibernate.validator.Valid;
-
+import org.richfaces.component.UIGraphValidator;
+import util.componentInfo.ComponentInfo;
+import util.data.Data;
/**
- * @author asmirnov
+ * @author mvitenkov
*
*/
public class DataBean {
private final List<Validable> beans;
+ private UIGraphValidator graphValidatorComponent = null;
+ private String bindLabel;
+ private boolean rendered;
+ @Size(min=2,max=5,message="Size validation failed!!!!")
+ private ArrayList<Data> data;
+ private int length;
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ public ArrayList<Data> getData() {
+ return data;
+ }
+
+ public void setData(ArrayList<Data> data) {
+ this.data = data;
+ }
+
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ public void checkBinding(ActionEvent actionEvent){
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = graphValidatorComponent.getClientId(context).toString();
+ }
+
+ public String add(){
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(graphValidatorComponent);
+ return null;
+ }
+ public String addNewItem() {
+ if (length < 0)
+ length = 0;
+ if (data.size() > length)
+ for (int i = length; i < data.size();)
+ data.remove(i);
+ else{
+ Random r = new Random();
+ for (int i = data.size() + 1; i <= length; i++)
+ data.add(new Data(i, r.nextInt(1000), Data.Random(6), r.nextInt(10000) + 98389, Data.Random(r.nextInt(10) + 1), r.nextInt(500000), Data.statusIcon[i % 5], Data.Random(3), false));
+ }
+ return null;
+ }
+
+ public String getBindLabel() {
+ return bindLabel;
+ }
+
+ public void setBindLabel(String bindLabel) {
+ this.bindLabel = bindLabel;
+ }
+
+ public UIGraphValidator getGraphValidatorComponent() {
+ return graphValidatorComponent;
+ }
+
+ public void setGraphValidatorComponent(UIGraphValidator graphValidatorComponent) {
+ this.graphValidatorComponent = graphValidatorComponent;
+ }
+
/**
* @return the beans
*/
@@ -36,6 +108,12 @@
beans.add(new MinBean());
beans.add(new MaxBean());
beans.add(new MinMaxBean());
+ this.bindLabel = "Click Binding";
+ this.rendered = true;
+ this.data = new ArrayList<Data>();
+ Random r = new Random();
+ for(int i = 0; i < 10; i++)
+ data.add(new Data(i, r.nextInt(1000), Data.Random(6), r.nextInt(10000) + 98389, Data.Random(r.nextInt(10) + 1), r.nextInt(500000), Data.statusIcon[i % 5], Data.Random(3), false)); //new Data(i, Data.Random(5), Data.statusIcon[i % 5], Data.Random(6), false));
}
@Max(value=20,message="Total value should be less then 20")
Added: trunk/test-applications/jsp/src/main/java/validator/GraphValidatorBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/validator/GraphValidatorBean.java (rev 0)
+++ trunk/test-applications/jsp/src/main/java/validator/GraphValidatorBean.java 2008-07-17 09:39:30 UTC (rev 9646)
@@ -0,0 +1,32 @@
+package validator;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.Valid;
+import org.richfaces.component.UIGraphValidator;
+
+public class GraphValidatorBean {
+
+ private final List<TestValidable> beans;
+
+ @Valid
+ public List<TestValidable> getBeans() {
+ return beans;
+ }
+
+ public GraphValidatorBean() {
+ beans = new ArrayList(1);
+ beans.add(new ValidatorBean());
+ }
+ @Max(value=50,message="total length > 50")
+ @Min(value=10,message="total length < 10")
+ public int getTotal(){
+ int total = 0;
+ for (TestValidable bean : beans) {
+ total += bean.getText().toString().length() + bean.getDateValue().toString().length();
+ }
+ return total;
+ }
+}
Added: trunk/test-applications/jsp/src/main/java/validator/TestValidable.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/validator/TestValidable.java (rev 0)
+++ trunk/test-applications/jsp/src/main/java/validator/TestValidable.java 2008-07-17 09:39:30 UTC (rev 9646)
@@ -0,0 +1,13 @@
+package validator;
+
+
+public interface TestValidable {
+
+ public String getText();
+
+ public int getIntValue();
+
+ public boolean isBooleanValue();
+
+ public String getDateValue();
+}
Deleted: trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java 2008-07-17 08:07:38 UTC (rev 9645)
+++ trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java 2008-07-17 09:39:30 UTC (rev 9646)
@@ -1,37 +0,0 @@
-package validator;
-
-import javax.faces.component.UIMessages;
-
-import org.hibernate.validator.CreditCardNumber;
-import org.hibernate.validator.Email;
-
-public class ValidatorBean {
- @Email(message="not a valid email value!")
- private String mailValue;
- @CreditCardNumber(message="not a valid credit card number")
- private String creditValue;
-
- public String getCreditValue() {
- return creditValue;
- }
-
- public void setCreditValue(String creditValue) {
- this.creditValue = creditValue;
- }
-
- public String getMailValue() {
- return mailValue;
- }
-
- public ValidatorBean(){
- this.mailValue = "";
- this.creditValue = "";
- }
- public String getMailDescription() {
- return "E-mail validation:";
- }
-
- public String getCreditDescription() {
- return "Credit card validation:";
- }
-}
Added: trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java (rev 0)
+++ trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java 2008-07-17 09:39:30 UTC (rev 9646)
@@ -0,0 +1,290 @@
+package validator;
+
+import java.util.ArrayList;
+import java.util.Date;
+import javax.faces.event.ActionEvent;
+import javax.faces.model.SelectItem;
+import org.hibernate.validator.AssertFalse;
+import org.hibernate.validator.AssertTrue;
+import org.hibernate.validator.CreditCardNumber;
+import org.hibernate.validator.EAN;
+import org.hibernate.validator.Email;
+import org.hibernate.validator.Future;
+import org.hibernate.validator.Pattern;
+import org.hibernate.validator.Size;
+import org.richfaces.component.UIBeanValidator;
+import util.componentInfo.ComponentInfo;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+
+public class ValidatorBean implements TestValidable{
+ @Email(message="Mail validation failed!")
+ private String text;
+ @AssertFalse(message="AssertFalse validation failed!")
+ private boolean booleanValue;
+ @AssertTrue(message="Asserttrue validation failed!")
+ private boolean assertTrue;
+ @Future(message="Future validation failed!")
+ private String dateValue;
+ @Pattern(regex="^\b1234\b*$") //Searh "1234" as a whole word
+ private int intValue;
+ @EAN(message="EAN validation failed")
+ private String ean;
+ @CreditCardNumber(message="CreditCardNumber validation failed!")
+ private String creditValue;
+ @Size(min=1,max=5,message="Size validation failed!")
+ private ArrayList<SelectItem> sizeValues;
+ private String sizeValue;
+ private UIBeanValidator ajaxValidatorComponent = null;
+ private boolean ajaxSingle;
+ private String bindLabel;
+ private boolean disableDefault;
+ private String eventsQueue;
+ private boolean ignoreDupResponses;
+ private boolean immediate;
+ private boolean limitToList;
+ private UIComponent parentProperties = null;
+ private boolean rendered;
+ private boolean renderRegionOnly;
+ private int requestDelay;
+ private boolean selfRendered;
+ private boolean submitted;
+ private int timeout;
+
+ public int getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
+ }
+
+ public boolean isSubmitted() {
+ return submitted;
+ }
+
+ public void setSubmitted(boolean submitted) {
+ this.submitted = submitted;
+ }
+
+ public boolean isSelfRendered() {
+ return selfRendered;
+ }
+
+ public void setSelfRendered(boolean selfRendered) {
+ this.selfRendered = selfRendered;
+ }
+
+ public int getRequestDelay() {
+ return requestDelay;
+ }
+
+ public void setRequestDelay(int requestDelay) {
+ this.requestDelay = requestDelay;
+ }
+
+ public boolean isRenderRegionOnly() {
+ return renderRegionOnly;
+ }
+
+ public void setRenderRegionOnly(boolean renderRegionOnly) {
+ this.renderRegionOnly = renderRegionOnly;
+ }
+
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+
+
+ public UIComponent getParentProperties() {
+ return parentProperties;
+ }
+
+ public void setParentProperties(UIComponent parentProperties) {
+ this.parentProperties = parentProperties;
+ }
+
+ public boolean isLimitToList() {
+ return limitToList;
+ }
+
+ public void setLimitToList(boolean limitToList) {
+ this.limitToList = limitToList;
+ }
+
+ public boolean isImmediate() {
+ return immediate;
+ }
+
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ public boolean isIgnoreDupResponses() {
+ return ignoreDupResponses;
+ }
+
+ public void setIgnoreDupResponses(boolean ignoreDupResponses) {
+ this.ignoreDupResponses = ignoreDupResponses;
+ }
+
+ public String getEventsQueue() {
+ return eventsQueue;
+ }
+
+ public void setEventsQueue(String eventsQueue) {
+ this.eventsQueue = eventsQueue;
+ }
+
+ public boolean isDisableDefault() {
+ return disableDefault;
+ }
+
+ public void setDisableDefault(boolean disableDefault) {
+ this.disableDefault = disableDefault;
+ }
+
+ public String getBindLabel() {
+ return bindLabel;
+ }
+
+ public void setBindLabel(String bindLabel) {
+ this.bindLabel = bindLabel;
+ }
+
+ public boolean isAjaxSingle() {
+ return ajaxSingle;
+ }
+
+ public void setAjaxSingle(boolean ajaxSingle) {
+ this.ajaxSingle = ajaxSingle;
+ }
+
+ public String add(){
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(ajaxValidatorComponent);
+ return null;
+ }
+
+ public UIBeanValidator getAjaxValidatorComponent() {
+ return ajaxValidatorComponent;
+ }
+
+ public void setAjaxValidatorComponent(UIBeanValidator ajaxValidatorComponent) {
+ this.ajaxValidatorComponent = ajaxValidatorComponent;
+ }
+
+ public String getSizeValue() {
+ return sizeValue;
+ }
+
+ public void setSizeValue(String sizeValue) {
+ this.sizeValue = sizeValue;
+ }
+
+ public ArrayList<SelectItem> getSizeValues() {
+ return sizeValues;
+ }
+
+ public void setSizeValues(ArrayList<SelectItem> sizeValues) {
+ this.sizeValues = sizeValues;
+ }
+
+ public String getCreditValue() {
+ return creditValue;
+ }
+
+ public void setCreditValue(String creditValue) {
+ this.creditValue = creditValue;
+ }
+
+ public String getEan() {
+ return ean;
+ }
+
+ public void setEan(String ean) {
+ this.ean = ean;
+ }
+
+ public ValidatorBean(){
+ this.ajaxSingle = true;
+ this.text = "mvitenkov(a)exadel.com";
+ this.intValue = 1234;
+ this.dateValue = (new Date()).toString();
+ this.booleanValue = false;
+ this.ean = "97 81550 41198 0";
+ this.creditValue = "visa maestro";
+ this.assertTrue = true;
+ this.sizeValues = new ArrayList<SelectItem>();
+ for(int i=0;i<6;i++){
+ sizeValues.add(new SelectItem("value_"+i,"label_"+i));
+ }
+ this.sizeValue = sizeValues.get(0).getValue().toString();
+ this.bindLabel = "click Binding";
+ this.disableDefault = false;
+ this.eventsQueue = "onchange";
+ this.ignoreDupResponses = true;
+ this.immediate = false;
+ this.limitToList = false;
+ this.rendered = true;
+ this.renderRegionOnly = true;
+ this.requestDelay = 500;
+ this.selfRendered = false;
+ this.submitted = false;
+ this.timeout = 3000;
+ }
+
+ public int getIntValue() {
+
+ return intValue;
+ }
+
+ public String getText() {
+
+ return text;
+ }
+
+ public String getDateValue() {
+
+ return dateValue;
+ }
+ public boolean isBooleanValue() {
+
+ return booleanValue;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public void setBooleanValue(boolean booleanValue) {
+ this.booleanValue = booleanValue;
+ }
+
+ public void setDateValue(String dateValue) {
+ this.dateValue = dateValue;
+ }
+
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public boolean isAssertTrue() {
+ return assertTrue;
+ }
+
+ public void setAssertTrue(boolean assertTrue) {
+ this.assertTrue = assertTrue;
+ }
+
+ public void checkBinding(ActionEvent actionEvent){
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = ajaxValidatorComponent.getClientId(context);
+ }
+}
Modified: trunk/test-applications/jsp/src/main/webapp/Validator/Validator.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Validator/Validator.jsp 2008-07-17 08:07:38 UTC (rev 9645)
+++ trunk/test-applications/jsp/src/main/webapp/Validator/Validator.jsp 2008-07-17 09:39:30 UTC (rev 9646)
@@ -3,6 +3,7 @@
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="validatorSubviewID">
+<a4j:region>
<rich:panel>
<f:facet name="header">
<h:outputText>Single input field with label and message. Validated by AJAX on every changing.</h:outputText>
@@ -15,7 +16,8 @@
</rich:panel>
<h2>Input fields with label and message in the JSF dataTable. Each
field validated by AJAX on "onchange" event</h2>
- <rich:graphValidator value="#{data}">
+ <rich:graphValidator value="#{data}" binding="#{data.graphValidatorComponent}" id="graphValidatorID"
+ rendered="#{data.rendered}">
<rich:dataTable value="#{data.beans}" var="bean" id="table">
<f:facet name="header">
<h:outputText
@@ -29,8 +31,7 @@
<h:outputLabel for="text" value="#{bean.textDescription}" />
<h:inputText id="text" value="#{bean.text}">
<rich:ajaxValidator event="onchange" />
- </h:inputText>
- <rich:message for="text" showDetail="true" showSummary="true" />
+ </h:inputText>
</h:column>
<h:column>
<f:facet name="header">
@@ -45,19 +46,104 @@
<f:facet name="footer">
<h:panelGroup>
<h:outputText>in addition to fields validation, total sum for an all integer values validated for a value less then 20.</h:outputText>
- <h:commandButton value="Submit all fields"></h:commandButton>
+ <a4j:commandButton value="Submit all fields"></a4j:commandButton>
</h:panelGroup>
</f:facet>
</rich:dataTable>
</rich:graphValidator>
+ </a4j:region>
<br />
+ <%--<rich:graphValidator value="#{graphValidator}">--%>
+ <h:panelGrid columns="2" border="2" id="panelGridID">
- <h:panelGroup>
- <h:outputLabel for="mailValue" value="#{validator.mailDescription}" />
- <h:inputText value="#{validator.someValue}" id="mailValue">
+ <f:facet name="header">
+ <h:outputText value="Ajax Validator test" />
+ </f:facet>
+
+ <h:outputLabel for="mailValue" value="Mail validation:" />
+ <h:panelGroup>
+ <h:inputText value="#{validator.text}" id="mailValue">
+ <rich:ajaxValidator ajaxSingle="#{validator.ajaxSingle}" binding="#{validator.ajaxValidatorComponent}"
+ data="{param1:'param1',param2:'param2'}" disableDefault="#{validator.disableDefault}" event="onchange" eventsQueue="#{validator.eventsQueue}"
+ focus="mailValue" id="ajaxValidatorID" ignoreDupResponses="#{validator.ignoreDupResponses}" immediate="#{validator.immediate}"
+ limitToList="#{validator.limitToList}" onbeforedomupdate="#{event.onbeforedomupdate}" oncomplete="#{event.oncomplete}" onsubmit="#{event.onsubmit}"
+ parentProperties="#{validator.parentProperties}" process="mailValue,booleanValue,assertTrue,eanValue,creditValue" rendered="#{validator.rendered}"
+ renderRegionOnly="#{validator.renderRegionOnly}" requestDelay="#{validator.requestDelay}" reRender="mailValue,booleanValue,assertTrue,eanValue,creditValue"
+ selfRendered="#{validator.selfRendered}" status="mailValue" submitted="#{validator.submitted}" timeout="#{validator.timeout}"></rich:ajaxValidator>
+ </h:inputText>
+ <rich:message for="mailValue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="booleanValue" value="AssertFalse validation:" />
+ <h:panelGroup>
+ <h:selectBooleanCheckbox value="#{validator.booleanValue}"
+ id="booleanValue">
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:selectBooleanCheckbox>
+ <rich:message for="booleanValue" showDetail="true"
+ showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="assertTrue" value="AssertTrue validation:" />
+ <h:panelGroup>
+ <h:selectBooleanCheckbox value="#{validator.assertTrue}"
+ id="assertTrue">
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:selectBooleanCheckbox>
+ <rich:message for="assertTrue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+ <%--
+ <h:outputLabel for="dateValue" value="Future validation:" />
+ <h:panelGroup>
+ <h:inputText value="#{validator.dateValue}" id="dateValue">
<rich:ajaxValidator event="onchange"></rich:ajaxValidator>
</h:inputText>
- <rich:message for="mailValue" showDetail="true" showSummary="true" />
- </h:panelGroup>
+ <rich:message for="dateValue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="patternValue" value="Pattern(1234) validation:" />
+ <h:panelGroup>
+ <h:inputText value="#{validator.intValue}" id="patternValue">
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:inputText>
+ <rich:message for="patternValue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+ --%>
+ <h:outputLabel for="eanValue" value="EAN validation:" />
+ <h:panelGroup>
+ <h:inputText value="#{validator.ean}" id="eanValue">
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:inputText>
+ <rich:message for="eanValue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="creditValue" value="CreditCardNumber validation:" />
+ <h:panelGroup>
+ <h:inputText value="#{validator.creditValue}" id="creditValue">
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:inputText>
+ <rich:message for="creditValue" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputLabel for="sizeValues" value="Size validation:" />
+ <h:panelGroup>
+ <h:selectOneMenu value="#{validator.sizeValue}">
+ <f:selectItems id="sizeValues" value="#{validator.sizeValues}"></f:selectItems>
+ <rich:ajaxValidator event="onchange"></rich:ajaxValidator>
+ </h:selectOneMenu>
+ <rich:message for="sizeValues" showDetail="true" showSummary="true" />
+ </h:panelGroup>
+
+ <h:outputText value="total length should be less than 50" />
+ <a4j:commandButton value="validate all fields" reRender="panelGridID"></a4j:commandButton>
+
+ <f:facet name="footer">
+ <h:outputText value="...together with graphValidator" />
+ </f:facet>
+
+ </h:panelGrid>
+ <%--</rich:graphValidator>--%>
+
+
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorProperty.jsp 2008-07-17 08:07:38 UTC (rev 9645)
+++ trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorProperty.jsp 2008-07-17 09:39:30 UTC (rev 9646)
@@ -3,5 +3,79 @@
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="validatorPropertySubviewID">
-<div style="FONT-WEIGHT: bold;">Component properties</div>
+ <h:commandButton value="add(ajaxValidator) test" action="#{validator.add}"></h:commandButton>
+
+ <h:commandButton value="add(graphValidator) test" action="#{data.add}"></h:commandButton>
+ <br />
+ <br />
+ <h:panelGrid columns="2">
+ <h:outputText value="Ajax Validator test" style="align:center; font-weight:bold;"/>
+ <h:outputText value="Graph Validator test" style="align:center; font-weight:bold;"/>
+ <h:panelGrid columns="2" border="2">
+
+ <h:outputText value="ajaxSingle" />
+ <h:selectBooleanCheckbox value="#{validator.ajaxSingle}"
+ onchange="submit();" />
+
+ <h:commandButton actionListener="#{validator.checkBinding}"
+ value="Binding" />
+ <h:outputText value="#{validator.bindLabel}" />
+
+ <h:outputText value="disableDefault" />
+ <h:selectBooleanCheckbox value="#{validator.disableDefault}"
+ onchange="submit();" />
+
+ <h:outputText value="eventsQueue" />
+ <h:inputText value="#{validator.eventsQueue}">
+ <a4j:support event="onchange" reRender="ajaxValidatorID"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="ignoreDupResponces" />
+ <h:selectBooleanCheckbox value="#{validator.ignoreDupResponses}"
+ onchange="submit();" />
+
+ <h:outputText value="immediate" />
+ <h:selectBooleanCheckbox value="#{validator.immediate}"
+ onchange="submit();" />
+
+ <h:outputText value="limitToList" />
+ <h:selectBooleanCheckbox value="#{validator.limitToList}"
+ onchange="submit();" />
+
+ <h:outputText value="renderRegionOnly" />
+ <h:selectBooleanCheckbox value="#{validator.renderRegionOnly}"
+ onchange="submit();" />
+
+ <h:outputText value="requestDelay" />
+ <h:inputText value="#{validator.requestDelay}">
+ <a4j:support event="onchange" reRender="ajaxValidatorID"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="selfRendered" />
+ <h:selectBooleanCheckbox value="#{validator.selfRendered}"
+ onchange="submit();" />
+
+ <h:outputText value="submitted" />
+ <h:selectBooleanCheckbox value="#{validator.submitted}"
+ onchange="submit();" />
+
+ <h:outputText value="timeout" />
+ <h:inputText value="#{validator.timeout}">
+ <a4j:support event="onchange" reRender="ajaxValidatorID"></a4j:support>
+ </h:inputText>
+ </h:panelGrid>
+
+
+ <h:panelGrid columns="2" border="2" style="float:top;">
+ <h:commandButton actionListener="#{data.checkBinding}"
+ value="Binding" />
+ <h:outputText value="#{data.bindLabel}" />
+
+ <h:outputText value="rendered" />
+ <h:selectBooleanCheckbox value="#{data.rendered}"
+ onchange="submit();" />
+ </h:panelGrid>
+
+ </h:panelGrid>
+
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorStraightforward.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorStraightforward.jsp 2008-07-17 08:07:38 UTC (rev 9645)
+++ trunk/test-applications/jsp/src/main/webapp/Validator/ValidatorStraightforward.jsp 2008-07-17 09:39:30 UTC (rev 9646)
@@ -3,5 +3,66 @@
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="validatorStraightforwardSubviewID">
-<div style="FONT-WEIGHT: bold;">Straightforward for test set</div>
+ <rich:dataTable value="#{data.data}" var="data" id="SizeValidationID">
+ showSummary="true" />
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#1" />
+ </f:facet>
+ <a4j:commandLink value="Select" reRender="SizeValidationID"></a4j:commandLink>
+ <f:facet name="footer">
+ <h:outputText value="#1" />
+ </f:facet>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#4" />
+ </f:facet>
+ <h:outputText value="#{data.int2}"></h:outputText>
+ <f:facet name="footer">
+ <h:outputText value="#4" />
+ </f:facet>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#5" />
+ </f:facet>
+ <h:outputText value="#{data.str1}"></h:outputText>
+ <f:facet name="footer">
+ <h:outputText value="#5" />
+ </f:facet>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#7" />
+ </f:facet>
+ <h:graphicImage value="#{data.str2}"></h:graphicImage>
+ <h:outputText value="#{data.str2}"></h:outputText>
+ <f:facet name="footer">
+ <h:outputText value="#7" />
+ </f:facet>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="#9" />
+ </f:facet>
+ <h:selectBooleanCheckbox value="#{data.bool0}"></h:selectBooleanCheckbox>
+ <f:facet name="footer">
+ <h:outputText value="#9" />
+ </f:facet>
+ </rich:column>
+ </rich:dataTable>
+ <br />
+ <a4j:region>
+ <h:outputText value="Enter quantity of lines [data]" />
+ <h:panelGroup>
+ <h:inputText value="#{data.length}"/>
+ <a4j:commandButton action="#{data.addNewItem}" value="ok"
+ reRender="SizeValidationID"></a4j:commandButton>
+ </h:panelGroup>
+ </a4j:region>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Validator.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Validator.xml 2008-07-17 08:07:38 UTC (rev 9645)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Validator.xml 2008-07-17 09:39:30 UTC (rev 9646)
@@ -22,5 +22,10 @@
<managed-bean-class>validator.ValidatorBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>graphValidator</managed-bean-name>
+ <managed-bean-class>validator.GraphValidatorBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
</faces-config>
16 years, 2 months
JBoss Rich Faces SVN: r9645 - trunk/test-applications/facelets/src/main/webapp/ModalPanel.
by richfaces-svn-commits@lists.jboss.org
Author: adubovsky
Date: 2008-07-17 04:07:38 -0400 (Thu, 17 Jul 2008)
New Revision: 9645
Modified:
trunk/test-applications/facelets/src/main/webapp/ModalPanel/ModalPanel.xhtml
Log:
changes in modalPanel (problem with Safari was fixed)
Modified: trunk/test-applications/facelets/src/main/webapp/ModalPanel/ModalPanel.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/ModalPanel/ModalPanel.xhtml 2008-07-17 08:01:23 UTC (rev 9644)
+++ trunk/test-applications/facelets/src/main/webapp/ModalPanel/ModalPanel.xhtml 2008-07-17 08:07:38 UTC (rev 9645)
@@ -1,22 +1,9 @@
-<!-- %@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%-->
-
<f:subview xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich" id="modalPanelSubviewID">
- <script type="text/javascript">
- function multiply(height,width){
- var tbody = document.getElementById('tbodyID');
- var trs = tbody.getElementsByTagName('TR');
- var y = parseInt(height);
- var x = parseInt(width);
- trs[1].innerHTML = 'modalPanel\'s size: ' + x + 'x' +y + ' px*px';
- return false;
- }
- </script>
-
<rich:modalPanel id="modalPanelID"
binding="#{modalPanel.htmlModalPanel}"
visualOptions="#{modalPanel.visualOptions}" left="#{modalPanel.left}"
@@ -39,7 +26,8 @@
onmaskmousemove="#{event.onmaskmousemove}"
onmaskmouseout="#{event.onmaskmouseout}"
onmaskmouseover="#{event.onmaskmouseover}"
- onmaskmouseup="#{event.onmaskmouseup}" onmove="#{event.onmove}"
+ onmaskmouseup="#{event.onmaskmouseup}"
+ onmove="#{event.onmove}"
onresize="#{event.onresize}" onshow="#{event.onshow}"
onbeforehide="#{event.onbeforehide}"
onbeforeshow="#{event.onbeforeshow}" >
@@ -50,71 +38,39 @@
<h:graphicImage value="/pics/error.gif" onclick="Richfaces.hideModalPanel('modalPanelID'); return false;" />
</f:facet>
- <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
- <h:panelGrid columns="2" id="findComponentID">
- <tbody id="tbodyID">
- <tr>
- <td>
- <a4j:commandLink value="getSize" reRender="findID" onclick="javascript:multiply(#('formID:modalPanelSubviewID:modalPanelID').component.height},#('formID:modalPanelSubviewID:modalPanelID').component.width});"></a4j:commandLink>
- </td>
- </tr>
- <tr>
- <td>
- <h:outputText/>
- </td>
- </tr>
- </tbody>
- </h:panelGrid>
- <br />
- <h:outputText value="This is Modal Panel example" styleClass="text1" />
- <h:selectOneMenu value="#{richBean.srcContainer}" onchange="submit();">
+ <h:outputText value="This is Modal Panel example" />
+ <h:selectOneMenu value="#{richBean.srcContainer}" >
<f:selectItems value="#{richBean.listContainer}" />
</h:selectOneMenu>
<h:inputText value="#{modalPanel.inputTextTest}" />
<h:selectOneListbox value="#{modalPanel.selectOneListboxTest}">
- <f:selectItem itemLabel="1" itemValue="1" />
- <f:selectItem itemLabel="2" itemValue="2" />
- <f:selectItem itemLabel="3" itemValue="3" />
+ <f:selectItem itemLabel="item 1" itemValue="item 1" />
+ <f:selectItem itemLabel="item 2" itemValue="item 2" />
+ <f:selectItem itemLabel="item 3" itemValue="item 3" />
</h:selectOneListbox>
<f:verbatim><br /><br /></f:verbatim>
<rich:spacer width="20" height="20"></rich:spacer>
- <a4j:commandButton value="submit" onclick="submit"></a4j:commandButton>
- <h:outputLink value="http://www.jboss.com/"><f:verbatim>Link</f:verbatim></h:outputLink>
+ <h:outputLink value="http://localhost:8080/facelets"><f:verbatim>http://localhost:8080/facelets/</f:verbatim></h:outputLink>
<f:verbatim><br /><br /></f:verbatim>
<a4j:commandLink onclick="Richfaces.showModalPanel('modalPanel2ID');return false;" value="show ModalPanel 2"></a4j:commandLink>
<f:verbatim><br /><br /></f:verbatim>
<h:outputLink onclick="Richfaces.hideModalPanel('modalPanelID');return false;" ><f:verbatim>Close</f:verbatim></h:outputLink>
</rich:modalPanel>
-
- <rich:modalPanel id="modalPanel2ID"
- visualOptions="#{modalPanel.visualOptions}"
- left="#{modalPanel.left}" top="#{modalPanel.top}"
- minHeight="#{modalPanel.minHeight}" minWidth="#{modalPanel.minWidth}"
- moveable="true" resizeable="false"
- keepVisualState="#{modalPanel.keepVisualState}"
- rendered="#{modalPanel.rendered}" zindex="#{modalPanel.zindex}"
- autosized="true"
- shadowDepth="#{modalPanel.shadowDepth}"
- shadowOpacity="#{modalPanel.shadowOpacity}"
- showWhenRendered="#{modalPanel.showWhenRendered}" >
+
+ <rich:modalPanel id="modalPanel2ID" autosized="true" resizeable="false">
<br />
<h:inputText value="input"></h:inputText>
<br />
<h:outputLink onclick="Richfaces.hideModalPanel('modalPanel2ID');return false;" ><f:verbatim>Close</f:verbatim></h:outputLink>
- <rich:pickList id="pickListID" >
- <f:selectItem itemValue="selectItem 0" itemLabel="selectItem 0" />
- <f:selectItem itemValue="selectItem 1" itemLabel="selectItem 1" />
- <f:selectItem itemValue="selectItem 2" itemLabel="selectItem 2" />
-
- </rich:pickList>
- <br />
- <a4j:commandButton reRender="pickListTargetID" value="refresh target"></a4j:commandButton>
+
+
+
</rich:modalPanel>
-
- <rich:modalPanel id="modalPanel3ID" minHeight="100" minWidth="200" moveable="true">
+
+ <rich:modalPanel id="modalPanel3ID" minHeight="100" minWidth="200" moveable="true" resizeable="false" autosized="true">
<f:facet name="header">
<h:outputText value="Events..." />
</f:facet>
@@ -133,7 +89,9 @@
<h:graphicImage value="/pics/info.gif">
<rich:componentControl event="onclick" for="modalPanel3ID" operation="show"></rich:componentControl>
</h:graphicImage>
- <f:verbatim><br /><br /></f:verbatim>
- <div id="idDiv1" style="position: relative; font-size: 50px; z-index: 2; color: navy" >z-index1</div>
- <div id="idDiv2" style="position: relative; font-size: 50px; z-index: 2; color: navy">z-index2</div>
+ <f:verbatim>
+ <br /><br />
+ <div id="idDiv1" align="center" style="position: relative; font-size: 50px; z-index: 2; color: navy" >z-index1</div>
+ <div id="idDiv2" align="center" style="position: relative; font-size: 50px; z-index: 2; color: navy">z-index2</div>
+ </f:verbatim>
</f:subview>
16 years, 2 months
JBoss Rich Faces SVN: r9644 - in trunk/test-applications/jsp/src/main: webapp/ModalPanel and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: adubovsky
Date: 2008-07-17 04:01:23 -0400 (Thu, 17 Jul 2008)
New Revision: 9644
Modified:
trunk/test-applications/jsp/src/main/java/modalPanel/ModalPanel.java
trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanel.jsp
trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanelProperty.jsp
Log:
changes in modalPanel
Modified: trunk/test-applications/jsp/src/main/java/modalPanel/ModalPanel.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/modalPanel/ModalPanel.java 2008-07-17 07:55:19 UTC (rev 9643)
+++ trunk/test-applications/jsp/src/main/java/modalPanel/ModalPanel.java 2008-07-17 08:01:23 UTC (rev 9644)
@@ -1,5 +1,6 @@
package modalPanel;
+import javax.faces.component.html.HtmlSelectBooleanCheckbox;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
@@ -29,7 +30,6 @@
private String bindLabel;
private HtmlModalPanel htmlModalPanel;
-
public String getVisualOptions() {
return visualOptions;
}
@@ -268,4 +268,5 @@
ComponentInfo info = ComponentInfo.getInstance();
info.addField(htmlModalPanel);
}
+
}
Modified: trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanel.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanel.jsp 2008-07-17 07:55:19 UTC (rev 9643)
+++ trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanel.jsp 2008-07-17 08:01:23 UTC (rev 9644)
@@ -72,7 +72,7 @@
</h:panelGrid>
<br />
<h:outputText value="This is Modal Panel example" styleClass="text1" />
- <h:selectOneMenu value="#{richBean.srcContainer}" onchange="submit();">
+ <h:selectOneMenu value="#{richBean.srcContainer}" >
<f:selectItems value="#{richBean.listContainer}" />
</h:selectOneMenu>
@@ -86,25 +86,14 @@
<f:verbatim><br /><br /></f:verbatim>
<rich:spacer width="20" height="20"></rich:spacer>
- <a4j:commandButton value="submit" onclick="submit"></a4j:commandButton>
- <h:outputLink value="http://www.jboss.com/"><f:verbatim>Link</f:verbatim></h:outputLink>
+ <h:outputLink value="http://localhost:8081/jsp/"><f:verbatim>http://localhost:8081/jsp/</f:verbatim></h:outputLink>
<f:verbatim><br /><br /></f:verbatim>
<a4j:commandLink onclick="Richfaces.showModalPanel('modalPanel2ID');return false;" value="show ModalPanel 2"></a4j:commandLink>
<f:verbatim><br /><br /></f:verbatim>
<h:outputLink onclick="Richfaces.hideModalPanel('modalPanelID');return false;" ><f:verbatim>Close</f:verbatim></h:outputLink>
</rich:modalPanel>
- <rich:modalPanel id="modalPanel2ID"
- visualOptions="#{modalPanel.visualOptions}"
- left="#{modalPanel.left}" top="#{modalPanel.top}"
- minHeight="#{modalPanel.minHeight}" minWidth="#{modalPanel.minWidth}"
- moveable="true" resizeable="false"
- keepVisualState="#{modalPanel.keepVisualState}"
- rendered="#{modalPanel.rendered}" zindex="#{modalPanel.zindex}"
- autosized="true"
- shadowDepth="#{modalPanel.shadowDepth}"
- shadowOpacity="#{modalPanel.shadowOpacity}"
- showWhenRendered="#{modalPanel.showWhenRendered}" >
+ <rich:modalPanel id="modalPanel2ID" autosized="true" resizeable="false">
<br />
<h:inputText value="input"></h:inputText>
<br />
@@ -116,10 +105,10 @@
</rich:pickList>
<br />
- <a4j:commandButton reRender="pickListTargetID" value="refresh target"></a4j:commandButton>
+ <a4j:commandButton reRender="pickListID" value="refresh target"></a4j:commandButton>
</rich:modalPanel>
- <rich:modalPanel id="modalPanel3ID" minHeight="100" minWidth="200" moveable="true">
+ <rich:modalPanel id="modalPanel3ID" minHeight="100" minWidth="200" moveable="true" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Events..." />
</f:facet>
@@ -130,6 +119,7 @@
<h:outputText value="Eventsaaaaaaaaaaaaaaaa ..." />
<rich:calendar popup="true" />
</rich:modalPanel>
+
<a onclick="Richfaces.showModalPanel('modalPanelID');" href="#">show ModalPanel 1</a>
<br />
<a4j:commandLink onclick="Richfaces.showModalPanel('modalPanel2ID');return false;" value="show ModalPanel 2"></a4j:commandLink>
@@ -138,7 +128,9 @@
<h:graphicImage value="/pics/info.gif">
<rich:componentControl event="onclick" for="modalPanel3ID" operation="show"></rich:componentControl>
</h:graphicImage>
- <f:verbatim><br /><br /></f:verbatim>
- <div id="idDiv1" style="position: relative; font-size: 50px; z-index: 2; color: navy" >z-index1</div>
- <div id="idDiv2" style="position: relative; font-size: 50px; z-index: 2; color: navy">z-index2</div>
+ <f:verbatim>
+ <br /><br />
+ <div id="idDiv1" align="center" style="position: relative; font-size: 50px; z-index: 2; color: navy" >z-index1</div>
+ <div id="idDiv2" align="center" style="position: relative; font-size: 50px; z-index: 2; color: navy">z-index2</div>
+ </f:verbatim>
</f:subview>
Modified: trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanelProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanelProperty.jsp 2008-07-17 07:55:19 UTC (rev 9643)
+++ trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanelProperty.jsp 2008-07-17 08:01:23 UTC (rev 9644)
@@ -73,14 +73,10 @@
</h:inputText>
<h:outputText value="autosized:" />
- <h:selectBooleanCheckbox value="#{modalPanel.autosized}"
- onchange="submit();">
- </h:selectBooleanCheckbox>
+ <h:selectBooleanCheckbox value="#{modalPanel.autosized}" onchange="submit();" ></h:selectBooleanCheckbox>
<h:outputText value="resizeable:" />
- <h:selectBooleanCheckbox value="#{modalPanel.resizeable}"
- onchange="submit();">
- </h:selectBooleanCheckbox>
+ <h:selectBooleanCheckbox value="#{modalPanel.resizeable}" onchange="submit();"></h:selectBooleanCheckbox>
<h:outputText value="Moveable:" />
<h:selectBooleanCheckbox value="#{modalPanel.moveable}">
16 years, 2 months