You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joel Wiegman <Jo...@btservices.com> on 2007/08/30 22:11:47 UTC

T5: Activation contexts

Hello all,

I'm wondering if anyone has had any luck making the "activation
contexts" of pages a little more flexible.

For example, let's say I have a "Sum.java" page that wants to take in
between 1 and 4 Integers and add them together:

//is there a way to make number3 and number4 "optional"?  Seems like
Tapestry forces me to provide values for all 4 numbers.
public void onActivate(Integer number1, Integer number2, Integer
number3, Integer number4)

//Or even make the values limitless?
public void onActivate(Integer... numbers) 

Kind of a contrived example, but hopefully you see where I'm going with
it.

Anyone had any luck with making context parameters optional or
limitless?

Thanks,

Joel

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


Re: T5: Activation contexts

Posted by Josh Canfield <jo...@thedailytube.com>.
On 8/31/07, Joel Wiegman <Jo...@btservices.com> wrote:
>
> Hrm... are you sure?  I only see the correct one being called.


I've seen the same behavior that Nick describes. It's especially harsh if
you have different parameter types (throws an exception trying to coerce the
parameters)

Josh

-----Original Message-----
> From: Nick Westgate (Work) [mailto:nick@key-planning.co.jp]
> Sent: Friday, August 31, 2007 1:56 PM
> To: users@tapestry.apache.org
> Subject: RE: T5: Activation contexts
>
>
> Did you examine your log output?
>
> For:
> http://localhost:8080/myapp/Start/1/2/3
> You'll see:
> Activated with 1 2
> _and_
> Activated with 1 2 3
>
> If you add a no argument onActivate() that will also be called.
> Object[] is the best solution right now for multiple parameters.
> http://issues.apache.org/jira/browse/TAPESTRY-1695
>
> Cheers,
> Nick.
>
>
>
> Joel Wiegman wrote:
> >
> > Actually, it's not!
> >
> > Surprised I didn't think of this before my post, but all you need to
> > do is overload the methods:
> >
> > public void onActivate(Integer number1, Integer number2, Integer
> > number3) {
> >       System.out.println("Activated with " + number1 + " " + number2 +
> " "
> > + number3); }
> >
> > public void onActivate(Integer number1, Integer number2) {
> >       System.out.println("Activated with " + number1 + " " + number2);
> }
> >
> > You can't make the values limitless, but as you can see from above,
> > you can definitely make them optional!
> >
> > -----Original Message-----
> > From: Nick Westgate [mailto:nick@key-planning.co.jp]
> > Sent: Thursday, August 30, 2007 10:23 PM
> > To: Tapestry users
> > Subject: Re: T5: Activation contexts
> >
> > That is in fact the only option for now.
> >
> > Cheers,
> > Nick.
> >
> >
> > Josh Canfield wrote:
> >> In situations where I have had optional parameters I've ended up
> >> using
> >
> >> an Object[] as the argument and figuring out what the values mean
> > myself.
> >>
> >> public Object onActivate(Object[] context) { }
> >>
> >> I haven't looked closely enough at the code to determine if there is
> >> a
> >
> >> better option.
> >>
> >> Josh
> >>
> >> On 8/30/07, Joel Wiegman <Jo...@btservices.com> wrote:
> >>> Hello all,
> >>>
> >>> I'm wondering if anyone has had any luck making the "activation
> >>> contexts" of pages a little more flexible.
> >>>
> >>> For example, let's say I have a "Sum.java" page that wants to take
> >>> in
> >
> >>> between 1 and 4 Integers and add them together:
> >>>
> >>> //is there a way to make number3 and number4 "optional"?  Seems like
>
> >>> Tapestry forces me to provide values for all 4 numbers.
> >>> public void onActivate(Integer number1, Integer number2, Integer
> >>> number3, Integer number4)
> >>>
> >>> //Or even make the values limitless?
> >>> public void onActivate(Integer... numbers)
> >>>
> >>> Kind of a contrived example, but hopefully you see where I'm going
> >>> with it.
> >>>
> >>> Anyone had any luck with making context parameters optional or
> >>> limitless?
> >>>
> >>> Thanks,
> >>>
> >>> Joel
> >>>
> >>> --------------------------------------------------------------------
> >>> - 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
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12431309
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5: Activation contexts

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Keep an eye on this JIRA then:
https://issues.apache.org/jira/browse/TAPESTRY-1730

