Hi - 

It seems to me that my understanding of the screen/layout thing is that the
following approach would be preferred:

Public class myScreen extends TemplateScreen {

    ... Normal implementation here ... or nothing ...

    public String getLayout ( RunData data ) {
        ... return your layout instead of the default layout
        ... using whatever logic you desire
    }
}

If you derive your screens from the myScreen class, I believe that when
setScreenTemplate is called, and turbine goes on its hunt for the proper
layout, your getLayout method (above) will be called and return the layout
you desire.

I am not 100% sure of this result, but it may be worth a try.

Good Luck!
-best-darr-



 -----Original Message-----
From:   Jason van Zyl [mailto:[EMAIL PROTECTED]] 
Sent:   Tuesday, June 26, 2001 3:51 PM
To:     [EMAIL PROTECTED]
Subject:        Re: setScreenTemplate

On 6/26/01 6:37 PM, "Xun Liu" <[EMAIL PROTECTED]> wrote:

> At 18:01 2001-6-26 -0400, you wrote:
>> On 6/26/01 5:07 PM, "Xun Liu" <[EMAIL PROTECTED]> wrote:
>> 
>>> Not exactly. Different users will share the same templates, but
different
>>> layout and
>>> look/feel.
>> 
>> If the requirement is only to change the layout then why are you
>> making calls to setScreenTemplate?
> 
> 
> Here is an example:
> 
> An screen class has the following code in the doBuildTemplate() method:

So before this block of code you have already set the layout template?
If so then a work around would be to do the following:

// Save the layout template before setScreenTemplate
// clobbers it.
String layout = data.getLayoutTemplate();
 
> If (the user is under 21) {
>        data.setScreenTemplate("NoDrinking.vm")
> }
> else {
>        data.setScreenTemplate("Drinking.vm")
> }

// Restore the layout template
data.setLayoutTemplate(layout);
 
> As you pointed out, after setScreenTemplate is executed the layout
template
> is also changed.
> 
> However the users want the screen templates ("NoDrinking.vm",
> "Drinking.vm", etc) to be
> displayed in their preferred layout templates.

Maybe we could change the behavior of setScreenTemplate() so
that it optionally looked for a matching layout template or
maybe we could make another method, say, setScreenTemplateXXX()
that looked up the layout and the original method wouldn't.
I'll think about it for a bit. But the work around should do
the trick if it's your layout template that's getting
clobbered by setScreenTemplate().
 
> 
> Thanks for your advices.
> 
> Xun
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 

jvz.

Jason van Zyl

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]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to