Re: DropDownChoice getting value into the model

2008-04-27 Thread Russell Webb

Perhaps I'm missing something big time about BoundCompoundPropertyModel. I
removed my loadable detachable model and still can't get it to work
specifically with a dropdown element.

The following works...
FormComponent networks = new DropDownChoice(network, new
PropertyModel(phone, network), networksList);
but the following doesn't
FormComponent networks = new DropDownChoice(network, new
BoundCompoundPropertyModel(phone), networksList);

I've tried stepping into the code but can't resolve the issue. Can anyone
confirm or explain this problem?




Russell Webb wrote:
 
 I am experiencing something similar. My LoadableDetachableModel is wrapped
 with a CompoundPropertyModel.
 
 Submitting a TexTField acquires the AttachedCompoundPropertyModel whose
 setObject() acquires the target object and persists changes. 

 CompoundPropertyModel$AttachedCompoundPropertyModel(AbstractPropertyModel).setObject(Object)
 line: 146 
 TextField(Component).setModelObject(Object) line: 2888
 TextField(FormComponent).updateModel() line: 1060 
 Form$19.validate(FormComponent) line: 1754
 
 Submitting the dropdown acquires the read only setObject()
 VxsNewUserWizard$3(AbstractReadOnlyModel).setObject(Object) line: 52  
 BoundCompoundPropertyModel(CompoundPropertyModel).setObject(Object)
 line: 72  
 DropDownChoice(Component).setModelObject(Object) line: 2888   
 DropDownChoice(FormComponent).updateModel() line: 1060
 Form$19.validate(FormComponent) line: 1754
 
 It seems the model is linked to the two components differently and that
 this causes different behaviour when using a CompoundPropertyModel (and
 perhaps others) like allowing the ReadOnlyModel.setObject to be bypassed. 
 
 Russ
 
 
 
 igor.vaynberg wrote:
 
 perhaps because your textfield is setting a property of the object
 loaded by the model, not the object itself.
 
 -igor
 
 
 On Fri, Mar 7, 2008 at 1:48 PM, rmattler [EMAIL PROTECTED] wrote:

  Thanks for the quick reply.  But you answer doesn't make sense to me. 
 Why do
  loadable models work for a text field but not a drop down?  If I have
 NY
  stored in the database, New York is loaded onto the form but when the
 form
  is submitted the selected value of the drop down is not saved into the
  model.  I'm trying to get the selected value stored into the Vendor
 object
  and a String not a SelectOption.

  public class Vendor implements java.io.Serializable {

 private String state;





  two problems

  1) loadable detachable models do not support the setobject() call,
  because they are...loadable. so you should use a different kind of
  model.

  2) yes, selectoption object will be put into your model, dropdown
  choice works like this:

  DropDownChoiceT(String id, IModelT model, IModelListT choices,
  IChoiceRenrererT renderer)

  -igor


  --
  View this message in context:
 http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15907046.html


 Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p16927437.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-04-24 Thread Russell Webb

I am experiencing something similar. My LoadableDetachableModel is wrapped
with a CompoundPropertyModel.

Submitting a TexTField acquires the AttachedCompoundPropertyModel whose
setObject() acquires the target object and persists changes. 
   
CompoundPropertyModel$AttachedCompoundPropertyModel(AbstractPropertyModel).setObject(Object)
line: 146   
TextField(Component).setModelObject(Object) line: 2888  
TextField(FormComponent).updateModel() line: 1060   
Form$19.validate(FormComponent) line: 1754  

Submitting the dropdown acquires the read only setObject()
VxsNewUserWizard$3(AbstractReadOnlyModel).setObject(Object) line: 52
BoundCompoundPropertyModel(CompoundPropertyModel).setObject(Object)
line: 72
DropDownChoice(Component).setModelObject(Object) line: 2888 
DropDownChoice(FormComponent).updateModel() line: 1060  
Form$19.validate(FormComponent) line: 1754  

It seems the model is linked to the two components differently and that this
causes different behaviour when using a CompoundPropertyModel (and perhaps
others) like allowing the ReadOnlyModel.setObject to be bypassed. 

Russ



