The selected value is reachable thru: customer.getName
On Fri, May 17, 2013 at 4:33 PM, Bruno Moura <brunormo...@gmail.com> wrote: > Martin, the DDC has already created with the sema object type in the > constructor > for PropertyModel, listCustomer, and ChoiceRenderer > > new DropDownChoice("customerSelection", > new PropertyModel[Customer](customer, "name"), listCustomer, new > ChoiceRenderer[Customer]("name"))* > > But I need only a piece of code that works in retrieve the selected value. > > Thanks again. > > Bruno Moura > > > 2013/5/17 Martin Grigorov <mgrigo...@apache.org> > > > Hi Bruno, > > > > > > On Fri, May 17, 2013 at 6:12 AM, Bruno Moura <brunormo...@gmail.com> > > wrote: > > > > > Hi Martin > > > > > > But the DDC doesn't have a constructor with PropertyModel[String](this, > > > "custName") > > > only a property model with the Object/Pojo as I was using. > > > > > > > String is an Object, no ? ;-) > > > > > > > > > > Sorry, I'm new in the world of wicket and scala, and is difficult to > find > > > > > > > You need to read some more on Java generics. > > There is nothing more you need to understand this problem. > > > > > > > good examples around > > > so I'm using this list a lot because I'm getting suport and feedback > and > > I > > > don't want to give up > > > of my project. > > > > > > thanks > > > > > > Bera > > > > > > > > > 2013/5/15 Martin Grigorov <mgrigo...@apache.org> > > > > > > > Hi, > > > > > > > > > > > > On Wed, May 15, 2013 at 6:32 AM, Bruno Moura <brunormo...@gmail.com> > > > > wrote: > > > > > > > > > Hi > > > > > > > > > > For some weeks I'm trying to implement a simple combobox, DDC, and > > I'm > > > > > struggling with this. I asked for some help several times but > > > > > unfortunately I didn't archive my goal because I'm failing > sometimes > > to > > > > > understand scala with wicket, I have a little background with them > > at > > > > the > > > > > moment. > > > > > > > > > > Anyway, my code is showed bellow: > > > > > > > > > > *// ComboBox in a listView > > > > > item.add(new DropDownChoice("customerSelection", new > > > > > PropertyModel[Customer](customer, "name"), listCustomer, new > > > > > ChoiceRenderer[Customer]("name"))* > > > > > > > > > > > > > > DropDownChoice[Customer] > > > > > > > > > > > > > > > > > > If I create a variable, for example,* val custName*, to receive > the > > > name > > > > > of the selected customer which functions I need to implement on the > > > > > creation of DDC object and how can I retrieve this value for the > > > > variable? > > > > > > > > > > > > > The way you already did it will set the selected value in customer's > > > name. > > > > Check PropertyModel's javadoc to understand how it works. > > > > > > > > If you want to read/write the value in 'custName' then you have to > use: > > > new > > > > PropertyModel[String](this, "custName") > > > > > > > > > > > > > Thanks very much for help me. > > > > > > > > > > > > > > > > > > > > > -- > > > > Martin Grigorov > > > > Wicket Training & Consulting > > > > http://jWeekend.com <http://jweekend.com/> > > > > > > > > > > > > > > > -- > > Martin Grigorov > > Wicket Training & Consulting > > http://jWeekend.com <http://jweekend.com/> > > > -- Martin Grigorov Wicket Training & Consulting http://jWeekend.com <http://jweekend.com/>