[Wicket-user] reference from deeply nested links

2007-07-02 Thread Pieter Cogghe

Hi,

I've got a bunch of links deeply nested in some listViews, panels, ... .
These links should set the ModelObject of a form that resides at top level.
Something like this:

id=SectionPanel  some-listview  some-panel  another-listview -
yet-another - link to edit some content (these classes are however not
nested!)
id=EditPanel  editForm

// mypage.java
this.sectionPanel = new SectionPanel(section-panel,
someModel-with-a-lot-of-sections);
add(sectionPanel);

this.editPanel = new EditPanel(edit-panel, someSectionModel);
add(editPanel);

Now I need a reference to the EditForm in the deeply nested links. As there
are  a lot of seperate classes involved (no nested classes), I can't do
something like this:
MyPage.this.editPanel.setModelOject(...);

The only solution I can think of is passing a reference to the editPanel
through all the constructors of the subsequent classes. This seems a bit
cumbersome. I was wondering whether there is a better solution.

thanks,

Pieter

--
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] reference from deeply nested links

2007-07-02 Thread Janos Cserep

 Now I need a reference to the EditForm in the deeply nested links. As there
 are  a lot of seperate classes involved (no nested classes), I can't do
 something like this:
 MyPage.this.editPanel.setModelOject(...);


findParent(EditPanel.class)

or

getPage().get(editPanel)


j

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] reference from deeply nested links

2007-07-02 Thread Pieter Cogghe

Thanks a lot. Read about findParent before, but forgot about them
completely.



2007/7/2, Janos Cserep [EMAIL PROTECTED]:



 Now I need a reference to the EditForm in the deeply nested links. As
there
 are  a lot of seperate classes involved (no nested classes), I can't do
 something like this:
 MyPage.this.editPanel.setModelOject(...);


findParent(EditPanel.class)

or

getPage().get(editPanel)


j

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





--
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] reference from deeply nested links

2007-07-02 Thread Eelco Hillenius
 findParent(EditPanel.class)

That's a good solution if you want to help keep your code clean.
However, having direct references - while it can get messy when you
have very deep nestings, means that your code is statically bound,
which can be an advantage when you have to refactor or navigate your
code. It's subjective, but I find working with nested classes
convenient, and this can save you from having to pass variables in
constructors all the time.

Eelco

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user