1

I am working on a Vaadin (7) server-side application, and i need to use a TextArea or a RichTextArea that will analyze word-by-word the typed input, and will highlight words of a certain type, for example - dates and times.

My problem is that a RichTextArea does not have a TextChangeListener, and a regular TextArea does not have a highlighting option because it does not support HTML tags... I tries using ShortcutKeyListener for RichTextArea and analyze the text after every Space key, but it was too slow and had also some other problems.

Is there anything else i can do? Is there an option to analyze the text on real time when using RichTextArea? or is there any add-on youre familiar with that can do that? Or is there a way to highlight text in TextArea after analyzing it?

Thank you!

poozmak
  • 414
  • 2
  • 11

1 Answers1

1

My suggestion is a bit strange, but anyway, take a look on Vaadin AceEditor. It supports text mode and SelectionChangeListener:

ed.addSelectionChangeListener(new SelectionChangeListener() {
    @Override
    public void selectionChanged(SelectionChangeEvent e) {
        int cursor = e.getSelection().getCursorPosition();
        Notification.show("Cursor at: " + cursor);
    }
});

See details here: Vaadin AceEditor

Renat Gilmanov
  • 17,735
  • 5
  • 39
  • 56
  • +1 THANK YOU SO MUCH!!! This is a really cool Add-on, and i can adjust it to my needs. You've helped me a lot! Thanx again! – poozmak Jan 17 '14 at 13:22
  • Hi, @Renat Gilmanov, im not sure if my tagging works... anyway i have another question, maybe yo will be so king and look at it (: – poozmak Jan 23 '14 at 13:01
  • To only insert some text in current cursor position, the `CKEditor wrapper for Vaadin` may be used, [here is short example](http://stackoverflow.com/a/33125925/5162026). – jsosnowski Oct 14 '15 at 12:58