Package com.gargoylesoftware.htmlunit.html.impl

Examples of com.gargoylesoftware.htmlunit.html.impl.SimpleRange


    /**
     * Constructs a text range around the provided element.
     * @param elt the element to wrap
     */
    public TextRange(final HTMLElement elt) {
        range_ = new SimpleRange(elt.getDomNodeOrDie());
    }
View Full Code Here


    /**
     * Returns a W3C {@link org.w3c.dom.ranges.Range} version of this object.
     * @return a W3C {@link org.w3c.dom.ranges.Range} version of this object
     */
    public SimpleRange toW3C() {
        return new SimpleRange(startContainer_.getDomNodeOrNull(), startOffset_,
            endContainer_.getDomNodeOrDie(), endOffset_);
    }
View Full Code Here

        final Range first = getFirstRange();
        if (first != null) {
            range = new TextRange(first);
        }
        else {
            range = new TextRange(new SimpleRange());
        }
        range.setParentScope(getParentScope());
        range.setPrototype(getPrototype(range.getClass()));
        return range;
    }
View Full Code Here

     * @param offset the caret will be placed this number of characters from the beginning of the parentNode's text
     */
    public void jsxFunction_collapse(final Node parentNode, final int offset) {
        final List<Range> ranges = getRanges();
        ranges.clear();
        ranges.add(new SimpleRange(parentNode.getDomNodeOrDie(), offset));
    }
View Full Code Here

     * @param parentNode all children of parentNode will be selected; parentNode itself is not part of the selection
     */
    public void jsxFunction_selectAllChildren(final Node parentNode) {
        final List<Range> ranges = getRanges();
        ranges.clear();
        ranges.add(new SimpleRange(parentNode.getDomNodeOrDie()));
    }
View Full Code Here

                final SgmlPage page = getPage();
                if (page instanceof HtmlPage) {
                    final HtmlPage htmlPage = (HtmlPage) page;
                    final DomNode child = htmlPage.getBody().getFirstChild();
                    final DomNode rangeNode = child != null ? child : htmlPage.getBody();
                    htmlPage.setSelectionRange(new SimpleRange(rangeNode, 0));
                }
            }
            else if ("off".equalsIgnoreCase(mode)) {
                designMode_ = "off";
            }
View Full Code Here

        elementWithFocus_ = newElement;

        final boolean ie = getWebClient().getBrowserVersion().isIE();
        if (ie && elementWithFocus_ instanceof SelectableTextInput) {
            final SelectableTextInput sti = (SelectableTextInput) elementWithFocus_;
            setSelectionRange(new SimpleRange(sti, sti.getSelectionStart(), sti, sti.getSelectionEnd()));
        }

        if (elementWithFocus_ != null) {
            elementWithFocus_.focus();
            elementWithFocus_.fireEvent(Event.TYPE_FOCUS);
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.impl.SimpleRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.