You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bruno Moura <br...@gmail.com> on 2013/05/10 03:35:53 UTC
Textbox in a listView, retrieve the value and set the property model
I implemented a dropbox in a ListView, now when I choose a value the erro
bellow always happen:
WicketMessage: Method onSelectionChanged of interface
org.apache.wicket.markup.html.form.IOnChangeListener targeted at component
[MarkupContainer [Component id = customerSelection]] threw an exception
Root cause:
java.lang.ClassCastException: java.lang.String cannot be cast to
com.prog.entities.Cliente
The code that I have implemented is showed bellow:
item.add(new DropDownChoice("clienteSelection", new
PropertyModel[Customer](customer, "name"), listCustomer, new
ChoiceRenderer[Customer]("name")) {
protected override def wantOnSelectionChangedNotifications: Boolean
= true
protected override def onSelectionChanged(newSelection: Customer) {
super.onSelectionChanged(newSelection)
}
})
I'll appreciate your help.
Bera
Re: Textbox in a listView, retrieve the value and set the property model
Posted by Bruno Moura <br...@gmail.com>.
Maxin, thanks a lot again!
I'll verify and if this approach works for me and then I'll share the code
here!
Regards!
Bruno Moura
2013/5/10 Maxim Solodovnik <so...@gmail.com>
> ChoiceRenderer accepts 2 parameters (one of its constructor) one parameter
> for the name being displayed, other for id (hidden)
> I never had problems with dropDown but I always specified both.
>
> If this doesn't help you can try to debug and see what is the reason, i.e.
> what value is being casted ...
>
>
>
> On Fri, May 10, 2013 at 10:41 AM, Bruno Moura <br...@gmail.com>
> wrote:
>
> > Thanks Maxin, yes the code is in scala.... I didn't understand your
> > suggestion
> > I want to display the property name in the DDC no the property or field
> id,
> > sorry
> > if I did mistake in the code of my previous message.
> >
> > Bruno Moura
> >
> >
> > 2013/5/10 Maxim Solodovnik <so...@gmail.com>
> >
> > > I would try to change your code as follows:
> > >
> > > new DropDownChoice*[Customer]*("customerSelection", new
> > > PropertyModel[Customer](customer, "name"), listCustomer, new
> > > ChoiceRenderer[Customer]("name", *"id"*))
> > >
> > > your code seems to not in JAVA
> > >
> > >
> > >
> > > On Fri, May 10, 2013 at 9:13 AM, Bruno Moura <br...@gmail.com>
> > > wrote:
> > >
> > > > Errata:
> > > >
> > > > the original message and code is:
> > > >
> > > > WicketMessage: Method onSelectionChanged of interface
> > > > org.apache.wicket.markup.html.form.IOnChangeListener targeted at
> > > component
> > > > [MarkupContainer [Component id = customerSelection]] threw an
> exception
> > > >
> > > > Root cause:
> > > >
> > > > java.lang.ClassCastException: java.lang.String cannot be cast to
> > > > com.prog.entities.Customer
> > > >
> > > > The code that I have implemented is showed bellow
> > > >
> > > > item.add(new DropDownChoice("customerSelection", new
> > > > PropertyModel[Customer](customer, "name"), listCustomer, new
> > > > ChoiceRenderer[Customer]("name")) {
> > > > protected override def wantOnSelectionChangedNotifications:
> > > Boolean
> > > > = true
> > > >
> > > > protected override def onSelectionChanged(newSelection:
> > > Customer) {
> > > > super.onSelectionChanged(newSelection)
> > > > }
> > > > })
> > > >
> > > > Thanks
> > > >
> > > > Bruno Moura
> > > >
> > > >
> > > > 2013/5/9 Bruno Moura <br...@gmail.com>
> > > >
> > > > >
> > > > > I implemented a dropbox in a ListView, now when I choose a value
> the
> > > erro
> > > > > bellow always happen:
> > > > >
> > > > > WicketMessage: Method onSelectionChanged of interface
> > > > > org.apache.wicket.markup.html.form.IOnChangeListener targeted at
> > > > component
> > > > > [MarkupContainer [Component id = customerSelection]] threw an
> > exception
> > > > >
> > > > > Root cause:
> > > > >
> > > > > java.lang.ClassCastException: java.lang.String cannot be cast to
> > > > > com.prog.entities.Cliente
> > > > > The code that I have implemented is showed bellow:
> > > > >
> > > > > item.add(new DropDownChoice("clienteSelection", new
> > > > > PropertyModel[Customer](customer, "name"), listCustomer, new
> > > > > ChoiceRenderer[Customer]("name")) {
> > > > > protected override def wantOnSelectionChangedNotifications:
> > > > > Boolean = true
> > > > >
> > > > > protected override def onSelectionChanged(newSelection:
> > > > Customer) {
> > > > > super.onSelectionChanged(newSelection)
> > > > > }
> > > > > })
> > > > >
> > > > > I'll appreciate your help.
> > > > >
> > > > > Bera
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>
Re: Textbox in a listView, retrieve the value and set the property model
Posted by Maxim Solodovnik <so...@gmail.com>.
ChoiceRenderer accepts 2 parameters (one of its constructor) one parameter
for the name being displayed, other for id (hidden)
I never had problems with dropDown but I always specified both.
If this doesn't help you can try to debug and see what is the reason, i.e.
what value is being casted ...
On Fri, May 10, 2013 at 10:41 AM, Bruno Moura <br...@gmail.com> wrote:
> Thanks Maxin, yes the code is in scala.... I didn't understand your
> suggestion
> I want to display the property name in the DDC no the property or field id,
> sorry
> if I did mistake in the code of my previous message.
>
> Bruno Moura
>
>
> 2013/5/10 Maxim Solodovnik <so...@gmail.com>
>
> > I would try to change your code as follows:
> >
> > new DropDownChoice*[Customer]*("customerSelection", new
> > PropertyModel[Customer](customer, "name"), listCustomer, new
> > ChoiceRenderer[Customer]("name", *"id"*))
> >
> > your code seems to not in JAVA
> >
> >
> >
> > On Fri, May 10, 2013 at 9:13 AM, Bruno Moura <br...@gmail.com>
> > wrote:
> >
> > > Errata:
> > >
> > > the original message and code is:
> > >
> > > WicketMessage: Method onSelectionChanged of interface
> > > org.apache.wicket.markup.html.form.IOnChangeListener targeted at
> > component
> > > [MarkupContainer [Component id = customerSelection]] threw an exception
> > >
> > > Root cause:
> > >
> > > java.lang.ClassCastException: java.lang.String cannot be cast to
> > > com.prog.entities.Customer
> > >
> > > The code that I have implemented is showed bellow
> > >
> > > item.add(new DropDownChoice("customerSelection", new
> > > PropertyModel[Customer](customer, "name"), listCustomer, new
> > > ChoiceRenderer[Customer]("name")) {
> > > protected override def wantOnSelectionChangedNotifications:
> > Boolean
> > > = true
> > >
> > > protected override def onSelectionChanged(newSelection:
> > Customer) {
> > > super.onSelectionChanged(newSelection)
> > > }
> > > })
> > >
> > > Thanks
> > >
> > > Bruno Moura
> > >
> > >
> > > 2013/5/9 Bruno Moura <br...@gmail.com>
> > >
> > > >
> > > > I implemented a dropbox in a ListView, now when I choose a value the
> > erro
> > > > bellow always happen:
> > > >
> > > > WicketMessage: Method onSelectionChanged of interface
> > > > org.apache.wicket.markup.html.form.IOnChangeListener targeted at
> > > component
> > > > [MarkupContainer [Component id = customerSelection]] threw an
> exception
> > > >
> > > > Root cause:
> > > >
> > > > java.lang.ClassCastException: java.lang.String cannot be cast to
> > > > com.prog.entities.Cliente
> > > > The code that I have implemented is showed bellow:
> > > >
> > > > item.add(new DropDownChoice("clienteSelection", new
> > > > PropertyModel[Customer](customer, "name"), listCustomer, new
> > > > ChoiceRenderer[Customer]("name")) {
> > > > protected override def wantOnSelectionChangedNotifications:
> > > > Boolean = true
> > > >
> > > > protected override def onSelectionChanged(newSelection:
> > > Customer) {
> > > > super.onSelectionChanged(newSelection)
> > > > }
> > > > })
> > > >
> > > > I'll appreciate your help.
> > > >
> > > > Bera
> > > >
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>
--
WBR
Maxim aka solomax
Re: Textbox in a listView, retrieve the value and set the property model
Posted by Bruno Moura <br...@gmail.com>.
Thanks Maxin, yes the code is in scala.... I didn't understand your
suggestion
I want to display the property name in the DDC no the property or field id,
sorry
if I did mistake in the code of my previous message.
Bruno Moura
2013/5/10 Maxim Solodovnik <so...@gmail.com>
> I would try to change your code as follows:
>
> new DropDownChoice*[Customer]*("customerSelection", new
> PropertyModel[Customer](customer, "name"), listCustomer, new
> ChoiceRenderer[Customer]("name", *"id"*))
>
> your code seems to not in JAVA
>
>
>
> On Fri, May 10, 2013 at 9:13 AM, Bruno Moura <br...@gmail.com>
> wrote:
>
> > Errata:
> >
> > the original message and code is:
> >
> > WicketMessage: Method onSelectionChanged of interface
> > org.apache.wicket.markup.html.form.IOnChangeListener targeted at
> component
> > [MarkupContainer [Component id = customerSelection]] threw an exception
> >
> > Root cause:
> >
> > java.lang.ClassCastException: java.lang.String cannot be cast to
> > com.prog.entities.Customer
> >
> > The code that I have implemented is showed bellow
> >
> > item.add(new DropDownChoice("customerSelection", new
> > PropertyModel[Customer](customer, "name"), listCustomer, new
> > ChoiceRenderer[Customer]("name")) {
> > protected override def wantOnSelectionChangedNotifications:
> Boolean
> > = true
> >
> > protected override def onSelectionChanged(newSelection:
> Customer) {
> > super.onSelectionChanged(newSelection)
> > }
> > })
> >
> > Thanks
> >
> > Bruno Moura
> >
> >
> > 2013/5/9 Bruno Moura <br...@gmail.com>
> >
> > >
> > > I implemented a dropbox in a ListView, now when I choose a value the
> erro
> > > bellow always happen:
> > >
> > > WicketMessage: Method onSelectionChanged of interface
> > > org.apache.wicket.markup.html.form.IOnChangeListener targeted at
> > component
> > > [MarkupContainer [Component id = customerSelection]] threw an exception
> > >
> > > Root cause:
> > >
> > > java.lang.ClassCastException: java.lang.String cannot be cast to
> > > com.prog.entities.Cliente
> > > The code that I have implemented is showed bellow:
> > >
> > > item.add(new DropDownChoice("clienteSelection", new
> > > PropertyModel[Customer](customer, "name"), listCustomer, new
> > > ChoiceRenderer[Customer]("name")) {
> > > protected override def wantOnSelectionChangedNotifications:
> > > Boolean = true
> > >
> > > protected override def onSelectionChanged(newSelection:
> > Customer) {
> > > super.onSelectionChanged(newSelection)
> > > }
> > > })
> > >
> > > I'll appreciate your help.
> > >
> > > Bera
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>
Re: Textbox in a listView, retrieve the value and set the property model
Posted by Maxim Solodovnik <so...@gmail.com>.
I would try to change your code as follows:
new DropDownChoice*[Customer]*("customerSelection", new
PropertyModel[Customer](customer, "name"), listCustomer, new
ChoiceRenderer[Customer]("name", *"id"*))
your code seems to not in JAVA
On Fri, May 10, 2013 at 9:13 AM, Bruno Moura <br...@gmail.com> wrote:
> Errata:
>
> the original message and code is:
>
> WicketMessage: Method onSelectionChanged of interface
> org.apache.wicket.markup.html.form.IOnChangeListener targeted at component
> [MarkupContainer [Component id = customerSelection]] threw an exception
>
> Root cause:
>
> java.lang.ClassCastException: java.lang.String cannot be cast to
> com.prog.entities.Customer
>
> The code that I have implemented is showed bellow
>
> item.add(new DropDownChoice("customerSelection", new
> PropertyModel[Customer](customer, "name"), listCustomer, new
> ChoiceRenderer[Customer]("name")) {
> protected override def wantOnSelectionChangedNotifications: Boolean
> = true
>
> protected override def onSelectionChanged(newSelection: Customer) {
> super.onSelectionChanged(newSelection)
> }
> })
>
> Thanks
>
> Bruno Moura
>
>
> 2013/5/9 Bruno Moura <br...@gmail.com>
>
> >
> > I implemented a dropbox in a ListView, now when I choose a value the erro
> > bellow always happen:
> >
> > WicketMessage: Method onSelectionChanged of interface
> > org.apache.wicket.markup.html.form.IOnChangeListener targeted at
> component
> > [MarkupContainer [Component id = customerSelection]] threw an exception
> >
> > Root cause:
> >
> > java.lang.ClassCastException: java.lang.String cannot be cast to
> > com.prog.entities.Cliente
> > The code that I have implemented is showed bellow:
> >
> > item.add(new DropDownChoice("clienteSelection", new
> > PropertyModel[Customer](customer, "name"), listCustomer, new
> > ChoiceRenderer[Customer]("name")) {
> > protected override def wantOnSelectionChangedNotifications:
> > Boolean = true
> >
> > protected override def onSelectionChanged(newSelection:
> Customer) {
> > super.onSelectionChanged(newSelection)
> > }
> > })
> >
> > I'll appreciate your help.
> >
> > Bera
> >
>
--
WBR
Maxim aka solomax
Re: Textbox in a listView, retrieve the value and set the property model
Posted by Bruno Moura <br...@gmail.com>.
Errata:
the original message and code is:
WicketMessage: Method onSelectionChanged of interface
org.apache.wicket.markup.html.form.IOnChangeListener targeted at component
[MarkupContainer [Component id = customerSelection]] threw an exception
Root cause:
java.lang.ClassCastException: java.lang.String cannot be cast to
com.prog.entities.Customer
The code that I have implemented is showed bellow
item.add(new DropDownChoice("customerSelection", new
PropertyModel[Customer](customer, "name"), listCustomer, new
ChoiceRenderer[Customer]("name")) {
protected override def wantOnSelectionChangedNotifications: Boolean
= true
protected override def onSelectionChanged(newSelection: Customer) {
super.onSelectionChanged(newSelection)
}
})
Thanks
Bruno Moura
2013/5/9 Bruno Moura <br...@gmail.com>
>
> I implemented a dropbox in a ListView, now when I choose a value the erro
> bellow always happen:
>
> WicketMessage: Method onSelectionChanged of interface
> org.apache.wicket.markup.html.form.IOnChangeListener targeted at component
> [MarkupContainer [Component id = customerSelection]] threw an exception
>
> Root cause:
>
> java.lang.ClassCastException: java.lang.String cannot be cast to
> com.prog.entities.Cliente
> The code that I have implemented is showed bellow:
>
> item.add(new DropDownChoice("clienteSelection", new
> PropertyModel[Customer](customer, "name"), listCustomer, new
> ChoiceRenderer[Customer]("name")) {
> protected override def wantOnSelectionChangedNotifications:
> Boolean = true
>
> protected override def onSelectionChanged(newSelection: Customer) {
> super.onSelectionChanged(newSelection)
> }
> })
>
> I'll appreciate your help.
>
> Bera
>