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 <[email protected]> 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 <[email protected]> >> 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 >>> <[email protected]>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: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >> >> >> >> -- >> 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: [email protected] >> For additional commands, e-mail: [email protected] >> >> >> > > -- > 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: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
