[Wicket-user] DropDownChoice confusion

2007-02-27 Thread Jason Roelofs

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.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] DropDownChoice confusion

2007-02-27 Thread Robert Novotny

The documentation might be a little scattered, however is a separate topic.
Nonetheless, the Wicket Library site features most of the Wicket components
and examples of their usage: e. g. DropDownChoice is demonstrated (along
with the IChoiceRenderer) on the
http://www.wicket-library.com/wicket-examples/compref?wicket:bookmarkablePage=:wicket.examples.compref.DropDownChoicePage




Jason Roelofs 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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=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#a9192544
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.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net

Re: [Wicket-user] DropDownChoice confusion

2007-02-27 Thread Jason Roelofs

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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] DropDownChoice confusion

2007-02-27 Thread Eelco Hillenius
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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net

Re: [Wicket-user] DropDownChoice confusion

2007-02-27 Thread Igor Vaynberg

On 2/27/07, Jason Roelofs [EMAIL PROTECTED] wrote:


Why can't I have:

add(new DropDownChoice(gated, model, {AND, OR},  {, |});

or better yet:

add(new DropDownChoice(gated, model, { {, AND}, {|, OR}});



you can

class mydropdownchoice extends dropdownchoice {
 public mydropdownchoice(id, model, final object[] choices) {
  super(id, model);
  arraylist choiceslist=new arraylist();
  for (int i=0;ichoices.length;i++) {
choiceslist.add(choices[i][0]);
  }
  setchoices(choiceslist);
  setrenderer(new ichoicerenderer() {
  Object getDisplayValue(Object object) {
return choices[getchoices().indexof(object)][1];
   }
   String getIdValue(T object, int index) { return object; }
   }
}

or something very close to that.

what you have to realize is that your usecase is not very representative of
whats out there.

one, you have only a few choices
two, your list of choices is hardcoded
three, you dont mind keeping those choices and their values in session

these three things are not true for most usecases ive come across

most usecases you have a list of objects, like Person, that you load from
the database. you dont know how many, and you dont want to keep the list in
session. dropdownchoice is optimized for that usage:

add(new dropdownchoice(people, model, new LoadableDetachableModel() {
load() { return db.loadpeople(); }, new ChoiceRenderer(personId,
fullName));

this also happens to be the most generic form. nothing stops you from
subclassing and optimizing the usage for your usecases

-igor
-
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.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] DropDownChoice confusion

2007-02-27 Thread Eelco Hillenius
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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=DEVDEV
   ___
   Wicket-user mailing list
   Wicket-user@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/wicket-user
  
 
 
  

Re: [Wicket-user] DropDownChoice confusion

2007-02-27 Thread Jason Roelofs

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.phpp=sourceforgeCID=DEVDEV

Re: [Wicket-user] DropDownChoice confusion

2007-02-27 Thread Igor Vaynberg

On 2/27/07, Jason Roelofs [EMAIL PROTECTED] wrote:



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?



did i say it was wrong? or doesnt fit with the philosophy?

i simply said it is not a very common usecase and we optimize core
components for what we think the most common usecases are

-igor



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.phpp=sourceforgeCID=DEVDEV
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net

   https://lists.sourceforge.net/lists/listinfo/wicket-user


   
--
View this message in context:
  
 

Re: [Wicket-user] DropDownChoice confusion

2007-02-27 Thread Eelco Hillenius
 Your example, Eelco, is amazingly verbose, but I can see how it works.

Hey, blame Java for that ok? Of course, if you only use strings you're
gonna be less verbose :) I tried to show that there is a relation
between the objects you work with through your model and how you would
use them in the dropdown component. Igor's example actually makes more
sense as he shows something that we're advocating all the time: write
custom components that fit your needs and code style. It's not that
hard, really, and the investment of writing such a component - like 10
minutes to get the one Igor made - saves you any further frustration
you might have with a particular component.

 want more docs want more docs

What else is new :) I've been working on Wicket In Action for over a
year now and I can tell you it's not a lot of fun to write
documentation. Not for me and I'm sure not for most coders. We try to
keep the examples as up-to-date and extensive as we can, and we have
multiple examples projects. That's the best we can/ want to at this
time, together with much appreciated contributions to the WIKI. I
recommend you buy Pro Wicket for 20 dollars or so.

Eelco

-
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.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user