[Wicket-user] Setting the style class of a component?
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 ? if (Math.random() 0.5) label1.setStyleClass(SomeClass); else label1.setStyleClass(AnotherClass); // ??? } } I want it to render as either: html body span class=SomeClasssome text/span /body /html or: html body span class=AnotherClasssome text/span /body /html Can anyone help? Thanks in advance. And thanks for a good looking web framework. -- Christian --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Setting the style class of a component?
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 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 ? if (Math.random() 0.5) label1.setStyleClass(SomeClass); else label1.setStyleClass(AnotherClass); // ??? } } I want it to render as either: html body span class=SomeClasssome text/span /body /html or: html body span class=AnotherClasssome text/span /body /html Can anyone help? Thanks in advance. And thanks for a good looking web framework. -- Christian --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Living a wicket life... Martijn Dashorst - http://www.jroller.com/page/dashorst Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1 --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid3432bid#0486dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Setting the style class of a component?
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 2/19/06, Christian Hvid [EMAIL PROTECTED] wrote: 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 ? if (Math.random() 0.5) label1.setStyleClass(SomeClass); else label1.setStyleClass(AnotherClass); // ??? } } I want it to render as either: html body span class=SomeClasssome text/span /body /html or: html body span class=AnotherClasssome text/span /body /html Can anyone help? Thanks in advance. And thanks for a good looking web framework. -- Christian --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel? cmd=lnkkid=103432bid=230486dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Living a wicket life... Martijn Dashorst - http://www.jroller.com/page/dashorst Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1 --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid3432bid#0486dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid3432bid#0486dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Setting the style class of a component?
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 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 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 ? if (Math.random() 0.5) label1.setStyleClass(SomeClass); else label1.setStyleClass(AnotherClass); // ??? } } I want it to render as either: html body span class=SomeClasssome text/span /body /html or: html body span class=AnotherClasssome text/span /body /html Can anyone help? Thanks in advance. And thanks for a good looking web framework. -- Christian --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel? cmd=lnkkid=103432bid=230486dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Living a wicket life... Martijn Dashorst - http://www.jroller.com/page/dashorst Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1 --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid3432bid#0486dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmdlnkkid3432bid#0486dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Living a wicket life... Martijn Dashorst - http://www.jroller.com/page/dashorst Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1 --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid3432bid#0486dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user