You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "BB@umd" <bb...@umd.edu> on 2009/06/24 22:26:10 UTC

Tapestry 5 and Event component.

I am getting this error when clicking on my "searchbutton". What is my
problem exactly ?

"Request event 'clicked' (on component Gentoo:button) was not handled; you
must provide a matching event handler method in the component or in one of
its containers."

gentoo.tml : 
<t:button type="button" t:id="button" value="search" event="clicked" />

gentoo.java :

@Component(parameters = {"type=button"})
	private Button button;
	
	@OnEvent(component = "button", value = "clicked")
	public JSONObject onButtonClicked(String value) {
		
		System.out.println("Event Caught !");
        }

Thanks




-- 
View this message in context: http://www.nabble.com/Tapestry-5-and-Event-component.-tp24192270p24192270.html
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: creating a component event link for another page...

Posted by Howard Lewis Ship <hl...@gmail.com>.
Create the event link for your own page, and then obtain the target page and
invoke a method on it.

On Thu, Jun 25, 2009 at 1:40 PM, Tom Zurkan <tz...@citizensportsinc.com>wrote:

> i have an admin page that creates a link that would reside on another page
> and refer to a component on that other page.  i implemented it by injecting
> the page loader and the link source and creating the link that way.
>  however, both the page loader and link source are internal services  which
> we are advised against using.  my question is, what is the proper way to do
> this?
>
> thanks,
>
> tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

creating a component event link for another page...

Posted by Tom Zurkan <tz...@citizensportsinc.com>.
i have an admin page that creates a link that would reside on another 
page and refer to a component on that other page.  i implemented it by 
injecting the page loader and the link source and creating the link that 
way.  however, both the page loader and link source are internal 
services  which we are advised against using.  my question is, what is 
the proper way to do this?

thanks,

tom

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


Re: Tapestry 5 and Event component.

Posted by ningdh <ni...@gmail.com>.
It seems that Button is not designed for ajax.
I wonder why you don't try block/zone?

DH

http://www.gaonline.com.cn/

----- Original Message ----- 
From: "BB@umd" 
To: <us...@tapestry.apache.org>
Sent: Friday, June 26, 2009 2:48 AM
Subject: Re: Tapestry 5 and Event component.


> 
> Ok, it seems to come from the parameter "String value" in my onButtonClicked
> statement. I removed it and the event is now handled. However it appears
> that I am not allowed to return a JSONObject from the OnButtonClicked
> method. May be is it not possible with this kind of component.
> 
> But perhaps you can still help me. I am trying to make a research function
> for my interface. For the moment, it works great with the following code :
> 
> gentoo.tml :
> <t:textfield t:id="textfield" t:value="textFieldValue" t:mixins="OnEvent"
> event="blur" onCompleteCallback="onSearchRequest" />
> 
> 
> gentoo.java :
> @OnEvent(component = "textfield", value = "blur") 
> public JSONObject onBlurEvent(String value) { 
> System.out.println("Event Caught !");
> String translatedValue = "Package not found !"; 
> try { 
>    String category=applicationManager.getCategoryFromApplication(value);
>    if (category != null) {
> translatedValue = "This package is located in category
> <strong>"+category+"</strong>.";
>    }
>            return new JSONObject().put("translatedValue",
> translatedValue);}
>         catch(Exception e){}
> return new JSONObject().put("translatedValue", translatedValue);
> }
> 
> gentoo.js :
> /* This is to update the Textfield component 'result' */
> function onSearchRequest(response) {
> $('result').update("Search result(s) : "+response.translatedValue);
> }
> 
> My problem is that the search is performed on "blur" event (when the user
> click anywhere outside the textfield box) whereas I would like to perform it
> when the user click on a button instead. So that is why I believed I could
> trigger this event by changing the "blur" event into a "clicked" event.
> 
> Does anyone know how I can simply do that ?
> 
> 
> 
> 
> 
> -- 
> View this message in context: http://www.nabble.com/Tapestry-5-and-Event-component.-tp24192270p24209012.html
> 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: Tapestry 5 and Event component.

