You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2004/09/02 02:15:08 UTC
cvs commit: jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing ComponentTag.java
dion 2004/09/01 17:15:08
Modified: jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing
ComponentTag.java
Log:
Jelly-122
Revision Changes Path
1.18 +25 -0 jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ComponentTag.java
Index: ComponentTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ComponentTag.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ComponentTag.java 25 Feb 2004 01:31:56 -0000 1.17
+++ ComponentTag.java 2 Sep 2004 00:15:07 -0000 1.18
@@ -49,6 +49,12 @@
* This tag creates a Swing component and adds it to its parent tag, optionally declaring this
* component as a variable if the <i>var</i> attribute is specified.</p>
*
+ * <p> This tag clears the reference to it's bean after doTag runs.
+ * This means that child tags can access the component (bean) normally
+ * during execution but should not hold a reference to this
+ * tag after their doTag completes.
+ * </p>
+ *
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @version $Revision$
*/
@@ -405,5 +411,24 @@
protected Object getConstraint() {
return null;
+ }
+
+ /**Overrides the default UseBean functionality to clear the bean after the
+ * tag runs. This prevents us from keeping references to heavy Swing objects
+ * around for longer than they are needed.
+ * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
+ */
+ public void doTag(XMLOutput output) throws JellyTagException {
+ super.doTag(output);
+ clearBean();
+ }
+
+ /** Sets the bean to null, to prevent it from
+ * sticking around in the event that this tag instance is
+ * cached. This method is called at the end of doTag.
+ *
+ */
+ protected void clearBean() {
+ setBean(null);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org