Cheers,
Nick.


Joel Wiegman wrote:
> I'm actually seeing the behavior Marcus is referring to, where all
> possible matches are applied in a specific order (In my previous post, I
> was only trying the 3-arg method).
> 
> Either way, it's not really that much of an inconvenience.  As long as
> the behavior is predictable I can code accordingly.
> 
> -----Original Message-----
> From: Nick Westgate (Work) [mailto:nick@key-planning.co.jp] 
> Sent: Saturday, September 01, 2007 10:02 PM
> To: users@tapestry.apache.org
> Subject: Re: T5: Activation contexts
> 
> 
> It _shouldn't_ change anything, but I'm wondering why Joel is seeing
> different behaviour, and trying to find out if there is a problem.
> 
> I studied this problem a few months ago, looked at the source code (and
> the Javassist generated source code) and I'm not happy with the current
> implementation or Howard's proposed solution unless there's more control
> over multiple event method calls. Short-circuiting for example.
> 
> And I read Howard's blog. My comment on that post is right before yours.
> Although your comment was on topic, you might want to read this:
> http://tapestryjava.blogspot.com/2005/10/blogs-arent-for-support.html
> 
> Cheers,
> Nick.
> 
> 
> 
> Marcus-11 wrote:
>> NIck,
>>
>> "When a single method is overloaded with different parameters, the 
>> order of invocation is fewest parameters to most parameters." 
>> commented by Howard at
>> (https://www.blogger.com/comment.g?blogID=4110180&postID=7231241573208
>> 214842
>> )
>>
>> So, reversing the order of methods don't should change anything.
>>
>> Anyway, T5 should call only those methods that matches, and 
>> onActivate(), with no parameters, first.
>>
>> Marcus
>>
>>
> 
> --
> View this message in context:
> http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12445691
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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: T5: Activation contexts

Posted by Joel Wiegman <Jo...@btservices.com>.
I'm actually seeing the behavior Marcus is referring to, where all
possible matches are applied in a specific order (In my previous post, I
was only trying the 3-arg method).

Either way, it's not really that much of an inconvenience.  As long as
the behavior is predictable I can code accordingly.

-----Original Message-----
From: Nick Westgate (Work) [mailto:nick@key-planning.co.jp] 
Sent: Saturday, September 01, 2007 10:02 PM
To: users@tapestry.apache.org
Subject: Re: T5: Activation contexts


It _shouldn't_ change anything, but I'm wondering why Joel is seeing
different behaviour, and trying to find out if there is a problem.

I studied this problem a few months ago, looked at the source code (and
the Javassist generated source code) and I'm not happy with the current
implementation or Howard's proposed solution unless there's more control
over multiple event method calls. Short-circuiting for example.

And I read Howard's blog. My comment on that post is right before yours.
Although your comment was on topic, you might want to read this:
http://tapestryjava.blogspot.com/2005/10/blogs-arent-for-support.html

Cheers,
Nick.



Marcus-11 wrote:
> 
> NIck,
> 
> "When a single method is overloaded with different parameters, the 
> order of invocation is fewest parameters to most parameters." 
> commented by Howard at
> (https://www.blogger.com/comment.g?blogID=4110180&postID=7231241573208
> 214842
> )
> 
> So, reversing the order of methods don't should change anything.
> 
> Anyway, T5 should call only those methods that matches, and 
> onActivate(), with no parameters, first.
> 
> Marcus
> 
> 

--
View this message in context:
http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12445691
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: T5: Activation contexts

Posted by "Nick Westgate (Work)" <ni...@key-planning.co.jp>.
It _shouldn't_ change anything, but I'm wondering why Joel is seeing
different behaviour, and trying to find out if there is a problem.

I studied this problem a few months ago, looked at the source code (and the
Javassist generated source code) and I'm not happy with the current
implementation or Howard's proposed solution unless there's more control
over multiple event method calls. Short-circuiting for example.

