Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 94533 invoked from network); 7 Sep 2004 16:54:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Sep 2004 16:54:28 -0000 Received: (qmail 15941 invoked by uid 500); 7 Sep 2004 16:54:25 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 15912 invoked by uid 500); 7 Sep 2004 16:54:25 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 15899 invoked by uid 500); 7 Sep 2004 16:54:25 -0000 Received: (qmail 15895 invoked by uid 99); 7 Sep 2004 16:54:24 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 07 Sep 2004 09:54:24 -0700 Received: (qmail 94482 invoked by uid 1431); 7 Sep 2004 16:54:23 -0000 Date: 7 Sep 2004 16:54:23 -0000 Message-ID: <20040907165423.94481.qmail@minotaur.apache.org> From: dion@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing ActionTag.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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