Package org.luwrain.controls.edit
Class LegacyMultilineTranslator
java.lang.Object
org.luwrain.controls.edit.LegacyMultilineTranslator
- All Implemented Interfaces:
MultilineEdit.Model,MultilineEditCorrector,Lines
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final HotPointControlprotected final MutableLinesprotected Stringprotected final MultilineTranslator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancommit()deleteChar(int pos, int line) deleteRegion(int fromX, int fromY, int toX, int toY) doEditAction(TextEditAction action) intintgetLine(int index) intinsertRegion(int x, int y, String[] text) mergeLines(int firstLineIndex) Puts one or several characters at some position.splitLine(int pos, int line) Splits the specified line at the specified position.
-
Field Details
-
translator
-
lines
-
hotPoint
-
tabSeq
-
-
Constructor Details
-
LegacyMultilineTranslator
-
-
Method Details
-
deleteChar
- Specified by:
deleteCharin interfaceMultilineEdit.Model
-
deleteRegion
- Specified by:
deleteRegionin interfaceMultilineEdit.Model
-
insertRegion
- Specified by:
insertRegionin interfaceMultilineEdit.Model
-
putChars
Description copied from interface:MultilineEdit.ModelPuts 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,lineIndexequals to zero andposequals 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.ModificationResultobject. If thecharsarguments has the length greater than one, the string argument of the result must be set to the value ofcharsargument.If
charsargument 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:
putCharsin interfaceMultilineEdit.Model- Parameters:
pos- The position on the line to put characters atline- The index of the line to put characters onstr- The characters to put- Returns:
- The
MultilineEdit.ModificationResultobject with the flag if the operation was performed and other corresponding information
-
mergeLines
- Specified by:
mergeLinesin interfaceMultilineEdit.Model
-
splitLine
Description copied from interface:MultilineEdit.ModelSplits 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:
splitLinein interfaceMultilineEdit.Model- Parameters:
pos- The 0-based position to split line atline- The 0-based index of the line to split- Returns:
- The fragment moved onto newly inserted line
-
doEditAction
- Specified by:
doEditActionin interfaceMultilineEditCorrector
-
commit
public boolean commit() -
getLineCount
public int getLineCount()- Specified by:
getLineCountin interfaceLines
-
getLine
-
getHotPointX
public int getHotPointX()- Specified by:
getHotPointXin interfaceMultilineEdit.Model
-
getHotPointY
public int getHotPointY()- Specified by:
getHotPointYin interfaceMultilineEdit.Model
-
getTabSeq
- Specified by:
getTabSeqin interfaceMultilineEdit.Model
-