And I read Howard's blog. My comment on that post is right before yours.
Although your comment was on topic, you might want to read this:
http://tapestryjava.blogspot.com/2005/10/blogs-arent-for-support.html

Cheers,
Nick.



Marcus-11 wrote:
> 
> NIck,
> 
> "When a single method is overloaded with different parameters, the order
> of
> invocation is fewest parameters to most parameters." commented by Howard
> at
> (https://www.blogger.com/comment.g?blogID=4110180&postID=7231241573208214842
> )
> 
> So, reversing the order of methods don't should change anything.
> 
> Anyway, T5 should call only those methods that matches, and onActivate(),
> with no parameters, first.
> 
> Marcus
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12445691
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: Activation contexts

Posted by Marcus <mv...@gmail.com>.
NIck,

"When a single method is overloaded with different parameters, the order of
invocation is fewest parameters to most parameters." commented by Howard at
(https://www.blogger.com/comment.g?blogID=4110180&postID=7231241573208214842
)

So, reversing the order of methods don't should change anything.

Anyway, T5 should call only those methods that matches, and onActivate(),
with no parameters, first.

Marcus

RE: T5: Activation contexts

Posted by "Nick Westgate (Work)" <ni...@key-planning.co.jp>.
Try reversing the order of your methods. (I.e. 2, 3 - not 3, 2).
Add a no argument method and you'll definitely see that.

After a few requests it will consistently happen. I hadn't seen the
consistency change before so I'll upgrade the JIRA to a bug.

Cheers,
Nick.



Joel Wiegman wrote:
> 
> Hrm... are you sure?  I only see the correct one being called. 
> 
> -----Original Message-----
> From: Nick Westgate (Work) [mailto:nick@key-planning.co.jp] 
> Sent: Friday, August 31, 2007 1:56 PM
> To: users@tapestry.apache.org
> Subject: RE: T5: Activation contexts
> 
> 
> Did you examine your log output?
> 
> For:
> http://localhost:8080/myapp/Start/1/2/3
> You'll see:
> Activated with 1 2
> _and_
> Activated with 1 2 3
> 
> If you add a no argument onActivate() that will also be called.
> Object[] is the best solution right now for multiple parameters.
> http://issues.apache.org/jira/browse/TAPESTRY-1695
> 
> Cheers,
> Nick.
> 
> 
> 
> Joel Wiegman wrote:
>> 
>> Actually, it's not!
>> 
>> Surprised I didn't think of this before my post, but all you need to 
>> do is overload the methods:
>> 
>> public void onActivate(Integer number1, Integer number2, Integer
>> number3) {
>> 	System.out.println("Activated with " + number1 + " " + number2 +
> " " 
>> + number3); }
>> 	
>> public void onActivate(Integer number1, Integer number2) {
>> 	System.out.println("Activated with " + number1 + " " + number2);
> }
>> 
>> You can't make the values limitless, but as you can see from above, 
>> you can definitely make them optional!
>> 
>> -----Original Message-----
>> From: Nick Westgate [mailto:nick@key-planning.co.jp]
>> Sent: Thursday, August 30, 2007 10:23 PM
>> To: Tapestry users
>> Subject: Re: T5: Activation contexts
>> 
>> That is in fact the only option for now.
>> 
>> Cheers,
>> Nick.
>> 
>> 
>> Josh Canfield wrote:
>>> In situations where I have had optional parameters I've ended up 
>>> using
>> 
>>> an Object[] as the argument and figuring out what the values mean
>> myself.
>>> 
>>> public Object onActivate(Object[] context) { }
>>> 
>>> I haven't looked closely enough at the code to determine if there is 
>>> a
>> 
>>> better option.
>>> 
>>> Josh
>>> 
>>> On 8/30/07, Joel Wiegman <Jo...@btservices.com> wrote:
>>>> Hello all,
>>>>
>>>> I'm wondering if anyone has had any luck making the "activation 
>>>> contexts" of pages a little more flexible.
>>>>
>>>> For example, let's say I have a "Sum.java" page that wants to take 
>>>> in
>> 
>>>> between 1 and 4 Integers and add them together:
>>>>
>>>> //is there a way to make number3 and number4 "optional"?  Seems like
> 
>>>> Tapestry forces me to provide values for all 4 numbers.
>>>> public void onActivate(Integer number1, Integer number2, Integer 
>>>> number3, Integer number4)
>>>>
>>>> //Or even make the values limitless?
>>>> public void onActivate(Integer... numbers)
>>>>
>>>> Kind of a contrived example, but hopefully you see where I'm going 
>>>> with it.
>>>>
>>>> Anyone had any luck with making context parameters optional or 
>>>> limitless?
>>>>
>>>> Thanks,
>>>>
>>>> Joel
>>>>
>>>> --------------------------------------------------------------------
>>>> - 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
>> 
>> 
>> 
> 
> --
> View this message in context:
> http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12431309
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12436127
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: Activation contexts

