You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "oliver.stef" <ov...@gmail.com> on 2012/06/14 17:27:11 UTC
on click on a label in a listview - onClicke method never used
localy
Hi,
i want to use a label inside listView and i want the user will press on the
label - and the
onClick method will work. but what i get is this msg.:
"The method onClick() from the type new Label(){} is never used locally".
I don't know why?!?!?!?!?!
this is my implement:
List list = Arrays.asList(new String[] { "a", "b", "c" });
@SuppressWarnings("unchecked")
ListView listview = new ListView("listview", list) {
protected void populateItem(ListItem item) {
String s = (String)item.getModelObject();
item.add(new Label("label", item.getModel())
{
private static final long serialVersionUID = 1L;
private void onClick()
{
System.out.println("Hello);
}
}
);
}
};
add(listview);
thanks!
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/on-click-on-a-label-in-a-listview-onClicke-method-never-used-localy-tp4649981.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: on click on a label in a listview - onClicke method never used localy
Posted by Thomas Götz <to...@decoded.de>.
What exactly is not working? If you could provide a Quickstart it would be easier to help you.
-Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: on click on a label in a listview - onClicke method never used
localy
Posted by "oliver.stef" <ov...@gmail.com>.
Thanks vineetsemwal and Thomas Götz-2 , but still - not working :(
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/on-click-on-a-label-in-a-listview-onClicke-method-never-used-localy-tp4649981p4649989.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: on click on a label in a listview - onClicke method never used localy
Posted by Thomas Götz <to...@decoded.de>.
Label does not have an onClick() method, so nobody will be calling your onClick() ;)
If you want to attach AJAX behavior to the label you should do the following:
final Label label = new Label("label", item.getModel());
label.add(new AjaxEventBehavior("click") {
@Override
protected void onEvent(AjaxRequestTarget target) {
// do something
}
});
item.add(label);
On 14.06.2012 at 17:27 oliver.stef wrote:
> Hi,
>
> i want to use a label inside listView and i want the user will press on the
> label - and the
> onClick method will work. but what i get is this msg.:
>
> "The method onClick() from the type new Label(){} is never used locally".
> I don't know why?!?!?!?!?!
>
> this is my implement:
>
> List list = Arrays.asList(new String[] { "a", "b", "c" });
>
> @SuppressWarnings("unchecked")
> ListView listview = new ListView("listview", list) {
>
> protected void populateItem(ListItem item) {
>
> String s = (String)item.getModelObject();
> item.add(new Label("label", item.getModel())
> {
> private static final long serialVersionUID = 1L;
>
> private void onClick()
> {
> System.out.println("Hello);
>
> }
> }
> );
> }
> };
> add(listview);
>
> thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: on click on a label in a listview - onClicke method never used localy
Posted by vineet semwal <vi...@gmail.com>.
currently what you have done is you have defined *your own* method so
it never gets used up unless you yourself use it.
On Thu, Jun 14, 2012 at 9:05 PM, vineet semwal <vi...@gmail.com> wrote:
> add ajaxeventbehavior to the label
>
>
> On Thu, Jun 14, 2012 at 8:57 PM, oliver.stef <ov...@gmail.com> wrote:
>> Hi,
>>
>> i want to use a label inside listView and i want the user will press on the
>> label - and the
>> onClick method will work. but what i get is this msg.:
>>
>> "The method onClick() from the type new Label(){} is never used locally".
>> I don't know why?!?!?!?!?!
>>
>> this is my implement:
>>
>> List list = Arrays.asList(new String[] { "a", "b", "c" });
>>
>> @SuppressWarnings("unchecked")
>> ListView listview = new ListView("listview", list) {
>>
>> protected void populateItem(ListItem item) {
>>
>> String s = (String)item.getModelObject();
>> item.add(new Label("label", item.getModel())
>> {
>> private static final long serialVersionUID = 1L;
>>
>> private void onClick()
>> {
>> System.out.println("Hello);
>>
>> }
>> }
>> );
>> }
>> };
>> add(listview);
>>
>> thanks!
>>
>>
>> --
>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/on-click-on-a-label-in-a-listview-onClicke-method-never-used-localy-tp4649981.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> --
> thanks,
>
> Vineet Semwal
--
thanks,
Vineet Semwal
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: on click on a label in a listview - onClicke method never used localy
Posted by vineet semwal <vi...@gmail.com>.
add ajaxeventbehavior to the label
On Thu, Jun 14, 2012 at 8:57 PM, oliver.stef <ov...@gmail.com> wrote:
> Hi,
>
> i want to use a label inside listView and i want the user will press on the
> label - and the
> onClick method will work. but what i get is this msg.:
>
> "The method onClick() from the type new Label(){} is never used locally".
> I don't know why?!?!?!?!?!
>
> this is my implement:
>
> List list = Arrays.asList(new String[] { "a", "b", "c" });
>
> @SuppressWarnings("unchecked")
> ListView listview = new ListView("listview", list) {
>
> protected void populateItem(ListItem item) {
>
> String s = (String)item.getModelObject();
> item.add(new Label("label", item.getModel())
> {
> private static final long serialVersionUID = 1L;
>
> private void onClick()
> {
> System.out.println("Hello);
>
> }
> }
> );
> }
> };
> add(listview);
>
> thanks!
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/on-click-on-a-label-in-a-listview-onClicke-method-never-used-localy-tp4649981.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
thanks,
Vineet Semwal
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org