Posted by "BB@umd" <bb...@umd.edu>.
Ok, it seems to come from the parameter "String value" in my onButtonClicked
statement. I removed it and the event is now handled. However it appears
that I am not allowed to return a JSONObject from the OnButtonClicked
method. May be is it not possible with this kind of component.

But perhaps you can still help me. I am trying to make a research function
for my interface. For the moment, it works great with the following code :

gentoo.tml :
<t:textfield t:id="textfield" t:value="textFieldValue" t:mixins="OnEvent"
event="blur" onCompleteCallback="onSearchRequest" />


gentoo.java :
@OnEvent(component = "textfield", value = "blur") 
	public JSONObject onBlurEvent(String value) {		
		System.out.println("Event Caught !");
		String translatedValue = "Package not found !";		
		try {		
		   String category=applicationManager.getCategoryFromApplication(value);
		   if (category != null) {
			translatedValue = "This package is located in category
<strong>"+category+"</strong>.";
		   }
	           return new JSONObject().put("translatedValue",
translatedValue);}
	        catch(Exception e){}
		return new JSONObject().put("translatedValue", translatedValue);
	}

gentoo.js :
/* This is to update the Textfield component 'result' */
function onSearchRequest(response) {
	$('result').update("Search result(s) : "+response.translatedValue);
}

My problem is that the search is performed on "blur" event (when the user
click anywhere outside the textfield box) whereas I would like to perform it
when the user click on a button instead. So that is why I believed I could
trigger this event by changing the "blur" event into a "clicked" event.

Does anyone know how I can simply do that ?





-- 
View this message in context: http://www.nabble.com/Tapestry-5-and-Event-component.-tp24192270p24209012.html
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: Tapestry 5 and Event component.

Posted by ningdh <ni...@gmail.com>.
I just tried t5commons component's Button component, it works. I think the Button in t5commons should be the same as CK lib because CK originates from T5commons.

<t:commons.button type="button" t:id="button" value="search" event="clicked" />

void onClicked() {
     System.out.println("I can get it.");
}

I don't use annotation here, but they should be the same.

DH

----- Original Message ----- 
From: "BB@umd"
To: <us...@tapestry.apache.org>
Sent: Friday, June 26, 2009 12:24 AM
Subject: Re: Tapestry 5 and Event component.


> 
> Here is the component reference :
> http://www.chenillekit.org/chenillekit-tapestry/ref/org/chenillekit/tapestry/core/components/Button.html
> 
> Indeed the parameter "value" is useless. So I remove it. But it does not
> work.
> 
> 
> 
> DH-14 wrote:
>> 
>> I don't have source of ck lib.
>> What about removing the parameter 'value' of the method? 
>> 
>> BTW what does the parameter mean?
>> 
>> DH
>> 
>> ----- Original Message ----- 
>> From: "BB@umd"
>> To: <us...@tapestry.apache.org>
>> Sent: Thursday, June 25, 2009 11:11 PM
>> Subject: Re: Tapestry 5 and Event component.
>> 
>> 
>>> 
>>> Actually I did. I first tried to use it with the OnEvent mixins, but the
>>> problem was the same. Then by checking on the ck component reference, I
>>> noticed that the component <t:button> has already a parameter named
>>> "event".
>>> That's why I removed the parameter "mixins".
>>> 
>>> I have just tried again with Try <t:button type="button" t:id="button"
>>> value="search" mixins="ck/OnEvent" event="clicked" />, and I got the same
>>> exception.
>>> 
>>> 
>>> 
>>> Thiago H. de Paula Figueiredo wrote:
>>>> 
>>>> On Wed, Jun 24, 2009 at 5:26 PM, BB@umd<bb...@umd.edu> wrote:
>>>>> gentoo.tml :
>>>>> <t:button type="button" t:id="button" value="search" event="clicked" />
>>>> 
>>>> You haven't used the ck/OnEvent mixin in the button, so the event is not
>>>> fired.
>>>> Try <t:button type="button" t:id="button" value="search"
>>>> mixins="ck/OnEvent" event="clicked" />
>>>> 
>>>> -- 
>>>> Thiago
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 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/Tapestry-5-and-Event-component.-tp24192270p24205124.html
>>> 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
>>> 
>>>
>> 
> 
> -- 
> View this message in context: http://www.nabble.com/Tapestry-5-and-Event-component.-tp24192270p24206567.html
> 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: Tapestry 5 and Event component.