igor.vaynberg wrote:
 
 perhaps because your textfield is setting a property of the object
 loaded by the model, not the object itself.
 
 -igor
 
 
 On Fri, Mar 7, 2008 at 1:48 PM, rmattler [EMAIL PROTECTED] wrote:

  Thanks for the quick reply.  But you answer doesn't make sense to me. 
 Why do
  loadable models work for a text field but not a drop down?  If I have
 NY
  stored in the database, New York is loaded onto the form but when the
 form
  is submitted the selected value of the drop down is not saved into the
  model.  I'm trying to get the selected value stored into the Vendor
 object
  and a String not a SelectOption.

  public class Vendor implements java.io.Serializable {

 private String state;





  two problems

  1) loadable detachable models do not support the setobject() call,
  because they are...loadable. so you should use a different kind of
  model.

  2) yes, selectoption object will be put into your model, dropdown
  choice works like this:

  DropDownChoiceT(String id, IModelT model, IModelListT choices,
  IChoiceRenrererT renderer)

  -igor


  --
  View this message in context:
 http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15907046.html


 Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p16850440.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-17 Thread 242

Well, IChoiceRenderer gives you ability to use any field of your custom
choice object for rendering. In order to select a choice before rendering
I'd implement custom choices IModel with additional method like: Object
getSelected(T key) to set selection model object properly. Then I use
DropDownCoice constructor that takes both models and renderer.



Vitaly Tsaplin wrote:
 
 An index is a kind of a link between a value and its displayable
 representation. Having an index in getDisplayValue method we would do
 something like:
 
   ListInteger lang_choices = Arrays.asList (new Object [] { 1, 2, 4, 8
 });
   Object [] lang_labels = new Object [] { php, perl, java, c++ };
 
   public Object getDisplayValue (Object object, int index) {
  return lang_labels [index];
   }
 
   public String getValueId (Object object, int index) {
  return String.valueOf (object);
   }
 
   It should be more efficient then to do a map lookup for every
 option especially in case of a long option list.
 
   Personally I think that things could be more simple and logical
 with less faceless model. I mean having a model which is based on an
 interface (not a simple single object container) like in swing or
 tapestry would help.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p16114450.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-11 Thread rmattler

I don't have time to work on this right now, have real work to do.  But I now
believe I understand my problem.  The Vendor bean needs to have the field
'state' be the class of State not String.  Now I just need to figure out how
to do that with Hibernate.

