You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (Resolved) (JIRA)" <ji...@apache.org> on 2012/01/31 17:11:11 UTC

[jira] [Resolved] (WICKET-4361) Markup Inheritance & getVariation(): markup loading (and merging) order depends on whether the super constructor adds components or not.

     [ https://issues.apache.org/jira/browse/WICKET-4361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4361.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 6.0.0
                   1.5.5
         Assignee: Martin Grigorov

Moved the calls of #internalOnMarkupAttached() in Component#onInitialize().
This way #onMarkupAttached() is called a bit later than now but it fixes the problem with early the load of the markup and also saves some CPU cycles by not iterating all children of the added component
                
> Markup Inheritance & getVariation(): markup loading (and merging) order depends on whether the super constructor adds components or not.
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4361
>                 URL: https://issues.apache.org/jira/browse/WICKET-4361
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.4
>            Reporter: Jerome Bodis
>            Assignee: Martin Grigorov
>              Labels: MarkupInheritance, getVariation, wicket
>             Fix For: 1.5.5, 6.0.0
>
>         Attachments: myproject2_1.4.19.zip, myproject_1.5.4.zip
>
>
> I have a web page 'ChildPage' that inherits (java/markup) from a 'SuperPage' ('ChildPage' --> 'SuperPage'). 'ChildPage' now needs to override getVariation() to return a variation string, for example "test". The variation string is preferably set in the ChildPages constructor, maybe by a PageParameter.
> I would expect the following markup: ChildPage_test.html merged with SuperPage.html. This is the case, when SuperPage has no component added in its constructor. But when SuperPage has a component added in constructor, then I get ChildPage.html merged with SuperPage.html.
> quickstart "myproject_1.5.4" (wicket 1.5.4) shows:
> ChildPage1 inherits from SuperPage1 (no component added)
> ChildPage2 inherits from SuperPage2 (label added)
> * Click on "load ChildPage1_test.html " -> markup ok: ChildPage1_test.html merged with SuperPage1.html 
> * Click on "load ChildPage2_test.html " -> markup not ok: ChildPage2.html merged with SuperPage2.html  :  expected ChildPage2_test.html merged with SuperPage2.html
> same with "myproject2_1.4.19" (wicket 1.4.19) works fine!
> At the moment I moved the logic into getVariation() with: return getPageParameters.get("variation").toString();
> This works and that's why I'm unsure if it is a bug at all.
> Here is some debugging output from MarkupCache:
> 1 : hildPage1 inherits from SuperPage1 (no component added)
> child constructor ------> Class=ChildPage1 variationString=test
> DEBUG - MarkupCache                - Load markup: cacheKey=com.mycompany.ChildPage1_test_en_US.html
> DEBUG - MarkupCache                - Loading markup from file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage1_test.html
> DEBUG - AbstractMarkupParser       - The markup file does not have a XML declaration prolog with 'encoding' attribute:file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage1_test.html. It is more save to use it. E.g. <?xml version="1.0" encoding="UTF-8" ?>
> DEBUG - WebAppClassLoader          - loaded class com.mycompany.ChildPage1 from sun.misc.Launcher$AppClassLoader@11b86e7
> DEBUG - MarkupCache                - Load markup: cacheKey=com.mycompany.SuperPage1_test_en_US.html
> DEBUG - MarkupCache                - Loading markup from file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/SuperPage1.html
> DEBUG - AbstractMarkupParser       - The markup file does not have a XML declaration prolog with 'encoding' attribute:file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/SuperPage1.html. It is more save to use it. E.g. <?xml version="1.0" encoding="UTF-8" ?>
> DEBUG - MergedMarkup               - Merge markup: derived markup: ChildPage1_test.html; base markup: SuperPage1.html
> DEBUG - WebAppClassLoader          - loaded class com.mycompany.SuperPage1 from sun.misc.Launcher$AppClassLoader@11b86e7
> DEBUG - MergedMarkup               - Merge markup: file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage1_test.html
> 2: ChildPage2 inherits from SuperPage2 (label added)
> DEBUG - MarkupCache                - Load markup: cacheKey=com.mycompany.ChildPage2_en_US.html
> DEBUG - MarkupCache                - Loading markup from file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage2.html
> DEBUG - AbstractMarkupParser       - The markup file does not have a XML declaration prolog with 'encoding' attribute:file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage2.html. It is more save to use it. E.g. <?xml version="1.0" encoding="UTF-8" ?>
> DEBUG - WebAppClassLoader          - loaded class com.mycompany.ChildPage2 from sun.misc.Launcher$AppClassLoader@11b86e7
> DEBUG - MarkupCache                - Load markup: cacheKey=com.mycompany.SuperPage2_en_US.html
> DEBUG - MarkupCache                - Loading markup from file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/SuperPage2.html
> DEBUG - AbstractMarkupParser       - The markup file does not have a XML declaration prolog with 'encoding' attribute:file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/SuperPage2.html. It is more save to use it. E.g. <?xml version="1.0" encoding="UTF-8" ?>
> DEBUG - MergedMarkup               - Merge markup: derived markup: ChildPage2.html; base markup: SuperPage2.html
> DEBUG - WebAppClassLoader          - loaded class com.mycompany.SuperPage2 from sun.misc.Launcher$AppClassLoader@11b86e7
> DEBUG - MergedMarkup               - Merge markup: file:/C:/testumgebung/eclipseWorkspace/myproject/target/classes/com/mycompany/ChildPage2.html
> ...
> child constructor ------> Class=ChildPage2 variationString=test

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira