public class TextFieldLogic extends Object
Constructor and Description |
---|
TextFieldLogic(CharSequence newText,
Clipboard newClipboard,
TextFieldView textFieldView)
Create TextField with clipboard support.
|
Modifier and Type | Method and Description |
---|---|
void |
backspace()
Backspace.
|
void |
copy()
Copy currently selected text to clipboard.
|
void |
cursorLeft()
Move cursor left.
|
void |
cursorRight()
Move cursor right.
|
void |
cut()
Cut the selected text into the clipboard.
|
void |
delete()
Delete the character at the cursor position.
|
void |
endSelecting()
Stop the active selecting operation.
|
int |
getCursorPosition()
Get cursor position.
|
CharSequence |
getDisplayedSelectedText() |
CharSequence |
getDisplayedText()
The text that is supposed to be displayed to the user.
|
TextFieldDisplayFormat |
getFormat()
Get the format that currently applies to the displayed text of this text field.
|
Character |
getPasswordChar()
Get the character that is used to mask the password.
|
CharSequence |
getRealSelectedText()
Get the part of the text that is selected.
|
CharSequence |
getRealText()
Get the real text that is stored in this text field.
|
int |
getSelectionEnd()
Get selection end.
|
int |
getSelectionLength()
Get the amount of characters that are currently selected.
|
int |
getSelectionStart()
Get selection start.
|
boolean |
hasSelection()
Checks if we currently have a selection.
|
void |
insert(char c)
Insert character at cursor position.
|
void |
insert(CharSequence chars)
Insert a sequence of characters into the current text.
|
void |
put()
Put data from clipboard into text field.
|
void |
resetSelection()
Reset the selection.
|
void |
selectAll()
Expand the active selection over the entire text field.
|
void |
setCursorPosition(int newIndex)
Set new cursor position.
|
void |
setDeleteFilter(TextFieldDeleteFilter filter)
Set the filter that is applied to delete operations.
|
void |
setFormat(TextFieldDisplayFormat newFormat)
Set the format that is applied to the text field.
|
void |
setInputFilterSequence(TextFieldInputCharSequenceFilter filter)
Set the filter that is applied to character sequence inputs.
|
void |
setInputFilterSingle(TextFieldInputCharFilter filter)
Set the filter that is applied to single character inputs.
|
void |
setMaxLength(int maxLen)
Set the maximal length that is allowed to be used.
|
void |
setText(CharSequence newText) |
void |
setTextAndNotify(CharSequence newText)
Overwrite the text that is stored in this text field entirely and notify the listeners about the changed text.
|
void |
startSelecting()
Start a selecting operation at the current cursor position.
|
void |
toFirstPosition()
Move the location of the cursor to the first position in the text.
|
void |
toLastPosition()
Move the cursor to the last position in the text field.
|
public TextFieldLogic(CharSequence newText, Clipboard newClipboard, TextFieldView textFieldView)
newText
- init textnewClipboard
- clipboardpublic void setText(CharSequence newText)
public void setInputFilterSingle(TextFieldInputCharFilter filter)
filter
- the new filter or null
to reset the filterpublic void setInputFilterSequence(TextFieldInputCharSequenceFilter filter)
filter
- the new filter or null
to reset the filterpublic void setDeleteFilter(TextFieldDeleteFilter filter)
filter
- the new filter or null
to reset the filterpublic void setFormat(TextFieldDisplayFormat newFormat)
newFormat
- the new format that is applied to the text fieldpublic TextFieldDisplayFormat getFormat()
public void resetSelection()
public int getCursorPosition()
public int getSelectionEnd()
public int getSelectionStart()
public void backspace()
public void cursorLeft()
public void delete()
public boolean hasSelection()
public void copy()
public void cursorRight()
public void cut()
public CharSequence getDisplayedSelectedText()
public void endSelecting()
public CharSequence getDisplayedText()
public CharSequence getRealText()
public Character getPasswordChar()
null
in case no character is used and the normal text is
displayedpublic CharSequence getRealSelectedText()
null
in case nothing is selectedpublic int getSelectionLength()
public void setTextAndNotify(CharSequence newText)
newText
- the new text that should be appliedpublic void insert(char c)
c
- the character to insertpublic void put()
public void insert(CharSequence chars)
chars
- the character sequence to insertpublic void selectAll()
public void setMaxLength(int maxLen)
maxLen
- the new maximal length of the text fieldpublic void setCursorPosition(int newIndex)
newIndex
- index.public void startSelecting()
public void toFirstPosition()
public void toLastPosition()
Copyright © 2013. All Rights Reserved.