Posted by "BB@umd" <bb...@umd.edu>.
Here is the component reference :
http://www.chenillekit.org/chenillekit-tapestry/ref/org/chenillekit/tapestry/core/components/Button.html

Indeed the parameter "value" is useless. So I remove it. But it does not
work.



DH-14 wrote:
> 
> I don't have source of ck lib.
> What about removing the parameter 'value' of the method? 
> 
> BTW what does the parameter mean?
> 
> DH
> 
> ----- Original Message ----- 
> From: "BB@umd"
> To: <us...@tapestry.apache.org>
> Sent: Thursday, June 25, 2009 11:11 PM
> Subject: Re: Tapestry 5 and Event component.
> 
> 
>> 
>> Actually I did. I first tried to use it with the OnEvent mixins, but the
>> problem was the same. Then by checking on the ck component reference, I
>> noticed that the component <t:button> has already a parameter named
>> "event".
>> That's why I removed the parameter "mixins".
>> 
>> I have just tried again with Try <t:button type="button" t:id="button"
>> value="search" mixins="ck/OnEvent" event="clicked" />, and I got the same
>> exception.
>> 
>> 
>> 
>> Thiago H. de Paula Figueiredo wrote:
>>> 
>>> On Wed, Jun 24, 2009 at 5:26 PM, BB@umd<bb...@umd.edu> wrote:
>>>> gentoo.tml :
>>>> <t:button type="button" t:id="button" value="search" event="clicked" />
>>> 
>>> You haven't used the ck/OnEvent mixin in the button, so the event is not
>>> fired.
>>> Try <t:button type="button" t:id="button" value="search"
>>> mixins="ck/OnEvent" event="clicked" />
>>> 
>>> -- 
>>> Thiago
>>> 
>>> ---------------------------------------------------------------------
>>> 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/Tapestry-5-and-Event-component.-tp24192270p24205124.html
>> 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
>> 
>>
> 

-- 
View this message in context: http://www.nabble.com/Tapestry-5-and-Event-component.-tp24192270p24206567.html
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: Tapestry 5 and Event component.

Posted by ningdh <ni...@gmail.com>.
I don't have source of ck lib.
What about removing the parameter 'value' of the method? 

BTW what does the parameter mean?

DH

----- Original Message ----- 
From: "BB@umd"
To: <us...@tapestry.apache.org>
Sent: Thursday, June 25, 2009 11:11 PM
Subject: Re: Tapestry 5 and Event component.


> 
> Actually I did. I first tried to use it with the OnEvent mixins, but the
> problem was the same. Then by checking on the ck component reference, I
> noticed that the component <t:button> has already a parameter named "event".
> That's why I removed the parameter "mixins".
> 
> I have just tried again with Try <t:button type="button" t:id="button"
> value="search" mixins="ck/OnEvent" event="clicked" />, and I got the same
> exception.
> 
> 
> 
> Thiago H. de Paula Figueiredo wrote:
>> 
>> On Wed, Jun 24, 2009 at 5:26 PM, BB@umd<bb...@umd.edu> wrote:
>>> gentoo.tml :
>>> <t:button type="button" t:id="button" value="search" event="clicked" />
>> 
>> You haven't used the ck/OnEvent mixin in the button, so the event is not
>> fired.
>> Try <t:button type="button" t:id="button" value="search"
>> mixins="ck/OnEvent" event="clicked" />
>> 
>> -- 
>> Thiago
>> 
>> ---------------------------------------------------------------------
>> 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/Tapestry-5-and-Event-component.-tp24192270p24205124.html
> 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: Tapestry 5 and Event component.

