Class Page
java.lang.Object
eu.svjatoslav.sixth.e3d.gui.textEditorComponent.Page
A page in a text editor.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidensureMaxTextLine(int row) Ensures that the page has at least the specified number of lines.chargetChar(int row, int column) Returns the character at the specified location.getLine(int row) Returns the specified line.intgetLineLength(int row) Returns the length of the specified line.intReturns the number of lines in the page.getText()Returns the text of the page.voidinsertCharacter(int row, int col, char value) Inserts a character at the specified position.voidinsertLine(int row, TextLine textLine) Inserts a line at the specified row.voidremoveCharacter(int row, int col) Removes the specified character from the page.voidremoveLine(int row) Removes the specified line from the page.
-
Field Details
-
rows
The text lines.
-
-
Constructor Details
-
Page
public Page()Creates a new empty page.
-
-
Method Details
-
ensureMaxTextLine
public void ensureMaxTextLine(int row) Ensures that the page has at least the specified number of lines.- Parameters:
row- the minimum number of lines required
-
getChar
public char getChar(int row, int column) Returns the character at the specified location. If the location is out of bounds, returns a space.- Parameters:
row- the row indexcolumn- the column index- Returns:
- the character at the specified location
-
getLine
Returns the specified line.- Parameters:
row- The line number.- Returns:
- The line.
-
getLineLength
public int getLineLength(int row) Returns the length of the specified line.- Parameters:
row- The line number.- Returns:
- The length of the line.
-
getLinesCount
public int getLinesCount()Returns the number of lines in the page.- Returns:
- The number of lines in the page.
-
getText
Returns the text of the page.- Returns:
- The text of the page.
-
insertCharacter
public void insertCharacter(int row, int col, char value) Inserts a character at the specified position.- Parameters:
row- the row indexcol- the column indexvalue- the character to insert
-
insertLine
Inserts a line at the specified row.- Parameters:
row- the row index where to inserttextLine- the text line to insert
-
removeCharacter
public void removeCharacter(int row, int col) Removes the specified character from the page.- Parameters:
row- The line number.col- The character number.
-
removeLine
public void removeLine(int row) Removes the specified line from the page.- Parameters:
row- The line number.
-