1 package be
.nikiroo
.jvcard
.tui
;
3 import java
.io
.IOException
;
4 import java
.io
.UnsupportedEncodingException
;
7 import jexer
.TApplication
;
9 import be
.nikiroo
.jvcard
.tui
.windows
.TuiFileListWindow
;
16 public class TuiLauncherJexer
extends TApplication
{
20 * TRUE to force text mode, FALSE to force the Swing terminal
21 * emulator, null to automatically determine the best choice
23 * the files to show at startup
24 * @throws UnsupportedEncodingException
26 public TuiLauncherJexer(final Boolean textMode
, final List
<String
> files
)
27 throws UnsupportedEncodingException
{
28 super(backend(textMode
));
33 @SuppressWarnings("unused")
34 TWindow w
= new TuiFileListWindow(this, files
);
38 * Start the TUI program.
43 public void start() throws IOException
{
44 (new Thread(this)).start();
48 * Select the most appropriate backend.
51 * NULL for auto-dection
52 * @return the backend type to use
54 private static BackendType
backend(Boolean textMode
) {
55 if (textMode
== null) {
56 boolean isMsWindows
= System
.getProperty("os.name", "")
57 .toLowerCase().startsWith("windows");
58 boolean forceSwing
= System
.getProperty("jexer.Swing", "false")
60 boolean noConsole
= System
.console() == null;
61 if (isMsWindows
|| forceSwing
|| noConsole
) {
62 return BackendType
.SWING
;
65 return BackendType
.XTERM
;
69 return BackendType
.XTERM
;
72 return BackendType
.SWING
;