2 * Jexer - Java Text User Interface
4 * License: LGPLv3 or later
6 * This module is licensed under the GNU Lesser General Public License
7 * Version 3. Please see the file "COPYING" in this directory for more
8 * information about the GNU Lesser General Public License Version 3.
10 * Copyright (C) 2015 Kevin Lamonte
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 3 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this program; if not, see
24 * http://www.gnu.org/licenses/, or write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
31 package jexer
.backend
;
33 import java
.util
.List
;
35 import jexer
.event
.TInputEvent
;
36 import jexer
.io
.Screen
;
37 import jexer
.session
.SessionInfo
;
40 * This abstract class provides a screen, keyboard, and mouse to
41 * TApplication. It also exposes session information as gleaned from lower
42 * levels of the communication stack.
44 public abstract class Backend
{
47 * The session information.
49 protected SessionInfo sessionInfo
;
52 * Getter for sessionInfo.
54 * @return the SessionInfo
56 public final SessionInfo
getSessionInfo() {
61 * The screen to draw on.
63 protected Screen screen
;
70 public final Screen
getScreen() {
75 * Subclasses must provide an implementation that syncs the logical
76 * screen to the physical device.
78 public abstract void flushScreen();
81 * Subclasses must provide an implementation to get keyboard, mouse, and
82 * screen resize events.
84 * @param queue list to append new events to
85 * @param timeout maximum amount of time (in millis) to wait for an
86 * event. 0 means to return immediately, i.e. perform a poll.
88 public abstract void getEvents(List
<TInputEvent
> queue
, int timeout
);
91 * Subclasses must provide an implementation that closes sockets,
92 * restores console, etc.
94 public abstract void shutdown();