简体   繁体   中英

Vaadin - TextArea/RichTextArea with real-time text analyzing

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM