You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andrei Razin <ru...@hotmail.com> on 2010/06/27 17:53:35 UTC

Dependent Models

Hello.

I have a problem:

1.There are 3 forms on the Page: GroupsForm, UsersForm, DocumentsForm. 
Each of them reflects a Dcorrespoding Domain object and supposed to have a
Model.

2.Functionality: 
Selecting a Group in  GroupsForm should 
force other 2 forms to show a list of corresponding objects – 
Users and Documents for the selected Group.

3.So, the User Object has a Group object inside and Document object has a
Group as well.

4.For now, I am able to synchronize 2 forms  GroupsForm and  UsersForm. 
The models for them look like:

	CompoundPropertyModel userModel = new
CompoundPropertyModel(getInitContactObject());

	groupModel = new PropertyModel(userModel, "group");

5.So, the  groupModel is derived from  userModel. This  synchronizes 2
models. But how can I  synchronize the 3d one?

6.It should be another way of chaining models, something like Composition. 
I want to include (opposite from derive)  groupModel into other two: 
userModel and documentModel. 
Is it possible?

Thanks in advance.
Appreciate any help.

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dependent-Models-tp2270083p2270083.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dependent Models

Posted by Andrei Razin <ru...@hotmail.com>.
Martin.

Thanks for clarification.
This will solve the problem for sure and I'll continue this way.

The only problem I can envision is - it will make the children not reusable.
They will have the references to the parent (Page or/and Panel) 
and to use them on another page I have to modify the Forms (and Panels).
Not a big deal though.

Regards, 
Andrei.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dependent-Models-tp2270083p2270185.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dependent Models

Posted by Andrei Razin <ru...@hotmail.com>.
One more thing.
Just forgot to mention:

If I implement the proper interfaces in Parent objects, that will help to
make children component reusable.

Thanks again for the idea.

Andrei.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dependent-Models-tp2270083p2270188.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dependent Models

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!

> 1. Yes, I think I do use "Hollywood principle". The children do not call
> Parent.

I think you have it the wrong way around. The dependants should call
the parent to ask status. Otherwise you have the parents running all
around trying to find all the dependants. It's easier for the
dependants to know what they depend on instead of parents like
shepards ...



**
Martin

> So, I do not call Form method from the other Form (through Parent hierarchy)
> 2. I also do not have references to the Parent (Page, Panel) inside the
> Form.
> 3. I try to synchronize forms through Models.
>
> 4. I just have no Idea how to create proper chained models using
> composition. I mean - include one model into several others.
>
> Sorry, if I misunderstood your reply about "Hollywood principle".
>
> Thanks again.
> Andrei.
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dependent-Models-tp2270083p2270146.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dependent Models

Posted by Andrei Razin <ru...@hotmail.com>.
Martin.

Thanks for reply.

1. Yes, I think I do use "Hollywood principle". The children do not call
Parent.
So, I do not call Form method from the other Form (through Parent hierarchy)
2. I also do not have references to the Parent (Page, Panel) inside the
Form.
3. I try to synchronize forms through Models.

4. I just have no Idea how to create proper chained models using
composition. I mean - include one model into several others.

Sorry, if I misunderstood your reply about "Hollywood principle".

Thanks again.
Andrei.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dependent-Models-tp2270083p2270146.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dependent Models

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Do you use hollywood principle?

**
Marti

2010/6/27 Andrei Razin <ru...@hotmail.com>:
>
> Hello.
>
> I have a problem:
>
> 1.There are 3 forms on the Page: GroupsForm, UsersForm, DocumentsForm.
> Each of them reflects a Dcorrespoding Domain object and supposed to have a
> Model.
>
> 2.Functionality:
> Selecting a Group in  GroupsForm should
> force other 2 forms to show a list of corresponding objects –
> Users and Documents for the selected Group.
>
> 3.So, the User Object has a Group object inside and Document object has a
> Group as well.
>
> 4.For now, I am able to synchronize 2 forms  GroupsForm and  UsersForm.
> The models for them look like:
>
>        CompoundPropertyModel userModel = new
> CompoundPropertyModel(getInitContactObject());
>
>        groupModel = new PropertyModel(userModel, "group");
>
> 5.So, the  groupModel is derived from  userModel. This  synchronizes 2
> models. But how can I  synchronize the 3d one?
>
> 6.It should be another way of chaining models, something like Composition.
> I want to include (opposite from derive)  groupModel into other two:
> userModel and documentModel.
> Is it possible?
>
> Thanks in advance.
> Appreciate any help.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dependent-Models-tp2270083p2270083.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org