commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing ActionTag.java
Date Tue, 07 Sep 2004 16:54:23 GMT
dion        2004/09/07 09:54:23

  Modified:    jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing
                        ActionTag.java
  Log:
  Apply Jelly-114.
  
  Revision  Changes    Path
  1.10      +16 -23    jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ActionTag.java
  
  Index: ActionTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ActionTag.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ActionTag.java	25 Feb 2004 01:31:56 -0000	1.9
  +++ ActionTag.java	7 Sep 2004 16:54:23 -0000	1.10
  @@ -16,12 +16,14 @@
   package org.apache.commons.jelly.tags.swing;
   
   import java.awt.event.ActionEvent;
  +import java.lang.reflect.InvocationTargetException;
   import java.util.Iterator;
   import java.util.Map;
   
   import javax.swing.AbstractAction;
   import javax.swing.Action;
   
  +import org.apache.commons.beanutils.BeanUtils;
   import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.MissingAttributeException;
   import org.apache.commons.jelly.XMLOutput;
  @@ -45,29 +47,6 @@
       public ActionTag() {
       }
   
  -    // Tag interface
  -    //-------------------------------------------------------------------------       
            
  -    public void doTag(XMLOutput output) throws JellyTagException {
  -        Map attributes = getAttributes();
  -        String var = (String) attributes.get( "var" );
  -        Object classObject = attributes.remove( "class" );
  -        
  -        // this method could return null in derived classes
  -        Class theClass = null;
  -        try {
  -           theClass = convertToClass(classObject);
  -        } catch (ClassNotFoundException e) {
  -            throw new JellyTagException(e);
  -        }
  -        
  -        Object bean = newInstance(theClass, attributes, output);
  -        setBean(bean);
  -        
  -        setBeanProperties(bean, attributes);
  -        
  -        processBean(var, bean);
  -    }
  -
       
       // Properties
       //-------------------------------------------------------------------------       
            
  @@ -157,6 +136,20 @@
        */
       protected void setBeanProperties(Object bean, Map attributes) throws JellyTagException
{
           Action action = getAction();
  +        
  +        String enabled = "enabled";
  +        if (attributes.containsKey(enabled)) {
  +            try {
  +                BeanUtils.copyProperty(action, enabled, attributes.get(enabled));
  +            } catch (IllegalAccessException e) {
  +                throw new JellyTagException("Failed to set the enabled property.", e);
  +            } catch (InvocationTargetException e) {
  +                throw new JellyTagException("Failed to set the enabled property.", e);
  +            }
  +            
  +            attributes.remove(enabled);
  +        }
  +        
           for ( Iterator iter = attributes.entrySet().iterator(); iter.hasNext(); ) {
               Map.Entry entry = (Map.Entry) iter.next();
               String name = (String) entry.getKey();
  
  
  

---------------------------------------------------------------------
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