I am implementing the Wicket IBehavior interface and want my behavior change the body of a component (or somehow update the model) from the onComponentTag method. Is there a way to do this?
@Override
public void onComponentTag(final Component component, final ComponentTag tag)
{
String myValue = tag.getAttribute("myAttribute");
// TODO: Based on the value of this attribute, update the body/model of the component
super.onComponentTag(component, tag);
}
Edit: I would like to grab an attribute from the html which specifies the maximum number of allowed characters for the element and then programmatically truncate the body of the element if needed.
Example:
<span wicket:id="myLabel" maxChars="10">The body of my tag</span>
would be replaced with:
<span wicket:id="myLabel" maxChars="10">The bod...</span>