One way would be to create an abstract page

public abstract class Template extends WebPage
{
  public Template()
  {
    add(createHeader1());
    add(createContent3());
    etc.
  }

  protected abstract Panel createHeader1();
  protected abstract Panel createContent3();
  etc.
}

public class WhateverPage extends Template
{
  protected Panel createContent3()
  {
    return new SomeContentPanel();
  }
  etc.
}

On 5/10/07, Fábio Bombonato <[EMAIL PROTECTED]> wrote:
>  Hi Everyone,
>
> Well, I´m a newbie in Wicket framework and had some difficulty to figure out
> how is the best way to make a template page where all areas defined in this
> template could be changed for Pages that use it. I read many topics about
> "template", "layout" in mail-list, some examples in Wicket Wiki e some
> others of Panels/Borders (
> http://www.wicket-wiki.org.uk/wiki/index.php/Panels_and_borders)
> and the correct way isn´t clearly for me.
>
>  Somebody has any suggestion or example to do this:
>
> For example, if a have a main Template page that define some containers,
> like header1, header2, content1:
>
>
> Template.html:
> <html>
>     <head>
>     </head>
>     <body>
>             <div id="mainheader">
>                 <!-- Every page could change this content -->
>             </div>
>
>             <div id="header1">
>                 <!-- Every page could change this content -->
>             </div>
>
>             <div id="header2">
>                 <!-- Every page could change this content -->
>             </div>
>
>             <div id="content3">
>                 <!-- Every page could change this content -->
>             </div>
>
>             <div id="maincontent">
>                 <!-- Every page could change this content -->
>             </div>
>
>             <div id="content1">
>                 <!-- Every page could change this content -->
>             </div>
>
>             <div id="content2">
>                 <!-- Every page could change this content -->
>         </div>
>     </body>
> </html>
>
>
>
> And Pages that use this template and change the contents of this
> containers, like:
>
> MainPage.html
> <html>
>     <head>
>     </head>
>     <body>
>             <div id="mainheader">
>                 <!-- no component here -->
>             </div>
>
>             <div id="header1">
>                 <!-- My Login Component -->
>             </div>
>
>             <div id="header2">
>                 <!-- Navigation Component -->
>             </div>
>
>             <div id="content3">
>                 <!-- Last News Component -->
>                 <!-- Blogs Listing Component -->
>                 <!-- Last Forum Messages Component -->
>             </div>
>
>             <div id=" maincontent">
>                 <!-- News Component -->
>             </div>
>
>             <div id="content1">
>                 <!-- Some User News Component -->
>             </div>
>
>             <div id="content2">
>                 <!-- Search Component -->
>         <!-- Ads Component -->
>         </div>
>     </body>
> </html>
>
>
> And other Page, using the same Template but change the content, like:
>
>
> SignInPage.html:
> <html>
>     <head>
>     </head>
>     <body>
>             <div id="mainheader">
>                 <!-- no component here -->
>             </div>
>
>             <div id="header1">
>                  <!-- no component here -->
>             </div>
>
>             <div id="header2">
>                 <!-- Navigation Component -->
>             </div>
>
>             <div id="content3">
>                 <!-- Last Registered Users Component -->
>             </div>
>
>             <div id=" maincontent">
>                 <!-- User Sign In Component -->
>             </div>
>
>             <div id="content1">
>                 <!-- no component here -->
>             </div>
>
>             <div id="content2">
>                 <!-- Search Component -->
>         </div>
>     </body>
> </html>
>
> Thanks for any help!
> -------------------------------------------------------------------------
> 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
>
>


-- 
Scott Swank
reformed mathematician

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