public abstract class BasePrimitives extends java.lang.Object implements OutputPrimitives
OutputPrimitives
implementations used by
CHUI.Modifier and Type | Field and Description |
---|---|
protected boolean |
cursorInvalid
Track the current cursor status.
|
protected static Cell |
EMPTY_CELL
Empty cell used for implementations which don't support
cellAt(int, int) |
Constructor and Description |
---|
BasePrimitives() |
Modifier and Type | Method and Description |
---|---|
abstract void |
append(int chr,
Color color)
Append char to the screen at current cursor location and move the cursor.
|
abstract void |
append(java.lang.String str,
Color color)
Append string to the screen at current cursor location and move the
cursor.
|
Color |
borderColor(Widget<?> widget)
Get color for border of specified widget.
|
abstract void |
box(int left,
int top,
int right,
int bottom,
Color color)
Draw complete box (with horizontal and vertical lines as well as corners)
using pseudo-graphic characters (or replacement characters, if
pseudo-graphic characters are not supported).
|
Cell |
cellAt(int row,
int col)
Get character at specified position.
|
abstract boolean |
cursorAt(int x,
int y)
Position physical cursor to specified screen location.
|
abstract boolean |
cursorStay(int x,
int y)
Position the real cursor.
|
abstract void |
drawHBorder(int col,
int row,
int width,
Color color)
Draw horizontal border.
|
abstract void |
drawLLCorner(int col,
int row,
Color color)
Draw lower left corner.
|
abstract void |
drawLRCorner(int col,
int row,
Color color)
Draw lower right corner.
|
abstract void |
drawULCorner(int col,
int row,
Color color)
Draw upper left corner.
|
abstract void |
drawURCorner(int col,
int row,
Color color)
Draw upper right corner.
|
abstract void |
drawVBorder(int col,
int row,
int height,
Color color)
Draw vertical border.
|
int |
getWindowId()
Get the ID of the window currently selected.
|
abstract int |
getX()
Get absolute cursor X coordinate.
|
abstract int |
getY()
Get absolute cursor Y coordinate.
|
boolean |
hasBoxBorderCorners()
Check if this output primitives implementation requires border corners
when drawing a box.
|
abstract void |
hLine(int length,
Color color)
Draw horizontal line using pseudo-graphic characters.
|
boolean |
isCursorInvalid()
Return state of cursor.
|
void |
setCursorInvalid(boolean cursorInvalid)
Set state of cursor.
|
void |
updateScreen(ScreenData screen)
Perform a bulk output operation for the whole screen at once with
output masking when desired.
|
abstract void |
vLine(int length,
Color color)
Draw vertical line using pseudo-graphic characters.
|
Color |
widgetColor(Widget<?> widget)
Get color for the component area.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearArea, getScreenBitmap, refresh, screenHeight, screenWidth, setScreenBitmap, sync
protected boolean cursorInvalid
protected static final Cell EMPTY_CELL
cellAt(int, int)
public abstract void drawULCorner(int col, int row, Color color)
The driver-level implementation does not need to implement this method because it is never reaches the driver.
col
- Column.row
- Row.color
- Color.public abstract void drawURCorner(int col, int row, Color color)
The driver-level implementation does not need to implement this method because it is never reaches the driver.
col
- Column.row
- Row.color
- Color.public abstract void drawLLCorner(int col, int row, Color color)
The driver-level implementation does not need to implement this method because it is never reaches the driver.
col
- Column.row
- Row.color
- Color.public abstract void drawLRCorner(int col, int row, Color color)
The driver-level implementation does not need to implement this method because it is never reaches the driver.
col
- Column.row
- Row.color
- Color.public abstract void drawHBorder(int col, int row, int width, Color color)
The driver-level implementation does not need to implement this method because it is never reaches the driver.
col
- Column.row
- Row.width
- Border width.color
- Color.public abstract void drawVBorder(int col, int row, int height, Color color)
The driver-level implementation does not need to implement this method because it is never reaches the driver.
col
- Column.row
- Row.height
- Border height.color
- Color.public abstract void box(int left, int top, int right, int bottom, Color color)
The driver-level implementation does not need to implement this method because it is never passed reaches the driver.
left
- Left coordinate of the box.top
- Top coordinate of the box.right
- Right coordinate of the box.bottom
- Bottom coordinate of the box.color
- Color.public abstract void append(int chr, Color color)
The driver-level implementation does not need to implement this method because it is never reaches the driver.
chr
- Character to add.color
- Color.public abstract void append(java.lang.String str, Color color)
Particular implementation of this method should perform direct output to
the screen and avoid any buffering. Note that input string is a Unicode
string, so support of the Unicode is up to implementation. Note that
this method is used at the very beginning of the application startup
(usually at the user authentication phase) and remaining interaction
with the user is performed via buffered output which uses bulk screen
data transfer (see updateScreen(ScreenData)
for more details),
monitors changed areas etc.
str
- String to add.color
- Color.public abstract int getX()
Driver-level OutputPrimitives
implementation should return actual
cursor position at physical screen.
public abstract int getY()
Driver-level OutputPrimitives
implementation should return actual
cursor position at physical screen.
public abstract boolean cursorStay(int x, int y)
TODO: in CRARVA driver at low level there is no difference between cursorStay and cursorAt, they both call same native method. Seems cursorStay can be completely dropped, at least for driver level.
x
- Cursor X coordinate.y
- Cursor Y coordinate.true
if cursor positioning succeeded.public abstract boolean cursorAt(int x, int y)
Low-level implementation of this method (i.e. implementation used by the
particular screen driver) should perform actual physical cursor movement
so it will be visible to user if cursor is enabled (see
ScreenDriver.setCursorStatus(boolean)
for more details).
x
- Cursor X.y
- Cursor Y.true
if operation was successful.public abstract void hLine(int length, Color color)
The driver-level implementation does not need to implement this method because it is never reaches the driver.
length
- Line length.color
- Color.public abstract void vLine(int length, Color color)
The driver-level implementation does not need to implement this method because it is never reaches the driver.
length
- Line length.color
- Color.public Cell cellAt(int row, int col)
row
- Character row.col
- Character column.public Color widgetColor(Widget<?> widget)
widget
- Widget reference.public Color borderColor(Widget<?> widget)
widget
- Widget reference.public boolean hasBoxBorderCorners()
true
.true
, as the box will be drawn with border
corners.public boolean isCursorInvalid()
public void setCursorInvalid(boolean cursorInvalid)
cursorInvalid
- State of cursor.public void updateScreen(ScreenData screen)
screen
- Container for whole screen content and cursor position.public int getWindowId()
getWindowId
in interface OutputPrimitives
WidgetId._DEFAULT_WINDOW_ID
.