2005/7/16, Nick Heudecker <[EMAIL PROTECTED]>:

> Let's say I have a String that I want to be colored green if it equals
> "ACTIVE" or red if it equals "CANCELLED".  The change would just be a
> different CSS style.  Is there a common method to do this with Wicket?

My suggestion would be

 add(new Label("message", "Hello World!") {
   @Override
   protected void onComponentTag(ComponentTag tag) {
     String value = tag.getString("class");
     tag.put("class", (value == null ? "" : value + " ") + "ACTIVE");
     super.onComponentTag(tag);
   }
 });

It would be nice, if adding something to the class attribute could
become some API method of ComponentTag. Something like,
get/set/add/removeClassAttribute().

-- 
Stefan Matthias Aust // Truth until paradox


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to