@Override public int getCursorPos() { return getImpl().getTextAreaCursorPos(getElement()); }
@Override public int getSelectionLength() { return getImpl().getTextAreaSelectionLength(getElement()); }
public int getTextAreaCursorPos(Element elem) { return getCursorPos(elem); }
public int getTextAreaSelectionLength(Element elem) { return getSelectionLength(elem); }
/** * Sets the range of text to be selected. * * This will only work when the widget is attached to the document and not * hidden. * * @param pos the position of the first character to be selected * @param length the number of characters to be selected */ public void setSelectionRange(int pos, int length) { // Setting the selection range will not work for unattached elements. if (!isAttached()) { return; } if (length < 0) { throw new IndexOutOfBoundsException( "Length must be a positive integer. Length: " + length); } if (pos < 0 || length + pos > getText().length()) { throw new IndexOutOfBoundsException("From Index: " + pos + " To Index: " + (pos + length) + " Text Length: " + getText().length()); } impl.setSelectionRange(getElement(), pos, length); }
/** * Gets the length of the current text selection. * * @return the text selection length */ public int getSelectionLength() { return impl.getSelectionLength(getElement()); }
/** * Selects text in the field. * * @param start the index where the selection should start. * @param length the number of characters to be selected */ public void select(int start, int length) { impl.setSelectionRange(getInputEl().dom, start, length); }
@Override public int getCursorPos() { return impl.getTextAreaCursorPos(getInputEl().dom); }
/** * {@inheritDoc} */ @Override public int getSelectionLength() { return getImpl().getTextAreaSelectionLength(getElement()); }
/** * Gets the current position of the cursor (this also serves as the beginning * of the text selection). * * @return the cursor's position */ public int getCursorPos() { return impl.getCursorPos(getElement()); }
public int getTextAreaSelectionLength(Element elem) { return getSelectionLength(elem); }
/** * Selects the range. * * @param pos the position * @param length the range length */ public void setSelectionRange(int pos, int length) { impl.setSelectionRange(getInputEl().dom, pos, length); }
/** * {@inheritDoc} */ @Override public int getCursorPos() { return getImpl().getTextAreaCursorPos(getElement()); }
/** * {@inheritDoc} */ @Override public int getSelectionLength() { return getImpl().getTextAreaSelectionLength(getElement()); }
public int getTextAreaCursorPos(Element elem) { return getCursorPos(elem); }
public int getTextAreaSelectionLength(Element elem) { return getSelectionLength(elem); }
/** * Sets the range of text to be selected. * * This will only work when the widget is attached to the document and not * hidden. * * @param pos the position of the first character to be selected * @param length the number of characters to be selected */ public void setSelectionRange(int pos, int length) { // Setting the selection range will not work for unattached elements. if (!isAttached()) { return; } if (length < 0) { throw new IndexOutOfBoundsException( "Length must be a positive integer. Length: " + length); } if (pos < 0 || length + pos > getText().length()) { throw new IndexOutOfBoundsException("From Index: " + pos + " To Index: " + (pos + length) + " Text Length: " + getText().length()); } impl.setSelectionRange(getElement(), pos, length); }
/** * {@inheritDoc} */ @Override public int getCursorPos() { return getImpl().getTextAreaCursorPos(getElement()); }
@Override public int getSelectionLength() { return getImpl().getTextAreaSelectionLength(getElement()); }
public int getTextAreaCursorPos(Element elem) { return getCursorPos(elem); }