Example usage for com.google.gwt.dom.client Text getPreviousSibling

List of usage examples for com.google.gwt.dom.client Text getPreviousSibling

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Text getPreviousSibling.

Prototype

@Override
    public Node getPreviousSibling() 

Source Link

Usage

From source file:org.waveprotocol.wave.client.editor.event.EditorEventHandler.java

License:Apache License

void checkForWebkitEndOfLinkHack(SignalEvent signal) {
    // If it's inserting text
    if (DomHelper.isTextNode(signal.getTarget())
            && (signal.getType().equals(BrowserEvents.DOMCharacterDataModified)
                    || signal.getType().equals(BrowserEvents.DOMNodeInserted))) {

        Text textNode = signal.getTarget().cast();
        if (textNode.getLength() > 0) {
            Node e = textNode.getPreviousSibling();
            if (e != null && !DomHelper.isTextNode(e)
                    && e.<Element>cast().getTagName().toLowerCase().equals("a")) {

                FocusedPointRange<Node> selection = editorInteractor.getHtmlSelection();
                if (selection.isCollapsed() && selection.getFocus().getTextOffset() == 0) {
                    editorInteractor.noteWebkitEndOfLinkHackOccurred(textNode);
                }/*  w  w w  .  ja  va2  s .  c  om*/
            }
        }
    }
}