On 6/12/01 11:58 AM, "Gary Lawrence Murphy" <[EMAIL PROTECTED]> wrote:
>
> What is the semantic difference between calling
> RunData.{get|set}Layout vs RunData.{get|set}LayoutTemplate; this same
> pattern is repeated for all the other template components but the
> api-docs only say that the *Template methods are "Convenience method
> for a template" .. what chain of methods do these methods replace?
The semantic difference between the two is that one family of
methods is referencing modules directly and the other family
references templates.
There was a point in time when the view portion of Turbine was
implemented using ECS (Element Construction Set) so that you had
to create modules, actual Java classes, to control the view portion
of your application. We have deprecated the use of ECS for the view
and now use templating systems.
The two families of methods are confusing and it might be
possible to actually deprecate them. When using Velocity you
should not need to call any of the RunData.{get|set}X methods.
You should strictly use the RunData.{get|set}Xtemplate methods.
You also do not need to use RunData.setLayoutTemplate(Z) anymore
because a call to RunData.setScreenTemplate(Y) will automatically
trigger a search for the corresponding layout template.
So, for example, LoginUser action that is part of Turbine you
will see that upon a failed login attempt we force the presentation
of the login template as follows:
(1) data.setScreenTemplate(loginTemplate)
In this case the value of 'loginTemplate' is taken from the TRP file.
This single statement is all that you need to control the flow of
the view. Let's say that the value of 'loginTemplate is 'Login.vm':
when you execute (1) a layout template search is executed so that
if you have a layout template called 'Login.vm' than that will be
used.
In the case of logging users in this is probably what you want
because your Default.vm layout template usually shows things
for logged in users. This is just a simple example.
I'm am not 100% sure if a single statement like (1) is all that
will ever be needed but I added the search for layouts so that
you didn't have to explicity do:
data.setScreenTemplate(X);
data.setLayoutTemplate(Y);
Turbine should do it for you.
I hope that helps :-)
The API docs should be changed because the template family of
methods are not convenience methods any longer, they are
fundamental now.
> - Does this imply that the *Template versions should only be called
> from _within_ a template (ie $data.getLayout) whereas the others are
> called from within modules/*/*.java files?
>
> - What happens if I am in the middle of a template and I call
> setLayoutTemplate? Does this immediately drop the current layout
> rendering and restart the rendering process on the new layout?
>
> - Is it the same action sequence if I call setLayout from within
> doBuildTemplate?
--
jvz.
http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]