You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Sigmar Muuga <me...@gmail.com> on 2010/03/07 17:52:03 UTC

Setting selected value for DropDownChoice

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

Re: two LDM DropDownChoice behave differently ?

Posted by Igor Vaynberg <ig...@gmail.com>.
state's model is only loaded if the dropdown is rerendered (thats when
the model is needed)

see here http://wicketstuff.org/wicket14/ajax/choice

-igor

On Fri, Mar 19, 2010 at 11:21 PM, David Chang <da...@yahoo.com> wrote:
> Hello,
>
> I am playing Wicket now and came across this "strange" behavior.
>
> I have a page with two LDM-based DropDownChoice (Country and State). The Country DDC ajax-controls the State DDC. The Ajax works well.
>
> Here is something I dont understand.
>
> When the page is diplayed first time, both LDM#load get called. If dont play with the DDCs, and simply refresh the page, both LDM#load get called.
>
> If I just select values in the Contry DDC without touch the State DDC (I can see State DDC values changes when Country DDC value change) and I referesh the page, only the Country LDM#load gets called.
>
> What happened to State DDC? Shouldn't it's LDM#load gets called each time when page refereshes?
>
> It is really puzzle to me. Googled, but no clue. I am pulling my hairs now...
>
> Thanks for any help!!!
>
> If I refresh page, I notice that Country State
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: JCaptcha sound with Wicket?

Posted by David Chang <da...@yahoo.com>.
Anybody ever got this working?

Thanks for any info or ponter.

Regards.

--- On Thu, 3/18/10, David Chang <da...@yahoo.com> wrote:

> From: David Chang <da...@yahoo.com>
> Subject: JCaptcha sound with Wicket?
> To: users@wicket.apache.org
> Date: Thursday, March 18, 2010, 11:31 PM
> Based on the WIA book, I am able to
> have a working example of JCaptcha image.
> 
> I am hoping to get JCaptcha sound working too. I tried
> different ways, but unable to get it working.
> 
> Did anyone get JCaptcha sound working with Wicket? Could
> you please share your config and code?
> 
> Thanks for any input!
> 
> Best.
> 
> 
>       
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


      

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


two LDM DropDownChoice behave differently ?

Posted by David Chang <da...@yahoo.com>.
Hello, 

I am playing Wicket now and came across this "strange" behavior.

I have a page with two LDM-based DropDownChoice (Country and State). The Country DDC ajax-controls the State DDC. The Ajax works well.

Here is something I dont understand. 

When the page is diplayed first time, both LDM#load get called. If dont play with the DDCs, and simply refresh the page, both LDM#load get called.

If I just select values in the Contry DDC without touch the State DDC (I can see State DDC values changes when Country DDC value change) and I referesh the page, only the Country LDM#load gets called.

What happened to State DDC? Shouldn't it's LDM#load gets called each time when page refereshes?

It is really puzzle to me. Googled, but no clue. I am pulling my hairs now...

Thanks for any help!!!

If I refresh page, I notice that Country State




      

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


JCaptcha sound with Wicket?

Posted by David Chang <da...@yahoo.com>.
Based on the WIA book, I am able to have a working example of JCaptcha image.

I am hoping to get JCaptcha sound working too. I tried different ways, but unable to get it working.

Did anyone get JCaptcha sound working with Wicket? Could you please share your config and code?

Thanks for any input!

Best.


      

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


Re: Example of configuring JCaptcha within Wicket?

Posted by David Chang <da...@yahoo.com>.
Eelco, 

Thanks for reply. I already read this book and already got the code working by understanding the sample code int the book. But I don't like what the default image and font look like and hope to change it. 

So I would like to see if there is existing work by folks here so that I dont have to re-invent wheels.

Best, David


--- On Sun, 3/7/10, Eelco Hillenius <ee...@gmail.com> wrote:

