Re: What is the best way to create layouts in Wicket?

2008-05-05 Thread Daniel Stoch
On Mon, Apr 28, 2008 at 10:48 PM, Martijn Dashorst
<[EMAIL PROTECTED]> wrote:
> On 4/28/08, James Carman <[EMAIL PROTECTED]> wrote:
>  > So, how do you know that everything is good to go in the subclass
>  >  then?  You really shouldn't be calling a method implemented by the
>  >  subclass in the superclass' constructor.  In your case, it may work,
>  >  but in general, it's bad practice.
>
>  In general programming with your brain shut down is bad practice. I
>  see a lot of fear, uncertainty and doubt about calling overridable
>  methods from a constructor. There is no need to if you engage your
>  brain.
>
>  The biggest problem is that components may not have their final
>  position in the page yet, so you can't call some methods. Guess what?
>  That isn't any different from calling those methods in the constructor
>  in the first place. And it is easily solved by moving that logic to a
>  delayed execution such as a Model's getObject() method. Which really
>  provides a better solution in the first place.
>
>  Martijn
>

Hi,

Could you give a small example of such solution (like: "moving that
logic to a delayed execution such as a Model's getObject() method")?
Scott's use case would be a good starting point (pasted below). I
still don't know how to specify the component to pass to the add
method in the BasePage constructor. How would you change this to avoid
these "createXXXPanel()" calls (I hope you are not thinking about
calling add(...) methods in the RedPage constructor of course :))?

public BasePage(...) {
 add(createFooPanel("fooId"));
 add(createBarPanel("barId"));
}

protected abstract Panel createFooPanel(String id);
protected abstract Panel createFooPanel(String id);

-

public RedPage(...) extends BasePage {
 super(...);
}

@Override
protected Panel createFooPanel(String id) {
 // do not reference anything that is instantiation dependent
 return new RedFooPanel(id);
}

@Override
protected Panel createBarPanel(String id) {
 // do not reference anything that is instantiation dependent
 return new RedBarPanel(id);
}

--
Daniel

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



Re: What is the best way to create layouts in Wicket?

2008-04-29 Thread Scott Swank
Where of course RedPage extends BasePage...

On Tue, Apr 29, 2008 at 9:15 AM, Scott Swank <[EMAIL PROTECTED]> wrote:
> The method just has to be stateless, particularly from the perspective
>  of instantiation.
>
>  public BasePage(...) {
>   add(createFooPanel("fooId"));
>   add(createBarPanel("barId"));
>  }
>
>  protected abstract Panel createFooPanel(String id);
>  protected abstract Panel createFooPanel(String id);
>
>  -
>
>  public RedPage(...) {
>   super(...);
>  }
>
>  @Override
>  protected Panel createFooPanel(String id) {
>   // do not reference anything that is instantiation dependent
>   return new RedFooPanel(id);
>  }
>
>  @Override
>  protected Panel createBarPanel(String id) {
>   // do not reference anything that is instantiation dependent
>   return new RedBarPanel(id);
>  }
>
>
>  On Tue, Apr 29, 2008 at 6:51 AM, Martin Makundi
>
> <[EMAIL PROTECTED]> wrote:
>
>
> > Bother to give an example of what you mean?
>  >
>  >  2008/4/29 Johan Compagner <[EMAIL PROTECTED]>:
>  >
>  > > no Scott just told you that you should create such initializers 
> completely
>  >  >  "static".
>  >  >  They should be 'static' without touching state of the current 
> object/class
>  >  >  itself.
>  >  >
>  >  >
>  >
>  >
>  >
>  > -
>  >  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]



Re: What is the best way to create layouts in Wicket?

2008-04-29 Thread Scott Swank
The method just has to be stateless, particularly from the perspective
of instantiation.

public BasePage(...) {
  add(createFooPanel("fooId"));
  add(createBarPanel("barId"));
}

protected abstract Panel createFooPanel(String id);
protected abstract Panel createFooPanel(String id);

-

public RedPage(...) {
  super(...);
}

@Override
protected Panel createFooPanel(String id) {
  // do not reference anything that is instantiation dependent
  return new RedFooPanel(id);
}

@Override
protected Panel createBarPanel(String id) {
  // do not reference anything that is instantiation dependent
  return new RedBarPanel(id);
}


