commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons/validator/conf/share validator_1_1.dtd
Date Sun, 25 May 2003 18:00:24 GMT
dgraham     2003/05/25 11:00:24

  Modified:    validator/src/share/org/apache/commons/validator Arg.java
                        digester-rules.xml Field.java
               validator/src/test/org/apache/commons/validator
                        validator-name-required.xml validator-locale.xml
                        validator-multiple-config-2.xml
                        validator-requiredif.xml validator-multipletest.xml
               validator/src/example/org/apache/commons/validator/example
                        validator-example.xml ValidateExample.java
               validator/conf/share validator_1_1.dtd
  Log:
  Deprecated the existing Arg structure which only allowed 4 message 
  replacement arguments.  This also put an undue burden on clients when
  trying to retrieve arguments.  There is a new <arg> element with a 
  "position" attribute and the existing <arg0> - <arg3> elements are 
  deprecated.
  
  Revision  Changes    Path
  1.9       +25 -4     jakarta-commons/validator/src/share/org/apache/commons/validator/Arg.java
  
  Index: Arg.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Arg.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Arg.java	24 May 2003 17:09:41 -0000	1.8
  +++ Arg.java	25 May 2003 18:00:23 -0000	1.9
  @@ -79,6 +79,7 @@
    * <p>Instances of this class are configured with an &lt;arg&gt; xml element.</p>
    *
    * @author David Winterfeldt
  + * @author David Graham
    * @version $Revision$ $Date$
    */
   public class Arg implements Cloneable, Serializable {
  @@ -98,6 +99,12 @@
        * If it is 'true', the value will try to be resolved as a message resource.
        */
       protected boolean resource = true;
  +    
  +    /**
  +     * This argument's position in the message (ie. you would set postion=0 to make 
  +     * a replacement in this string "some msg {0}").
  +     */
  +    protected int position = 0;
   
       /**
        * Gets the name of the dependency.
  @@ -185,6 +192,20 @@
           results.append("\n");
   
           return results.toString();
  +    }
  +
  +    /**
  +     * @return This argument's replacement position.
  +     */
  +    public int getPosition() {
  +        return this.position;
  +    }
  +
  +    /**
  +     * Set this argument's replacement position.
  +     */
  +    public void setPosition(int position) {
  +        this.position = position;
       }
   
   }
  
  
  
  1.3       +7 -0      jakarta-commons/validator/src/share/org/apache/commons/validator/digester-rules.xml
  
  Index: digester-rules.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/digester-rules.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- digester-rules.xml	22 May 2003 00:27:45 -0000	1.2
  +++ digester-rules.xml	25 May 2003 18:00:23 -0000	1.3
  @@ -65,6 +65,13 @@
   					<set-next-rule methodname="addMsg" paramtype="org.apache.commons.validator.Msg"
/>
   				</pattern>
   				
  +				<pattern value="arg">
  +					<object-create-rule classname="org.apache.commons.validator.Arg" />
  +					<set-properties-rule/>
  +					<set-next-rule methodname="addArg" paramtype="org.apache.commons.validator.Arg"
/>
  +				</pattern>
  +				
  +				<!-- The arg0, etc. elements are deprecated.  We can remove these definitions after