> From: Eelco Hillenius <ee...@gmail.com>
> Subject: Re: Example of configuring JCaptcha within Wicket?
> To: users@wicket.apache.org
> Date: Sunday, March 7, 2010, 11:07 PM
> It's been a while, so I don't know
> how well it works with recent
> versions (and whether I would do things differently today),
> but
> there's a few pages on this in Wicket In Action. You can
> find example
> source code here:
> http://code.google.com/p/wicketinaction/source/browse/trunk/book-wicket-in-action/src/java/wicket/in/action/chapter09/jcaptcha/?r=110
> 
> Eelco
> 
> On Sun, Mar 7, 2010 at 11:53 AM, David Chang <da...@yahoo.com>
> wrote:
> > Anybody used the JCaptcha tool? How did you do the
> customization? The out-of-box config sucks.
> >
> > Could you please share your config and how to?
> >
> > Cheers!
> >
> >
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


      

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


Re: Example of configuring JCaptcha within Wicket?

Posted by Eelco Hillenius <ee...@gmail.com>.
It's been a while, so I don't know how well it works with recent
versions (and whether I would do things differently today), but
there's a few pages on this in Wicket In Action. You can find example
source code here:
http://code.google.com/p/wicketinaction/source/browse/trunk/book-wicket-in-action/src/java/wicket/in/action/chapter09/jcaptcha/?r=110

Eelco

On Sun, Mar 7, 2010 at 11:53 AM, David Chang <da...@yahoo.com> wrote:
> Anybody used the JCaptcha tool? How did you do the customization? The out-of-box config sucks.
>
> Could you please share your config and how to?
>
> Cheers!
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Where to put an application's configuration parameters?

Posted by James Carman <ja...@carmanconsulting.com>.
That's an interesting idea.  Ldap support is built into the jdk.  Does that
make unit testing interesting or do you have all that stuff abstracted out?

On Mar 8, 2010 8:48 AM, "T Ames" <ta...@gmail.com> wrote:

As an alternative, I place all my properties in an LDAP server.  In the
Application, I have a class that retrieves the properties.



On Sun, Mar 7, 2010 at 8:33 PM, James Carman <james@carmanconsulting.com
>wrote:


> And if you want live redeployment, you could use jrebel and their spring
> plugin. I think it wi...

Re: Where to put an application's configuration parameters?

Posted by T Ames <ta...@gmail.com>.
As an alternative, I place all my properties in an LDAP server.  In the
Application, I have a class that retrieves the properties.



On Sun, Mar 7, 2010 at 8:33 PM, James Carman <ja...@carmanconsulting.com>wrote:

> And if you want live redeployment, you could use jrebel and their spring
> plugin.  I think it will reload beans based on property file changes
>
> On Mar 7, 2010 7:17 PM, "Riyad Kalla" <rk...@gmail.com> wrote:
>
> James,
>
> Thanks for the link.
>
> -R
>
> On Sun, Mar 7, 2010 at 4:50 PM, James Carman <james@carmanconsulting.com
> >wrote:
>
>
> > If you want to see how I did it with spring config, you can check out my
> > advanced wicket demo a...
>

Re: Where to put an application's configuration parameters?

Posted by James Carman <ja...@carmanconsulting.com>.
And if you want live redeployment, you could use jrebel and their spring
plugin.  I think it will reload beans based on property file changes

On Mar 7, 2010 7:17 PM, "Riyad Kalla" <rk...@gmail.com> wrote:

James,

Thanks for the link.

-R

On Sun, Mar 7, 2010 at 4:50 PM, James Carman <james@carmanconsulting.com
>wrote:


> If you want to see how I did it with spring config, you can check out my
> advanced wicket demo a...

Re: Where to put an application's configuration parameters?

Posted by Riyad Kalla <rk...@gmail.com>.
James,

Thanks for the link.

-R

On Sun, Mar 7, 2010 at 4:50 PM, James Carman <ja...@carmanconsulting.com>wrote:

> If you want to see how I did it with spring config, you can check out my
> advanced wicket demo app at:
>
> http://svn.carmanconsulting.com/public/wicket-advanced/trunk
>
> On Mar 7, 2010 5:41 PM, "David Chang" <da...@yahoo.com> wrote:
>
> James and Riyad,
>
> Thanks for your input. I really appreciate it. Wicket is great, but I still
> feel a little elusive.
>
> Regards.
>
>
>
> --- On Sun, 3/7/10, James Carman <jc...@carmanconsulting.com> wrote:
>
> > From: James Carman <jc...@carmanconsulting.com>
>
> > Subject: Re: Where to put an application's configuration parameters?
> > To: users@wicket.apache.org...
> > Date: Sunday, March 7, 2010, 3:26 PM
>
> > Why not use Spring *with* Wicket?
> >
> > On Sun, Mar 7, 2010 at 3:15 PM, David Chang <david_q_zhang@...
>

