How about...

        add(new DropDownChoice(
                "options2",
                new Model(getDefaultSelection(getMyOptionValue())),
                OPTIONS) {
            protected String getDefaultChoice( final Object selected ) {
                return ""; // remove "Choose One" prompt
            }
        });
    };

    private Integer getMyOptionValue() {
        return new Integer(2);
    }
    private String getDefaultSelection(Integer i) {
        return String.valueOf(OPTIONS.get(i.intValue()));
    }

/Gwyn

On 22/09/06, Dumitru Postoronca <[EMAIL PROTECTED]> wrote:
> Gwyn Evans wrote:
> > What does "c.getMyOptionValue()" return?
> >
> > This...
> >     public HomePage() {
> >         add(new DropDownChoice(
> >                 "options",
> >                 new Model(getMyOptionValue()),
> >                 OPTIONS)
> >         {
> >             protected String getDefaultChoice(final Object selected) {
> >                 return ""; // remove "Choose One" prompt
> >             }
> >         });
> >     }
> >
> >     private String getMyOptionValue() { return "Opt2"; }
> > }
> > works as you'd expect. (The ChoiceRenderer() wasn't doing anything).
> >
> > /Gwyn
>
> getMyOptionValue() actually returns an Integer.
>
> What I'm trying to acomplish is this:
> in my Client object I have stored an Integer myOptionValue, and there
> are 3 possible options, so I want to show an edit form with a
> dropdownchoice with those 3 options and have the selected option to be
> the one that corresponds to the Integer I have stored in myOptionValue.
> For Integer(1) - "Opt1", Integer(2) - "Opt2", etc.
>
> - posto
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-- 
Download Wicket 1.2.2 now! - http://wicketframework.org

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to