Class zebkit.util.Position | <zebkit.util> |
Useful class to track a virtual cursor position in a structure that has dedicated number of lines where every line has a number of elements. The structure metric has to be described by providing an instance of zebkit.util.Position.Metric interface that discovers how many lines the structure has and how many elements every line includes.
public | <Integer> | getOffsetByPoint (row, col) |
public | <Array> | getPointByOffset (off) |
protected
|
void | removed (off, size) |
protected
|
void | removed (off, size) |
public | <Integer> | seek (off) |
public | void | seekLineTo (t, num) |
public | void | setMetric (p) |
public | <Integer> | setOffset (o) |
public | void | setRowCol (r, c) |
public
<Integer>
getOffsetByPoint (row, col )
Calculate an offset by the given line and column in the line Parameters:
Returns:
<Integer>
an offset |
protected
void
removed (off, size )
Special method to inform the position object that its state has to be adjusted because of the given portion of data had been inserted . Parameters:
|
protected
void
removed (off, size )
Special method to inform the position object that its state has to be adjusted because of the given portion of data had been removed. Parameters:
|
public
<Integer>
seek (off )
Seek virtual cursor offset with the given shift Parameters:
Returns:
<Integer>
an offset that has been set |
public
void
seekLineTo (t, num )
Seek virtual cursor to the next position. How the method has to seek to the next position has to be denoted by one of the following constants:
If the current virtual position is not known (-1) the method always sets it to the first line, the first column in the line (offset is zero). Parameters:
|
public
void
setMetric (p )
Set position metric. Metric describes how many lines and elements in these line the virtual cursor can be navigated Parameters:
|
public
<Integer>
setOffset (o )
Set the specified virtual cursor offsest Parameters:
Returns:
<Integer>
an offset that has been set |
public
void
setRowCol (r, c )
Set the virtual cursor line and the given column in the line Parameters:
|
public
![]() currentCol
Current virtual cursor column position |
public
![]() currentLine
Current virtual cursor line position |
public
![]() offset
Current virtual cursor offset |
posChanged
Fire when a virtual cursor position has been updated
Parameters:
|