I've used XsltTransformerBehavior on the containing Panel for such things. Behaviors (possibly added by a IComponentInstantiationListener) could 'transform' the tag too.
Sven Steve Lowery <[email protected]> schrieb: >We have forms throughout our application that can be toggled from read-only >to editable. The wicket framework will disable the form components which >is great, but we'd rather have it display just the texts in a label. We >can subclass TextField, TextArea, DropDownChoice, etc and override the >onComponentTag() and onComponentTagBody() methods where applicable, but was >wondering if anyone had a more elegant solution or wicket had something out >of the box that would turn FormComponents into Labels. > >Here's example for a TextField we could do by subclassing TextField and >overriding onComponentTag: > >@Override >protected void onComponentTag(ComponentTag tag) { >if (!isEnabledInHierarchy()) { >tag.setName("span"); >tag.remove("type"); >tag.remove("disabled"); >tag.remove("name"); >tag.remove("value"); >tag.setType(XmlTag.TagType.OPEN); >} >}
