Package docking.widgets.textfield
Class TextFieldLinker.LinkerState
- java.lang.Object
-
- docking.widgets.textfield.TextFieldLinker.LinkerState
-
- Enclosing class:
- TextFieldLinker
protected class TextFieldLinker.LinkerState extends java.lang.ObjectA class to track the internal state gathered from the text fields
-
-
Constructor Summary
Constructors Change Modifier Constructor Description protectedLinkerState()
-
Method Summary
All Methods Instance Methods Concrete Methods Change Modifier and Type Method Description MODIFIED TextFieldLinker.LinkerStatecopy()Copy the stateNEW booleanequals(java.lang.Object o)intgetGlobalCaret()Get the composite caret locationNEW intgetGlobalCaret(int omitSep)Get the composite caret location, omitting the given separator.java.lang.StringgetText()Get the whole composite stringNEW java.lang.StringgetText(int omitSep)Get the composite string, omitting the given separator.NEW java.lang.StringgetTextBeforeCursor(int field)Get the composite text preceding the caret in the given fieldNEW booleanisAfterSep(int field)Figure out whether the caret in the given field immediately proceeds a separator.NEW booleanisBeforeSep(int field)Figure out whether the caret in the given field immediately precedes a separator.NEW voidnavigateFieldLeft(int field)Change focus to the given field as if navigating left.NEW voidnavigateFieldRight(int field)Change focus to the given field as if navigating right.voidreformat()Re-parse the composite string and place the components into their proper fieldsNEW protected voidremoveSep(int sep)Remove the given separator from the composite text.voidreset()Erase the state Blank all the fields, and put the caret at the front of the first field.NEW voidsetGlobalCaret(int caret)Set the composite caret locationNEW intsetText(java.lang.String text)Set the composite textjava.lang.StringtoString()
-
-
-
Method Detail
-
copy MODIFIED
return type: LinkerState → LinkerState-TextFieldLinker.LinkerState copy()+docking.widgets.textfield.TextFieldLinker.LinkerState copy()public TextFieldLinker.LinkerState copy()
Copy the state- Returns:
- the copy
-
reset
public void reset()
Erase the state Blank all the fields, and put the caret at the front of the first field.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getText
public java.lang.String getText()
Get the whole composite string- Returns:
- the text
-
getText NEW
public java.lang.String getText(int omitSep)
Get the composite string, omitting the given separator. This is used as a helper to delete the separator when backspace/delete is pressed at a boundary.- Parameters:
omitSep- the separator to omit, or -1 to omit nothing- Returns:
- the text
-
getGlobalCaret
public int getGlobalCaret()
Get the composite caret location- Returns:
- the location (including separators)
-
getGlobalCaret NEW
public int getGlobalCaret(int omitSep)
Get the composite caret location, omitting the given separator.- Parameters:
omitSep- the separator to omit, or -1 to omit nothing- Returns:
- the location
-
getTextBeforeCursor NEW
public java.lang.String getTextBeforeCursor(int field)
Get the composite text preceding the caret in the given field- Parameters:
field- the field whose caret to use- Returns:
- the text
-
isAfterSep NEW
public boolean isAfterSep(int field)
Figure out whether the caret in the given field immediately proceeds a separator. In other words, the caret must be to the far left (position 0), and the given field must not be the first field. If true, the caret immediately follows separator indexfield - 1.- Parameters:
field- the field index to check- Returns:
- true if the caret immediately follows a separator.
-
isBeforeSep NEW
public boolean isBeforeSep(int field)
Figure out whether the caret in the given field immediately precedes a separator. In other words, the caret must be to the far right, and the given field must not be the last field. If true, the caret immediately precedes separator indexfield.- Parameters:
field- the field index to check- Returns:
- true if the caret immediately precedes a separator.
-
navigateFieldLeft NEW
public void navigateFieldLeft(int field)
Change focus to the given field as if navigating left. The caret will be moved to the rightmost position, because we're moving left from the leftmost position of the field to the right.- Parameters:
field- the field index to be given focus.
-
navigateFieldRight NEW
public void navigateFieldRight(int field)
Change focus to the given field as if navigating right. The caret will be moved to the leftmost position, because we're moving right from the rightmost position of the field to the left.- Parameters:
field- the field index to be given focus.
-
removeSep NEW
protected void removeSep(int sep)
Remove the given separator from the composite text.- Parameters:
sep- the separator to remove, by index
-
setText NEW
public int setText(java.lang.String text)
Set the composite text- Parameters:
text- the new text
-
setGlobalCaret NEW
public void setGlobalCaret(int caret) throws javax.swing.text.BadLocationExceptionSet the composite caret location- Parameters:
caret- the new caret location- Throws:
javax.swing.text.BadLocationException- if the location exceeds the text length
-
reformat
public void reformat()
Re-parse the composite string and place the components into their proper fields
-
-