Re: T5 onActive method (multiple parameters)

2008-04-16 Thread Josh Canfield
Hmm... what version of tapestry are you using. I created a little test
for 5.0.11 and it looks right to me (although the Object[] came at the
end I'm not sure where that one is supposed to fit in).

http://localhost:8080/start/test/this/args

@OnEvent("activate")
public void alpha() {
System.out.println("alpha no parms ");
}

@OnEvent("activate")
public void alpha(String one) {
System.out.println(String.format("alpha one parm %s ", one));
}

@OnEvent("activate")
public void alpha(String one, String two) {
System.out.println(String.format("alpha two parm '%s', '%s' ", 
one, two));
}
@OnEvent("activate")
public void alpha(Object[] params) {
StringBuilder builder = new StringBuilder("alpha many parm ");
for ( Object s : params) {
builder.append(" ").append(s).append(",");
}
System.out.println(builder.toString());

}
@OnEvent("activate")
public void beta() {
System.out.println("beta no parms ");
}

@OnEvent("activate")
public void beta(String one) {
System.out.println(String.format("beta one parm %s ", one));
}

@OnEvent("activate")
public void beta(String one, String two) {
System.out.println(String.format("beta two parm '%s', '%s' ", 
one, two));
}

@OnEvent("activate")
public void beta(Object[] params) {
StringBuilder builder = new StringBuilder("beta many parm ");
for ( Object s : params) {
builder.append(" ").append(s).append(",");
}
System.out.println(builder.toString());

}


Outputs:

alpha two parm 'test', 'this'
alpha one parm test
alpha many parm  test, this, args,
alpha no parms
beta two parm 'test', 'this'
beta one parm test
beta many parm  test, this, args,
beta no parms
onActivate two parm 'test', 'this'
onActivate one parm test
onActivate many parm  test, this, args,
onActivate no parms



On Wed, Apr 16, 2008 at 9:02 AM, Szemere Szemere
<[EMAIL PROTECTED]> wrote:
> On further experimentation I find that the onActivate methods are selected
> by reverse alphabetical order and by decreasing number of parameters.
>
> Multiple Parameters in onActivateMultiple Parameters in onActivateShall I
> reopen  https://issues.apache.org/jira/browse/TAPESTRY-1730  ?
>
> Szemere
>
>
> On Mon, Apr 14, 2008 at 10:44 PM, Filip S. Adamsen <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > onActivate(Object[]) is always called first because it counts as a method
> > having an infinite amount of parameters, so to speak. At least that's the
> > way I see it.
> >
> > -Filip
> >
> >
> > On 2008-04-14 20:40, Szemere Szemere wrote:
> >
> > > I've been playing around with onActivate methods recently, that is with
> > > multiple  parameters and multiple methods. I don't understand its
> > > behaviour
> > > - it does not seem to match up with the lore on the mailing lists
> > > (apologies
> > > for the lack of references). I was wondering if anyone has recent
> > > experience
> > > or a write-up of this - if not I'll post a Wiki page on it.
> > >
> > > Specifically, the "lore" says that onActivate methods should be picked
> > > first
> > > by alphabetical method name and then by descending number of parameters.
> > > On
> > > 5.0.11, I find that the first method picked is the safety catch-all
> > > onActivate(Object[] context) irrespective of the name of other methods
> > > and
> > > how many parameters they have.
> > >
> > > Further I get strange results if I have a method of the form:
> > > onActivate(String firstParameter,Object[] otherParameters)
> > > I expected otherParameters to contain just the other parameters, but in
> > > fact
> > > it also contains firstParameter! (not that this isn't useful too).
> > >
> > > Any thoughts?
> > >
> > > Szemere
> > >
> > >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>



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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 onActive method (multiple parameters)

2008-04-16 Thread Szemere Szemere
On further experimentation I find that the onActivate methods are selected
by reverse alphabetical order and by decreasing number of parameters.

Multiple Parameters in onActivateMultiple Parameters in onActivateShall I
reopen  https://issues.apache.org/jira/browse/TAPESTRY-1730  ?

Szemere

On Mon, Apr 14, 2008 at 10:44 PM, Filip S. Adamsen <[EMAIL PROTECTED]> wrote:

> Hi,
>
> onActivate(Object[]) is always called first because it counts as a method
> having an infinite amount of parameters, so to speak. At least that's the
> way I see it.
>
> -Filip
>
>
> On 2008-04-14 20:40, Szemere Szemere wrote:
>
> > I've been playing around with onActivate methods recently, that is with
> > multiple  parameters and multiple methods. I don't understand its
> > behaviour
> > - it does not seem to match up with the lore on the mailing lists
> > (apologies
> > for the lack of references). I was wondering if anyone has recent
> > experience
> > or a write-up of this - if not I'll post a Wiki page on it.
> >
> > Specifically, the "lore" says that onActivate methods should be picked
> > first
> > by alphabetical method name and then by descending number of parameters.
> > On
> > 5.0.11, I find that the first method picked is the safety catch-all
> > onActivate(Object[] context) irrespective of the name of other methods
> > and
> > how many parameters they have.
> >
> > Further I get strange results if I have a method of the form:
> > onActivate(String firstParameter,Object[] otherParameters)
> > I expected otherParameters to contain just the other parameters, but in
> > fact
> > it also contains firstParameter! (not that this isn't useful too).
> >
> > Any thoughts?
> >
> > Szemere
> >
> >
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: T5 onActive method (multiple parameters)

2008-04-14 Thread Filip S. Adamsen

Hi,

onActivate(Object[]) is always called first because it counts as a 
method having an infinite amount of parameters, so to speak. At least 
that's the way I see it.


-Filip

On 2008-04-14 20:40, Szemere Szemere wrote:

I've been playing around with onActivate methods recently, that is with
multiple  parameters and multiple methods. I don't understand its behaviour
- it does not seem to match up with the lore on the mailing lists (apologies
for the lack of references). I was wondering if anyone has recent experience
or a write-up of this - if not I'll post a Wiki page on it.

Specifically, the "lore" says that onActivate methods should be picked first
by alphabetical method name and then by descending number of parameters. On
5.0.11, I find that the first method picked is the safety catch-all
onActivate(Object[] context) irrespective of the name of other methods and
how many parameters they have.

Further I get strange results if I have a method of the form:
onActivate(String firstParameter,Object[] otherParameters)
I expected otherParameters to contain just the other parameters, but in fact
it also contains firstParameter! (not that this isn't useful too).

Any thoughts?

Szemere



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T5 onActive method (multiple parameters)

2008-04-14 Thread Szemere Szemere
I've been playing around with onActivate methods recently, that is with
multiple  parameters and multiple methods. I don't understand its behaviour
- it does not seem to match up with the lore on the mailing lists (apologies
for the lack of references). I was wondering if anyone has recent experience
or a write-up of this - if not I'll post a Wiki page on it.

Specifically, the "lore" says that onActivate methods should be picked first
by alphabetical method name and then by descending number of parameters. On
5.0.11, I find that the first method picked is the safety catch-all
onActivate(Object[] context) irrespective of the name of other methods and
how many parameters they have.

Further I get strange results if I have a method of the form:
onActivate(String firstParameter,Object[] otherParameters)
I expected otherParameters to contain just the other parameters, but in fact
it also contains firstParameter! (not that this isn't useful too).

Any thoughts?

Szemere


Re: T5: onActive()

2007-12-23 Thread Howard Lewis Ship
Your template has a relative URL to a file "commons.css", that does
not exist.  Because the file is missing, Tapestry thinks that the
request is for the application, and invokes your page, including the
activation part.

On Dec 23, 2007 8:01 AM, osamuo <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have encountered the following strange behavior (with 5.0.8-SNAPSHOT).
>
> When I accessed "http://localhost:8080/test/1";, "onActive( Object parameter
> )" in Test.java was called two times.
>
> At the first call, the value of the argument was "1".
> At the second call, the value of the argument was "commons.css".
>
> Why was "commons.css" set to the argument?
> Is this correct behavior?
>
> Test.tml
> 
> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
> ...
> 
> 
> 
> 
> 
> ...
> 
>
>
> Test.java
> 
> public class Test{
>   public void onActivate( Object parameter ){
>   }
> }
> 
>
>
>
> best regards
> Osamuo
>
>
> --
> View this message in context: 
> http://www.nabble.com/T5%3A-onActive%28%29-tp14479409p14479409.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Howard M. Lewis Ship
TWD Consulting, Inc.

Creator Apache Tapestry and Apache HiveMind

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T5: onActive()

2007-12-23 Thread osamuo

Hi,

I have encountered the following strange behavior (with 5.0.8-SNAPSHOT).

When I accessed "http://localhost:8080/test/1";, "onActive( Object parameter
)" in Test.java was called two times.

At the first call, the value of the argument was "1".
At the second call, the value of the argument was "commons.css". 

Why was "commons.css" set to the argument?
Is this correct behavior?

Test.tml

http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
...





...



Test.java

public class Test{
  public void onActivate( Object parameter ){
  }
}




best regards 
Osamuo


-- 
View this message in context: 
http://www.nabble.com/T5%3A-onActive%28%29-tp14479409p14479409.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]