On 9/6/05, Ralf Ebert <[EMAIL PROTECTED]> wrote:
This would be done using: new CompoundPropertyModel(new PropertyModel(getPage().getModel(), "room"))
However, why don't you create a RoomEditForm, which looks something like this:
public RoomEditForm extends Form
{
public RoomEditForm(String id, Room room)
{
super(id, new CompoundPropertyModel(room));
// ... add components
}
protected void onSubmit()
{
// save or something else...
}
}
Currently not. The Listview is dependend on List because the default implementation uses indexes to gain access to the elements. That is not possible using Set.
As far as I know, there isn't 'a' preferred way. Choose whatever you like most.
I prefer option 1 or 2 (I like option 2 better).
MartijnHi,
- when having a page using a CompoundPropertyModel which has a form
using a CompoundPropertyModel, how do I get the form's model to map
to a property of the page's model? (the pages model is bound to
"house", and I want the form's model to be bound to " house.room" so
the forms components will be bound to "house.room.table" instead of
"house.table" :) just using the id "room" for the form didn't do the
trick)
This would be done using: new CompoundPropertyModel(new PropertyModel(getPage().getModel(), "room"))
However, why don't you create a RoomEditForm, which looks something like this:
public RoomEditForm extends Form
{
public RoomEditForm(String id, Room room)
{
super(id, new CompoundPropertyModel(room));
// ... add components
}
protected void onSubmit()
{
// save or something else...
}
}
- The property a ListView is bound to needs to be a Set (in my app).
ListView requires List. Is there a way to use ListView with a set in
a convenient way?
Currently not. The Listview is dependend on List because the default implementation uses indexes to gain access to the elements. That is not possible using Set.
- What is the preferred way to get the CompoundPropertyModel's model
object from a component thats bound via the CompoundPropertyModel?
- getModel().getObject(null) which gives the root model object
which is the same in most cases
- getParent().getModelObject()
- or something different like binding the CoProMo (that's a nice
abbreviation) to the button itself?
As far as I know, there isn't 'a' preferred way. Choose whatever you like most.
I prefer option 1 or 2 (I like option 2 better).