[Wicket-user] Setting the style class of a component?

2006-02-19 Thread Christian Hvid
Hi wicket list. I am trying to set the class attribute of a wicket component: html body span wicket:id=label1.../span /body /html public class MyPage extends WebPage { private Label label1; public MyPage() { add(label1 = new Label(label1, some text)); // How do I do this v ?

Re: [Wicket-user] Setting the style class of a component?

2006-02-19 Thread Martijn Dashorst
Use an AttributeModifier for this: label1.add(new AttributeModifier(class, true, new Model() { Object getObject(Component comp) { return Math.random()0.5 ? SomeClass : AnotherClass; } }); Martijn On 2/19/06, Christian Hvid [EMAIL PROTECTED] wrote: Hi wicket list. I am trying

Re: [Wicket-user] Setting the style class of a component?

2006-02-19 Thread Christian Hvid
It works. Perfect. On 19 Feb 2006, at 14:51, Martijn Dashorst wrote: Use an AttributeModifier for this: label1.add(new AttributeModifier(class, true, new Model() { Object getObject(Component comp) { return Math.random()0.5 ? SomeClass : AnotherClass; } }); Martijn On

Re: [Wicket-user] Setting the style class of a component?

2006-02-19 Thread Martijn Dashorst
Thanks, I'm putting it in the book as well :-). I was busy writing and this struck a bit of inspiration... Martijn On 2/19/06, Christian Hvid [EMAIL PROTECTED] wrote: It works. Perfect. On 19 Feb 2006, at 14:51, Martijn Dashorst wrote: Use an AttributeModifier for this: label1.add(new