Hello Matt,

It does not work as I cannot override add method from webmarkupcontainer.

Even if it works I will have to add something to the htlm. Right?


Tnx again

Matt Brictson <m...@55minutes.com> wrote:

>Since isTransparentResolver() is going away in 1.5, the trick that I found is 
>to create a normal WebMarkupContainer for the <body> element, then override 
>add(Component...) of the page to mimic the transparent resolver feature.
>
>Your pages can then contribute to the <body> element by adding 
>AttributeModifier, etc. to the WebMarkupContainer.
>
>See:
><https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-MarkupContainer.isTransparentResolver%2528%2529removed>
>
>Here's an example:
>
>public abstract class BasePage extends WebPage
>{
>    private WebMarkupContainer _body;
>    
>    public BasePage(PageParameters params)
>    {
>        super(params);
>        
>        // Allow subclasses to register CSS classes on the body tag
>        WebMarkupContainer body = new WebMarkupContainer("body");
>        body.setOutputMarkupId(true);
>        add(body);
>        
>        // From now on add() will add to _body instead of page
>        this._body = body;
>    }
>    
>    /**
>     * Return a component that represents the {@code <body>} of the page.
>     * Use this to add CSS classes or set the markup ID for styling purposes.
>     */
>    public WebMarkupContainer getBody()
>    {
>        return _body;
>    }
>
>    /**
>     * When subclasses of BasePage add components to the page, in reality
>     * they need to be added as children of the {@code <body>} container.
>     * This implementation ensures the page hierarchy is correctly enforced.
>     * 
>     * @return {@code this} to allow chaining
>     */
>    @Override
>    public BasePage add(Component... childs)
>    {
>        for(Component c : childs)
>        {
>            // Wicket automatically translates <head> into an
>            // HtmlHeaderContainer and adds it to the page. Make sure this
>            // is registered as a direct child of the page itself, not the
>            // body.
>            if(null == _body || c instanceof HtmlHeaderContainer)
>            {
>                super.add(c);
>            }
>            // Everything else goes into the <body>.
>            else
>            {
>                _body.add(c);
>            }
>        }
>        return this;
>    }
>}
>
>-- 
>Matt
>
>On Mar 2, 2011, at 11:35 AM, Gonzalo Aguilar Delgado wrote:
>
>> Hello, 
>> 
>> I'm building a wiJQuery equivalent for Dojo. And it seems to work nice
>> with new wicket 1.5. HeaderContributions are really nice... Great work!
>> 
>> But I ran into problems when trying to setup the themes. 
>> 
>> I have to put something like this in the body:
>> 
>> <body class="claro">
>> 
>> </body>
>> 
>> But I rode a lot and discovered that wicket no longer supports
>> contributing to body because onLoad handler as well others.
>> 
>> Reading in forums I found the BodyTagAttributeModifier but you need a
>> panel that I wont have.
>> 
>> And the:
>> 
>> <body wicket:id="body"> 
>> 
>>        add(new WebMarkupContainer("body"){
>>            @Override
>>            public boolean isTransparentResolver() {
>>                return true;
>>            }
>>            @Override
>>            protected void onComponentTag(ComponentTag tag) {
>>                tag.put("class",  "somestyle");
>>            }
>>        }); 
>> It will not work because wicket:id attribute removed from body in version 
>> 1.5.
>> 
>> 
>> So... What's they way to go?
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
>

Reply via email to