Re: Where to put an application's configuration parameters?

Posted by James Carman <ja...@carmanconsulting.com>.
If you want to see how I did it with spring config, you can check out my
advanced wicket demo app at:

http://svn.carmanconsulting.com/public/wicket-advanced/trunk

On Mar 7, 2010 5:41 PM, "David Chang" <da...@yahoo.com> wrote:

James and Riyad,

Thanks for your input. I really appreciate it. Wicket is great, but I still
feel a little elusive.

Regards.



--- On Sun, 3/7/10, James Carman <jc...@carmanconsulting.com> wrote:

> From: James Carman <jc...@carmanconsulting.com>

> Subject: Re: Where to put an application's configuration parameters?
> To: users@wicket.apache.org...
> Date: Sunday, March 7, 2010, 3:26 PM

> Why not use Spring *with* Wicket?
>
> On Sun, Mar 7, 2010 at 3:15 PM, David Chang <david_q_zhang@...

Re: Where to put an application's configuration parameters?

Posted by David Chang <da...@yahoo.com>.
James and Riyad, 

Thanks for your input. I really appreciate it. Wicket is great, but I still feel a little elusive.

Regards.



--- On Sun, 3/7/10, James Carman <jc...@carmanconsulting.com> wrote:

> From: James Carman <jc...@carmanconsulting.com>
> Subject: Re: Where to put an application's configuration parameters?
> To: users@wicket.apache.org
> Date: Sunday, March 7, 2010, 3:26 PM
> Why not use Spring *with* Wicket?
> 
> On Sun, Mar 7, 2010 at 3:15 PM, David Chang <da...@yahoo.com>
> wrote:
> > Hi, I am new in Wicket.
> >
> > I did Spring web applications before and I usually put
> an app's configuration parameters in the application context
> file.
> >
> > I would like to know the best practice in Wichet for
> setting parameters such as SMTP server, LDAP server, etc.
> Where should I put them? I dont feel WebApplication is a
> good place. Put them in an old java properties file? I want
> these parameters can be changed without touching source
> code.
> >
> > Thanks!
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


      

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


Re: Where to put an application's configuration parameters?

Posted by James Carman <jc...@carmanconsulting.com>.
Why not use Spring *with* Wicket?

On Sun, Mar 7, 2010 at 3:15 PM, David Chang <da...@yahoo.com> wrote:
> Hi, I am new in Wicket.
>
> I did Spring web applications before and I usually put an app's configuration parameters in the application context file.
>
> I would like to know the best practice in Wichet for setting parameters such as SMTP server, LDAP server, etc. Where should I put them? I dont feel WebApplication is a good place. Put them in an old java properties file? I want these parameters can be changed without touching source code.
>
> Thanks!
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Where to put an application's configuration parameters?

Posted by David Chang <da...@yahoo.com>.
Jeremy, thanks for chiming. I read your transition from Spring to Wicket long time ago. 
Best, David

--- On Sun, 3/7/10, Jeremy Thomerson <je...@wickettraining.com> wrote:

> From: Jeremy Thomerson <je...@wickettraining.com>
> Subject: Re: Where to put an application's configuration parameters?
> To: users@wicket.apache.org
> Date: Sunday, March 7, 2010, 5:28 PM
> I use Spring IoC and do all of my app
> configuration with Spring still.  I
> just use Wicket for the webapp portion.  There's no
> reason Wicket should
> know about these SMTP / LDAP config values - all of that
> should be service
> layer or below.
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> On Sun, Mar 7, 2010 at 2:15 PM, David Chang <da...@yahoo.com>
> wrote:
> 
> > Hi, I am new in Wicket.
> >
> > I did Spring web applications before and I usually put
> an app's
> > configuration parameters in the application context
> file.
> >
> > I would like to know the best practice in Wichet for
> setting parameters
> > such as SMTP server, LDAP server, etc. Where should I
> put them? I dont feel
> > WebApplication is a good place. Put them in an old
> java properties file? I
> > want these parameters can be changed without touching
> source code.
> >
> > Thanks!
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 


      

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