Posted by Marcus <mv...@gmail.com>.
Hi Nick,

You're right. Using T-5.0.5 this is correct.
Tapestry will call onActivate method with no parameter, and all others with
at least X parameters, where X is the number of parameters you pass in URL.

Marcus

RE: T5: Activation contexts

Posted by Joel Wiegman <Jo...@btservices.com>.
Hrm... are you sure?  I only see the correct one being called. 

-----Original Message-----
From: Nick Westgate (Work) [mailto:nick@key-planning.co.jp] 
Sent: Friday, August 31, 2007 1:56 PM
To: users@tapestry.apache.org
Subject: RE: T5: Activation contexts


Did you examine your log output?

For:
http://localhost:8080/myapp/Start/1/2/3
You'll see:
Activated with 1 2
_and_
Activated with 1 2 3

If you add a no argument onActivate() that will also be called.
Object[] is the best solution right now for multiple parameters.
http://issues.apache.org/jira/browse/TAPESTRY-1695

Cheers,
Nick.



Joel Wiegman wrote:
> 
> Actually, it's not!
> 
> Surprised I didn't think of this before my post, but all you need to 
> do is overload the methods:
> 
> public void onActivate(Integer number1, Integer number2, Integer
> number3) {
> 	System.out.println("Activated with " + number1 + " " + number2 +
" " 
> + number3); }
> 	
> public void onActivate(Integer number1, Integer number2) {
> 	System.out.println("Activated with " + number1 + " " + number2);
}
> 
> You can't make the values limitless, but as you can see from above, 
> you can definitely make them optional!
> 
> -----Original Message-----
> From: Nick Westgate [mailto:nick@key-planning.co.jp]
> Sent: Thursday, August 30, 2007 10:23 PM
> To: Tapestry users
> Subject: Re: T5: Activation contexts
> 
> That is in fact the only option for now.
> 
> Cheers,
> Nick.
> 
> 
> Josh Canfield wrote:
>> In situations where I have had optional parameters I've ended up 
>> using
> 
>> an Object[] as the argument and figuring out what the values mean
> myself.
>> 
>> public Object onActivate(Object[] context) { }
>> 
>> I haven't looked closely enough at the code to determine if there is 
>> a
> 
>> better option.
>> 
>> Josh
>> 
>> On 8/30/07, Joel Wiegman <Jo...@btservices.com> wrote:
>>> Hello all,
>>>
>>> I'm wondering if anyone has had any luck making the "activation 
>>> contexts" of pages a little more flexible.
>>>
>>> For example, let's say I have a "Sum.java" page that wants to take 
>>> in
> 
>>> between 1 and 4 Integers and add them together:
>>>
>>> //is there a way to make number3 and number4 "optional"?  Seems like

>>> Tapestry forces me to provide values for all 4 numbers.
>>> public void onActivate(Integer number1, Integer number2, Integer 
>>> number3, Integer number4)
>>>
>>> //Or even make the values limitless?
>>> public void onActivate(Integer... numbers)
>>>
>>> Kind of a contrived example, but hopefully you see where I'm going 
>>> with it.
>>>
>>> Anyone had any luck with making context parameters optional or 
>>> limitless?
>>>
>>> Thanks,
>>>
>>> Joel
>>>
>>> --------------------------------------------------------------------
>>> - 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
> 
> 
> 

