quote: "To keep the models of the nested components and the top component synchronized, we need to override two methods: onBeforeRender, which prepares for rendering,
and convertInput, which handles receiving input."

So your code would become something like this:

public class LimitedTextArea extends FormComponentPanel implements
IHeaderContributor {
*private String text;
private TextArea textField;
*    public LimitedTextArea(String id, IModel model, int limit) {
       super(id, model);
*       PropertyModel textModel = new PropertyModel(this, "text");*
       *textField *= new TextArea("content", *textModel*);
       add(textField);
       ...
   }

*...@override   
public void onBeforeRender() {
        text = (String) getModelObject();
        super.onBeforeRender();
}

@Override
public void convertInput() {
        String text = (String) textField.getConvertedInput();
        setConvertedInput(text);
}

*}


Mind you, I'm a newbie too, so this is what I got from the book. (And for your example I haven't checked if it works.)

Linda

triswork wrote:
Hi Stefan

You have completely lost me on this one. All I want to do is have my TextArea (contained within my
FormComponentPanel) to render properly without sticking arbitrary bits of
markup inside itself.
That markup you have quoted is being generated by Wicket - not by me :(


Stefan Lindner wrote:
<textarea id="content" name="tabs:panel:form:content:text">
</textarea>

Should do it


Linda,

I don't have that book unfortunately. The javadocs do mention those two
methods, but it seems targeted at compound components. Mine is pretty
simple. I just want to decorate my textarea with some text and some
Javascript...


Linda van der Pal wrote:
I found it in the book Wicket in Action.


------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.278 / Virus Database: 270.11.29/2023 - Release Date: 03/25/09 18:54:00


Reply via email to