commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Ext-Mike.Ho...@nokia.com>
Subject RE: [jelly] Subclassing JellyContext
Date Mon, 09 Dec 2002 10:17:03 GMT
Take a look at this script: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jgt/jgt/tests/net/sourceforge/jgt/jelly/script.jelly?rev=HEAD&content-type=text/vnd.viewcvs-markup

What I have done here is produce a set of Jelly tags that allow you "do things" with a graph
of java objects: create nodes, prune nodes, copy values from one node to another.

All these tags assume the presence of the following variables:

CURRENT_NODE_A - the current node we are looking at in graph A
CURRENT_NODE_B - the current node we are looking at in graph B
PARENT_NODE_A - the parent of the current node in graph A
PARENT_NODE_B - the parent of the current node in graph B
ROOT_NODE_A - the root node from graph A
ROOT_NODE_B - the root node from graph B

The first 4 values are set by the graph:mapping tag.  It says "position yourself at the specified
'location' in graphs A and B".  And then all the creation, pruning and copying tags work in
the context of this 'location'.

So the "scoping effect" is a natural and automatic mechanism that the author of this script
does not have to care about.  Well, he does have to care about it, but he does not have to
manage it is what I am saying.

> -----Original Message-----
> From: ext James Strachan [mailto:james_strachan@yahoo.co.uk]
> Sent: 09. December 2002 12:06
> To: Jakarta Commons Developers List
> Subject: Re: [jelly] Subclassing JellyContext
> 
> 
> > Ok, but I want the scoping of values to be transparent to 
> the Jelly script
> writer.
> 
> In what way? Could you give an example of the kind of thing you mean?
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> ----- Original Message -----
> From: <Ext-Mike.Hogan@nokia.com>
> To: <commons-dev@jakarta.apache.org>
> Sent: Monday, December 09, 2002 10:03 AM
> Subject: RE: [jelly] Subclassing JellyContext
> 
> 
> Ok, but I want the scoping of values to be transparent to the 
> Jelly script
> writer.
> 
> > -----Original Message-----
> > From: ext James Strachan [mailto:james_strachan@yahoo.co.uk]
> > Sent: 09. December 2002 9:58
> > To: Jakarta Commons Developers List
> > Subject: Re: [jelly] Subclassing JellyContext
> >
> >
> > > What I meant to say was that a variable _value_ should be
> > visible only in
> > a certain
> > > scope.  So there is a stack of values per variable.
> >
> > You could create a number of different contexts each of which
> > can contain
> > different values of a given variable name. e.g.
> >
> > <j:set var="foo" value="1"/>
> > <j:scope>
> >     <j:set var="foo" value="2"/>
> >
> >     <j:scope>
> >         <j:set var="foo" value="3"/>
> >         ${foo}
> >     </j:scope>
> >     ${foo}
> > </j:scope>
> > ${foo}
> >
> > which would output "3 2 1". i.e. that the above implements 
> a stack of
> > variable values of the 'foo' variable.
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> > ----- Original Message -----
> > From: <Ext-Mike.Hogan@nokia.com>
> > To: <commons-dev@jakarta.apache.org>
> > Sent: Monday, December 09, 2002 6:48 AM
> > Subject: RE: [jelly] Subclassing JellyContext
> >
> >
> > > Variables should automatically be available to their child
> > > contexts so I
> > > don't think you need to create your own JellyContext for that.
> >
> > What I meant to say was that a variable _value_ should be
> > visible only in a
> > certain
> > scope.  So there is a stack of values per variable.
> >
> > > Also the push/pop features can be used by just creating and
> > > using child
> > > context - its rather like using a local block in Java.
> >
> > Ok, I will look into this - this should help.
> >
> > > There's also the
> > > <j:scope> tag which creates a child variable scope,
> > > essentially making any
> > > variables set inside the <j:scope> tag
> > >
> > > One question; where will you be using these typesafe getters
> > > and setters you
> > > want? Will it be inside a Jelly Tag implementation?
> >
> > Unfortunately no.  The application has to put about 10 values
> > in the context
> > before the Jelly Tags can do their work.  Right now I am
> > doing it via a
> > "ContextHelper"
> > class.
> >
> > Thanks for the help,
> > Mike.
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:commons-dev-help@jakarta.apache.org>
> >
> > __________________________________________________
> >
> > Do You Yahoo!?
> >
> > Everything you'll ever need on one web page
> >
> > from News and Sport to Email and Music Charts
> >
> > http://uk.my.yahoo.com
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:commons-dev-help@jakarta.apache.org>
> >
> >
> 
> --
> To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> 
> __________________________________________________
> 
> Do You Yahoo!?
> 
> Everything you'll ever need on one web page
> 
> from News and Sport to Email and Music Charts
> 
> http://uk.my.yahoo.com
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message