From 1073af21305360bd33903c533cdac57e9f936294 Mon Sep 17 00:00:00 2001 From: Yuuta Liang Date: Tue, 28 Nov 2023 18:19:39 -0800 Subject: Move TUI and GUI into separate packages Signed-off-by: Yuuta Liang --- src/main/ui/tui/UIHandler.java | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/main/ui/tui/UIHandler.java (limited to 'src/main/ui/tui/UIHandler.java') diff --git a/src/main/ui/tui/UIHandler.java b/src/main/ui/tui/UIHandler.java new file mode 100644 index 0000000..672fd50 --- /dev/null +++ b/src/main/ui/tui/UIHandler.java @@ -0,0 +1,45 @@ +package ui.tui; + +/** + * Represents a screen + */ +public interface UIHandler { + /** + * EFFECTS: Called when the screen is switched to. + */ + default void enter(Object... args) { + + } + + /** + * EFFECTS: Show objects. command() will not be called. + */ + void show(); + + /** + * EFFECTS: Commit changes and exit. command() will not be called. + */ + default void commit() { + } + + /** + * EFFECTS: Discard changes and exit. command() will not be called. Returns the next screen. + */ + Screen exit(); + + /** + * EFFECTS: Run help. command() will not be called. + */ + void help(); + + /** + * EFFECTS: Any commands rather than commit / exit / help. + * REQUIRES: args != null && args.length >= 1 + */ + void command(String... args); + + /** + * EFFECTS: Return the current PS1 prompt. + */ + String getPS1(); +} -- cgit v1.2.3