Re: Help with onActivate Page

2009-12-27 Thread Piero Sartini
   2. If No, help me with the following scenario in my project.
   I need to show a page a page to the user, only when it has a context with
   it! Else i need to redirect the user to another page. Though i  link the
   page, only with the t:context, i just need to confirm no one has ever
   bookmarked the page, and is seeing it.

Instead of using 2 onActivate() methods, you may also make use of
EventContext. It's often less verbose and better to read:

--
Object onActivate(EventContext eventContext) {
  switch (eventContext.getCount()) {
  case 0:
return NoContextPage.class;
  case 1:
this.myparameterstring = eventContext.get(String.class, 1);
  break;
  }
}
--


   Piero

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



Re: Help with onActivate Page

2009-12-27 Thread Ashwanth Kumar
Piero,

Thanks a lot!! It worked!

  - Ashwanth

On Sun, Dec 27, 2009 at 6:17 PM, Piero Sartini li...@pierosartini.dewrote:

2. If No, help me with the following scenario in my project.
I need to show a page a page to the user, only when it has a context
 with
it! Else i need to redirect the user to another page. Though i  link
 the
page, only with the t:context, i just need to confirm no one has ever
bookmarked the page, and is seeing it.

 Instead of using 2 onActivate() methods, you may also make use of
 EventContext. It's often less verbose and better to read:

 --
 Object onActivate(EventContext eventContext) {
  switch (eventContext.getCount()) {
  case 0:
return NoContextPage.class;
  case 1:
this.myparameterstring = eventContext.get(String.class, 1);
  break;
  }
 }
 --


   Piero

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




Help with onActivate Page

2009-12-26 Thread Ashwanth Kumar
Hello,

I have a small doubt. I need some clarification regarding the onActivate()
of every Page class..

   1. Is it Overloadable? (I know, it has some internal type casting, still
   wanted to know?)
   2. If No, help me with the following scenario in my project.
   I need to show a page a page to the user, only when it has a context with
   it! Else i need to redirect the user to another page. Though i  link the
   page, only with the t:context, i just need to confirm no one has ever
   bookmarked the page, and is seeing it.


 - Ashwanth Kumar


Re: Help with onActivate Page

2009-12-26 Thread Alfonso Quiroga
What do you mean with overloadable? something like...

a) void onActivate()
b) void onActivate(String param)

you mean that? I think the easier way is to do only one method:

onActivate(EventContext context), tapestry5 will hit it always.

On Sat, Dec 26, 2009 at 9:57 PM, Ashwanth Kumar
ashwanth.ku...@gmail.com wrote:
 Hello,

 I have a small doubt. I need some clarification regarding the onActivate()
 of every Page class..

   1. Is it Overloadable? (I know, it has some internal type casting, still
   wanted to know?)
   2. If No, help me with the following scenario in my project.
   I need to show a page a page to the user, only when it has a context with
   it! Else i need to redirect the user to another page. Though i  link the
   page, only with the t:context, i just need to confirm no one has ever
   bookmarked the page, and is seeing it.


  - Ashwanth Kumar


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



Re: Help with onActivate Page

2009-12-26 Thread Kenneth CH, LEE
Hi,

You can have multiple event handler for the same event:

  http://tapestry.apache.org/tapestry5/guide/event.html

The one with the same no. of arguments as the no. of context
parameters will get called, as well as the no-arg one. I figured that
out with my own experiment.

Hope that helps.

Kenneth


2009/12/27 Ashwanth Kumar ashwanth.ku...@gmail.com:
 Hello,

 I have a small doubt. I need some clarification regarding the onActivate()
 of every Page class..

   1. Is it Overloadable? (I know, it has some internal type casting, still
   wanted to know?)
   2. If No, help me with the following scenario in my project.
   I need to show a page a page to the user, only when it has a context with
   it! Else i need to redirect the user to another page. Though i  link the
   page, only with the t:context, i just need to confirm no one has ever
   bookmarked the page, and is seeing it.


  - Ashwanth Kumar


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



Re: Help with onActivate Page

2009-12-26 Thread Ashwanth Kumar
Thanks Keneth,

That helps a lot!

 - Ashwanth Kumar

On Sun, Dec 27, 2009 at 9:24 AM, Kenneth CH, LEE klch...@gmail.com wrote:

 Hi,

 You can have multiple event handler for the same event:

  http://tapestry.apache.org/tapestry5/guide/event.html

 The one with the same no. of arguments as the no. of context
 parameters will get called, as well as the no-arg one. I figured that
 out with my own experiment.

 Hope that helps.

 Kenneth


 2009/12/27 Ashwanth Kumar ashwanth.ku...@gmail.com:
  Hello,
 
  I have a small doubt. I need some clarification regarding the
 onActivate()
  of every Page class..
 
1. Is it Overloadable? (I know, it has some internal type casting,
 still
wanted to know?)
2. If No, help me with the following scenario in my project.
I need to show a page a page to the user, only when it has a context
 with
it! Else i need to redirect the user to another page. Though i  link
 the
page, only with the t:context, i just need to confirm no one has ever
bookmarked the page, and is seeing it.
 
 
   - Ashwanth Kumar
 

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