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),
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.
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
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
I don't understand. Vendor.state and SelectOption.state are both Strings.
I cut down my form to only have state on the form so I can post all the
code. The code pulls the correct data from the database and displays it on
the form but when I save it is gives me the following error.
First:
You bind the DDC to the wrong model. You bind it directly to the LDM
instead of the vendor's state property.
DropDownChoice stateFC = new DropDownChoice(state, states, choiceRenderer);
should be sufficient.
Second:
Your current setup assumes that the Vendor#state is of type
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
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
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?
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++ };
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
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,
[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
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
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
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
[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:
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
[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
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:
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)
21 matches
Mail list logo