/**
* THScroller implements a simple horizontal scroll bar.
*/
-public class THScroller extends TWidget {
+public final class THScroller extends TWidget {
}
/**
* TVScroller implements a simple vertical scroll bar.
*/
-public class TVScroller extends TWidget {
+public final class TVScroller extends TWidget {
}
* TWidget is the base class of all objects that can be drawn on screen or
* handle user input events.
*/
-public abstract class TWidget {
+public abstract class TWidget implements Comparable<TWidget> {
/**
* Every widget has a parent widget that it may be "contained" in. For
private int cursorY = 0;
/**
- * Comparison operator sorts on tabOrder.
+ * Comparison operator sorts on tabOrder for TWidgets and z for TWindows.
*
- * @param that another TWidget instance
- * @return difference between this.tabOrder and that.tabOrder
+ * @param that another TWidget or TWindow instance
+ * @return difference between this.tabOrder and that.tabOrder, or
+ * difference between this.z and that.z
*/
- public final int compare(final TWidget that) {
+ @Override
+ public final int compareTo(final TWidget that) {
+ if ((this instanceof TWindow)
+ && (that instanceof TWindow)
+ ) {
+ return (((TWindow) this).getZ() - ((TWindow) that).getZ());
+ }
return (this.tabOrder - that.tabOrder);
}
/**
* TWindow is the top-level container and drawing surface for other widgets.
*/
-public class TWindow extends TWidget implements Comparable<TWindow> {
+public class TWindow extends TWidget {
/**
* Window's parent TApplication.
return true;
}
- /**
- * Comparison operator sorts on z.
- *
- * @param that another TWindow instance
- * @return difference between this.z and that.z
- */
- @Override
- public final int compareTo(final TWindow that) {
- return (this.z - that.z);
- }
-
/**
* Returns true if the mouse is currently on the close button.
*
* This class uses an xterm/ANSI X3.64/ECMA-48 type terminal to provide a
* screen, keyboard, and mouse to TApplication.
*/
-public class ECMA48Backend extends Backend {
+public final class ECMA48Backend extends Backend {
/**
* Input events are processed by this Terminal.
* Sync the logical screen to the physical device.
*/
@Override
- public final void flushScreen() {
+ public void flushScreen() {
screen.flushPhysical();
}
* Close the I/O, restore the console, etc.
*/
@Override
- public final void shutdown() {
+ public void shutdown() {
terminal.shutdown();
}
/**
* This class represents a single text cell on the screen.
*/
-public class Cell extends CellAttributes {
+public final class Cell extends CellAttributes {
/**
* The character at this cell.
*
* @return cell character
*/
- public final char getChar() {
+ public char getChar() {
return ch;
}
*
* @param ch new cell character
*/
- public final void setChar(final char ch) {
+ public void setChar(final char ch) {
this.ch = ch;
}
* Reset this cell to a blank.
*/
@Override
- public final void reset() {
+ public void reset() {
super.reset();
ch = ' ';
}
*
* @return true if this cell has default attributes.
*/
- public final boolean isBlank() {
+ public boolean isBlank() {
if ((getForeColor().equals(Color.WHITE))
&& (getBackColor().equals(Color.BLACK))
&& !getBold()
* @return true if all fields are equal
*/
@Override
- public final boolean equals(final Object rhs) {
+ public boolean equals(final Object rhs) {
if (!(rhs instanceof Cell)) {
return false;
}
* @param rhs an instance of either Cell or CellAttributes
*/
@Override
- public final void setTo(final Object rhs) {
+ public void setTo(final Object rhs) {
// Let this throw a ClassCastException
CellAttributes thatAttr = (CellAttributes) rhs;
super.setTo(thatAttr);
*
* @param that a CellAttributes instance
*/
- public final void setAttr(final CellAttributes that) {
+ public void setAttr(final CellAttributes that) {
super.setTo(that);
}
* @return displayable String
*/
@Override
- public final String toString() {
+ public String toString() {
return String.format("fore: %d back: %d bold: %s blink: %s ch %c",
getForeColor(), getBackColor(), getBold(), getBlink(), ch);
}
import jexer.bits.CellAttributes;
/**
- * This Screen class draws to an xterm/ANSI X3.64/ECMA-48 type terminal.
+ * This Screen implementation draws to an xterm/ANSI X3.64/ECMA-48 type
+ * terminal.
*/
-public class ECMA48Screen extends Screen {
+public final class ECMA48Screen extends Screen {
/**
* Emit debugging to stderr.
* This class reads keystrokes and mouse events and emits output to ANSI
* X3.64 / ECMA-48 type terminals e.g. xterm, linux, vt100, ansi.sys, etc.
*/
-public class ECMA48Terminal implements Runnable {
+public final class ECMA48Terminal implements Runnable {
/**
* The session information.
*
* @return the SessionInfo
*/
- public final SessionInfo getSessionInfo() {
+ public SessionInfo getSessionInfo() {
return sessionInfo;
}
};
try {
Process process;
- if (mode == true) {
+ if (mode) {
process = Runtime.getRuntime().exec(cmdRaw);
} else {
process = Runtime.getRuntime().exec(cmdCooked);
/**
* TMenuSeparator is a special case menu item.
*/
-public class TMenuSeparator extends TMenuItem {
+public final class TMenuSeparator extends TMenuItem {
/**
* Package private constructor.
/**
* TSubMenu is a special case menu item that wraps another TMenu.
*/
-public class TSubMenu extends TMenuItem {
+public final class TSubMenu extends TMenuItem {
/**
* The menu window. Note package private access.
* @param key global keyboard accelerator
* @return the new menu item
*/
- public final TMenuItem addItem(final int id, final String label,
+ public TMenuItem addItem(final int id, final String label,
final TKeypress key) {
return menu.addItem(id, label, key);
* @param label menu item label
* @return the new menu item
*/
- public final TMenuItem addItem(final int id, final String label) {
+ public TMenuItem addItem(final int id, final String label) {
return menu.addItem(id, label);
}
* (inclusive).
* @return the new menu item
*/
- public final TMenuItem addDefaultItem(final int id) {
+ public TMenuItem addDefaultItem(final int id) {
return menu.addDefaultItem(id);
}
/**
* Convenience function to add a menu separator.
*/
- public final void addSeparator() {
+ public void addSeparator() {
menu.addSeparator();
}
* denoted by prefixing a letter with "&", e.g. "&File"
* @return the new sub-menu
*/
- public final TSubMenu addSubMenu(final String title) {
+ public TSubMenu addSubMenu(final String title) {
return menu.addSubMenu(title);
}