You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Terry McBride <tt...@yahoo.com> on 2001/11/22 00:06:51 UTC

RE: Pull Tool Re: Cannot get correct Layout with my Reflect(ing) Screen

Thanks Jeff,

Praise be to Pull Tools =)

.
.
.

I thought I was being clever to add another directory
parallel to templates/app (templates/display).  I
wanted turbine to find the screen in display/screens
(after adding this to path in TRprops) and use
display/layouts/Default.vm so I wouldn't have to have
a crapload of layouts, but it didn't behave that way.

So, I'm putting
$data.setLayoutTemplate("/DisplayDefault.vm") in my
screens in that dir (unless I need a specific layout).

Any comments?


--- "Brekke, Jeff" <Je...@qg.com> wrote:
> Don't use screen objects, use pull tool(s). Read the
> pull-tool docs on the
> Turbine site.  The only reason left for needing a
> screen object is security.
> Name your screen template the same as the layout you
> want to use: 
> 
>        /layouts
>            Printable.vm
>            Default.vm
>        /screens 
>            Printable.vm
>            Index.vm
>            Other.vm  
> 
> When Index.vm and Other.vm are rendered, turbine
> will use Default.vm.  When
> the Printable.vm screen is rendered, it will use the
> Printable.vm layout.
> 
> -----Original Message-----
> From: Terry McBride
> To: Turbine Users List
> Sent: 11/16/01 4:00 PM
> Subject: Pull Tool Re: Cannot get correct Layout
> with my Reflect(ing) Screen
> 
> 
> Dookie!
> 
> After reading the NumberFormatter Pull Tool thread,
> maybe I should be making this a pull tool.
> 
> BUT, I'm still tired of having a bazillion Screen
> classes that are the same thing over and over.  How
> can I have one Screen serve different screen
> templates
> AND LAYOUT TEMPLATES and have it work correctly (not
> use Layout DefaultLayout - during my investigation I
> had set default.layout to DefaultLayout it TR.props;
> this is the layout I'm seeing).
> 
> --- Terry McBride <tt...@yahoo.com> wrote:
> > Hi, 
> > 
> > I'm trying to write a VelocityScreen that allows
> me
> > to
> > set the velocity templates to use as layout and
> > screen
> > from parameters.  I get the appropriate object
> > passed
> > to the appropriate screen, but the layout is
> screwed
> > up.  No matter what I do I keep getting a/the
> > DefaultLayout with top and bottomg containing the
> > text: 
> >      "Turbine - A Servlet Framework for building
> > Secure Dynamic Websites."
> > 
> > In my screen $data.getLayout() returns
> > VelocityECSLayout and $data.getLayoutTemplate()
> > returns the outline parameter ("/Display.vm") but
> > the
> > appropriate layout is not used.
> > 
> > Can anyone shed some light?
> > 
> > I've had data.setScreenTemplate() in place of
> > setTemplate() as well.
> > 
> > 
> > extends VelocityScreen CODE:
> > 
> >     /**
> >      * Place the componenet in the context
> >      * for use in the template. 
> >      * Uses OMUtils to locate the componenent.
> >      * expect component=Class of the component and
> > the
> > component id to be placed in params
> >      */
> >     public void doBuildTemplate( RunData data,
> > Context
> > context )
> >     {
> > 
> > 	// get the component (ie. Quote, Organization,
> > Image)
> > 	String className =
> > data.getParameters().get("component");
> > 
> > 	if (className != null && className != "")
> > 	{
> > 
> > 		BaseObject object = null;
> > 
> > 		try 
> > 		{
> > 
> > 			// Find the appropriate method in OMUtils and
> > invoke it
> > 			String methodName = "find" + className;
> > 
> > 			Class[] paramTypes = {
> > Class.forName("org.apache.turbine.util.RunData")
> };
> > 			Object[] paramList = { data };
> > 
> > 			Class OMClass =
> >
>
Class.forName("edu.stanford.mlkpp.launchpads.utils.OMUtils");
> > 			Method finder = OMClass.getMethod(methodName,
> > paramTypes);
> > 			object = (BaseObject) finder.invoke(null,
> > paramList);
> > 		}
> > 		catch (Exception e)
> > 		{
> > 			data.setMessage("Error finding component with
> > className " + className);
> > 			e.printStackTrace();
> > 			setTemplate(data, "Error.vm");
> > 		}
> > 
> > 		if (object != null)
> >         		context.put(className.toLowerCase(),
> > object);
> > 
> > 	}
> > 	else
> > 	{
> > 			data.setMessage("No component parameter
> found");
> > 			setTemplate(data, "Error.vm");
> > 	}
> > 
> > 	// set template and layout	
> > 	String view = data.getParameters().get("view");
> > 	String outline =
> > data.getParameters().get("outline");
> > 
> > System.out.println(" found view " + view + " and
> > outline " + outline);
> > 
> > 	try {
> > 		if (view != null) {
> > 			setTemplate(data, view);
> > 		}
> > 
> > 		if (outline != null) {
> > 			setLayout(data, "VelocityECSLayout");
> > 			data.setLayoutTemplate(outline);
> > 		}
> > 	} catch (Exception e) {
> > 		e.printStackTrace();
> > 	}
> >     }
> > 
> > 
> > 
> > =====
> > "I'm concerned about a better world. I'm concerned
> > about justice; I'm concerned about brotherhood;
> I'm
> > concerned about truth. And when one is concerned
> > about that, he can never advocate violence. For
> > through violence you may murder a murderer, but
> you
> > can't murder murder. Through violence you may
> murder
> > a liar, but you can't establish truth. Through
> > violence you may murder a hater, but you can't
> > murder hate through violence. Darkness cannot put
> > out darkness; only light can do that."
> > 
> > -M. L. King, Jr., 16 August 1967
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Find the one for you at Yahoo! Personals
> > http://personals.yahoo.com
> > 
> > --
> > To unsubscribe, e-mail:  
> >
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > 
> 
> 
> =====
> "I'm concerned about a better world. I'm concerned
> about justice; I'm
> concerned about brotherhood; I'm concerned about
> truth. And when one is
> concerned about that, he can never advocate
> violence. For through
> violence you may murder a murderer, but you can't
> murder murder. Through
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: foo/layouts/Default.vm WAS: Pull Tool Re: Cannot get correct Layout with my Reflect(ing) Screen

Posted by Terry McBride <tt...@yahoo.com>.
Thanks All,

Sorry `bout that.  I guess I'm going against the grain
setting up my template directories.  

I got a false notion from reading (and altering) the
following line in TRprops...

services.VelocityService.file.resource.loader.path =
/templates/app,/templates/flux [, /templates/display]

It seems like your suggestion is to set it like so...

services.VelocityService.file.resource.loader.path =
/templates,/templates/flux

and use setPage(app, Foo.vm) and (display,Foo.vm) to
seperate my administration templates from public
display templates.  It's is very nearly the same as
having /templates/app/screens/display but it makes me
happier ;)

Do I have it right now?

Thanks,
Terry

--- John McNally <jm...@collab.net> wrote:
> the way it works you would need to have
> 
> templates/screens/app
> templates/screens/display
> 
> templates/layouts/app
> templates/layouts/display
> 
> then in templates you would references screens as
> $link.setPage("app,Foo.vm")
> 
> and screens/app/Foo.vm will use
> layouts/app/Default.vm for layout unless
> (maybe) a layouts/app/Foo.vm existed.
> 
> john mcnally
> 
> Terry McBride wrote:
> > 
> > Jason,
> > 
> > I know that screen/Foo.vm uses layouts/Foo.vm.
> > 
> > I was hoping that templates/display/screens/Foo.vm
> > would use templates/display/layouts/Default.vm (it
> > appears to use the same default layout -
> > templates/app/layouts/Default.vm - regardless of
> the
> > subdirectory)
> > .
> > 
> > I hoped that their would be a default layout for
> each
> > subdirectory of templates.
> > 
> > Here is my directory structure
> > 
> > templates/
> >    templates/app/
> >         templates/app/layouts
> >         templates/app/navigations
> >         templates/app/screens
> > 
> >    templates/display/
> >         templates/display/layouts
> >               templates/display/layouts/Default.vm
> >               templates/display/layouts/Display.vm
> >         templates/display/navigations
> >         templates/display/screens
> >              
> templates/display/screens/ShowTopic.vm
> > 
> > Did I miss something?
> > 
> > Thanks for any help,
> > Terry
> > 
> > --- Jason van Zyl <jv...@zenplex.com> wrote:
> > > On 11/21/01 6:06 PM, "Terry McBride"
> > > <tt...@yahoo.com> wrote:
> > >
> > > > Thanks Jeff,
> > > >
> > > > Praise be to Pull Tools =)
> > > >
> > > > .
> > > > .
> > > > .
> > > >
> > > > I thought I was being clever to add another
> > > directory
> > > > parallel to templates/app (templates/display).
>  I
> > > > wanted turbine to find the screen in
> > > display/screens
> > > > (after adding this to path in TRprops) and use
> > > > display/layouts/Default.vm so I wouldn't have
> to
> > > have
> > > > a crapload of layouts, but it didn't behave
> that
> > > way.
> > >
> > > It does work, show us a tree of your directory
> > > structure and I can probably
> > > point out what's wrong. Layout templates in a
> > > parallel directory will be
> > > found and  used. With the TDK sample app with no
> > > modifications to the TRP
> > > with this setup:
> > >
> > > templates/app
> > >   screens/
> > >     Foo.vm
> > >   layouts/
> > >     Foo.vm
> > >
> > > Will result in the Foo.vm layout being used with
> the
> > > Foo.vm template screen.
> > >
> > > > So, I'm putting
> > > > $data.setLayoutTemplate("/DisplayDefault.vm")
> in
> > > my
> > > > screens in that dir (unless I need a specific
> > > layout).
> > > >
> > > > Any comments?
> > >
> > > Turbine's searching mechanism works, you don't
> need
> > > to diddle your templates
> > > for particular layouts.
> > >
> > >
> > >
> > > --
> > >
> > > 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:
> > >
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <ma...@jakarta.apache.org>
> > >
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! GeoCities - quick and easy web site
> hosting, just $8.95/month.
> > http://geocities.yahoo.com/ps/info1
> > 
> > --
> > To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: foo/layouts/Default.vm WAS: Pull Tool Re: Cannot get correct Layout with my Reflect(ing) Screen

Posted by John McNally <jm...@collab.net>.
the way it works you would need to have

templates/screens/app
templates/screens/display

templates/layouts/app
templates/layouts/display

then in templates you would references screens as
$link.setPage("app,Foo.vm")

and screens/app/Foo.vm will use layouts/app/Default.vm for layout unless
(maybe) a layouts/app/Foo.vm existed.

john mcnally

Terry McBride wrote:
> 
> Jason,
> 
> I know that screen/Foo.vm uses layouts/Foo.vm.
> 
> I was hoping that templates/display/screens/Foo.vm
> would use templates/display/layouts/Default.vm (it
> appears to use the same default layout -
> templates/app/layouts/Default.vm - regardless of the
> subdirectory)
> .
> 
> I hoped that their would be a default layout for each
> subdirectory of templates.
> 
> Here is my directory structure
> 
> templates/
>    templates/app/
>         templates/app/layouts
>         templates/app/navigations
>         templates/app/screens
> 
>    templates/display/
>         templates/display/layouts
>               templates/display/layouts/Default.vm
>               templates/display/layouts/Display.vm
>         templates/display/navigations
>         templates/display/screens
>               templates/display/screens/ShowTopic.vm
> 
> Did I miss something?
> 
> Thanks for any help,
> Terry
> 
> --- Jason van Zyl <jv...@zenplex.com> wrote:
> > On 11/21/01 6:06 PM, "Terry McBride"
> > <tt...@yahoo.com> wrote:
> >
> > > Thanks Jeff,
> > >
> > > Praise be to Pull Tools =)
> > >
> > > .
> > > .
> > > .
> > >
> > > I thought I was being clever to add another
> > directory
> > > parallel to templates/app (templates/display).  I
> > > wanted turbine to find the screen in
> > display/screens
> > > (after adding this to path in TRprops) and use
> > > display/layouts/Default.vm so I wouldn't have to
> > have
> > > a crapload of layouts, but it didn't behave that
> > way.
> >
> > It does work, show us a tree of your directory
> > structure and I can probably
> > point out what's wrong. Layout templates in a
> > parallel directory will be
> > found and  used. With the TDK sample app with no
> > modifications to the TRP
> > with this setup:
> >
> > templates/app
> >   screens/
> >     Foo.vm
> >   layouts/
> >     Foo.vm
> >
> > Will result in the Foo.vm layout being used with the
> > Foo.vm template screen.
> >
> > > So, I'm putting
> > > $data.setLayoutTemplate("/DisplayDefault.vm") in
> > my
> > > screens in that dir (unless I need a specific
> > layout).
> > >
> > > Any comments?
> >
> > Turbine's searching mechanism works, you don't need
> > to diddle your templates
> > for particular layouts.
> >
> >
> >
> > --
> >
> > 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:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
> http://geocities.yahoo.com/ps/info1
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


foo/layouts/Default.vm WAS: Pull Tool Re: Cannot get correct Layout with my Reflect(ing) Screen

Posted by Terry McBride <tt...@yahoo.com>.
Jason,

I know that screen/Foo.vm uses layouts/Foo.vm.

I was hoping that templates/display/screens/Foo.vm
would use templates/display/layouts/Default.vm (it
appears to use the same default layout -
templates/app/layouts/Default.vm - regardless of the
subdirectory)
.

I hoped that their would be a default layout for each
subdirectory of templates.

Here is my directory structure

templates/
   templates/app/
        templates/app/layouts
        templates/app/navigations
        templates/app/screens

   templates/display/
        templates/display/layouts
              templates/display/layouts/Default.vm
              templates/display/layouts/Display.vm
        templates/display/navigations
        templates/display/screens
              templates/display/screens/ShowTopic.vm


Did I miss something?


Thanks for any help,
Terry

--- Jason van Zyl <jv...@zenplex.com> wrote:
> On 11/21/01 6:06 PM, "Terry McBride"
> <tt...@yahoo.com> wrote:
> 
> > Thanks Jeff,
> > 
> > Praise be to Pull Tools =)
> > 
> > .
> > .
> > .
> > 
> > I thought I was being clever to add another
> directory
> > parallel to templates/app (templates/display).  I
> > wanted turbine to find the screen in
> display/screens
> > (after adding this to path in TRprops) and use
> > display/layouts/Default.vm so I wouldn't have to
> have
> > a crapload of layouts, but it didn't behave that
> way.
> 
> It does work, show us a tree of your directory
> structure and I can probably
> point out what's wrong. Layout templates in a
> parallel directory will be
> found and  used. With the TDK sample app with no
> modifications to the TRP
> with this setup:
> 
> templates/app
>   screens/
>     Foo.vm
>   layouts/
>     Foo.vm
> 
> Will result in the Foo.vm layout being used with the
> Foo.vm template screen.
>  
> > So, I'm putting
> > $data.setLayoutTemplate("/DisplayDefault.vm") in
> my
> > screens in that dir (unless I need a specific
> layout).
> > 
> > Any comments?
> 
> Turbine's searching mechanism works, you don't need
> to diddle your templates
> for particular layouts.
>  
> 
> 
> -- 
> 
> 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:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Pull Tool Re: Cannot get correct Layout with my Reflect(ing) Screen

Posted by Jason van Zyl <jv...@zenplex.com>.
On 11/21/01 6:06 PM, "Terry McBride" <tt...@yahoo.com> wrote:

> Thanks Jeff,
> 
> Praise be to Pull Tools =)
> 
> .
> .
> .
> 
> I thought I was being clever to add another directory
> parallel to templates/app (templates/display).  I
> wanted turbine to find the screen in display/screens
> (after adding this to path in TRprops) and use
> display/layouts/Default.vm so I wouldn't have to have
> a crapload of layouts, but it didn't behave that way.

It does work, show us a tree of your directory structure and I can probably
point out what's wrong. Layout templates in a parallel directory will be
found and  used. With the TDK sample app with no modifications to the TRP
with this setup:

templates/app
  screens/
    Foo.vm
  layouts/
    Foo.vm

Will result in the Foo.vm layout being used with the Foo.vm template screen.
 
> So, I'm putting
> $data.setLayoutTemplate("/DisplayDefault.vm") in my
> screens in that dir (unless I need a specific layout).
> 
> Any comments?

Turbine's searching mechanism works, you don't need to diddle your templates
for particular layouts.
 


-- 

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>