I did buy your book.  It is excellent everybody should buy one or two.  How
is that for a plug?

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p1597.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-10 Thread rmattler
]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15950742.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-10 Thread Martijn Dashorst
 {


 private long tblId;
 private String state;


  @Column(name = state, length = 2)
 public String getState() {
 return this.state;
 }

 public void setState(String state) {
 this.state = state;
 }






 Johan Compagner wrote:
  
   This has to work yes, the only thing is do build up the new
   Model(states) as States so the same type of object as vendor.state
   returns.
  
   On 3/7/08, Kai Mutz [EMAIL PROTECTED] wrote:
   [EMAIL PROTECTED]  wrote:
It is nice to know I'm not the only one struggling with
DropDownChoices.  I'm new to Wicket and I'm pretty far with
rebuilding an application we are using internally.  Has anybody
proposed an alternative or a wrapper to DropDownChoices?
  
   Have you tried something like:
  
   Vendor vendor = (Vendor) vendorModel.getObject();
  
   DropDownChoice stateFC = new DropDownChoice(state, new
   PropertyModel(vendor, state), new Model(states), choiceRenderer);
  
   This should work.
  
   Kai
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  


 --
  View this message in context: 
 http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15950742.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


  -

 To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-09 Thread Johan Compagner
This has to work yes, the only thing is do build up the new
Model(states) as States so the same type of object as vendor.state
returns.

On 3/7/08, Kai Mutz [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED]  wrote:
  It is nice to know I'm not the only one struggling with
  DropDownChoices.  I'm new to Wicket and I'm pretty far with
  rebuilding an application we are using internally.  Has anybody
  proposed an alternative or a wrapper to DropDownChoices?

 Have you tried something like:

 Vendor vendor = (Vendor) vendorModel.getObject();

 DropDownChoice stateFC = new DropDownChoice(state, new
 PropertyModel(vendor, state), new Model(states), choiceRenderer);

 This should work.

 Kai


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-09 Thread Johan Compagner
No it works also good, exactly the same if you where using the swing
combobox. The problem that you have is that when you have an id
(integer) in your object model that needs to be set but thagt id is
the id of a Person then i think your object model is just plain wrong.
Its not an object model at all its just direct sql/resultset mapping
instead of a real pojo model.

On 3/7/08, Vitaly Tsaplin [EMAIL PROTECTED] wrote:
The DropDownBox component is in fact well designed in theory. But I
 think the way it works is a bit inconvenient in practice. Normally the
 main purpose of this component in to supply some value or an index for
 a model but a label is needed only for to be presented to a user.
 Unfortunately we are supposed  to use either the same value (a string
 representation) for both pupposes or to use some kind of a wrapper and
 to pollute the model by some strange SelectOption object even though
 that the model would normally accept an integer.

Vitaly

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-09 Thread Erik van Oosten

Hi Vitaly,

That is correct. For primitive model values you need something like a map.

I think the DropDownBox was more designed for complex data where the
data to display is embedded in the model value itself.

Anyway, how would the addition of an index argument to the display
method help?

Regards,
   Erik.



Vitaly Tsaplin schreef:

   Hi everyone, Hi Erik,

   I am sorry for so late post. But am going to go back to our
DropDownChoice discussion.
   If you suggest me to create a list of integers and use a special
renderer implementation to retrieve a displayable value you should
take into account that in case if we have a list of indices we can
easily look up in an array or a list using an index. But if we have a
list of unordered integers for example to do such a lookup we need to
create a map and search this map every time we render a single option.
That comes from the fact that a relationship between a value and its
displayable equivalent is not obvious for a renderer. So I would ask
to add an index of an options being rendered to the getDisplayValue
method.

   Vitaly


  




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-09 Thread Vitaly Tsaplin
An index is a kind of a link between a value and its displayable
representation. Having an index in getDisplayValue method we would do
something like:

  ListInteger lang_choices = Arrays.asList (new Object [] { 1, 2, 4, 8 });
  Object [] lang_labels = new Object [] { php, perl, java, c++ };

  public Object getDisplayValue (Object object, int index) {
 return lang_labels [index];
  }

  public String getValueId (Object object, int index) {
 return String.valueOf (object);
  }

  It should be more efficient then to do a map lookup for every
option especially in case of a long option list.

  Personally I think that things could be more simple and logical
with less faceless model. I mean having a model which is based on an
interface (not a simple single object container) like in swing or
tapestry would help.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-08 Thread Vitaly Tsaplin
   Hi everyone, Hi Erik,

   I am sorry for so late post. But am going to go back to our
DropDownChoice discussion.
   If you suggest me to create a list of integers and use a special
renderer implementation to retrieve a displayable value you should
take into account that in case if we have a list of indices we can
easily look up in an array or a list using an index. But if we have a
list of unordered integers for example to do such a lookup we need to
create a map and search this map every time we render a single option.
That comes from the fact that a relationship between a value and its
displayable equivalent is not obvious for a renderer. So I would ask
to add an index of an options being rendered to the getDisplayValue
method.

   Vitaly

On Fri, Mar 7, 2008 at 10:33 PM, Erik van Oosten [EMAIL PROTECTED] wrote:
 Hello Vitaly,

  That is not true, you are thinking to complicated (I did in the past as
  well).

  If you want to set an integer on the model, then the choices must be a
  list of integers. In addition you set an IChoiceRenderer that can
  display the integer as a sensible string.

  Regards,
 Erik.





  Vitaly Tsaplin wrote:
  The DropDownBox component is in fact well designed in theory. But I
   think the way it works is a bit inconvenient in practice. Normally the
   main purpose of this component in to supply some value or an index for
   a model but a label is needed only for to be presented to a user.
   Unfortunately we are supposed  to use either the same value (a string
   representation) for both pupposes or to use some kind of a wrapper and
   to pollute the model by some strange SelectOption object even though
   that the model would normally accept an integer.
  
  Vitaly
  


  -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DropDownChoice getting value into the model

2008-03-07 Thread rmattler

I've tried for 1 1/2 days to get this simple Drop Down to work and I'm
feeling stupid.  My mom tells me I'm smart.:-(

Everything works fine until I try to save it. I get the following error.  I
think it is trying to put the SelectOption object into the Model but I don't
know how to tell it to put the state var from SelectOption into my Vendor
object.




java.lang.UnsupportedOperationException: Model class
com.myprepress.pages.vendor.profile.VendorEntry$1 does not support
setObject(Object)

IModel vendorModel = new LoadableDetachableModel() {
protected Object load() {
return vendorDAO.load(tblId);

}
};

// add state
ArrayListSelectOption states = new ArrayListSelectOption();
states.add(new SelectOption(AL, Alabama));
states.add(new SelectOption(OH, Ohio));
states.add(new SelectOption(NY, New York));
ChoiceRenderer choiceRenderer = new ChoiceRenderer(display, 
state);

DropDownChoice stateFC = new DropDownChoice(state, 
vendorModel, new
Model(states), choiceRenderer);


public class SelectOption implements Serializable {

private String state;
private String display;


-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15905486.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-07 Thread Igor Vaynberg
two problems

1) loadable detachable models do not support the setobject() call,
because they are...loadable. so you should use a different kind of
model.

2) yes, selectoption object will be put into your model, dropdown
choice works like this:

