Question

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!

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top