/**
* When true, logical != physical.
*/
- protected boolean dirty;
+ protected volatile boolean dirty;
+
+ /**
+ * Get dirty flag.
+ *
+ * @return if true, the logical screen is not in sync with the physical
+ * screen
+ */
+ public final boolean isDirty() {
+ return dirty;
+ }
/**
* Set if the user explicitly wants to redraw everything starting with a
* @return attributes at (x, y)
*/
public final CellAttributes getAttrXY(final int x, final int y) {
-
CellAttributes attr = new CellAttributes();
if ((x >= 0) && (x < width) && (y >= 0) && (y < height)) {
attr.setTo(logical[x][y]);
dirty = true;
logical[X][Y].setForeColor(attr.getForeColor());
logical[X][Y].setBackColor(attr.getBackColor());
- logical[X][Y].setBold(attr.getBold());
- logical[X][Y].setBlink(attr.getBlink());
- logical[X][Y].setReverse(attr.getReverse());
- logical[X][Y].setUnderline(attr.getUnderline());
- logical[X][Y].setProtect(attr.getProtect());
+ logical[X][Y].setBold(attr.isBold());
+ logical[X][Y].setBlink(attr.isBlink());
+ logical[X][Y].setReverse(attr.isReverse());
+ logical[X][Y].setUnderline(attr.isUnderline());
+ logical[X][Y].setProtect(attr.isProtect());
}
}
logical[X][Y].setChar(ch);
logical[X][Y].setForeColor(attr.getForeColor());
logical[X][Y].setBackColor(attr.getBackColor());
- logical[X][Y].setBold(attr.getBold());
- logical[X][Y].setBlink(attr.getBlink());
- logical[X][Y].setReverse(attr.getReverse());
- logical[X][Y].setUnderline(attr.getUnderline());
- logical[X][Y].setProtect(attr.getProtect());
+ logical[X][Y].setBold(attr.isBold());
+ logical[X][Y].setBlink(attr.isBlink());
+ logical[X][Y].setReverse(attr.isReverse());
+ logical[X][Y].setUnderline(attr.isUnderline());
+ logical[X][Y].setProtect(attr.isProtect());
}
}
}
/**
- * Force the screen to be fully cleared and redrawn on the next flush().
+ * Clear the logical screen.
*/
public final void clear() {
reset();
}
+ /**
+ * Clear the physical screen.
+ */
+ public final void clearPhysical() {
+ dirty = true;
+ for (int row = 0; row < height; row++) {
+ for (int col = 0; col < width; col++) {
+ physical[col][row].reset();
+ }
+ }
+ }
+
/**
* Draw a box with a border and empty background.
*
final CellAttributes border, final CellAttributes background,
final int borderType, final boolean shadow) {
- int boxTop = top;
- int boxLeft = left;
int boxWidth = right - left;
int boxHeight = bottom - top;