in 1.5 i want to have a detach listener that will automatically detach any idetachable fields of a component. if you have references to components (as you often do in formcomponetnpanel) and component itself is idetachable we will have a problem - either detach all idetachable fields or only those that are not also components, etc, etc.
while i agree that it is a little weird at first glance that component does not implement idetachable because it has a detach() i would also say that idetachable behavior is implemented by the components and so they themselves do not need to implement it directly. -igor On Wed, May 6, 2009 at 6:18 AM, Matej Knopp <matej.kn...@gmail.com> wrote: > The codebase assumes that during detach parent component detaches it's > children. But say if child references some of it parent components in > model and model is detached, model detaches the parent component > (because it's instanceof IDetachable) which is situation that current > code is not capable of handling. Because it doesn't really make sense. > > Component detaching is done on couple of places and has certain rules > - components are detached from parents to children. If you make > component idetachable this would break the rules with components being > detached in random order and it could even result in stack overflow. > > -Matej > > On Wed, May 6, 2009 at 3:10 PM, Martijn Dashorst > <martijn.dasho...@gmail.com> wrote: >> I fail to see how it would make detach logic complicated by marking >> Component properly as IDetachable. Care to elaborate? >> >> Martijn >> >> On Wed, May 6, 2009 at 3:05 PM, Matej Knopp <matej.kn...@gmail.com> wrote: >>> What problem exactly would this solve? Detaching logic is not exactly >>> trivial and I fail to see any benefit in complicating it with >>> Component itself being detachable. >>> >>> -Matej >>> >>> On Wed, May 6, 2009 at 2:19 PM, Martijn Dashorst >>> <martijn.dasho...@gmail.com> wrote: >>>> It is also trivial to implement a stop for endless recursion. Still >>>> fail to see the problem. >>>> >>>> Martijn >>>> >>>> On Wed, May 6, 2009 at 2:10 PM, Frank van Lankvelt >>>> <f.vanlankv...@onehippo.com> wrote: >>>>> could it be so that you can use a Component as a model object? E.g. in a >>>>> Model or CompoundPropertyModel? >>>>> A detachable Component would trivially lead to recursion in this case. >>>>> >>>>> cheers, Frank >>>>> >>>>> On Wed, May 6, 2009 at 12:28 PM, Martijn Dashorst < >>>>> martijn.dasho...@gmail.com> wrote: >>>>> >>>>>> I always assumed that Component implements IDetachable but today found >>>>>> out that it doesn't. >>>>>> >>>>>> A Component clearly is detachable, it has a detach() method. Is there >>>>>> some reason why Component shouldn't implement IDetachable? >>>>>> >>>>>> Martijn >>>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> 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. >>>> >>> >> >> >> >> -- >> 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. >> >