X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FGenericBackend.java;h=bf27e947607f1c7bea073b4edac0689f300e6067;hb=e8a11f986bfe2556e450d7b8ad6ef0059b369bbc;hp=d96f7a93f468afc404a61888faf62bfcef337d7a;hpb=42873e30bf487bc0b695d60652dba44f82185dbb;p=fanfix.git diff --git a/src/jexer/backend/GenericBackend.java b/src/jexer/backend/GenericBackend.java index d96f7a9..bf27e94 100644 --- a/src/jexer/backend/GenericBackend.java +++ b/src/jexer/backend/GenericBackend.java @@ -68,30 +68,52 @@ public abstract class GenericBackend implements Backend { } /** - * Subclasses must provide an implementation that syncs the logical - * screen to the physical device. + * Sync the logical screen to the physical device. */ - public abstract void flushScreen(); + public void flushScreen() { + screen.flushPhysical(); + } + + /** + * Input events are processed by this Terminal. + */ + protected TerminalReader terminal; /** - * Subclasses must provide an implementation to get keyboard, mouse, and - * screen resize events. + * Get keyboard, mouse, and screen resize events. * * @param queue list to append new events to */ - public abstract void getEvents(List queue); + public void getEvents(final List queue) { + if (terminal.hasEvents()) { + terminal.getEvents(queue); + } + } /** - * Subclasses must provide an implementation that closes sockets, - * restores console, etc. + * Close the I/O, restore the console, etc. */ - public abstract void shutdown(); + public void shutdown() { + terminal.closeTerminal(); + } /** - * Subclasses must provide an implementation that sets the window title. + * Set the window title. * * @param title the new title */ - public abstract void setTitle(final String title); + public void setTitle(final String title) { + screen.setTitle(title); + } + + /** + * Set listener to a different Object. + * + * @param listener the new listening object that run() wakes up on new + * input + */ + public void setListener(final Object listener) { + terminal.setListener(listener); + } }