You can do it in either but since its best to separate the display from the logic, keep it in the HTML. Exception is if you need to dynamically change the class etc.

HTML:

<div class="someCSS" wicket:id="someComponent">
stuff
</div>


Java:

look at AttributeAppender
AttributeModifier that appends the given value, rather than replace it. This is especially useful for adding CSS classes to markup elements, or adding JavaScript snippets to existing element handlers.

<a href="#" wicket:id="foo" class="link" onmouseover="doSomething()">

can be modified with these AttributeAppenders:
 link.add(new AttributeAppender("class", new Model("hot"), " "));
link.add(new AttributeAppender("onmouseover", new Model("foo();return false;"), ";"));

this will result in the following markup:
<a href="#" wicket:id="foo" class="link hot" onmouseover="doSomething();foo();return false;">



cheers,
Steve






On 23 Dec 2008, at 14:54, walnutmon wrote:


I have found very little in my wicket books, and on this forum in terms of adding styles to components through java. Is this because it's outside of
the scope of wicket?

As an example. If I have a panel, and I want all of those panels to have a style class "someComponentClass", is it better to keep that information in
the HTML?  Or can I assign that behavior through the .java code?

Also, as an aside, where can I find wicket jars for the 1.3.5 release with javadocs contained so that I can see the javadocs from netbeans? I have had
a heck of a time without them.

best,
justin
--
View this message in context: 
http://www.nabble.com/Applying-Styles-Through-Java-tp21145758p21145758.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to