--
View this message in context:
http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12431309
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: T5: Activation contexts

Posted by "Nick Westgate (Work)" <ni...@key-planning.co.jp>.
Did you examine your log output?

For:
http://localhost:8080/myapp/Start/1/2/3
You'll see:
Activated with 1 2
_and_
Activated with 1 2 3

If you add a no argument onActivate() that will also be called.
Object[] is the best solution right now for multiple parameters.
http://issues.apache.org/jira/browse/TAPESTRY-1695

Cheers,
Nick.



Joel Wiegman wrote:
> 
> Actually, it's not!
> 
> Surprised I didn't think of this before my post, but all you need to do
> is overload the methods:
> 
> public void onActivate(Integer number1, Integer number2, Integer
> number3) {
> 	System.out.println("Activated with " + number1 + " " + number2 +
> " " + number3);
> }
> 	
> public void onActivate(Integer number1, Integer number2) {
> 	System.out.println("Activated with " + number1 + " " + number2);
> } 
> 
> You can't make the values limitless, but as you can see from above, you
> can definitely make them optional!
> 
> -----Original Message-----
> From: Nick Westgate [mailto:nick@key-planning.co.jp] 
> Sent: Thursday, August 30, 2007 10:23 PM
> To: Tapestry users
> Subject: Re: T5: Activation contexts
> 
> That is in fact the only option for now.
> 
> Cheers,
> Nick.
> 
> 
> Josh Canfield wrote:
>> In situations where I have had optional parameters I've ended up using
> 
>> an Object[] as the argument and figuring out what the values mean
> myself.
>> 
>> public Object onActivate(Object[] context) { }
>> 
>> I haven't looked closely enough at the code to determine if there is a
> 
>> better option.
>> 
>> Josh
>> 
>> On 8/30/07, Joel Wiegman <Jo...@btservices.com> wrote:
>>> Hello all,
>>>
>>> I'm wondering if anyone has had any luck making the "activation 
>>> contexts" of pages a little more flexible.
>>>
>>> For example, let's say I have a "Sum.java" page that wants to take in
> 
>>> between 1 and 4 Integers and add them together:
>>>
>>> //is there a way to make number3 and number4 "optional"?  Seems like 
>>> Tapestry forces me to provide values for all 4 numbers.
>>> public void onActivate(Integer number1, Integer number2, Integer 
>>> number3, Integer number4)
>>>
>>> //Or even make the values limitless?
>>> public void onActivate(Integer... numbers)
>>>
>>> Kind of a contrived example, but hopefully you see where I'm going 
>>> with it.
>>>
>>> Anyone had any luck with making context parameters optional or 
>>> limitless?
>>>
>>> Thanks,
>>>
>>> Joel
>>>
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12431309
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


RE: T5: Activation contexts

Posted by Joel Wiegman <Jo...@btservices.com>.
Actually, it's not!

Surprised I didn't think of this before my post, but all you need to do
is overload the methods:

public void onActivate(Integer number1, Integer number2, Integer
number3) {
	System.out.println("Activated with " + number1 + " " + number2 +
" " + number3);
}
	
public void onActivate(Integer number1, Integer number2) {
	System.out.println("Activated with " + number1 + " " + number2);
} 

You can't make the values limitless, but as you can see from above, you
can definitely make them optional!

-----Original Message-----
From: Nick Westgate [mailto:nick@key-planning.co.jp] 
Sent: Thursday, August 30, 2007 10:23 PM
To: Tapestry users
Subject: Re: T5: Activation contexts

That is in fact the only option for now.

Cheers,
Nick.


Josh Canfield wrote:
> In situations where I have had optional parameters I've ended up using

> an Object[] as the argument and figuring out what the values mean
myself.
> 
> public Object onActivate(Object[] context) { }
> 
> I haven't looked closely enough at the code to determine if there is a

