On 6/22/07, rc.china <[EMAIL PROTECTED]> wrote:




Scott Swank wrote:
>
> I've often seen folk want what I see as "abstract" tags that can then
> be implemented by subclasses.  The way I've handled that for our
> application is by creating an abstract component (say it's a page)
> with div tags with appropriate wicket:ids.
>
> public class BasePage extends WebPage
> {
>   public BasePage()
>   {
>     add(buildFoo("foo"));
>     add(buildBar("bar"));
>   }
>
>   public abstract Panel buildFoo(String id);
>   public abstract Component buildBar(String id);
> }
>
> Then subclass appropriately.
>

This solution has some limitations while multiple <wicket:child> has not:
1)We have to repeat the common parts of BasePage.html in all of its
descendants (such as DerivedPage1.html, DerivedPage2.html ...).
  ==> If we have multiple <wicket:child>, we have no need to do this.
2)If we chang the common parts in BasePage.html, we have to do the same
change in all of its descendants.
  ==> If we have multiple <wicket:child>, we just do the change in
BasePage.html


points one and two are not true. you would use wicket's markup inheritance
so the derived pages do not have to repeat anything from basepage.

3)The descendants have to provide a XXXPanel to encapsulate some components
  ==> If we have multiple <wicket:child>, we can just put these components
between <wichet:child> and </wicket:child>, such as
      <wicket:child>
         <label wicket:id="label">aaa</label>
         <input wicket:id="input" value="test/>
      </wicket:child>


also not strictly true. it doesnt need to be a panel, it can as easily be a
fragment which means it would be defined inline in the derived page. instead
of <wicket:extend> you would use <wicket:fragment>

all that said, like i said before there is nothing stopping you from
implementing what you want. all the api to do so is exposed - it is just not
the default the wicket team prefers.

-igor



--
View this message in context:
http://www.nabble.com/Multiple-wicket%3Achild-tags-in-the-same-page-tf3775143.html#a11263485
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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

-------------------------------------------------------------------------
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

Reply via email to