Posted by "BB@umd" <bb...@umd.edu>.
Actually I did. I first tried to use it with the OnEvent mixins, but the
problem was the same. Then by checking on the ck component reference, I
noticed that the component <t:button> has already a parameter named "event".
That's why I removed the parameter "mixins".

I have just tried again with Try <t:button type="button" t:id="button"
value="search" mixins="ck/OnEvent" event="clicked" />, and I got the same
exception.



Thiago H. de Paula Figueiredo wrote:
> 
> On Wed, Jun 24, 2009 at 5:26 PM, BB@umd<bb...@umd.edu> wrote:
>> gentoo.tml :
>> <t:button type="button" t:id="button" value="search" event="clicked" />
> 
> You haven't used the ck/OnEvent mixin in the button, so the event is not
> fired.
> Try <t:button type="button" t:id="button" value="search"
> mixins="ck/OnEvent" event="clicked" />
> 
> -- 
> Thiago
> 
> ---------------------------------------------------------------------
> 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/Tapestry-5-and-Event-component.-tp24192270p24205124.html
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: Tapestry 5 and Event component.

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, Jun 24, 2009 at 5:26 PM, BB@umd<bb...@umd.edu> wrote:
> gentoo.tml :
> <t:button type="button" t:id="button" value="search" event="clicked" />

You haven't used the ck/OnEvent mixin in the button, so the event is not fired.
Try <t:button type="button" t:id="button" value="search"
mixins="ck/OnEvent" event="clicked" />

-- 
Thiago

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


Re: Tapestry 5 and Event component.

Posted by "BB@umd" <bb...@umd.edu>.
Thanks for your quick answer. I tried to rename this method "ButtonClicked"
instead, but it did not fix the problem : the request event is still not
handled.

Any other idea ?



Howard Lewis Ship wrote:
> 
> I suspect Tapestry got confused because your method is both the naming
> convention ("onButtonClicked") and has @OnEvent ... and they are in
> conflict. Rename the method to not start with "on".
> 
> On Wed, Jun 24, 2009 at 1:26 PM, BB@umd <bb...@umd.edu> wrote:
> 
>>
>> I am getting this error when clicking on my "searchbutton". What is my
>> problem exactly ?
>>
>> "Request event 'clicked' (on component Gentoo:button) was not handled;
>> you
>> must provide a matching event handler method in the component or in one
>> of
>> its containers."
>>
>> gentoo.tml :
>> <t:button type="button" t:id="button" value="search" event="clicked" />
>>
>> gentoo.java :
>>
>> @Component(parameters = {"type=button"})
>>        private Button button;
>>
>>        @OnEvent(component = "button", value = "clicked")
>>        public JSONObject onButtonClicked(String value) {
>>
>>                System.out.println("Event Caught !");
>>        }
>>
>> Thanks
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Tapestry-5-and-Event-component.-tp24192270p24192270.html
>> 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
>>
>>
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> Director of Open Source Technology at Formos
> 
> 

-- 
View this message in context: http://www.nabble.com/Tapestry-5-and-Event-component.-tp24192270p24203394.html
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: Tapestry 5 and Event component.

Posted by Howard Lewis Ship <hl...@gmail.com>.
I suspect Tapestry got confused because your method is both the naming
convention ("onButtonClicked") and has @OnEvent ... and they are in
conflict. Rename the method to not start with "on".

On Wed, Jun 24, 2009 at 1:26 PM, BB@umd <bb...@umd.edu> wrote:

>
> I am getting this error when clicking on my "searchbutton". What is my
> problem exactly ?
>
> "Request event 'clicked' (on component Gentoo:button) was not handled; you
> must provide a matching event handler method in the component or in one of
> its containers."
>
> gentoo.tml :
> <t:button type="button" t:id="button" value="search" event="clicked" />
>
> gentoo.java :
>
> @Component(parameters = {"type=button"})
>        private Button button;
>
>        @OnEvent(component = "button", value = "clicked")
>        public JSONObject onButtonClicked(String value) {
>
>                System.out.println("Event Caught !");
>        }
>
> Thanks
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Tapestry-5-and-Event-component.-tp24192270p24192270.html
> 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
>
>


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos