Re: Adding tab to default project (index, about, contact)

2013-08-31 Thread Jeremy Villalobos
Yes, I think session storage is what I need.

Thank you


On Fri, Aug 30, 2013 at 5:27 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Fri, 30 Aug 2013 17:33:28 -0300, Jeremy Villalobos <
> jeremyvillalo...@gmail.com> wrote:
>
>  I am still new to Tapestry 5.  For a prototype, I am doing very simple
>> user login portal.   I would like to show a couple of option along with
>> index,
>> about and contact, but they would only show up if the user is signed in.
>>
>> How do I access the Layout class from a Page ?
>>
>
> You can @InjectComponent private Layout layout; in the page, but that's
> something to be avoided. The best practice is to have top-down
> communication: from page to component and from a component to the
> components declared inside it. What exactly do you need? Anyway, the logged
> in or not state wouldn't be handled inside just a given component or page.
> Instead, the simpler solution would be to have some sort of User class and
> declare @SessionState(create = false) private User user; fields in any page
> or component that needs it. See http://tapestry.apache.org/**
> session-storage.html for 
> more details.
>
>
>  I see on the documentation that I can use "Nested Layouts"  but I still
>> need some sample code or project to see how it works.
>>
>
> The Layout component is a component as each other, having no special
> meaning or treatment. If you use one component inside another, you're
> having nested components, and the same is valid for layouts, because
> layouts are ordinary components.
>
> --
> Thiago H. de Paula Figueiredo
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Jeremy


Re: Adding tab to default project (index, about, contact)

2013-08-30 Thread Thiago H de Paula Figueiredo
On Fri, 30 Aug 2013 17:33:28 -0300, Jeremy Villalobos  
 wrote:


I am still new to Tapestry 5.  For a prototype, I am doing very simple  
user login portal.   I would like to show a couple of option along with  
index,

about and contact, but they would only show up if the user is signed in.

How do I access the Layout class from a Page ?


You can @InjectComponent private Layout layout; in the page, but that's  
something to be avoided. The best practice is to have top-down  
communication: from page to component and from a component to the  
components declared inside it. What exactly do you need? Anyway, the  
logged in or not state wouldn't be handled inside just a given component  
or page. Instead, the simpler solution would be to have some sort of User  
class and declare @SessionState(create = false) private User user; fields  
in any page or component that needs it. See  
http://tapestry.apache.org/session-storage.html for more details.



I see on the documentation that I can use "Nested Layouts"  but I still
need some sample code or project to see how it works.


The Layout component is a component as each other, having no special  
meaning or treatment. If you use one component inside another, you're  
having nested components, and the same is valid for layouts, because  
layouts are ordinary components.


--
Thiago H. de Paula Figueiredo

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Adding tab to default project (index, about, contact)

2013-08-30 Thread Jeremy Villalobos
I am still new to Tapestry 5.  For a prototype, I am doing very simple user
login portal.   I would like to show a couple of option along with index,
about and contact, but they would only show up if the user is signed in.

How do I access the Layout class from a Page ?

I see on the documentation that I can use "Nested Layouts"  but I still
need some sample code or project to see how it works.

Thanks