gonzalo     01/07/12 05:05:28

  Modified:    src/java/org/apache/turbine/util/template Tag: T_2_1_BRANCH
                        SelectorBox.java
  Log:
  Added a method setSelected(Object name) that will set all the elements
  in the SelectorBox as unselected, except for those that match the name.
  I will apply the same patch in HEAD presently.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.10.9  +25 -1     
jakarta-turbine/src/java/org/apache/turbine/util/template/Attic/SelectorBox.java
  
  Index: SelectorBox.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/template/Attic/SelectorBox.java,v
  retrieving revision 1.5.10.8
  retrieving revision 1.5.10.9
  diff -u -r1.5.10.8 -r1.5.10.9
  --- SelectorBox.java  2001/06/04 23:53:33     1.5.10.8
  +++ SelectorBox.java  2001/07/12 12:05:13     1.5.10.9
  @@ -100,7 +100,7 @@
    * </pre>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jon S. Stevens</a>
  - * @version $Id: SelectorBox.java,v 1.5.10.8 2001/06/04 23:53:33 jvanzyl Exp $
  + * @version $Id: SelectorBox.java,v 1.5.10.9 2001/07/12 12:05:13 gonzalo Exp $
    */
   public class SelectorBox
   {
  @@ -342,4 +342,28 @@
           return this;
       }
   
  +    /**
  +     * This will set all elements as unselected, except for the
  +     * element(s) with the given name.
  +     *
  +     * @param name The name to appear as selected.
  +     * @return A SelectorBox (self).
  +     */
  +    public SelectorBox setSelected(Object name)
  +    {
  +        if (name != null)
  +        {
  +            selected = new boolean[names.length];
  +            for ( int i=0; i<names.length; i++ )
  +            {
  +                Object o = names[i];
  +                if ( o != null && 
  +                     o.toString().equalsIgnoreCase(name.toString()) )
  +                {
  +                    selected[i] = true;
  +                }
  +            }
  +        }
  +        return this;
  +    }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to