I have done this by creating an abstract base page with an abstract
factory methods getFooPanel() or getBarPanel().  Then the base page
add()s the result of getFooPanel(), while the implementations supply
it.

- Scott


On Mon, Apr 28, 2008 at 10:09 AM, Cristi Manole <[EMAIL PROTECTED]> wrote:
> To answer your second point :
>  ->NO, at this point you cannot define multiple <wicket:child> anywhere.
>  Try using fragments or generic panels (i don't know which would be better
>  for you). Replace a generic panel with the specific panel you need.
>
>  Cristi Manole
>
>  On Mon, Apr 28, 2008 at 11:34 AM, Martin Makundi <
>
>
> [EMAIL PROTECTED]> wrote:
>
>  > Well, here you have an example of a panel:
>  > http://www.javalobby.org/java/forums/t60926.html
>  >
>  > It is reusable, so you can use it from anywhere, or decide not to use it.
>  >
>  > Design one page which uses panels. Then change the panels according to
>  > some session state, for example. Here is a trivial bad example:
>  >
>  > public class MyChangingPage extends WebPage {
>  > private static int pageReloadCount;
>  >
>  > public MyChangingPage() {
>  >   pageReloadCount++;
>  >
>  >   boolean even = (pageReloadCount % 2) == 0;
>  >
>  >   if (even) {
>  >      add(new EvenPanel("panel_id"));
>  >   } else {
>  >      add(new OddPanel("panel_id"));
>  >   }
>  >  }
>  > }
>  >
>  >
>  >
>  > Ofcourse in real life a static counter is not what you want.
>  >
>  >
>  > **
>  > Martin
>  >
>  > 2008/4/28 Azzeddine Daddah <[EMAIL PROTECTED]>:
>  > > Could you or somebody else please provide some code?
>  > >  I didn't understand your last sentence " Start with one hard coded
>  > layout
>  > >
>  > > and then tune it using an internal
>  > >  state, for example."
>  > >
>  > >  Thank you,
>  > >
>  > >  Azzeddine
>  > >
>  > >
>  > >
>  > >  On Mon, Apr 28, 2008 at 10:16 AM, Martin Makundi <
>  > >  [EMAIL PROTECTED]> wrote:
>  > >
>  > >  > I would guess that it is better to use panels or fragments and
>  > instead
>  > >  > of using setXXX, just initialize everyting in its place according to
>  > >  > an internal state.
>  > >  >
>  > >  > Start with one hard coded layout and then tune it using an internal
>  > >  > state, for example.
>  > >  >
>  > >  > **
>  > >  > Martin
>  > >  >
>  > >  > 2008/4/28 Azzeddine Daddah <[EMAIL PROTECTED]>:
>  > >  > > Hi there,
>  > >  > >
>  > >  > >  I'm new to Wicket trying to build my first application :).
>  > >  > >  I've already token a look at "Creating layouts using markup
>  > >  > inheritance"
>  > >  > >  tutorial from the Wicket website, but still have some questions:
>  > >  > >  Suppose that I've a base page which I want that some of my pages
>  > >  > inherits
>  > >  > >  the layout from it. What I want to do is to have some protected
>  > methods
>  > >  > like
>  > >  > >  f.e. appendComponen(final Component comp, String position) and
>  > >  > >  setTitle(String title). The position string In the first method
>  > >  > indicates
>  > >  > >  the position where the component in the page should be appended.
>  > >  > >
>  > >  > >    1. How can I implement this?
>  > >  > >    2. Is it possible to define multiple <wicket:child /> in the
>  > base
>  > >  > >    page?
>  > >  > >
>  > >  > >  Gr. Azzeddine
>  > >  > >
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > >  > For additional commands, e-mail: [EMAIL PROTECTED]
>  > >  >
>  > >  >
>  > >
>  > >
>  > >  --
>  > >  Azzeddine Daddah
>  > >  www.hbiloo.com
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to