struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Graham <grahamdavid1...@yahoo.com>
Subject Re: cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html JavascriptValidatorTag.java
Date Mon, 28 Jul 2003 13:34:46 GMT
I think we should only place @since tags on methods in the public API
(public and protected).  Placing them on private members will be confusing
if we make those methods accessible in a future release.

David

--- rleland@apache.org wrote:
> rleland     2003/07/27 22:54:33
> 
>   Modified:    src/share/org/apache/struts/taglib/html
>                         JavascriptValidatorTag.java
>   Log:
>   Bug 20754, Enhancement to allow checking of all constraints
>   instead of aborting. The default  is same as struts 1.1.
>   Patch for struts 1.1 RC2 provided by (Marcelo Caldas)
>   
>   Revision  Changes    Path
>   1.36      +29 -10   
>
jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java
>   
>   Index: JavascriptValidatorTag.java
>   ===================================================================
>   RCS file:
>
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java,v
>   retrieving revision 1.35
>   retrieving revision 1.36
>   diff -u -r1.35 -r1.36
>   --- JavascriptValidatorTag.java	26 Jul 2003 18:51:35 -0000	1.35
>   +++ JavascriptValidatorTag.java	28 Jul 2003 05:54:33 -0000	1.36
>   @@ -367,7 +367,7 @@
>                    PageContext.APPLICATION_SCOPE);
>            
>            Locale locale =
> TagUtils.getInstance().getUserLocale(this.pageContext, null);
>   -        
>   +
>            Form form = resources.get(locale, formName);
>            if (form != null) {
>                if ("true".equalsIgnoreCase(dynamicJavascript)) {
>   @@ -402,6 +402,7 @@
>         * @param resources
>         * @param locale
>         * @param form
>   +     * @since Struts 1.2
>         */
>        private String createDynamicJavascript(
>            ModuleConfig config,
>   @@ -418,7 +419,15 @@
>    
>            List actions = this.createActionList(resources, form);
>    
>   -       
> results.append(this.getJavascriptBegin(this.createMethods(actions)));
>   +        Object stopOnErrorObj =
> pageContext.getAttribute(ValidatorPlugIn.STOP_ON_ERROR_KEY + '.'+
> config.getPrefix(),
>   +                PageContext.APPLICATION_SCOPE);
>   +        boolean stopOnError = true;
>   +        if (stopOnErrorObj != null && (stopOnErrorObj instanceof
> Boolean)) {
>   +            stopOnError = ((Boolean)stopOnErrorObj).booleanValue();
>   +        }
>   +
>   +
>   +       
>
results.append(this.getJavascriptBegin(this.createMethods(actions,stopOnError)));
>    
>            for (Iterator i = actions.iterator(); i.hasNext();) {
>                ValidatorAction va = (ValidatorAction) i.next();
>   @@ -526,11 +535,18 @@
>        /**
>         * Creates the JavaScript methods list from the given actions.
>         * @param actions A List of ValidatorAction objects.
>   +     * @param stopOnError If true, behaves like released version of
> struts 1.1
>   +     *        and stops after first error. If false, evaluates all
> validations.
>         * @return JavaScript methods.
>   +     * @since Struts 1.2
>         */
>   -    private String createMethods(List actions) {
>   +    private String createMethods(List actions, boolean stopOnError) {
>            String methods = null;
>   -        
>   +        String methodOperator = " && ";
>   +        if (!stopOnError) {
>   +            methodOperator= " & ";
>   +        }
>   +
>            Iterator iter = actions.iterator();
>            while (iter.hasNext()) {
>                ValidatorAction va = (ValidatorAction) iter.next();
>   @@ -538,7 +554,7 @@
>                if (methods == null) {
>                    methods = va.getMethod() + "(form)";
>                } else {
>   -                methods += " && " + va.getMethod() + "(form)";
>   +                methods += methodOperator + va.getMethod() +
> "(form)";
>                }
>            }
>            
>   @@ -651,7 +667,10 @@
>            if (methods == null || methods.length() == 0) {
>                sb.append("       return true; \n");
>            } else {
>   -            sb.append("       return " + methods + "; \n");
>   +            //Making Sure that Bitwise operator works:
>   +            sb.append(" var formValidationResult;\n");
>   +            sb.append("       formValidationResult = " + methods + ";
> \n");
>   +            sb.append("     return (formValidationResult == 1);\n");
>            }
>    
>            sb.append("   } \n\n");
>   
>   
>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message