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