You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jurjan <ju...@gmail.com> on 2007/10/31 11:08:07 UTC

Dynamically Change css style of body tag

Hi,

I'm trying to dynamically change the CSS class of the body tag depending on
the context.

      ....
      <body class="detailpage theme01">
      ....


In my page class I'm using the BodyTagAttributeModifier to implement this
behavior, but this is not currect. Obviously I'm mising something, but what?
     

       final Theme theme = outing.getMainTheme();
       
       add(new BodyTagAttributeModifier("class", true, new
AbstractReadOnlyModel(){

           @Override
           public Object getObject() {
               return theme.getDisplaystyle();
           }
       }, this));

Thanks in advance, Jurjan
-- 
View this message in context: http://www.nabble.com/Dynamically-Change-css-style-of-body-tag-tf4723877.html#a13505908
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Tabbed panels

Posted by Igor Vaynberg <ig...@gmail.com>.
On 10/31/07, Alexander Landsnes Keül <Al...@visma.no> wrote:
>
> I have two questions regarding tabbed panels. I've read the example, so I've been able to create a navigation with it but it's a bit limited.
>
> First thing, is it possible to nest tabbed panels? I tried to do so, but then all the wickets in the panels stopped working. Way I set it up was create a TabbedPanel where the different tabs referred to new TabbedPanels. Not really sure if this is doable, but if so how would I go about it, and is it possible to change the CSS style for the two tab panels?

yes it is possible, but i dont think it will help much returning a
tabbedpanel as the tab directly. instead return a panel that contains
a tabbedpanel inside. this is also how you would style the inner panel
differently, by wrapping it in a div tag with a class eg

<div class="tab1"><div wicket:id="tabs"/></div>

and style your panel like:

tab1 ul.first-tab {...} ....

>
> Second thing, I tried to make a helper class for adding tabs to a Tabbed Panel. It works fine, except for the getPanel() overloading. I tried to do it as follows:
>
>         public void addTab( final String label, final Panel tabPanel ) {
>                 tabs.add( new AbstractTab( new Model( label ))
>                 {
>                         private static final long serialVersionUID = 1L;
>                         public Panel getPanel( String panelID )
>                         {
>                                 return tabpanel;
>                         }
>                 });
>         }
>
> Simply changing it to "return new PersondataPanel( panelID );" works, but this would mean creating one addTab(..) for each possible panel. Is there an elegant way of solving this?

what you are doing is creating panels for tabs eagerly during
construction time, which isnt the best way to go about it. the whole
idea of having getpanel abstract in abstracttab is that it gives you
the hint that panels should be created lazily inside the callback.

-igor



>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Tabbed panels

Posted by Alexander Landsnes Keül <Al...@visma.no>.
I have two questions regarding tabbed panels. I've read the example, so I've been able to create a navigation with it but it's a bit limited.

First thing, is it possible to nest tabbed panels? I tried to do so, but then all the wickets in the panels stopped working. Way I set it up was create a TabbedPanel where the different tabs referred to new TabbedPanels. Not really sure if this is doable, but if so how would I go about it, and is it possible to change the CSS style for the two tab panels?

Second thing, I tried to make a helper class for adding tabs to a Tabbed Panel. It works fine, except for the getPanel() overloading. I tried to do it as follows:

	public void addTab( final String label, final Panel tabPanel ) {
		tabs.add( new AbstractTab( new Model( label )) 
		{
			private static final long serialVersionUID = 1L;
			public Panel getPanel( String panelID )
			{
				return tabpanel;
			}
		});
	}

Simply changing it to "return new PersondataPanel( panelID );" works, but this would mean creating one addTab(..) for each possible panel. Is there an elegant way of solving this?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dynamically Change css style of body tag

Posted by Jurjan <ju...@gmail.com>.
Tnx! Igor, it works!

Jurjan



igor.vaynberg wrote:
> 
> hava you tried this?
> 
> <body wicket:id="foo">...
> 
> 
> add(new webmarkupcontainer("body") { boolean istransparentresolver() {
> return true; } oncomponenttag(tag) { tag.put("class","green"); });
> 
> -igor
> 
> 
> On 10/31/07, Jurjan <ju...@gmail.com> wrote:
>>
>> Hi,
>>
>> I'm trying to dynamically change the CSS class of the body tag depending
>> on
>> the context.
>>
>>       ....
>>       <body class="detailpage theme01">
>>       ....
>>
>>
>> In my page class I'm using the BodyTagAttributeModifier to implement this
>> behavior, but this is not currect. Obviously I'm mising something, but
>> what?
>>
>>
>>        final Theme theme = outing.getMainTheme();
>>
>>        add(new BodyTagAttributeModifier("class", true, new
>> AbstractReadOnlyModel(){
>>
>>            @Override
>>            public Object getObject() {
>>                return theme.getDisplaystyle();
>>            }
>>        }, this));
>>
>> Thanks in advance, Jurjan
>> --
>> View this message in context:
>> http://www.nabble.com/Dynamically-Change-css-style-of-body-tag-tf4723877.html#a13505908
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamically-Change-css-style-of-body-tag-tf4723877.html#a13516764
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dynamically Change css style of body tag

Posted by Igor Vaynberg <ig...@gmail.com>.
hava you tried this?

<body wicket:id="foo">...


add(new webmarkupcontainer("body") { boolean istransparentresolver() {
return true; } oncomponenttag(tag) { tag.put("class","green"); });

-igor


On 10/31/07, Jurjan <ju...@gmail.com> wrote:
>
> Hi,
>
> I'm trying to dynamically change the CSS class of the body tag depending on
> the context.
>
>       ....
>       <body class="detailpage theme01">
>       ....
>
>
> In my page class I'm using the BodyTagAttributeModifier to implement this
> behavior, but this is not currect. Obviously I'm mising something, but what?
>
>
>        final Theme theme = outing.getMainTheme();
>
>        add(new BodyTagAttributeModifier("class", true, new
> AbstractReadOnlyModel(){
>
>            @Override
>            public Object getObject() {
>                return theme.getDisplaystyle();
>            }
>        }, this));
>
> Thanks in advance, Jurjan
> --
> View this message in context: http://www.nabble.com/Dynamically-Change-css-style-of-body-tag-tf4723877.html#a13505908
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org