Zebra API Doc

zebra.util.Position.Metric Class

Position metric interface. This interface is designed for describing a navigational structure that consists on number of lines where every line consists of number of elements

Methods

calcMaxOffset

() Integer protected

Calculate maximal possible offset


Return: Integer

a maximal possible offset

getLines

() Integer

Get number of lines to navigate through


Return: Integer

a number of lines

getLineSize

(
  • l
)
Integer

Get a number of elements in the given line

Parameters:

  • l Integer

    a line index


Return: Integer

a number of elements in a line

getMaxOffset

() Integer

Get a maximal element index (a last element of a last line)


Return: Integer

a maximal element index

getOffsetByPoint

(
  • row
  • col
)
Integer

Calculate an offset by the given line and column in the line

Parameters:

  • row Integer

    a line

  • col Integer

    a column in the line


Return: Integer

an offset

getPointByOffset

(
  • off
)
Array

Calculate a line and line column by the given offset.

Parameters:

  • off Integer

    an offset


Return: Array

an array that contains a line as the first element and a column in the line as the second element.

seek

(
  • off
)
Integer

Seek virtual cursor offset with the given shift

Parameters:

  • off Integer

    a shift


Return: Integer

an offset that has been set

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:

  • zebra.util.Position.BEG seek cursor to the begin of the current line
  • zebra.util.Position.END seek cursor to the end of the current line
  • zebra.util.Position.UP seek cursor one line up
  • zebra.util.Position.DOWN seek cursor one line down

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:

  • t Integer

    an action the seek has to be done

  • num Integer

    number of seek actions

setMetric

(
  • p
)

Set position metric. Metric describes how many lines
and elements in these line the virtual cursor can be navigated

Parameters:

setOffset

(
  • o
)
Integer

Set the specified virtual cursor offsest

Parameters:

  • o Integer

    an offset, pass -1 to set position to indefinite state


Return: Integer

an offset that has been set

setRowCol

(
  • r
  • c
)

Set the vurtual cursor line and the given column in the line

Parameters:

  • r Integer

    a line

  • c Integer

    a column in the line

Attributes

currentCol

Integer readonly

Current virtual cursor column position

currentLine

Integer readonly

Current virtual cursor line position

offset

Integer readonly

Current virtual cursor offset