1.1 -->
   				<pattern value="arg0">
   					<object-create-rule classname="org.apache.commons.validator.Arg" />
   					<set-properties-rule/>
  
  
  
  1.13      +188 -111  jakarta-commons/validator/src/share/org/apache/commons/validator/Field.java
  
  Index: Field.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Field.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Field.java	24 May 2003 18:26:49 -0000	1.12
  +++ Field.java	25 May 2003 18:00:23 -0000	1.13
  @@ -65,6 +65,7 @@
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Collections;
  +import java.util.HashMap;
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
  @@ -81,6 +82,7 @@
    * </p>
    *
    * @author David Winterfeldt
  + * @author David Graham
    * @version $Revision$ $Date$
    * @see org.apache.commons.validator.Form
    */
  @@ -137,9 +139,31 @@
       
       protected FastHashMap hVars = new FastHashMap();
       protected FastHashMap hMsgs = new FastHashMap();
  -    protected FastHashMap hArg0 = new FastHashMap();
  +    
  +    /**
  +     * Holds Maps of arguments.  args[0] returns the Map for the first replacement
  +     * argument.
  +     */
  +    protected Map[] args = new Map[10];
  +    
  +    /**
  +     * @deprecated This variable is no longer used, use args instead.
  +     */
  +    private FastHashMap hArg0 = new FastHashMap();
  +    
  +    /**
  +     * @deprecated This variable is no longer used, use args instead.
  +     */
       protected FastHashMap hArg1 = new FastHashMap();
  +
  +    /**
  +     * @deprecated This variable is no longer used, use args instead.
  +     */
       protected FastHashMap hArg2 = new FastHashMap();
  +    
  +    /**
  +     * @deprecated This variable is no longer used, use args instead.
  +     */
       protected FastHashMap hArg3 = new FastHashMap();
   
   
  @@ -166,14 +190,12 @@
          return this.fieldOrder;	
       }
   
  -
       /**
        * Sets the position of the <code>Field</code> in the validation list.
        */
       public void setFieldOrder(int fieldOrder) {
          this.fieldOrder = fieldOrder;	
       }
  -    
      
       /**
        * Gets the property name of the field.
  @@ -182,7 +204,6 @@
          return this.property;	
       }
   
  -
       /**
        * Sets the property name of the field.
        */
  @@ -199,7 +220,6 @@
          return this.indexedProperty;	
       }
   
  -
       /**
        * Sets the indexed property name of the field.
        */
  @@ -218,7 +238,6 @@
          return this.indexedListProperty;	
       }
   
  -
       /**
        * Sets the indexed property name of the field.
        */
  @@ -273,131 +292,164 @@
       }
   
       /**
  +     * Add an <code>Arg</code> to the replacement argument list.
  +     */
  +    public void addArg(Arg arg) {
  +        // TODO this first if check can go away after arg0, etc. are removed from dtd
  +        if (arg == null || arg.getKey() == null || arg.getKey().length() == 0) {
  +            return;
  +        }
  +
  +        this.ensureArgsCapacity(arg);
  +
  +        Map argMap = (Map) this.args[arg.getPosition()];
  +        if (argMap == null) {
  +            argMap = new HashMap();
  +            this.args[arg.getPosition()] = argMap;
  +        }
  +
  +        if (arg.getName() == null) {
  +            argMap.put(DEFAULT_ARG, arg);
  +        } else {
  +            argMap.put(arg.getName(), arg);
  +        }
  +
  +    }
  +
  +    /**
  +     * Ensures that the args array can hold the given arg.  Resizes the array as 
  +     * necessary.
  +     * @param arg Determine if the args array is long enough to store this arg's 
  +     * position. 
  +     */
  +    private void ensureArgsCapacity(Arg arg) {
  +        if (arg.getPosition() >= this.args.length) {
  +            Map[] newArgs = new Map[arg.getPosition() + 1];
  +            System.arraycopy(this.args, 0, newArgs, 0, this.args.length);
  +            this.args = newArgs;
  +        }
  +    }
  +    
  +    /**
  +     * Gets the default <code>Arg</code> object at the given position.
  +     */
  +    public Arg getArg(int position) {
  +        return this.getArg(DEFAULT_ARG, position);
  +    }
  +
  +    /**
  +     * Gets the default <code>Arg</code> object at the given position.
  +     */
  +    public Arg getArg(String key, int position) {
  +        if (position >= this.args.length) {
  +            return null;
  +        }
  +
  +        return (args[position] == null) ? null : (Arg) args[position].get(key);
  +    }
  +
  +    /**
        * Add a <code>Arg</code> to the arg0 list.
  +     * @deprecated Use addArg(Arg) instead.
        */
       public void addArg0(Arg arg) {
  -    	if (arg != null && arg.getKey() != null && arg.getKey().length() >
0) {
  -            
  -    		if (arg.getName() != null && arg.getName().length() > 0) {
  -    			hArg0.put(arg.getName(), arg);
  -    		} else {
  -    			hArg0.put(DEFAULT_ARG, arg);
  -    		}
  -            
  -    	}
  +        arg.setPosition(0);
  +        this.addArg(arg);
       }
   
       /**
        * Gets the default arg0 <code>Arg</code> object.
  +     * @deprecated Use getArg(0) instead.
        */
       public Arg getArg0() {
  -       return (Arg) hArg0.get(DEFAULT_ARG);	
  +       return this.getArg(0);
       }
   
       /**
        * Gets the arg0 <code>Arg</code> object based on the key passed in.  If
the key 
        * finds a <code>null</code> value then the default value will try to be
retrieved.
  +     * @deprecated Use getArg(String, 0) instead.
        */
       public Arg getArg0(String key) {
  -       Arg arg = (Arg) hArg0.get(key);
  -       
  -       return (arg != null) ? arg : getArg0();
  +        return this.getArg(key, 0);
       }
   
       /**
        * Add a <code>Arg</code> to the arg1 list.
  +     * @deprecated Use addArg(Arg) instead.
        */
       public void addArg1(Arg arg) {
  -       if (arg != null && arg.getKey() != null && arg.getKey().length()
> 0) {
  -           
  -          if (arg.getName() != null && arg.getName().length() > 0) {
  -             hArg1.put(arg.getName(), arg);
  -          } else {
  -             hArg1.put(DEFAULT_ARG, arg);
  -          }
  -          
  -       }
  +        arg.setPosition(1);
  +        this.addArg(arg);
       }
   
       /**
        * Gets the default arg1 <code>Arg</code> object.
  +     * @deprecated Use getArg(1) instead.
        */
       public Arg getArg1() {
  -       return (Arg) hArg1.get(DEFAULT_ARG);	
  +       return this.getArg(1);	
       }
   
       /**
        * Gets the arg1 <code>Arg</code> object based on the key passed in.  If
the key 
        * finds a <code>null</code> value then the default value will try to be
retrieved.
  +     * @deprecated Use getArg(String, 1) instead.
        */
       public Arg getArg1(String key) {
  -       Arg arg = (Arg) hArg1.get(key);
  -       
  -       return (arg != null) ? arg : getArg1();
  +        return this.getArg(key, 1);
       }
       
       /**
        * Add a <code>Arg</code> to the arg2 list.
  +     * @deprecated Use addArg(Arg) instead.
        */
       public void addArg2(Arg arg) {
  -       if (arg != null && arg.getKey() != null && arg.getKey().length()
> 0) {
  -           
  -          if (arg.getName() != null && arg.getName().length() > 0) {
  -             hArg2.put(arg.getName(), arg);
  -          } else {
  -             hArg2.put(DEFAULT_ARG, arg);
  -          }
  -          
  -       }
  +        arg.setPosition(2);
  +        this.addArg(arg);
       }
   
       /**
        * Gets the default arg2 <code>Arg</code> object.
  -    */
  +     * @deprecated Use getArg(2) instead.
  +     */
       public Arg getArg2() {
  -       return (Arg) hArg2.get(DEFAULT_ARG);	
  +       return this.getArg(2);
       }
   
       /**
        * Gets the arg2 <code>Arg</code> object based on the key passed in.  If
the key 
        * finds a <code>null</code> value then the default value will try to be
retrieved.
  -    */
  +     * @deprecated Use getArg(String, 2) instead.
  +     */
       public Arg getArg2(String key) {
  -       Arg arg = (Arg) hArg2.get(key);
  -       
  -       return (arg != null) ? arg : getArg2();
  +        return this.getArg(key, 2);
       }
       
       /**
        * Add a <code>Arg</code> to the arg3 list.
  +     * @deprecated Use addArg(Arg) instead.
        */
       public void addArg3(Arg arg) {
  -       if (arg != null && arg.getKey() != null && arg.getKey().length()
> 0) {
  -           
  -          if (arg.getName() != null && arg.getName().length() > 0) {
  -             hArg3.put(arg.getName(), arg);
  -          } else {
  -             hArg3.put(DEFAULT_ARG, arg);
  -          }
  -          
  -       }
  +        arg.setPosition(3);
  +        this.addArg(arg);
       }
   
       /**
        * Gets the default arg3 <code>Arg</code> object.
  -    */
  +     * @deprecated Use getArg(3) instead.
  +     */
       public Arg getArg3() {
  -       return (Arg) hArg3.get(DEFAULT_ARG);	
  +       return this.getArg(3); 
       }
   
       /**
        * Gets the arg3 <code>Arg</code> object based on the key passed in.  If
the key 
        * finds a <code>null</code> value then the default value will try to be
retrieved.
  +     * @deprecated Use getArg(String, 3) instead.
        */
       public Arg getArg3(String key) {
  -       Arg arg = (Arg) hArg3.get(key);
  -       
  -       return (arg != null) ? arg : getArg3();
  +        return this.getArg(key, 3);
       }
           
       /**
  @@ -494,12 +546,8 @@
        * to create the dependency <code>Map</code>.
        */
       public void process(Map globalConstants, Map constants) {
  -    	hMsgs.setFast(false);
  -    	hArg0.setFast(true);
  -    	hArg1.setFast(true);
  -    	hArg2.setFast(true);
  -    	hArg3.setFast(true);
  -    	hVars.setFast(true);
  +    	this.hMsgs.setFast(false);
  +    	this.hVars.setFast(true);
       
       	this.generateKey();
       
  @@ -513,7 +561,7 @@
       
       		processVars(key2, replaceValue);
       
  -    		processMessageComponents(key2, replaceValue);
  +    		this.processMessageComponents(key2, replaceValue);
       	}
       
       	// Process Global Constants
  @@ -526,7 +574,7 @@
       
       		processVars(key2, replaceValue);
       
  -    		processMessageComponents(key2, replaceValue);
  +    		this.processMessageComponents(key2, replaceValue);
       	}
       
       	// Process Var Constant Replacement
  @@ -536,7 +584,7 @@
       		Var var = (Var) hVars.get(key);
       		String replaceValue = var.getValue();
       
  -    		processMessageComponents(key2, replaceValue);
  +    		this.processMessageComponents(key2, replaceValue);
       	}
       
       	hMsgs.setFast(true);
  @@ -546,10 +594,10 @@
        * Replace the vars value with the key/value pairs passed in.
        */
       private void processVars(String key, String replaceValue) {
  -        Iterator i = hVars.keySet().iterator();
  +        Iterator i = this.hVars.keySet().iterator();
           while (i.hasNext()) {
               String varKey = (String) i.next();
  -            Var var = (Var) hVars.get(varKey);
  +            Var var = (Var) this.hVars.get(varKey);
   
               var.setValue(ValidatorUtils.replace(var.getValue(), key, replaceValue));
           }
  @@ -558,36 +606,53 @@
       
       /**
        * Replace the args key value with the key/value pairs passed in.
  +     * @deprecated This is an internal setup method that clients don't need to call.
        */
       public void processMessageComponents(String key, String replaceValue) {
  -    	String varKey = TOKEN_START + TOKEN_VAR;
  -    	// Process Messages
  -    	if (key != null && !key.startsWith(varKey)) {
  -    		for (Iterator i = hMsgs.keySet().iterator(); i.hasNext();) {
  -    			String msgKey = (String) i.next();
  -    			String value = (String) hMsgs.get(msgKey);
  +        this.internalProcessMessageComponents(key, replaceValue);
  +    }
  +    
  +    /**
  +     * Replace the args key value with the key/value pairs passed in.
  +     * TODO When processMessageComponents() is removed from the public API we
  +     * should rename this private method to "processMessageComponents".
  +     */
  +    private void internalProcessMessageComponents(String key, String replaceValue) {
  +        String varKey = TOKEN_START + TOKEN_VAR;
  +        // Process Messages
  +        if (key != null && !key.startsWith(varKey)) {
  +            for (Iterator i = hMsgs.keySet().iterator(); i.hasNext();) {
  +                String msgKey = (String) i.next();
  +                String value = (String) hMsgs.get(msgKey);
       
  -    			hMsgs.put(msgKey, ValidatorUtils.replace(value, key, replaceValue));
  -    		}
  +                hMsgs.put(msgKey, ValidatorUtils.replace(value, key, replaceValue));
  +            }
          }
          
  -       processArg(hArg0, key, replaceValue);
  -       processArg(hArg1, key, replaceValue);
  -       processArg(hArg2, key, replaceValue);
  -       processArg(hArg3, key, replaceValue);
  -       
  +       this.processArg(key, replaceValue);
       }
   
       /**
  -     * Replace the arg <code>Collection</code> key value with the key/value
pairs passed in.
  +     * Replace the arg <code>Collection</code> key value with the key/value
pairs 
  +     * passed in.
        */
  -    private void processArg(Map hArgs, String key, String replaceValue) {
  -        for (Iterator i = hArgs.values().iterator(); i.hasNext();) {
  -        	Arg arg = (Arg) i.next();
  -        
  -        	if (arg != null) {
  -        		arg.setKey(ValidatorUtils.replace(arg.getKey(), key, replaceValue));
  -        	}
  +    private void processArg(String key, String replaceValue) {
  +        for (int i = 0; i < this.args.length; i++) {
  +
  +            Map argMap = this.args[i];
  +            if (argMap == null) {
  +                continue;
  +            }
  +
  +            Iterator iter = argMap.values().iterator();
  +            while (iter.hasNext()) {
  +                Arg arg = (Arg) iter.next();
  +
  +                if (arg != null) {
  +                    arg.setKey(
  +                        ValidatorUtils.replace(arg.getKey(), key, replaceValue));
  +                }
  +            }
           }
       }
   
  @@ -619,20 +684,32 @@
        * Creates and returns a copy of this object.
        */
       public Object clone() {
  -       try {
  -           Field field = (Field) super.clone();
  -           
  -           field.hVars = ValidatorUtils.copyFastHashMap(hVars);
  -           field.hMsgs = ValidatorUtils.copyFastHashMap(hMsgs);
  -           field.hArg0 = ValidatorUtils.copyFastHashMap(hArg0);
  -           field.hArg1 = ValidatorUtils.copyFastHashMap(hArg1);
  -           field.hArg2 = ValidatorUtils.copyFastHashMap(hArg2);
  -           field.hArg3 = ValidatorUtils.copyFastHashMap(hArg3);
  -    
  -           return field;
  -       } catch (CloneNotSupportedException e) {
  -          throw new InternalError(e.toString());
  -       }
  +        try {
  +            Field field = (Field) super.clone();
  +            
  +            field.args = new Map[this.args.length];
  +            for (int i = 0; i < this.args.length; i++) {
  +                Map argMap = new HashMap(this.args[i]);
  +                Iterator iter = argMap.keySet().iterator();
  +                while (iter.hasNext()) {
  +                    String validatorName = (String) iter.next();
  +                    Arg arg = (Arg) argMap.get(validatorName);
  +                    argMap.put(validatorName, arg.clone());
  +                }
  +                field.args[i] = argMap;
  +            }
  +
  +            field.hVars = ValidatorUtils.copyFastHashMap(hVars);
  +            field.hMsgs = ValidatorUtils.copyFastHashMap(hMsgs);
  +            field.hArg0 = ValidatorUtils.copyFastHashMap(hArg0);
  +            field.hArg1 = ValidatorUtils.copyFastHashMap(hArg1);
  +            field.hArg2 = ValidatorUtils.copyFastHashMap(hArg2);
  +            field.hArg3 = ValidatorUtils.copyFastHashMap(hArg3);
  +
  +            return field;
  +        } catch (CloneNotSupportedException e) {
  +            throw new InternalError(e.toString());
  +        }
       }    
   
       /**
  
  
  
  1.3       +2 -2      jakarta-commons/validator/src/test/org/apache/commons/validator/validator-name-required.xml
  
  Index: validator-name-required.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-name-required.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- validator-name-required.xml	13 Mar 2002 05:39:32 -0000	1.2
  +++ validator-name-required.xml	25 May 2003 18:00:23 -0000	1.3
  @@ -9,11 +9,11 @@
         <form    name="nameForm">
            <field    property="firstName"
            	   depends="required">
  -         	     <arg0 key="nameForm.firstname.displayname"/>
  +         	     <arg key="nameForm.firstname.displayname" position="0"/>
            </field>    
            <field    property="lastName"
            	   depends="required">
  -         	     <arg0 key="nameForm.lastname.displayname"/>
  +         	     <arg key="nameForm.lastname.displayname"/>
            </field>
         </form>
      </formset>   
  
  
  
  1.2       +8 -8      jakarta-commons/validator/src/test/org/apache/commons/validator/validator-locale.xml
  
  Index: validator-locale.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-locale.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- validator-locale.xml	20 Jan 2003 06:15:06 -0000	1.1
  +++ validator-locale.xml	25 May 2003 18:00:23 -0000	1.2
  @@ -8,44 +8,44 @@
      <formset>
         <form    name="nameForm" >
            <field    property="firstName"  depends="required">
  -         	     <arg0 key="nameForm.firstname.displayname"/>
  +         	     <arg key="nameForm.firstname.displayname"/>
            </field>    
            <field    property="lastName"
            	   depends="required">
  -         	     <arg0 key="nameForm.lastname.displayname"/>
  +         	     <arg key="nameForm.lastname.displayname"/>
            </field>
         </form>
      </formset>   
      <formset language="en" country="US" variant="TEST1">
         <form    name="nameForm" >
            <field    property="firstName"  depends="required">
  -         	     <arg0 key="nameForm.firstname.displayname"/>
  +         	     <arg key="nameForm.firstname.displayname"/>
            </field>    
            <field    property="lastName"
            	   depends="required">
  -         	     <arg0 key="nameForm.lastname.displayname"/>
  +         	     <arg key="nameForm.lastname.displayname"/>
            </field>
         </form>
      </formset>   
      <formset language="en" country="US" variant="TEST2">
         <form    name="nameForm" >
            <field    property="firstName"  depends="">
  -         	     <arg0 key="nameForm.firstname.displayname"/>
  +         	     <arg key="nameForm.firstname.displayname"/>
            </field>    
            <field    property="lastName"
            	   depends="required">
  -         	     <arg0 key="nameForm.lastname.displayname"/>
  +         	     <arg key="nameForm.lastname.displayname"/>
            </field>
         </form>
      </formset>   
      <formset language="en" country="UK">
         <form    name="nameForm" >
            <field    property="firstName"  depends="required">
  -         	     <arg0 key="nameForm.firstname.displayname"/>
  +         	     <arg key="nameForm.firstname.displayname"/>
            </field>    
            <field    property="lastName"
            	   depends="">
  -         	     <arg0 key="nameForm.lastname.displayname"/>
  +         	     <arg key="nameForm.lastname.displayname"/>
            </field>
         </form>
      </formset>   
  
  
  
  1.3       +2 -2      jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multiple-config-2.xml
  
  Index: validator-multiple-config-2.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multiple-config-2.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- validator-multiple-config-2.xml	22 May 2003 02:52:47 -0000	1.2
  +++ validator-multiple-config-2.xml	25 May 2003 18:00:23 -0000	1.3
  @@ -5,11 +5,11 @@
      <formset>
         <form    name="nameForm">
            <field    property="firstName"  depends="required">
  -         	     <arg0 key="nameForm.firstname.displayname"/>
  +         	     <arg key="nameForm.firstname.displayname"/>
            </field>    
            <field    property="lastName"
            	   depends="required,int">
  -         	     <arg0 key="nameForm.lastname.displayname"/>
  +         	     <arg key="nameForm.lastname.displayname"/>
            </field>
         </form>
      </formset>   
  
  
  
  1.3       +2 -2      jakarta-commons/validator/src/test/org/apache/commons/validator/validator-requiredif.xml
  
  Index: validator-requiredif.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-requiredif.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- validator-requiredif.xml	15 Mar 2003 22:28:20 -0000	1.2
  +++ validator-requiredif.xml	25 May 2003 18:00:23 -0000	1.3
  @@ -8,7 +8,7 @@
      <formset>
         <form    name="nameForm">
            <field    property="firstName"  depends="requiredif">
  -         	     <arg0 key="nameForm.firstname.displayname"/>
  +         	     <arg key="nameForm.firstname.displayname"/>
                     <var>
                      <var-name>field[0]</var-name>
                      <var-value>lastName</var-value>
  @@ -20,7 +20,7 @@
            </field>    
            <field    property="lastName"
            	   depends="requiredif">
  -         	     <arg0 key="nameForm.lastname.displayname"/>
  +         	     <arg key="nameForm.lastname.displayname"/>
                     <var>
                      <var-name>field[0]</var-name>
                      <var-value>firstName</var-value>
  
  
  
  1.2       +2 -2      jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multipletest.xml
  
  Index: validator-multipletest.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/validator-multipletest.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- validator-multipletest.xml	24 Sep 2002 20:23:35 -0000	1.1
  +++ validator-multipletest.xml	25 May 2003 18:00:23 -0000	1.2
  @@ -12,11 +12,11 @@
      <formset>
         <form    name="nameForm">
            <field    property="firstName"  depends="required">
  -         	     <arg0 key="nameForm.firstname.displayname"/>
  +         	     <arg key="nameForm.firstname.displayname"/>
            </field>    
            <field    property="lastName"
            	   depends="required,int">
  -         	     <arg0 key="nameForm.lastname.displayname"/>
  +         	     <arg key="nameForm.lastname.displayname"/>
            </field>
         </form>
      </formset>   
  
  
  
  1.2       +7 -7      jakarta-commons/validator/src/example/org/apache/commons/validator/example/validator-example.xml
  
  Index: validator-example.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/example/org/apache/commons/validator/example/validator-example.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- validator-example.xml	11 Oct 2002 20:17:50 -0000	1.1
  +++ validator-example.xml	25 May 2003 18:00:24 -0000	1.2
  @@ -15,25 +15,25 @@
      <formset>
         <form name="ValidateBean">
            <field property="firstName"  depends="required">
  -         	   <arg0 key="nameForm.firstname.displayname"/>
  +         	   <arg key="nameForm.firstname.displayname"/>
            </field>    
            <field  property="lastName" depends="required">
  -         	     <arg0 key="nameForm.lastname.displayname"/>
  +         	     <arg key="nameForm.lastname.displayname"/>
            </field>
            <field  property="street1" depends="required">
  -         	     <arg0 key="nameForm.street1.displayname"/>
  +         	     <arg key="nameForm.street1.displayname"/>
            </field>
            <field  property="state" depends="required">
  -         	     <arg0 key="nameForm.city.displayname"/>
  +         	     <arg key="nameForm.city.displayname"/>
            </field>
            <field  property="state" depends="required">
  -         	     <arg0 key="nameForm.state.displayname"/>
  +         	     <arg key="nameForm.state.displayname"/>
            </field>
            <field  property="postalCode" depends="required">
  -         	     <arg0 key="nameForm.postalCode.displayname"/>
  +         	     <arg key="nameForm.postalCode.displayname"/>
            </field>
            <field  property="age" depends="required,int">
  -         	     <arg0 key="nameForm.age.displayname"/>
  +         	     <arg key="nameForm.age.displayname"/>
            </field>
   
         </form>
  
  
  
  1.10      +5 -5      jakarta-commons/validator/src/example/org/apache/commons/validator/example/ValidateExample.java
  
  Index: ValidateExample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/example/org/apache/commons/validator/example/ValidateExample.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ValidateExample.java	24 May 2003 19:40:12 -0000	1.9
  +++ ValidateExample.java	25 May 2003 18:00:24 -0000	1.10
  @@ -191,7 +191,7 @@
               Field field = (Field) form.getFieldMap().get(propertyName);
   
               // Look up the formatted name of the field from the Field arg0
  -            String prettyFieldName = apps.getString(field.getArg0().getKey());
  +            String prettyFieldName = apps.getString(field.getArg(0).getKey());
   
               // Get the result of validating the property.
               ValidatorResult result = results.getValidatorResult(propertyName);
  
  
  
  1.3       +44 -2     jakarta-commons/validator/conf/share/validator_1_1.dtd
  
  Index: validator_1_1.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/conf/share/validator_1_1.dtd,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- validator_1_1.dtd	24 May 2003 18:55:13 -0000	1.2
  +++ validator_1_1.dtd	25 May 2003 18:00:24 -0000	1.3
  @@ -111,7 +111,7 @@
                        validations for this field.
   
   -->
  -<!ELEMENT field (msg|arg0|arg1|arg2|arg3|var)*>
  +<!ELEMENT field (msg|arg|arg0|arg1|arg2|arg3|var)*>
   <!ATTLIST field property CDATA #REQUIRED>
   <!ATTLIST field depends CDATA #IMPLIED>
   <!ATTLIST field page CDATA #IMPLIED>
  @@ -140,7 +140,39 @@
   <!ATTLIST msg resource CDATA #IMPLIED>
   
   
  +
  +<!--
  +     The "arg" element defines a replacement value to use with the
  +     message template for this validator or this field.
  +     The arg element accepts these attributes.
  +
  +      name        The name of the validator corresponding to this msg.
  +      			  If not supplied, this argument will be used in the given 
  +      			  position for every validator.
  +
  +      key         The key that will return the message template from a
  +                  resource bundle.
  +
  +      resource    If set to "false", the key is taken to be a literal
  +                  value rather than a bundle key.
  +                  [true]
  +
  +      position    The position of this replacement parameter in the message.
  +      			  For example, position="0" will set the first argument.
  +      			  [0]
  +-->
  +<!ELEMENT arg EMPTY>
  +<!ATTLIST arg key CDATA #REQUIRED>
  +<!ATTLIST arg name CDATA #IMPLIED>
  +<!ATTLIST arg resource CDATA #IMPLIED>
  +<!ATTLIST arg position CDATA #IMPLIED>
  +
  +
  +
   <!--
  +
  +		DEPRECATED Use <arg position="0"/> instead.
  +
        The "arg0" element defines the first replacement value to use with the
        message template for this validator or this field.
        The arg0 element accepts these attributes.
  @@ -161,6 +193,9 @@
   
   
   <!--
  +
  +		DEPRECATED Use <arg position="1"/> instead.
  +
        The "arg1" element defines the second replacement value to use with the
        message template for this validator or this field.
        The arg1 element accepts these attributes.
  @@ -181,6 +216,9 @@
   
   
   <!--
  +
  +		DEPRECATED Use <arg position="2"/> instead.
  +
        The "arg2" element defines the third replacement value to use with the
        message template for this validator or this field.
        The arg2 element accepts these attributes.
  @@ -199,7 +237,11 @@
   <!ATTLIST arg2 key CDATA #IMPLIED>
   <!ATTLIST arg2 resource CDATA #IMPLIED>
   
  +
   <!--
  +
  +		DEPRECATED Use <arg position="3"/> instead.
  +
        The "arg3" element defines the fourth replacement value to use with the
        message template for this validator or this field.
        The arg0 element accepts these attributes.
  
  
  

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


Mime
View raw message