/** * {@inheritDoc} */ @Override public int getSelectionEnd() { return selection_.getEndOffset(); }
/** * {@inheritDoc} */ @Override public int getSelectionEnd() { return selection_.getEndOffset(); }
/** * Returns the number of characters that the selection's focus is offset within the focus node. * @return the number of characters that the selection's focus is offset within the focus node */ public int jsxGet_focusOffset() { return getPageSelection().getEndOffset(); }
/** * Returns the number of characters that the selection's focus is offset within the focus node. * @return the number of characters that the selection's focus is offset within the focus node */ public int jsxGet_focusOffset() { return getPageSelection().getEndOffset(); }
/** * Returns the number of characters that the selection's focus is offset within the focus node. * @return the number of characters that the selection's focus is offset within the focus node */ public int jsxGet_focusOffset() { return getPageSelection().getEndOffset(); }
/** * Returns the end position of the selected text in the owner element. * @return the end position of the selected text in the owner element */ public int getSelectionEnd() { final Range selection = getSelectionInner(); if (selection != null) { return selection.getEndOffset(); } return element_.getText().length(); }
/** * Returns the end position of the selected text in the owner element. * @return the end position of the selected text in the owner element */ public int getSelectionEnd() { final Range selection = getSelectionInner(); if (selection != null) { return selection.getEndOffset(); } return element_.getText().length(); }
/** * Returns the end position of the selected text in the owner element. * @return the end position of the selected text in the owner element */ public int getSelectionEnd() { final Range selection = getSelectionInner(); if (selection != null) { return selection.getEndOffset(); } return element_.getText().length(); }
/** * Returns the number of characters that the selection's focus is offset within the focus node. * @return the number of characters that the selection's focus is offset within the focus node */ @JsxGetter public int getFocusOffset() { final Range last = getLastRange(); if (last == null) { return 0; } return last.getEndOffset(); }
/** * Returns the number of characters that the selection's focus is offset within the focus node. * @return the number of characters that the selection's focus is offset within the focus node */ @JsxGetter public int getFocusOffset() { final Range last = getLastRange(); if (last == null) { return 0; } return last.getEndOffset(); }
/** * Returns the selected text in the owner element, or <tt>null</tt> if there is no selected text. * @return the selected text in the owner element, or <tt>null</tt> if there is no selected text */ public String getSelectedText() { final Range selection = getSelectionInner(); if (selection != null) { return element_.getText().substring(selection.getStartOffset(), selection.getEndOffset()); } return null; }
/** * Returns the selected text in the owner element, or <tt>null</tt> if there is no selected text. * @return the selected text in the owner element, or <tt>null</tt> if there is no selected text */ public String getSelectedText() { final Range selection = getSelectionInner(); if (selection != null) { return element_.getText().substring(selection.getStartOffset(), selection.getEndOffset()); } return null; }
/** * Returns the selected text in the owner element, or <tt>null</tt> if there is no selected text. * @return the selected text in the owner element, or <tt>null</tt> if there is no selected text */ public String getSelectedText() { final Range selection = getSelectionInner(); if (selection != null) { return element_.getText().substring(selection.getStartOffset(), selection.getEndOffset()); } return null; }
Range(final org.w3c.dom.ranges.Range w3cRange) { final DomNode domNodeStartContainer = (DomNode) w3cRange.getStartContainer(); startContainer_ = domNodeStartContainer.getScriptableObject(); startOffset_ = w3cRange.getStartOffset(); final DomNode domNodeEndContainer = (DomNode) w3cRange.getEndContainer(); endContainer_ = domNodeEndContainer.getScriptableObject(); endOffset_ = w3cRange.getEndOffset(); }
/** * {@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); } }
Range(final org.w3c.dom.ranges.Range w3cRange) { final DomNode domNodeStartContainer = (DomNode) w3cRange.getStartContainer(); startContainer_ = domNodeStartContainer.getScriptableObject(); startOffset_ = w3cRange.getStartOffset(); final DomNode domNodeEndContainer = (DomNode) w3cRange.getEndContainer(); endContainer_ = domNodeEndContainer.getScriptableObject(); endOffset_ = w3cRange.getEndOffset(); }
/** * Sets the start position of the selected text in the owner element. * @param selectionStart the start position of the selected text in the owner element */ public void setSelectionStart(int selectionStart) { if (element_.getPage() instanceof HtmlPage) { final HtmlPage page = (HtmlPage) element_.getPage(); final int length = element_.getText().length(); selectionStart = Math.max(0, Math.min(selectionStart, length)); page.getSelection().setStart(element_, selectionStart); if (page.getSelection().getEndContainer() != element_) { page.getSelection().setEnd(element_, length); } else if (page.getSelection().getEndOffset() < selectionStart) { page.getSelection().setEnd(element_, selectionStart); } } }
/** * Sets the start position of the selected text in the owner element. * @param selectionStart the start position of the selected text in the owner element */ public void setSelectionStart(int selectionStart) { if (element_.getPage() instanceof HtmlPage) { final HtmlPage page = (HtmlPage) element_.getPage(); final int length = element_.getText().length(); selectionStart = Math.max(0, Math.min(selectionStart, length)); page.getSelection().setStart(element_, selectionStart); if (page.getSelection().getEndContainer() != element_) { page.getSelection().setEnd(element_, length); } else if (page.getSelection().getEndOffset() < selectionStart) { page.getSelection().setEnd(element_, selectionStart); } } }
/** * Sets the start position of the selected text in the owner element. * @param selectionStart the start position of the selected text in the owner element */ public void setSelectionStart(int selectionStart) { if (element_.getPage() instanceof HtmlPage) { final HtmlPage page = (HtmlPage) element_.getPage(); final int length = element_.getText().length(); selectionStart = Math.max(0, Math.min(selectionStart, length)); page.getSelection().setStart(element_, selectionStart); if (page.getSelection().getEndContainer() != element_) { page.getSelection().setEnd(element_, length); } else if (page.getSelection().getEndOffset() < selectionStart) { page.getSelection().setEnd(element_, selectionStart); } } }