Thanks for that, Marco!

Regards,

Pierre



On Fri, Apr 12, 2013 at 8:35 AM, Marco Springer <ma...@glitchbox.nl> wrote:

> Hello Pierre,
>
> You can also just override/extend the onComponentTag function from the
> Component.:
>
> Component {
>   @Override
>   protected void onComponentTag(ComponentTag tag) {
>     super.onComponentTag(tag);
>     tag.put("attribute", "value")
>   }
> }
>
> As far as I can see, SimpleAttributeModifier doesn't exist anymore, just
> use
> the "AttributeModifier" class or sub-class that if you really need to.
>
> Or attach a custom Behavior to the component which can also override the
> onComponentTag function like so:
> public class FeedbackFieldDecorator extends Behavior {
>   @Override
>   public void onComponentTag(Component component, ComponentTag tag) {
>     if (!((FormComponent<?>)component).isValid()) {
>       String cl = tag.getAttribute("class");
>       if (cl == null) {
>         tag.put("class", "error");
>       } else {
>         tag.put("class", "error " + cl);
>       }
>     }
>   }
> }
>
> Cheers,
> Marco
>
> On Thursday 11 April 2013 21:50:28 Pierre Goupil wrote:
> > Good evening,
> >
> > I have a Wicket 1.4 code that I want to migrate to 6.0. It all works fine
> > except for this code in a sub-class of SimpleAttributeModifier:
> >
> >   @Override
> >   public void onComponentTag(final Component component, final
> ComponentTag
> > tag) {
> >     System.out.println("ononComponentTag called. component="+component+",
> > tag="+tag);
> >     if (isEnabled(component)) {
> >       System.out.println("changing attribute, value="+value);
> >       tag.getAttributes().put(attribute, value);
> >     }
> >   }
> >
> > I don't know what this code is supposed to do, so does anyone know with
> > what to replace it? AttributeModifier#onComponentTag() is final in 6.0!
> >
> > Any help is much appreciated.
> >
> > Regards,
> >
> > Pierre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
"Parce que c'est la nuit qu'il est beau de croire à la lumière."

Edmond Rostand

Reply via email to