> better option.
> 
> Josh
> 
> On 8/30/07, Joel Wiegman <Jo...@btservices.com> wrote:
>> Hello all,
>>
>> I'm wondering if anyone has had any luck making the "activation 
>> contexts" of pages a little more flexible.
>>
>> For example, let's say I have a "Sum.java" page that wants to take in

>> between 1 and 4 Integers and add them together:
>>
>> //is there a way to make number3 and number4 "optional"?  Seems like 
>> Tapestry forces me to provide values for all 4 numbers.
>> public void onActivate(Integer number1, Integer number2, Integer 
>> number3, Integer number4)
>>
>> //Or even make the values limitless?
>> public void onActivate(Integer... numbers)
>>
>> Kind of a contrived example, but hopefully you see where I'm going 
>> with it.
>>
>> Anyone had any luck with making context parameters optional or 
>> limitless?
>>
>> Thanks,
>>
>> Joel
>>
>> ---------------------------------------------------------------------
>> 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: T5: Activation contexts

Posted by "Nick Westgate (Work)" <ni...@key-planning.co.jp>.
No. Tapestry will call _all_ the matching methods.
http://issues.apache.org/jira/browse/TAPESTRY-1695

Cheers,
Nick.



Marcus-11 wrote:
> 
> Hi Joel,
> 
> You can make, of course, three onActivate methods, with 2, 3 and 4
> parameters, then the Tapestry with call one that matches.
> 
> Marcus
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12431179
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: Activation contexts

Posted by Marcus <mv...@gmail.com>.
Hi Joel,

You can make, of course, three onActivate methods, with 2, 3 and 4
parameters, then the Tapestry with call one that matches.

Marcus

Re: T5: Activation contexts

Posted by Nick Westgate <ni...@key-planning.co.jp>.
That is in fact the only option for now.

Cheers,
Nick.


Josh Canfield wrote:
> In situations where I have had optional parameters I've ended up using an
> Object[] as the argument and figuring out what the values mean myself.
> 
> public Object onActivate(Object[] context) {
> }
> 
> I haven't looked closely enough at the code to determine if there is a
> better option.
> 
> Josh
> 
> On 8/30/07, Joel Wiegman <Jo...@btservices.com> wrote:
>> Hello all,
>>
>> I'm wondering if anyone has had any luck making the "activation
>> contexts" of pages a little more flexible.
>>
>> For example, let's say I have a "Sum.java" page that wants to take in
>> between 1 and 4 Integers and add them together:
>>
>> //is there a way to make number3 and number4 "optional"?  Seems like
>> Tapestry forces me to provide values for all 4 numbers.
>> public void onActivate(Integer number1, Integer number2, Integer
>> number3, Integer number4)
>>
>> //Or even make the values limitless?
>> public void onActivate(Integer... numbers)
>>
>> Kind of a contrived example, but hopefully you see where I'm going with
>> it.
>>
>> Anyone had any luck with making context parameters optional or
>> limitless?
>>
>> Thanks,
>>
>> Joel
>>
>> ---------------------------------------------------------------------
>> 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: T5: Activation contexts

Posted by Josh Canfield <jo...@thedailytube.com>.
In situations where I have had optional parameters I've ended up using an
Object[] as the argument and figuring out what the values mean myself.

public Object onActivate(Object[] context) {
}

I haven't looked closely enough at the code to determine if there is a
better option.

Josh

On 8/30/07, Joel Wiegman <Jo...@btservices.com> wrote:
>
> Hello all,
>
> I'm wondering if anyone has had any luck making the "activation
> contexts" of pages a little more flexible.
>
> For example, let's say I have a "Sum.java" page that wants to take in
> between 1 and 4 Integers and add them together:
>
> //is there a way to make number3 and number4 "optional"?  Seems like
> Tapestry forces me to provide values for all 4 numbers.
> public void onActivate(Integer number1, Integer number2, Integer
> number3, Integer number4)
>
> //Or even make the values limitless?
> public void onActivate(Integer... numbers)
>
> Kind of a contrived example, but hopefully you see where I'm going with
> it.
>
> Anyone had any luck with making context parameters optional or
> limitless?
>
> Thanks,
>
> Joel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.