Thanks for that, Marco! Regards,
Pierre On Fri, Apr 12, 2013 at 8:35 AM, Marco Springer <[email protected]> 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: [email protected] > For additional commands, e-mail: [email protected] > > -- "Parce que c'est la nuit qu'il est beau de croire à la lumière." Edmond Rostand
