I think that fix should be fine
The thing i have is why does Page.componentAdded() really call initialize again
Will that not happen anyway?

Also now i do see a but of weird initializing when you see the order..
In MarkupContainer.addedComponent:

                if (page != null)
                {
                        component.initialize();
                }

                if (page != null)
                {
                        page.componentAdded(component);
                }


so first we call component initialize. then page.componentAdded that
will call initialize on the page.
But isnt that a bit the wrong way around?

If you are in the constructor of a page and you add a component.
Then i think the component is called initialized on and
page.componentAdded will then call initialize on itself
But then the component is called initialized first before the page is
initialized
AND we are still in the constructor of the page so initialize is
suddenly called on a page that is still constructing?
(i have to test this a bit, just looking at the code quickly)

i think we should have some logic that as long as the page is not
initialized, component shouldnt also be initialized.
And for a page the same thing as for a component should happen, only
after construction the initialize is called.

johan


On Sat, Jul 24, 2010 at 11:05, Martin Grigorov <mgrigo...@apache.org> wrote:
> +1 for vote in users@
>
> I just found a problem while creating new wicket-example for the new request
> mappers:
>
> java.lang.StackOverflowError
>  at
> org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:978)
>     at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:168)
>     at
> org.apache.wicket.examples.WicketExamplePage.onInitialize(WicketExamplePage.java:67)
>     at org.apache.wicket.Component.initialize(Component.java:970)
>     at
> org.apache.wicket.MarkupContainer.initialize(MarkupContainer.java:992)
>     at org.apache.wicket.Page.componentAdded(Page.java:1130)
>     at
> org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:978)
>     at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:168)
>     at
> org.apache.wicket.examples.WicketExamplePage.onInitialize(WicketExamplePage.java:67)
>     at org.apache.wicket.Component.initialize(Component.java:970)
>     at
> org.apache.wicket.MarkupContainer.initialize(MarkupContainer.java:992)
>     at org.apache.wicket.Page.componentAdded(Page.java:1130)
>     at
> org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:978)
>     at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:168)
>     at
> org.apache.wicket.examples.WicketExamplePage.onInitialize(WicketExamplePage.java:67)
>     at org.apache.wicket.Component.initialize(Component.java:970)
>     at
> org.apache.wicket.MarkupContainer.initialize(MarkupContainer.java:992)
>     at org.apache.wicket.Page.componentAdded(Page.java:1130)
>     at
> org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:978)
>     at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:168)
>     at
> org.apache.wicket.examples.WicketExamplePage.onInitialize(WicketExamplePage.java:67)
>     at org.apache.wicket.Component.initialize(Component.java:970)
>     at
> org.apache.wicket.MarkupContainer.initialize(MarkupContainer.java:992)
>     at org.apache.wicket.Page.componentAdded(Page.java:1130)
>     at
> org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:978)
>     at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:168)
>     at
> org.apache.wicket.examples.WicketExamplePage.onInitialize(WicketExamplePage.java:67)
>     at org.apache.wicket.Component.initialize(Component.java:970)
> ....
>
> In 
> org.apache.wicket.examples.WicketExamplePage.onInitialize(WicketExamplePage.java:67)
> I have "add(header)".
>
> My fix looks is:
> Index: wicket/src/main/java/org/apache/wicket/Component.java
> ===================================================================
> --- wicket/src/main/java/org/apache/wicket/Component.java (revision 978819)
> +++ wicket/src/main/java/org/apache/wicket/Component.java (working copy)
> @@ -967,8 +967,8 @@
>  {
>  if (!getFlag(FLAG_INITIALIZED))
>  {
> + setFlag(FLAG_INITIALIZED, true);
>  onInitialize();
> - setFlag(FLAG_INITIALIZED, true);
>  }
>  }
>
> Is this ok ?
>
> On Fri, Jul 23, 2010 at 5:45 PM, Igor Vaynberg <igor.vaynb...@gmail.com>wrote:
>
>> since this has turned into more of a vote should we take it to the
>> user list so we get a wider range of responses?
>>
>> -igor
>>
>> On Fri, Jul 23, 2010 at 1:50 AM, Martijn Dashorst
>> <martijn.dasho...@gmail.com> wrote:
>> > +1 for Johan's changes to make the surface area of the change smaller.
>> >
>> > I didn't find onInitialize and onConfigure in our code base as well.
>> >
>> > The benefits are evident. So that is +0 from me to keep them in.
>> > Pushing them to only 1.5 ensures we get enough folks trying 1.5 though
>> > :)
>> >
>> > Martijn
>> >
>> > On Fri, Jul 23, 2010 at 10:38 AM, Johan Compagner <jcompag...@gmail.com>
>> wrote:
>> >> we (servoy) dont care much about those changes, they can be left in
>> >> (we dont use it and they also dont give us a problem (after my fix ;)
>> >> )
>> >>
>> >>
>> >> the only problem is by the way onInitialize and onConfigure()
>> >>
>> >> Because initialize and also doInitialize() are package scope so they
>> >> are not a problem as far as i know... for example doinitialize() is
>> >> final but a subclass of component in another package can just create
>> >> such a method just fine...
>> >>
>> >> configure() you made public final.. i think we just should do the
>> >> same, make it package scope final...
>> >> then that method shouldnt also be a big problem.
>> >>
>> >> The it is just the 2 overridable protected methods onInitialize and
>> onConfigure
>> >>
>> >> johan
>> >>
>> >>
>> >> On Thu, Jul 22, 2010 at 19:33, Igor Vaynberg <igor.vaynb...@gmail.com>
>> wrote:
>> >>> i just thought of something, i added oninitialize and onconfigure
>> >>> features to 1.4.x as well as trunk, but they can create an
>> >>> incompatibility for 1.4.x users if they have declared a method on
>> >>> their components with the same name.
>> >>>
>> >>> impacted method names are component#configure(), onConfigure(),
>> >>> initialize(), onInitialize().
>> >>>
>> >>> should we remove these features from 1.4.x to remove the chance of an
>> >>> incompatibility?
>> >>>
>> >>> -igor
>> >>>
>> >>
>> >
>> >
>> >
>> > --
>> > Become a Wicket expert, learn from the best: http://wicketinaction.com
>> > Apache Wicket 1.4 increases type safety for web applications
>> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.8
>> >
>>
>

Reply via email to