Interface MultilineEdit.Model
-
- All Superinterfaces:
Lines
- All Known Subinterfaces:
MultilineEditCorrector
- All Known Implementing Classes:
EditCorrectorHooks
,EditCorrectors.IndentationCorrector
,EditCorrectors.WordWrapCorrector
,EditUtils.ActiveCorrector
,EditUtils.CorrectorChangeListener
,EditUtils.EmptyCorrector
,MultilineEditTranslator
- Enclosing class:
- MultilineEdit
public static interface MultilineEdit.Model extends Lines
The model forMultilineEdit
. It is supposed that this interface is a front-end forMutableLines
in conjunction withHotPointControl
, but you may use it freely as it is necessary for a particular purpose. SeeMultilineEditTranslator
for a default implementation.MultilineEdit
guarantees that each user action results exactly in a single call of some method of this interface. This allows substitution of any method, which makes changes in the model, by any number of other methods in any order, and this will keep all structures consistent.If some operation is addressed at the position outside of the stored text, the result may be undefined. The implementation of this interface should not issue any speech output.
- See Also:
MultilineEditTranslator
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MultilineEdit.ModificationResult
deleteChar(int pos, int lineIndex)
MultilineEdit.ModificationResult
deleteRegion(int fromX, int fromY, int toX, int toY)
int
getHotPointX()
int
getHotPointY()
String
getTabSeq()
MultilineEdit.ModificationResult
insertRegion(int x, int y, String[] lines)
MultilineEdit.ModificationResult
mergeLines(int firstLineIndex)
MultilineEdit.ModificationResult
putChars(int pos, int lineIndex, String chars)
Puts one or several characters at some position.MultilineEdit.ModificationResult
splitLine(int pos, int lineIndex)
Splits the specified line at the specified position.-
Methods inherited from interface org.luwrain.core.Lines
getLine, getLineCount
-
-
-
-
Method Detail
-
getHotPointX
int getHotPointX()
-
getHotPointY
int getHotPointY()
-
getTabSeq
String getTabSeq()
-
deleteChar
MultilineEdit.ModificationResult deleteChar(int pos, int lineIndex)
-
deleteRegion
MultilineEdit.ModificationResult deleteRegion(int fromX, int fromY, int toX, int toY)
-
insertRegion
MultilineEdit.ModificationResult insertRegion(int x, int y, String[] lines)
-
putChars
MultilineEdit.ModificationResult putChars(int pos, int lineIndex, String chars)
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 andpos
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 thechars
arguments has the length greater than one, the string argument of the result must be set to the value ofchars
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.- Parameters:
pos
- The position on the line to put characters atlineIndex
- The index of the line to put characters onchars
- The characters to put- Returns:
- The
MultilineEdit.ModificationResult
object with the flag if the operation was performed and other corresponding information
-
mergeLines
MultilineEdit.ModificationResult mergeLines(int firstLineIndex)
-
splitLine
MultilineEdit.ModificationResult splitLine(int pos, int lineIndex)
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.- Parameters:
pos
- The 0-based position to split line atlineIndex
- The 0-based index of the line to split- Returns:
- The fragment moved onto newly inserted line
-
-