Class EditUtils.CorrectorChangeListener

java.lang.Object
org.luwrain.controls.edit.EditUtils.CorrectorChangeListener
All Implemented Interfaces:
MultilineEdit.Model, MultilineEditCorrector, Lines
Enclosing class:
EditUtils

public abstract static class EditUtils.CorrectorChangeListener extends Object implements MultilineEditCorrector
Implements a listener of all changes in MultilineEdit.Model. This class contains the abstract method onMultilineEditChange called each time when any changes occurred in the state of the model. This allows users to implement any necessary actions, which should have effect if and only if something was changed in the model and this class guarantees that onMultilineEditChange is called strictly after changes in the model.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • onMultilineEditChange

      public abstract void onMultilineEditChange()
      Called if the model gets some changes. There is a guarantee that this method is invoked strictly after the changes in the model.
    • getLineCount

      public int getLineCount()
      Specified by:
      getLineCount in interface Lines
    • getLine

      public String getLine(int index)
      Specified by:
      getLine in interface Lines
    • getHotPointX

      public int getHotPointX()
      Specified by:
      getHotPointX in interface MultilineEdit.Model
    • getHotPointY

      public int getHotPointY()
      Specified by:
      getHotPointY in interface MultilineEdit.Model
    • getTabSeq

      public String getTabSeq()
      Specified by:
      getTabSeq in interface MultilineEdit.Model
    • deleteChar

      public MultilineEdit.ModificationResult deleteChar(int pos, int lineIndex)
      Specified by:
      deleteChar in interface MultilineEdit.Model
    • deleteRegion

      public MultilineEdit.ModificationResult deleteRegion(int fromX, int fromY, int toX, int toY)
      Specified by:
      deleteRegion in interface MultilineEdit.Model
    • insertRegion

      public MultilineEdit.ModificationResult insertRegion(int x, int y, String[] lines)
      Specified by:
      insertRegion in interface MultilineEdit.Model
    • putChars

      public MultilineEdit.ModificationResult putChars(int pos, int lineIndex, String str)
      Description copied from interface: MultilineEdit.Model
      Puts one or several characters at some position. The position expects to be valid in the content of the model, except of the case when there are no lines at all, lineIndex equals to zero and pos equals to zero. In this case the method must insert one empty line prior to making any required changes.

      After performing the operation, the method must prepare the MultilineEdit.ModificationResult object. If the chars arguments has the length greater than one, the string argument of the result must be set to the value of chars argument.

      If chars argument has the length equals to one, this single character must be returned as the character argument of the result. If the method is requested to insert a single spacing character, the string argument of the result must contain the last word prior to the inserting position. If there is no any word prior to the inserting position, the result may have the string argument empty.

      Specified by:
      putChars in interface MultilineEdit.Model
      Parameters:
      pos - The position on the line to put characters at
      lineIndex - The index of the line to put characters on
      str - The characters to put
      Returns:
      The MultilineEdit.ModificationResult object with the flag if the operation was performed and other corresponding information
    • mergeLines

      public MultilineEdit.ModificationResult mergeLines(int firstLineIndex)
      Specified by:
      mergeLines in interface MultilineEdit.Model
    • splitLine

      public MultilineEdit.ModificationResult splitLine(int pos, int lineIndex)
      Description copied from interface: MultilineEdit.Model
      Splits the specified line at the specified position. This method removes on the line all the content after the specified position and puts the deleted fragment on new line which is inserted just after modified. If the position is given outside of the stored text, the behaviour of this method is undefined.
      Specified by:
      splitLine in interface MultilineEdit.Model
      Parameters:
      pos - The 0-based position to split line at
      lineIndex - The 0-based index of the line to split
      Returns:
      The fragment moved onto newly inserted line
    • doEditAction

      public MultilineEdit.ModificationResult doEditAction(TextEditAction action)
      Specified by:
      doEditAction in interface MultilineEditCorrector