no, SelectChoice is a component that represents a single <option> element. you add that to the Select component. SelectChoices is a convinience component that draws out a bunch of <option> tags much like our current components.

-Igor


On 12/2/05, Johan Compagner <[EMAIL PROTECTED]> wrote:
That selectchoice is a thing you have to add to the collection of choices?
then that is not that nice. Because choose one should only be there if no one is selected and null is required (or something like that)
Because of that you can't add it easily to the collection because you have to know that you want to add it or not...

I like the getDefaultValue() or what is that method  called of DropDown..

johan



On 12/2/05, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
just checked in a fix. also the Select element does not add a "choose one" choice for you, you have to do it yourself by adding a SelectChoice that represents that element.

-Igor



On 12/2/05, Davide Savazzi <[EMAIL PROTECTED]> wrote:
On 11/30/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> any feedback on this yet? if not, i guess i will polish it with its current
> feature set and that will be that.

I have a Map that contains List of choices, my code is:

Map choicesMap = getChoicesMap();
Select select = new Select("mySelect", new PropertyModel(myModel,
"propertyName"));
IOptionRenderer renderer = new IOptionRenderer() {
  public String getDisplayValue(Object selection) {
        return ((Selection) selection).getName();
  }
  public IModel getModel(Object selection) {
        return new Model(new Integer(((Selection) selection).getId()));
  }
};
select.add(new SelectOptions("group1", new Model((Serializable)
choicesMap.get("group1")), renderer));
select.add(new SelectOptions("group2", new Model((Serializable)
choicesMap.get("group2")), renderer));

When myModel.getPropertyName() is null I get a WicketException:

09:50:07,679 ERROR [RequestCycle] Select
[3:step1Form:section4Border:mySelect] contains a null model object,
must be an object of type java.lang.Ob
ject or java.util.Collection (in case of multi-valued select element)

In other dropdown menu when model is null there is a entry like
'Choose one', they don't throw an exception!
Am I using your extension correctly?

Cheers,
--
Davide Savazzi


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



Reply via email to