Search in sources :

Example 1 with Terminal

use of org.apache.hadoop.hbase.hbtop.terminal.Terminal in project hbase by apache.

the class TestKeyPress method main.

public static void main(String[] args) throws Exception {
    try (Terminal terminal = new TerminalImpl()) {
        terminal.hideCursor();
        terminal.refresh();
        while (true) {
            KeyPress keyPress = terminal.pollKeyPress();
            if (keyPress == null) {
                TimeUnit.MILLISECONDS.sleep(100);
                continue;
            }
            terminal.getTerminalPrinter(0).print(keyPress.toString()).endOfLine();
            terminal.refresh();
            if (keyPress.getType() == KeyPress.Type.F12) {
                break;
            }
        }
    }
}
Also used : KeyPress(org.apache.hadoop.hbase.hbtop.terminal.KeyPress) Terminal(org.apache.hadoop.hbase.hbtop.terminal.Terminal)

Example 2 with Terminal

use of org.apache.hadoop.hbase.hbtop.terminal.Terminal in project hbase by apache.

the class TestCursor method main.

public static void main(String[] args) throws Exception {
    try (Terminal terminal = new TerminalImpl()) {
        terminal.refresh();
        terminal.setCursorPosition(0, 0);
        terminal.getTerminalPrinter(0).print("aaa").endOfLine();
        terminal.refresh();
        TimeUnit.SECONDS.sleep(1);
        terminal.getTerminalPrinter(0).print("bbb").endOfLine();
        terminal.refresh();
        TimeUnit.SECONDS.sleep(1);
        terminal.setCursorPosition(1, 0);
        terminal.refresh();
        TimeUnit.SECONDS.sleep(1);
        terminal.setCursorPosition(2, 0);
        terminal.refresh();
        TimeUnit.SECONDS.sleep(1);
        terminal.setCursorPosition(3, 0);
        terminal.refresh();
        TimeUnit.SECONDS.sleep(1);
        terminal.setCursorPosition(0, 1);
        terminal.refresh();
        TimeUnit.SECONDS.sleep(1);
        terminal.getTerminalPrinter(1).print("ccc").endOfLine();
        terminal.refresh();
        TimeUnit.SECONDS.sleep(1);
        terminal.getTerminalPrinter(3).print("Press any key to finish").endOfLine();
        terminal.refresh();
        while (true) {
            KeyPress keyPress = terminal.pollKeyPress();
            if (keyPress == null) {
                TimeUnit.MILLISECONDS.sleep(100);
                continue;
            }
            break;
        }
    }
}
Also used : KeyPress(org.apache.hadoop.hbase.hbtop.terminal.KeyPress) Terminal(org.apache.hadoop.hbase.hbtop.terminal.Terminal)

Example 3 with Terminal

use of org.apache.hadoop.hbase.hbtop.terminal.Terminal in project hbase by apache.

the class TestTerminalPrinter method main.

public static void main(String[] args) throws Exception {
    try (Terminal terminal = new TerminalImpl()) {
        terminal.hideCursor();
        terminal.refresh();
        TerminalPrinter printer = terminal.getTerminalPrinter(0);
        printer.print("Normal string").endOfLine();
        printer.startHighlight().print("Highlighted string").stopHighlight().endOfLine();
        printer.startBold().print("Bold string").stopBold().endOfLine();
        printer.startHighlight().startBold().print("Highlighted bold string").stopBold().stopHighlight().endOfLine();
        printer.endOfLine();
        printer.print("Press any key to finish").endOfLine();
        terminal.refresh();
        while (true) {
            KeyPress keyPress = terminal.pollKeyPress();
            if (keyPress == null) {
                TimeUnit.MILLISECONDS.sleep(100);
                continue;
            }
            break;
        }
    }
}
Also used : KeyPress(org.apache.hadoop.hbase.hbtop.terminal.KeyPress) TerminalPrinter(org.apache.hadoop.hbase.hbtop.terminal.TerminalPrinter) Terminal(org.apache.hadoop.hbase.hbtop.terminal.Terminal)

Aggregations

KeyPress (org.apache.hadoop.hbase.hbtop.terminal.KeyPress)3 Terminal (org.apache.hadoop.hbase.hbtop.terminal.Terminal)3 TerminalPrinter (org.apache.hadoop.hbase.hbtop.terminal.TerminalPrinter)1