I'm doing just right like you described. Probably I have to pay more
attention to your comment about improper use of models. isVisible method
should rely only on the component model. I some cases it is easier to
delegate some calls to aggregated components. But instead I have to work
with component own model itself.


Jeremy Thomerson-5 wrote:
> 
> expose multiple overridable methods that provide the components... i.e.:
> 
> // I don't have my IDE open, so some method names may be wrong
> ParentComponent  {
> 
>   public void onBeforeRender {
>     if (!hasBeenRendered()) {
>       add(createLeftNavPanel(getModel()));
>       add(createContentPanel(getModel()));
>       add(createTopHeaderPanel(getModel()));
>     }
> 
>     protected Component createContentPanel(IModel model) {
>       // this can be overridden in subclasses
>       return MyDefaultTypeOfContentPanel(model);
>     }
> }
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> 
> On Fri, May 15, 2009 at 12:54 AM, Vladimir K <koval...@gmail.com> wrote:
>>
>> Jeremy,
>>
>> I can't add another example to mentioned RepeatingView.
>> Concerning RepeatingView... Wicket allow me just one point to subclass
>> parent component markup within <wicket:child/> tag. RepeatingView comes
>> in
>> handy. It allows me to reserve some places in base component markup and
>> put
>> something there in subclasssing component markup. I saw examples of that
>> in
>> some projects when studying Wicket. So I just copy the idea without
>> thinking
>> about WHEN to call the overridden method that fills in the RepeatingView
>> instance. It is my fault :)
>>
>> If you add "name" attribute to wicket:child tag, and multiple
>> <wicket:extend
>> name="..."> tags I would use it instead of RepeatingView.
>>
>> Concerning your post on onBeforeRender ... I didn't say that it is
>> related
>> to class' constructor. Yes it is related to delayed component creation.
>> And
>> the reason why I delay creation is to follow mentioned rule. It is not
>> related to use of models in my case. I delay creation to allow
>> subclassing
>> components to replace some default parts of base component. Probably I'm
>> doing something wrong. Then suggest me how to do it right. For instance I
>> would like to subclass NatigationToolbar in DefaultDataTable. What should
>> I
>> do?
>>
>>
>> Jeremy Thomerson-5 wrote:
>>>
>>> Do you have any examples of where Wicket calls an overridable method
>>> from the constructor of a Wicket class?  If so, please file it as a
>>> JIRA - that would be a bug.
>>>
>>> Most java programmers know not to call overridable methods from the
>>> constructor as a general rule, although there are times when it could
>>> inadvertantly happen - which is why we need bug reports if you see
>>> that happening.
>>>
>>> --
>>> Jeremy Thomerson
>>> http://www.wickettraining.com
>>>
>>>
>>>
>>>
>>> On Fri, May 15, 2009 at 12:01 AM, Vladimir K <koval...@gmail.com> wrote:
>>>>
>>>> Martijn,
>>>>
>>>> here Java is not safe as a language. Yo're able to invoke overrided
>>>> methods
>>>> on non-completely constructed objects.
>>>>
>>>> from my perspective it is a regular case in Wicket:
>>>>
>>>> class SampleComponent extends ... {
>>>>    String parameter;
>>>>
>>>>    SampleComponent(String id, String parameter) {
>>>>        super(id);
>>>>        this.parameter = parameter;
>>>>    }
>>>>
>>>>    // method is called from within superconstructor
>>>>   �...@override
>>>>    void createAdditionalComponents(RepeatingView rv) {
>>>>        useSomehow(parameter);
>>>>    }
>>>> }
>>>>
>>>> I know two approaches to work around:
>>>> - onBeforeRender
>>>> - a closure as a constructor formal parameter.
>>>>
>>>> But the latter does not help with built-in components.
>>>>
>>>> If Wicket does not help us with adding appropriate method for
>>>> second-step-initialization it should document it in wiki, javadoc and
>>>> books
>>>> "dear user, when overriding methods, beware using of yet unassigned
>>>> constructor parameters". Hmm ... sounds stupid :)
>>>>
>>>>
>>>> Martijn Dashorst wrote:
>>>>>
>>>>> This has been discussed till death previously and we have excluded it
>>>>> from our roadmap. We will never have an init() method for components.
>>>>> Gossling gave us a Constructor to initialize your Objects.
>>>>>
>>>>> Search and read the archives if you want more information on the
>>>>> subject.
>>>>>
>>>>> Martijn
>>>>>
>>>>> On Fri, May 15, 2009 at 12:36 AM, Juan G. Arias <juangar...@gmail.com>
>>>>> wrote:
>>>>>> It would be very nice to add a new phase for component creation, like
>>>>>> I
>>>>>> said, an init() or createContent().
>>>>>> Is there a JIRA issue for that?
>>>>>> If yes, I will vote for it and suggest to change the name to
>>>>>> something
>>>>>> _not_
>>>>>> related to the rendre phase.
>>>>>>
>>>>>> Thanks!
>>>>>> Juan
>>>>>>
>>>>>>
>>>>>> On Thu, May 14, 2009 at 3:31 PM, Daniel Stoch
>>>>>> <daniel.st...@gmail.com>wrote:
>>>>>>
>>>>>>> I think you can use hasBeenRendered() method instead of custom
>>>>>>> boolean
>>>>>>> flag.
>>>>>>>
>>>>>>> --
>>>>>>> Daniel
>>>>>>>
>>>>>>> On 2009-05-14, at 20:15, Jeremy Thomerson wrote:
>>>>>>>
>>>>>>>  You could probably do it in onBeforeRender - but you would need to
>>>>>>>> keep a boolean flag to check if it's the first render so that you
>>>>>>>> don't recreate them on a second render....  There was talking of
>>>>>>>> adding an onBeforeFirstRender method, but I don't think it's
>>>>>>>> happened
>>>>>>>> yet - you could look for the method to see if I'm wrong.
>>>>>>>>
>>>>>>>> --
>>>>>>>> Jeremy Thomerson
>>>>>>>> http://www.wickettraining.com
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>>>> Apache Wicket 1.3.5 is released
>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Component-creation-and-initialization-tp23545666p23553458.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Component-creation-and-initialization-tp23545666p23553847.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Component-creation-and-initialization-tp23545666p23554210.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to