i never had the need to have 2 special models for new and existing objects
What is then the difference?
The only thing a model really does it getting the modelObject. So what you put in that can be an existing one or just a new Room()
Please give a better usecase for this
For now replacing models isn't needed.

And if you really want to get a model from the parent:

ParentModel extends Model
{
ParentModel(Component parentComponent)

protected Object onGetObject(final Component component)
{
 return parentComponent.getModel().getModelObject();
}
}

ParentModel parentModel = new ParentModel(this);
Component childComponent = new ChildComponent("test", new PropertyModel(parentModel, "myproperty"))

or something like that.


On 9/14/05, Ralf Ebert <[EMAIL PROTECTED]> wrote:
Hi,

> no then it isn't
> But why are you changing a model itself?
> Why not just the data? A model itself shouldn't have to change
> after construction.
well, currently I have no use case for this, I just want to model
these dependencies in a way which reflect the things I want to
express. In these cases I want to be bound to a property of my parent
model and not to a property of a concrete model instance.
I could also think of some cases where changing the model is
neccessary. For example, if you have different ways to access the
data. Lets say we have a Room object. I have a NewRoomModel for
objects which are new and not saved. For editing saved objects I
would have a RoomModel, probably as LoadableDetachableModel. When a
new object is saved I would probably call setModel(...) on the parent
component because I need a new model instance.

If I got models right, I think there should be a convenient way to
bind models (especially CompoundPropertyModel's) dynamically to a
property of a parent CompoundPropertyModel.

Regards,
Ralf


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to