/** * {@inheritDoc} */ @Override public void setSelectionEnd(int selectionEnd) { final int length = element_.getText().length(); selectionEnd = Math.min(length, Math.max(selectionEnd, 0)); selection_.setEnd(element_, selectionEnd); if (selection_.getStartOffset() > selectionEnd) { selection_.setStart(element_, selectionEnd); } } }
/** * Moves the focus of the selection to a specified point. The anchor of the selection does not move. * @param parentNode the node within which the focus will be moved * @param offset the number of characters from the beginning of parentNode's text the focus will be placed */ public void jsxFunction_extend(final Node parentNode, final int offset) { final Range selection = getPageSelection(); selection.setEnd(parentNode.getDomNodeOrDie(), offset); }
/** * {@inheritDoc} */ @Override public void setSelectionEnd(int selectionEnd) { final int length = element_.getText().length(); selectionEnd = Math.min(length, Math.max(selectionEnd, 0)); selection_.setEnd(element_, selectionEnd); if (selection_.getStartOffset() > selectionEnd) { selection_.setStart(element_, selectionEnd); } } }
/** * Moves the focus of the selection to a specified point. The anchor of the selection does not move. * @param parentNode the node within which the focus will be moved * @param offset the number of characters from the beginning of parentNode's text the focus will be placed */ public void jsxFunction_extend(final Node parentNode, final int offset) { final Range selection = getPageSelection(); selection.setEnd(parentNode.getDomNodeOrDie(), offset); }
/** * Moves the focus of the selection to a specified point. The anchor of the selection does not move. * @param parentNode the node within which the focus will be moved * @param offset the number of characters from the beginning of parentNode's text the focus will be placed */ public void jsxFunction_extend(final Node parentNode, final int offset) { final Range selection = getPageSelection(); selection.setEnd(parentNode.getDomNodeOrDie(), offset); }
/** * Moves the focus of the selection to a specified point. The anchor of the selection does not move. * @param parentNode the node within which the focus will be moved * @param offset the number of characters from the beginning of parentNode's text the focus will be placed */ @JsxFunction({CHROME, FF}) public void extend(final Node parentNode, final int offset) { final Range last = getLastRange(); if (last != null) { last.setEnd(parentNode.getDomNodeOrDie(), offset); type_ = TYPE_RANGE; } }
/** * Moves the focus of the selection to a specified point. The anchor of the selection does not move. * @param parentNode the node within which the focus will be moved * @param offset the number of characters from the beginning of parentNode's text the focus will be placed */ @JsxFunction({CHROME, FF}) public void extend(final Node parentNode, final int offset) { final Range last = getLastRange(); if (last != null) { last.setEnd(parentNode.getDomNodeOrDie(), offset); type_ = TYPE_RANGE; } }
public Range cloneRange(){ if( fDetach) { throw new DOMException( DOMException.INVALID_STATE_ERR, DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null)); } Range range = fDocument.createRange(); range.setStart(fStartContainer, fStartOffset); range.setEnd(fEndContainer, fEndOffset); return range; }
public Range cloneRange(){ if( fDetach) { throw new DOMException( DOMException.INVALID_STATE_ERR, DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null)); } Range range = fDocument.createRange(); range.setStart(fStartContainer, fStartOffset); range.setEnd(fEndContainer, fEndOffset); return range; }
public Range cloneRange(){ if( fDetach) { throw new DOMException( DOMException.INVALID_STATE_ERR, DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_STATE_ERR", null)); } Range range = fDocument.createRange(); range.setStart(fStartContainer, fStartOffset); range.setEnd(fEndContainer, fEndOffset); return range; }
/** * Collapses the current selection to a single point. The document is not modified. * @param parentNode the caret location will be within this node * @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 Range selection = getPageSelection(); selection.setStart(parentNode.getDomNodeOrDie(), offset); selection.setEnd(parentNode.getDomNodeOrDie(), offset); }
/** * Collapses the current selection to a single point. The document is not modified. * @param parentNode the caret location will be within this node * @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 Range selection = getPageSelection(); selection.setStart(parentNode.getDomNodeOrDie(), offset); selection.setEnd(parentNode.getDomNodeOrDie(), offset); }
/** * Collapses the current selection to a single point. The document is not modified. * @param parentNode the caret location will be within this node * @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 Range selection = getPageSelection(); selection.setStart(parentNode.getDomNodeOrDie(), offset); selection.setEnd(parentNode.getDomNodeOrDie(), offset); }
/** * {@inheritDoc} */ @Override public void setSelectionStart(int selectionStart) { if (selectionStart < 0 && element_.getPage().getEnclosingWindow().getWebClient() .getBrowserVersion().hasFeature(JS_INPUT_IGNORE_NEGATIVE_SELECTION_START)) { return; } final int length = element_.getText().length(); selectionStart = Math.max(0, Math.min(selectionStart, length)); selection_.setStart(element_, selectionStart); if (selection_.getEndOffset() < selectionStart) { selection_.setEnd(element_, selectionStart); } }
/** * {@inheritDoc} */ @Override public void setSelectionStart(int selectionStart) { if (selectionStart < 0 && element_.getPage().getEnclosingWindow().getWebClient() .getBrowserVersion().hasFeature(JS_INPUT_IGNORE_NEGATIVE_SELECTION_START)) { return; } final int length = element_.getText().length(); selectionStart = Math.max(0, Math.min(selectionStart, length)); selection_.setStart(element_, selectionStart); if (selection_.getEndOffset() < selectionStart) { selection_.setEnd(element_, selectionStart); } }
/** * {@inheritDoc} */ @Override public void focus() { super.focus(); valueAtFocus_ = getText(); if (getPage() instanceof HtmlPage) { final Range selection = ((HtmlPage) getPage()).getSelection(); selection.setStart(this, 0); selection.setEnd(this, getText().length()); } }
/** * {@inheritDoc} */ @Override public void focus() { super.focus(); valueAtFocus_ = getText(); if (getPage() instanceof HtmlPage) { final Range selection = ((HtmlPage) getPage()).getSelection(); selection.setStart(this, 0); selection.setEnd(this, getText().length()); } }
/** * {@inheritDoc} */ @Override public void focus() { super.focus(); valueAtFocus_ = getText(); if (getPage() instanceof HtmlPage) { final Range selection = ((HtmlPage) getPage()).getSelection(); selection.setStart(this, 0); selection.setEnd(this, getText().length()); } }
public Range getSelectionRange() { if (this.dotInfo == null || this.dotInfo.range == null) { return null; } Range r = docRange.createRange(); // some xml parsers don't allow end<start in the same text node. So, // handle dot<mark here if (this.markInfo.range.compareBoundaryPoints(Range.START_TO_START, this.dotInfo.range) <= 0) { r.setStart(this.markInfo.range.getStartContainer(), this.markInfo.range .getStartOffset()); r.setEnd(this.dotInfo.range.getStartContainer(), this.dotInfo.range.getStartOffset()); } else { r.setStart(this.dotInfo.range.getStartContainer(), this.dotInfo.range.getStartOffset()); r.setEnd(this.markInfo.range.getStartContainer(), this.markInfo.range.getStartOffset()); } return r; }
public Range getSelectionRange() { if (this.dotInfo == null || this.dotInfo.range == null) { return null; } Range r = docRange.createRange(); // some xml parsers don't allow end<start in the same text node. So, // handle dot<mark here if (this.markInfo.range.compareBoundaryPoints(Range.START_TO_START, this.dotInfo.range) <= 0) { r.setStart(this.markInfo.range.getStartContainer(), this.markInfo.range .getStartOffset()); r.setEnd(this.dotInfo.range.getStartContainer(), this.dotInfo.range.getStartOffset()); } else { r.setStart(this.dotInfo.range.getStartContainer(), this.dotInfo.range.getStartOffset()); r.setEnd(this.markInfo.range.getStartContainer(), this.markInfo.range.getStartOffset()); } return r; }