On Tue, Apr 29, 2008 at 6:51 AM, Martin Makundi
<[EMAIL PROTECTED]> wrote:
> Bother to give an example of what you mean?
>
>  2008/4/29 Johan Compagner <[EMAIL PROTECTED]>:
>
> > no Scott just told you that you should create such initializers completely
>  >  "static".
>  >  They should be 'static' without touching state of the current object/class
>  >  itself.
>  >
>  >
>
>
>
> -
>  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]



Re: What is the best way to create layouts in Wicket?

2008-04-29 Thread Martin Makundi
Bother to give an example of what you mean?

2008/4/29 Johan Compagner <[EMAIL PROTECTED]>:
> no Scott just told you that you should create such initializers completely
>  "static".
>  They should be 'static' without touching state of the current object/class
>  itself.
>
>

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



Re: What is the best way to create layouts in Wicket?

2008-04-29 Thread Johan Compagner
no Scott just told you that you should create such initializers completely
"static".
They should be 'static' without touching state of the current object/class
itself.



On Tue, Apr 29, 2008 at 10:18 AM, Martin Makundi <
[EMAIL PROTECTED]> wrote:

> Are there such factory initializers in Wicket?
>
> There is one, initModel(), but I have not yet evaluated if it is being
> called on page repaint. I have had to implement my own intializer
> methods for page repaints in evolved state.
>
> **
> Martin
>
> 2008/4/28 Scott Swank <[EMAIL PROTECTED]>:
> > Agreed.  It has to be a stateless factory method.
> >
> >  On Mon, Apr 28, 2008 at 1:39 PM, James Carman
> >
> >
> > <[EMAIL PROTECTED]> wrote:
> >  > So, how do you know that everything is good to go in the subclass
> >  >  then?  You really shouldn't be calling a method implemented by the
> >  >  subclass in the superclass' constructor.  In your case, it may work,
> >  >  but in general, it's bad practice.
> >  >
> >  >
> >  >
> >  >  On Mon, Apr 28, 2008 at 4:34 PM, Scott Swank <[EMAIL PROTECTED]>
> wrote:
> >  >  > Yes, in the constructor.
> >  >  >
> >  >  >  - Scott
> >  >  >
> >  >  >
> >  >  >
> >  >  >  On Mon, Apr 28, 2008 at 11:12 AM, James Carman
> >  >  >  <[EMAIL PROTECTED]> wrote:
> >  >  >  > And, when does the base page do the adding?  In the
> constructor?
> >  >  >  >
> >  >  >  >
> >  >  >  >
> >  >  >  >  On Mon, Apr 28, 2008 at 1:38 PM, Scott Swank <
> [EMAIL PROTECTED]> wrote:
> >  >  >  >  > 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
>  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 int

Re: What is the best way to create layouts in Wicket?

2008-04-29 Thread Martin Makundi
Are there such factory initializers in Wicket?

There is one, initModel(), but I have not yet evaluated if it is being
called on page repaint. I have had to implement my own intializer
methods for page repaints in evolved state.

**
Martin

2008/4/28 Scott Swank <[EMAIL PROTECTED]>:
> Agreed.  It has to be a stateless factory method.
>
>  On Mon, Apr 28, 2008 at 1:39 PM, James Carman
>
>
> <[EMAIL PROTECTED]> wrote:
>  > So, how do you know that everything is good to go in the subclass
>  >  then?  You really shouldn't be calling a method implemented by the
>  >  subclass in the superclass' constructor.  In your case, it may work,
>  >  but in general, it's bad practice.
>  >
>  >
>  >
>  >  On Mon, Apr 28, 2008 at 4:34 PM, Scott Swank <[EMAIL PROTECTED]> wrote:
>  >  > Yes, in the constructor.
>  >  >
>  >  >  - Scott
>  >  >
>  >  >
>  >  >
>  >  >  On Mon, Apr 28, 2008 at 11:12 AM, James Carman
>  >  >  <[EMAIL PROTECTED]> wrote:
>  >  >  > And, when does the base page do the adding?  In the constructor?
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  On Mon, Apr 28, 2008 at 1:38 PM, Scott Swank <[EMAIL PROTECTED]> 
> wrote:
>  >  >  >  > 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  
> 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 
> usi

Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread Martijn Dashorst
On 4/28/08, James Carman <[EMAIL PROTECTED]> wrote:
> So, how do you know that everything is good to go in the subclass
>  then?  You really shouldn't be calling a method implemented by the
>  subclass in the superclass' constructor.  In your case, it may work,
>  but in general, it's bad practice.