DropDownChoiceT(String id, IModelT model, IModelListT choices,
IChoiceRenrererT renderer)

-igor


On Fri, Mar 7, 2008 at 12:37 PM, rmattler [EMAIL PROTECTED] wrote:

  I've tried for 1 1/2 days to get this simple Drop Down to work and I'm
  feeling stupid.  My mom tells me I'm smart.:-(

  Everything works fine until I try to save it. I get the following error.  I
  think it is trying to put the SelectOption object into the Model but I don't
  know how to tell it to put the state var from SelectOption into my Vendor
  object.




  java.lang.UnsupportedOperationException: Model class
  com.myprepress.pages.vendor.profile.VendorEntry$1 does not support
  setObject(Object)

  IModel vendorModel = new LoadableDetachableModel() {
 protected Object load() {
 return vendorDAO.load(tblId);

 }
 };

  // add state
 ArrayListSelectOption states = new 
 ArrayListSelectOption();
 states.add(new SelectOption(AL, Alabama));
 states.add(new SelectOption(OH, Ohio));
 states.add(new SelectOption(NY, New York));
 ChoiceRenderer choiceRenderer = new ChoiceRenderer(display, 
 state);

 DropDownChoice stateFC = new DropDownChoice(state, 
 vendorModel, new
  Model(states), choiceRenderer);


  public class SelectOption implements Serializable {

 private String state;
 private String display;


  --
  View this message in context: 
 http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15905486.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: DropDownChoice getting value into the model

2008-03-07 Thread Kai Mutz
[EMAIL PROTECTED]  wrote:
 I've tried for 1 1/2 days to get this simple Drop Down to work and I'm
 feeling stupid.  My mom tells me I'm smart.:-(

 Everything works fine until I try to save it. I get the following
 error.  I
 think it is trying to put the SelectOption object into the Model
 but I don't
 know how to tell it to put the state var from SelectOption into my
 Vendor object.

Does your Vendor object have an field of type SelectOption? If not which
field do you want to set with the select box?

Perhaps this helps:
http://cwiki.apache.org/WICKET/another-dropdownchoice-example-by-adam.html

Kai


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-07 Thread rmattler

Thanks for the quick reply.  But you answer doesn't make sense to me.  Why do
loadable models work for a text field but not a drop down?  If I have NY
stored in the database, New York is loaded onto the form but when the form
is submitted the selected value of the drop down is not saved into the
model.  I'm trying to get the selected value stored into the Vendor object
and a String not a SelectOption.

public class Vendor implements java.io.Serializable {

private String state;




two problems

1) loadable detachable models do not support the setobject() call,
because they are...loadable. so you should use a different kind of
model.

2) yes, selectoption object will be put into your model, dropdown
choice works like this:

DropDownChoiceT(String id, IModelT model, IModelListT choices,
IChoiceRenrererT renderer)

-igor


-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15907046.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-07 Thread Igor Vaynberg
perhaps because your textfield is setting a property of the object
loaded by the model, not the object itself.

-igor