Re: Where to put an application's configuration parameters?

Posted by Jeremy Thomerson <je...@wickettraining.com>.
I use Spring IoC and do all of my app configuration with Spring still.  I
just use Wicket for the webapp portion.  There's no reason Wicket should
know about these SMTP / LDAP config values - all of that should be service
layer or below.

--
Jeremy Thomerson
http://www.wickettraining.com



On Sun, Mar 7, 2010 at 2:15 PM, David Chang <da...@yahoo.com> wrote:

> Hi, I am new in Wicket.
>
> I did Spring web applications before and I usually put an app's
> configuration parameters in the application context file.
>
> I would like to know the best practice in Wichet for setting parameters
> such as SMTP server, LDAP server, etc. Where should I put them? I dont feel
> WebApplication is a good place. Put them in an old java properties file? I
> want these parameters can be changed without touching source code.
>
> Thanks!
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Where to put an application's configuration parameters?

Posted by Riyad Kalla <rk...@gmail.com>.
David,

Given your requirements, I'd recomment putting them in a properties file
along side your custom WebApplication class for your particular application
and then inside of the WebApp's init method, reading in the properties file
and storing the information in the WebApplication.get/setMetaData methods to
store that free-formed information:
http://wicket.apache.org/docs/1.4/org/apache/wicket/Application.html#getMetaData(org.apache.wicket.MetaDataKey)

<http://wicket.apache.org/docs/1.4/org/apache/wicket/Application.html#getMetaData(org.apache.wicket.MetaDataKey)>You
could be fancy and spin off a thread that checks every 10 mins for changes
to the files and re-sets the metadata info if you want to be able to change
that data while the app is running without a restart. Either way, it's just
a plain properties file.

Best,
Riyad

On Sun, Mar 7, 2010 at 1:15 PM, David Chang <da...@yahoo.com> wrote:

> Hi, I am new in Wicket.
>
> I did Spring web applications before and I usually put an app's
> configuration parameters in the application context file.
>
> I would like to know the best practice in Wichet for setting parameters
> such as SMTP server, LDAP server, etc. Where should I put them? I dont feel
> WebApplication is a good place. Put them in an old java properties file? I
> want these parameters can be changed without touching source code.
>
> Thanks!
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Where to put an application's configuration parameters?

Posted by David Chang <da...@yahoo.com>.
Hi, I am new in Wicket. 

I did Spring web applications before and I usually put an app's configuration parameters in the application context file. 

I would like to know the best practice in Wichet for setting parameters such as SMTP server, LDAP server, etc. Where should I put them? I dont feel WebApplication is a good place. Put them in an old java properties file? I want these parameters can be changed without touching source code.

Thanks!


      

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


Example of configuring JCaptcha within Wicket?

Posted by David Chang <da...@yahoo.com>.
Anybody used the JCaptcha tool? How did you do the customization? The out-of-box config sucks.

Could you please share your config and how to?

Cheers!




      

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


Re: Setting selected value for DropDownChoice

Posted by Vit Rozkovec <ro...@email.cz>.
This may help you with your problem: 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#hashCode%28%29

And this as well (in case you use Hibernate, but may be applicable to 
other frameworks too): https://www.hibernate.org/109.html

Regards
Vitek


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 <me...@gmail.com> 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 <me...@gmail.com> 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 <ro...@email.cz>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: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>         
>
>   


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


Re: Setting selected value for DropDownChoice

Posted by Martin Grigorov <mc...@e-card.bg>.
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 <me...@gmail.com> 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 <me...@gmail.com> 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 <ro...@email.cz>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: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >



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


Re: Setting selected value for DropDownChoice

Posted by Sigmar Muuga <me...@gmail.com>.
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 <me...@gmail.com> 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 <me...@gmail.com> 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 <ro...@email.cz>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: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>

Re: Setting selected value for DropDownChoice

Posted by Sigmar Muuga <me...@gmail.com>.
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 <me...@gmail.com> 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 <ro...@email.cz> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

Re: Setting selected value for DropDownChoice

Posted by Sigmar Muuga <me...@gmail.com>.
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 <ro...@email.cz> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Setting selected value for DropDownChoice

Posted by Vit Rozkovec <ro...@email.cz>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org