Now that actually makes sense. Yes, the dealing of models in Wicket has
thrown me a few times, and in the end is the main source of my frustration,
mainly because I've yet to find a page, a paper, something helping out
people like me who want to do the Rails way of development (for example).
Examples like this are exactly what that paper needs. The number one failing
of Wicket for me so far is that it pushes a new web development philosophy
but makes little to no effort to help people understand this new state of
mind, and I'm sure some, if not most of you here have been through this as
well.
Your example, Eelco, is amazingly verbose, but I can see how it works.
However, to Igor, what is wrong with a hard-coded list of values for a
select box? Why is my suggestion of doing it so wrong, or not fitting in the
Wicket philosophy?
Jason
On 2/27/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
Your case would be:
class Option {
String key;
String value;
public Option(String key, String value) {
this.key = key;
this.value = value;
}
}
add(new DropDownChoice("gated", model, Arrays.asList(new Option[]{
new Option("&", "AND"), new Option("|", "OR") }), new
ChoiceRenderer("value", "key"));
Of course, the model has to reference an existing option.
Looking from the example you gave, your problem lies in how to work
with models. And this is a common thing for people new to Wicket. It
seems the obvious thing to do for people is to keep working with
Strings rather than full objects (like Option is), and rather then
putting the model central, do things like
myDropDownChoice.getModelValue().
If you encountered more components you didn't think were obvious, please
share.
Eelco
On 2/27/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> I'm sorry to hear you don't find the API as obvious. DropDownChoice
> seems to be one of the larger offenders usually, though there haven't
> been any good suggestions about how to improve this either. Speaking
> of which... patches and concrete suggestions are more helpful than
> rants as you can imagine. We're pretty open to suggestions in general.
>
> add(new DropDownChoice("gated", model, { {"&", "AND"}, {"|", "OR"}});
>
> How would that work together with the model? Just set AND or OR as the
> model value?
>
> Eelco
>
>
> On 2/27/07, Jason Roelofs <[EMAIL PROTECTED]> wrote:
> > Which of course makes perfect sense...
> >
> > I'm sorry if I come across as crash, it's because I'm very annoyed. I
> > thought Wicket was the coolest Java framework out there, but now that
I've
> > used it for 2 weeks on, I can't say that anymore. Every time I've
moved on
> > to the next part of my website, it takes me 2+ hours to figure out
how, and
> > I'm not talking about entire pages, I'm talking about components of
pages. A
> > <select>, an Ajax-ified form, etc. Why do I have to deal with
> > IChoiceRenderers? Besides how the documentation doesn't tell me how to
use
> > the thing, nor do the examples explain how it works, just "here ya go,
copy
> > this". It just doesn't make sense.
> >
> > Back to the matter at hand, does anyone have example code using
> > wicket-extensions Select and SelectOptions? There is absolutely NO
usage
> > documentation on getting all that working together.
> >
> > Anyway, sorry about the rant, I'm just getting more disappointed with
Wicket
> > in general. It may be different than other Java frameworks, but I
cannot say
> > that it's any better. I like the idea, I like some of the
implementation of
> > it (how Ajaxing components work, best I've seen), but using the
framework
> > has been an exercise in frustration from day 2.
> >
> > So I'll head back to banging on the DropDownChoice, I'll get it
eventually,
> > though I'm open for suggestions.
> >
> > Jason
> >
> >
> > On 2/27/07, Robert Novotny <[EMAIL PROTECTED]> wrote:
> > >
> > > The DropDownChoice allows you to specify in one of its constructors
a
> > custom
> > > implementation of IChoiceRenderer, which can be used to customize
the item
> > > IDs and labels. You may try to have a look on the IChoiceRenderer
and the
> > > ChoiceRenderer (which is its default implementation) JavaDoc.
> > >
> > >
> > > Jason Roelofs wrote:
> > > >
> > > > Why is nothing in Wicket obvious?
> > > >
> > > > I want:
> > > >
> > > > <select ...>
> > > > <option value="&">AND</option>
> > > > <option value="|">OR</option>
> > > > </select>
> > > >
> > > > My model has a 'gated' field that is either '&' or '|'
> > > >
> > > > Why can't I have:
> > > >
> > > > add(new DropDownChoice("gated", model, {"AND", "OR"}, {"&",
"|"});
> > > >
> > > > or better yet:
> > > >
> > > > add(new DropDownChoice("gated", model, { {"&", "AND"}, {"|",
"OR"}});
> > > >
> > > > (assuming properly created arrays, of course)?
> > > >
> > > > How is this supposed to work?
> > > >
> > > > Thanks
> > > >
> > > > Jason
> > > >
> > > >
> >
-------------------------------------------------------------------------
> > > > 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
> > > >
> > > >
> > >
> > > --
> > > View this message in context:
> > http://www.nabble.com/DropDownChoice-confusion-tf3304232.html#a9191899
> > > Sent from the Wicket - User mailing list archive at Nabble.com.
> > >
> > >
> > >
> >
-------------------------------------------------------------------------
> > > 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
> > >
> >
> >
> >
-------------------------------------------------------------------------
> > 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
> >
> >
>
-------------------------------------------------------------------------
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
-------------------------------------------------------------------------
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