On Fri, Mar 7, 2008 at 1:48 PM, rmattler [EMAIL PROTECTED] wrote:

  Thanks for the quick reply.  But you answer doesn't make sense to me.  Why do
  loadable models work for a text field but not a drop down?  If I have NY
  stored in the database, New York is loaded onto the form but when the form
  is submitted the selected value of the drop down is not saved into the
  model.  I'm trying to get the selected value stored into the Vendor object
  and a String not a SelectOption.

  public class Vendor implements java.io.Serializable {

 private String state;





  two problems

  1) loadable detachable models do not support the setobject() call,
  because they are...loadable. so you should use a different kind of
  model.

  2) yes, selectoption object will be put into your model, dropdown
  choice works like this:

  DropDownChoiceT(String id, IModelT model, IModelListT choices,
  IChoiceRenrererT renderer)

  -igor


  --
  View this message in context: 
 http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15907046.html


 Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-07 Thread rmattler

It is nice to know I'm not the only one struggling with DropDownChoices.  I'm
new to Wicket and I'm pretty far with rebuilding an application we are using
internally.  Has anybody proposed an alternative or a wrapper to
DropDownChoices?   



Vitaly Tsaplin wrote:
 
The DropDownBox component is in fact well designed in theory. But I
 think the way it works is a bit inconvenient in practice. Normally the
 main purpose of this component in to supply some value or an index for
 a model but a label is needed only for to be presented to a user.
 Unfortunately we are supposed  to use either the same value (a string
 representation) for both pupposes or to use some kind of a wrapper and
 to pollute the model by some strange SelectOption object even though
 that the model would normally accept an integer.
 
Vitaly
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15907346.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: DropDownChoice getting value into the model

2008-03-07 Thread Kai Mutz
[EMAIL PROTECTED]  wrote:
 It is nice to know I'm not the only one struggling with
 DropDownChoices.  I'm new to Wicket and I'm pretty far with
 rebuilding an application we are using internally.  Has anybody
 proposed an alternative or a wrapper to DropDownChoices?

Have you tried something like:

Vendor vendor = (Vendor) vendorModel.getObject();

DropDownChoice stateFC = new DropDownChoice(state, new
PropertyModel(vendor, state), new Model(states), choiceRenderer);

This should work.

Kai


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: DropDownChoice getting value into the model

2008-03-07 Thread rmattler

Thanks for trying but I get:

WicketMessage: No get method defined for class: class java.lang.String
expression: state



Kai Mütz wrote:
 
 [EMAIL PROTECTED]  wrote:
 It is nice to know I'm not the only one struggling with
 DropDownChoices.  I'm new to Wicket and I'm pretty far with
 rebuilding an application we are using internally.  Has anybody
 proposed an alternative or a wrapper to DropDownChoices?
 
 Have you tried something like:
 
 Vendor vendor = (Vendor) vendorModel.getObject();
 
 DropDownChoice stateFC = new DropDownChoice(state, new
 PropertyModel(vendor, state), new Model(states), choiceRenderer);
 
 This should work.
 
 Kai
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15907691.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: DropDownChoice getting value into the model

2008-03-07 Thread Kai Mütz
[EMAIL PROTECTED]  wrote:
 Thanks for trying but I get:
 
 WicketMessage: No get method defined for class: class
 java.lang.String expression: state 

Have you defined a getter/setter for field state in your vendor class?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: DropDownChoice getting value into the model

2008-03-07 Thread rmattler

Yes

@Column(name = state, length = 2)
public String getState() {
return this.state;
}

public void setState(String state) {
this.state = state;
}


Kai Mütz wrote:
 
 [EMAIL PROTECTED]  wrote:
 Thanks for trying but I get:
 
 WicketMessage: No get method defined for class: class
 java.lang.String expression: state 
 
 Have you defined a getter/setter for field state in your vendor class?
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15907944.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DropDownChoice getting value into the model

2008-03-07 Thread Per Newgro
But in java.lang.String there is no state property.

You added a list of Strings to the ddc. But you have to add your vendor 
objects. The display in ddc will be done by ChoiceRenderer.

Cheers
Per


Am Freitag, 7. März 2008 23:34:35 schrieb rmattler:
 Yes

 @Column(name = state, length = 2)
   public String getState() {
   return this.state;
   }

   public void setState(String state) {
   this.state = state;
   }

 Kai Mütz wrote:
  [EMAIL PROTECTED]  wrote:
  Thanks for trying but I get:
 
  WicketMessage: No get method defined for class: class
  java.lang.String expression: state
 
  Have you defined a getter/setter for field state in your vendor class?
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]