you need Country#hashcode()

On Sun, 2010-03-07 at 19:46 +0200, Sigmar Muuga wrote:
> I got it working with ISO2.
> Thanks Vit, I got your idea, I'll investigate later, why it didnt work with
> ID.
> 
> On Sun, Mar 7, 2010 at 7:35 PM, Sigmar Muuga <[email protected]> wrote:
> 
> > Actually it works even randomly now, when I change the values:S
> >
> > I've read docs and books and still have no idea with that :S DropDownChoice
> > has hard API design problems IMHO...
> >
> >
> > On Sun, Mar 7, 2010 at 7:18 PM, Sigmar Muuga <[email protected]> wrote:
> >
> >> Still not working actually, got another problem.
> >> When I select the item with ID 241, I get item with ID 239.
> >>
> >> My country pojo is like this:
> >> import lombok.Data;
> >>
> >> @Data
> >> public class Country extends BaseModel {
> >>
> >>     private static final long serialVersionUID = 1L;
> >>
> >>     private long id;
> >>     private String iso2;
> >>     private String iso3;
> >>     private String nameShort;
> >>     private String nameLong;
> >>
> >>     @Override
> >>     public String toString() {
> >>         return nameShort;
> >>     }
> >>
> >>     @Override
> >>     public boolean equals(Object o) {
> >>         if (o != null) {
> >>             if (o instanceof Country) {
> >>                 return id == ((Country) o).getId();
> >>             }
> >>         }
> >>         return false;
> >>     }
> >>
> >> }
> >>
> >> Weird.
> >>
> >>
> >> On Sun, Mar 7, 2010 at 7:05 PM, Vit Rozkovec <[email protected]>wrote:
> >>
> >>> Hallo,
> >>> try something like this:
> >>>
> >>>
> >>> List<Country> countryList = generalDAO.findAllCountries();
> >>> Country country = getSelectedCountryByISO3(141, countryList);
> >>> inal DropDownChoice<Cointry> countryId = new
> >>> DropDownChoice<Country>("countryId",
> >>> new Model<Country>(country), countryList);
> >>>           add(countryId);
> >>>
> >>> You must pass the model, which contains the element you want to select.
> >>>
> >>> Vitek
> >>>
> >>>
> >>> Sigmar Muuga wrote:
> >>>
> >>>> Hello, I am trying to use one of the hardest part in Wicket:
> >>>> DropDownChoice
> >>>>
> >>>> the code looks like this:
> >>>>
> >>>>            List<Country> countryList = generalDAO.findAllCountries();
> >>>>            Country country = getSelectedCountryByISO3(141, countryList);
> >>>>            final DropDownChoice countryId = new
> >>>> DropDownChoice("countryId",
> >>>> new PropertyModel(country, "id"), countryList);
> >>>>            add(countryId);
> >>>>
> >>>> I want to select an item, and set it selected on my dropdown, but its
> >>>> not
> >>>> selected. How to set the selected value for it?
> >>>>
> >>>>
> >>>> Sigmar
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [email protected]
> >>> For additional commands, e-mail: [email protected]
> >>>
> >>>
> >>
> >



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to