You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dennis Sinelnikov <de...@augustschell.com> on 2007/01/03 05:37:56 UTC

Tap4: Leaving the Page Listener?

Hey guys,

I've searched and searched, but nothing too appealing popped up. 
Ideally, I would like to attach a listener to SomePage.java class.  This 
listener would get fired when a user is leaving the current page.  In 
this listener method, I would simply reset some of the persistent 
session properties.

Thoughts? Prayers?

-Dennis


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


Re: Tap4: Leaving the Page Listener?

Posted by Jesse Kuhnert <jk...@gmail.com>.
Hmmm... That is doubtful. At least my initial gut reaction didn't like
it very much.

Whether or not a form(s) should be hidden can be easily specified
using a single property on a page (if need be) . If you need to
control this for your entire application then you could make it a
property on a single base page. (or interface that your pages
implement)

On 1/3/07, karthik G <be...@gmail.com> wrote:
> On 1/3/07, Jesse Kuhnert <jk...@gmail.com> wrote:
> >
> > I almost added a central hivemind service to expose those page
> > listener methods as global listeners you can have a hivemind service
> > implement to generically listen to all page changes (for all pages)
>
>
> that will be great.  I want to be able to hide/disable all formcomponents
> based on some condition globally. Can we bind the hidden/enabled attributes
> all Form components to some interface method globally?
>
> thanks,
> Karthik
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: Tap4: Leaving the Page Listener?

Posted by karthik G <be...@gmail.com>.
On 1/3/07, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> I almost added a central hivemind service to expose those page
> listener methods as global listeners you can have a hivemind service
> implement to generically listen to all page changes (for all pages)


that will be great.  I want to be able to hide/disable all formcomponents
based on some condition globally. Can we bind the hidden/enabled attributes
all Form components to some interface method globally?

thanks,
Karthik

Re: Tap4: Leaving the Page Listener?

Posted by Jesse Kuhnert <jk...@gmail.com>.
You can probably add some sort of hivemind interceptor to the typical
core engine services (direct / page / etc ) to listen for page changes
on a per user basis. It could get a little sticky in a lot of
scenarios. (Such as handling different session persistence strategies
- but if it's just for one app I guess it won't matter).

I almost added a central hivemind service to expose those page
listener methods as global listeners you can have a hivemind service
implement to generically listen to all page changes (for all pages)
but decided not to because it wasn't the right solution for the bug I
was trying to fix...If you file a jira issue I could probably do it
pretty easily. (Can't promise when though)

On 1/2/07, Dennis Sinelnikov <de...@augustschell.com> wrote:
> Hey guys,
>
> I've searched and searched, but nothing too appealing popped up.
> Ideally, I would like to attach a listener to SomePage.java class.  This
> listener would get fired when a user is leaving the current page.  In
> this listener method, I would simply reset some of the persistent
> session properties.
>
> Thoughts? Prayers?
>
> -Dennis
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: Tap4: Leaving the Page Listener?

Posted by Dennis Sinelnikov <de...@augustschell.com>.
Nice and simple, I like it :)

Thanks guys!

RonPiterman wrote:
> Thats a very tricky thing - especialy if handled directly by tapestry, 
> since one should not forget that some applications still would like to 
> function correctly with tabbed/2-window browsing.
> 
> 
> For your problem: you could do the following:
> use a single state object and let each page initialize it:
> 
> Class MyStateObject ... {
>   MyStateObject( String pageName ) { this.pageName = pageName; }
>   public String getPageName() {...}
>   public boolean isMatch( String pageName );
>   // No setter !
> }
> 
> in your page validate method:
> 
> if ( ! getMyState().isMatch( getPageName() )
>   setMyState( new MyStateObjecT( getPageName() ) );
> 
> thats it.
> 
> on each transition, the state object will reset.
> 
> Cheers,
> Ron
> 
> 
> 
> 
> 
> Dennis Sinelnikov wrote:
>> Hey guys,
>>
>> I've searched and searched, but nothing too appealing popped up. 
>> Ideally, I would like to attach a listener to SomePage.java class.  
>> This listener would get fired when a user is leaving the current 
>> page.  In this listener method, I would simply reset some of the 
>> persistent session properties.
>>
>> Thoughts? Prayers?
>>
>> -Dennis
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


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


Re: Tap4: Leaving the Page Listener?

Posted by RonPiterman <rp...@gmx.net>.
Thats a very tricky thing - especialy if handled directly by tapestry, 
since one should not forget that some applications still would like to 
function correctly with tabbed/2-window browsing.


For your problem: you could do the following:
use a single state object and let each page initialize it:

Class MyStateObject ... {
   MyStateObject( String pageName ) { this.pageName = pageName; }
   public String getPageName() {...}
   public boolean isMatch( String pageName );
   // No setter !
}

in your page validate method:

if ( ! getMyState().isMatch( getPageName() )
   setMyState( new MyStateObjecT( getPageName() ) );

thats it.

on each transition, the state object will reset.

Cheers,
Ron





Dennis Sinelnikov wrote:
> Hey guys,
> 
> I've searched and searched, but nothing too appealing popped up. 
> Ideally, I would like to attach a listener to SomePage.java class.  This 
> listener would get fired when a user is leaving the current page.  In 
> this listener method, I would simply reset some of the persistent 
> session properties.
> 
> Thoughts? Prayers?
> 
> -Dennis
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


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