on 11/9/2000 8:26 AM, "Tom Green" <[EMAIL PROTECTED]> wrote:
> I agree that this document is really helpful, but I puzzled over the same
> issue
> as Rafal, and was about to post to the list before Rafal beat me to it. We've
> been adding the same kind of objects to the Context by subclassing (in our
> case)
> TurbineWebMacroService and overriding getContext(), but on reading the
> document I began to worry that there was something dangerous about doing that.
> I know that I could study the source carefully and find the answer, but I
> would
> also welcome it if someone with more experience than me could critically
> review
> the difference between these two approaches.
The right way to auto add objects to the Context would be by subclassing
your Screens or Page or Layout (depending on what the visibility of the
Context is) to make it happen.
So, you have a "BaseScreen". Within that you have the void
doBuildTemplate(RunData data) method where you can say:
context.put (my custom context object);
Then, any screen which extends BaseScreen would automatically have that
object added in its context.
You should also carry the abstract doBuidTemplate(RunData data, WebContext
context) over from the WebMacroSiteScreen so that any screen which extends
this screen will be required to implement that method.
Eventually though, we should provide an API in TurbineWebMacroService for
doing this same thing as well, but I like the above because it gives you
more control over where those objects are placed into the Context.
-jon
--
http://scarab.tigris.org/ | http://noodle.tigris.org/
http://java.apache.org/ | http://java.apache.org/turbine/
http://www.working-dogs.com/ | http://jakarta.apache.org/velocity/
http://www.collab.net/ | http://www.sourcexchange.com/
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]