You can override the Component#onComponentTag or AbstractBehavior#onComponentTag method and use the ComponentTag API to deal with the tag attributes.
On Mon, Jan 31, 2011 at 9:07 AM, Patrick Petermair < patrick.peterm...@openforce.com> wrote: > Hi! > > I was trying to solve the problem of replacing a specific css class of a > wicket component with another css class. Google pointed me to the following > thread: > > > http://apache-wicket.1842946.n4.nabble.com/How-to-add-and-remove-css-classes-the-right-way-td1868408.html > > The nice and simple solution was something like this: > > String oldCss = String.valueOf(this.getMarkupAttributes().get("class")); > String newCss = oldCss.replaceFirst("old", "new"); > new SimpleAttributeModifier("class", newCss); > > I've used it and it works just fine. > Unfortunately - as I've just found out - the method getMarkupAttributes() > has the following javadoc: > > "THIS IS WICKET INTERNAL ONLY. DO NOT USE IT." > > If I'm not supposed to use getMarkupAttributes(), what would be the correct > way then to get the current css classes of a wicket component? > > Cheers, > Patrick > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Pedro Henrique Oliveira dos Santos