You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/08/19 23:42:03 UTC
cvs commit: jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/define MyRunnable.java jellyBeanSample.jelly
jstrachan 2002/08/19 14:42:03
Modified: jelly/src/test/org/apache/commons/jelly/define
MyRunnable.java jellyBeanSample.jelly
Log:
Added support for Ant style adder and setter methods that can be used either on a Jelly Tag implementation or on a regular Java Bean that is bound to a dynamic tag via either <define:bean> or <define:jellybean>
So you can write a tag or bean like this
public MyTag extends TagSupport {
public void setFileset(FileSet fileSet);
// or
public void addFileset(FileSet fileSet);
}
which can then take nested (say) <fileset> Ant properties etc.
To see this in action, try the demo:jellybean Maven target which demonstrates the use of this technique.
Revision Changes Path
1.2 +13 -1 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/define/MyRunnable.java
Index: MyRunnable.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/define/MyRunnable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MyRunnable.java 25 Jun 2002 19:12:29 -0000 1.1
+++ MyRunnable.java 19 Aug 2002 21:42:03 -0000 1.2
@@ -61,9 +61,14 @@
*/
package org.apache.commons.jelly.define;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.tools.ant.types.FileSet;
+
/**
* An example Runnable bean that is framework neutral and just performs
* some useful function.
@@ -78,16 +83,23 @@
private int x;
private String y;
-
+ private List fileSets = new ArrayList();
public MyRunnable() {
}
+ // Adder methods
+ //-------------------------------------------------------------------------
+ public void addFileset(FileSet fileSet) {
+ fileSets.add(fileSet);
+ }
+
// Runnable interface
//-------------------------------------------------------------------------
public void run() {
log.info( "About to do something where x = " + getX() + " y = " + getY() );
+ log.info( "FileSets are: " + fileSets );
}
1.4 +15 -3 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/define/jellyBeanSample.jelly
Index: jellyBeanSample.jelly
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/define/jellyBeanSample.jelly,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- jellyBeanSample.jelly 17 Jul 2002 17:38:16 -0000 1.3
+++ jellyBeanSample.jelly 19 Aug 2002 21:42:03 -0000 1.4
@@ -5,7 +5,8 @@
xmlns:j="jelly:core"
xmlns:define="jelly:define"
xmlns:log="jelly:log"
- xmlns:my="myDummyTagLib">
+ xmlns:my="myDummyTagLib"
+ xmlns="jelly:ant">
<testcase>
@@ -21,11 +22,22 @@
<log:info>Now lets invoke the new Jelly bean tag</log:info>
- <my:foo x="2" y="cheese"/>
+ <my:foo x="2" y="cheese">
+ <fileset dir=".">
+ <include name="*.xml"/>
+ </fileset>
+ <fileset dir="src/java">
+ <include name="*.java"/>
+ </fileset>
+ </my:foo>
<log:info>Did that work?</log:info>
- <my:foo x="2"/>
+ <my:foo x="2">
+ <fileset dir=".">
+ <include name="*.xml"/>
+ </fileset>
+ </my:foo>
</testcase>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>