Class TextFieldLinker.LinkerState

java.lang.Object
docking.widgets.textfield.TextFieldLinker.LinkerState
Enclosing class:
TextFieldLinker

protected class TextFieldLinker.LinkerState extends Object
A class to track the internal state gathered from the text fields
  • Constructor Details

    • LinkerState

      protected LinkerState()
  • Method Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • 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 String toString()
      Overrides:
      toString in class Object
    • getText

      public String getText()
      Get the whole composite string
      Returns:
      the text
    • getText

      public 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

      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

      public 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

      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 index field - 1.

      Parameters:
      field - the field index to check
      Returns:
      true if the caret immediately follows a separator.
    • isBeforeSep

      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 index field.

      Parameters:
      field - the field index to check
      Returns:
      true if the caret immediately precedes a separator.
    • removeSep

      protected void removeSep(int sep)
      Remove the given separator from the composite text.
      Parameters:
      sep - the separator to remove, by index
    • setText

      public int setText(String text)
      Set the composite text
      Parameters:
      text - the new text
    • setGlobalCaret

      public void setGlobalCaret(int caret) throws BadLocationException
      Set the composite caret location
      Parameters:
      caret - the new caret location
      Throws:
      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