MouseClick listener on TextArea?

I have a TextArea field on an input form, but it is too small given the nature of input forms. So I want to give the user a friendlier option:

1 Display prompt in a TextArea box, directing the user to click the area to view or edit data.
2.On click, popup a RichTextArea (modal) window for the user to view or edit data.

In all the RIA Frameworks that I know, there is something like a ‘MouseEvent lsitener’ that any input component can listen to. I am having trouble finding one in Vaadin.

In the absent of an appropriate listener, I could use a Button but it is not a good idea from a good ui design perspectives. Any suggestion would be appreciated.

Thanks

FocusListener might be a better option for that, so that users without a mouse can still enter data. A mouse only solution at least is somewhat limited.

There isn’t a ClickListener in TextFields/TextAreas, instead you can add click listeners to layouts, and you get the clicked component as a parameter for the listener.


myLayoutWithTextArea.addListener(new LayoutClickListener() {
    public void layoutClick(LayoutClickEvent event) {
         …
    }
});

Hi Jouni Koivuviita,

I have tested FocusListener and TextChangeListener . The latter is too “eager” whereas the former is too “lazy” for my use case: I only want my RichTextEditor [ RichTextArea ]
to popup when the user indicates an intent, but FocusListener causes RichTextEditor to open every time the TextArea box has the focus. TextChangeListener waits for the user to type something into the text box before going into action.

I thought about your second option but it is not a feasible solution: I am using FieldFactory to create the
form fields and my TextArea (from which the RichTextArea popup window is triggered ) is one of the fields.

I chose TextChangeListener as it is less irritating than FocusListener.

Thanks