In general programming with your brain shut down is bad practice. I
see a lot of fear, uncertainty and doubt about calling overridable
methods from a constructor. There is no need to if you engage your
brain.

The biggest problem is that components may not have their final
position in the page yet, so you can't call some methods. Guess what?
That isn't any different from calling those methods in the constructor
in the first place. And it is easily solved by moving that logic to a
delayed execution such as a Model's getObject() method. Which really
provides a better solution in the first place.

Martijn

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



Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread Scott Swank
Agreed.  It has to be a stateless factory method.

On Mon, Apr 28, 2008 at 1:39 PM, James Carman
<[EMAIL PROTECTED]> wrote:
> So, how do you know that everything is good to go in the subclass
>  then?  You really shouldn't be calling a method implemented by the
>  subclass in the superclass' constructor.  In your case, it may work,
>  but in general, it's bad practice.
>
>
>
>  On Mon, Apr 28, 2008 at 4:34 PM, Scott Swank <[EMAIL PROTECTED]> wrote:
>  > Yes, in the constructor.
>  >
>  >  - Scott
>  >
>  >
>  >
>  >  On Mon, Apr 28, 2008 at 11:12 AM, James Carman
>  >  <[EMAIL PROTECTED]> wrote:
>  >  > And, when does the base page do the adding?  In the constructor?
>  >  >
>  >  >
>  >  >
>  >  >  On Mon, Apr 28, 2008 at 1:38 PM, Scott Swank <[EMAIL PROTECTED]> wrote:
>  >  >  > 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  
> 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
>  >  >  >  >  > 

Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread James Carman
So, how do you know that everything is good to go in the subclass
then?  You really shouldn't be calling a method implemented by the
subclass in the superclass' constructor.  In your case, it may work,
but in general, it's bad practice.

On Mon, Apr 28, 2008 at 4:34 PM, Scott Swank <[EMAIL PROTECTED]> wrote:
> Yes, in the constructor.
>
>  - Scott
>
>
>
>  On Mon, Apr 28, 2008 at 11:12 AM, James Carman
>  <[EMAIL PROTECTED]> wrote:
>  > And, when does the base page do the adding?  In the constructor?
>  >
>  >
>  >
>  >  On Mon, Apr 28, 2008 at 1:38 PM, Scott Swank <[EMAIL PROTECTED]> wrote:
>  >  > 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  
> 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  
> in the
>  >  >  >  > base
>  >  >  >  > >  > >page?
>  >  >  >  > >  > >
>  >  >  >  > >  > >  Gr. Azzeddine
>  >  >  >  > >  > >
>  >  >  >  > >  >
>  >  >  >  > >  > 
> -
>  >  >  >  > >  > To uns

Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread Scott Swank
Yes, in the constructor.

- Scott

On Mon, Apr 28, 2008 at 11:12 AM, James Carman
<[EMAIL PROTECTED]> wrote:
> And, when does the base page do the adding?  In the constructor?
>
>
>
>  On Mon, Apr 28, 2008 at 1:38 PM, Scott Swank <[EMAIL PROTECTED]> wrote:
>  > 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  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  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]
>  >
>  >
>
>

Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread James Carman
And, when does the base page do the adding?  In the constructor?

On Mon, Apr 28, 2008 at 1:38 PM, Scott Swank <[EMAIL PROTECTED]> wrote:
> 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  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  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]
>
>

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



Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread Scott Swank
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  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  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]



Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread Cristi Manole
To answer your second point :
->NO, at this point you cannot define multiple  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  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]
>
>


Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread Martin Makundi
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  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]



Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread Azzeddine Daddah
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  in the base
> >page?
> >
> >  Gr. Azzeddine
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Azzeddine Daddah
www.hbiloo.com


Re: What is the best way to create layouts in Wicket?

2008-04-28 Thread Martin Makundi
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  in the base
>page?
>
>  Gr. Azzeddine
>

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