package be.nikiroo.jvcard.tui;
import java.io.IOException;
+import java.util.List;
+
+import be.nikiroo.jvcard.tui.panes.FileList;
import com.googlecode.lanterna.TerminalSize;
import com.googlecode.lanterna.TextColor;
import com.googlecode.lanterna.terminal.ResizeListener;
import com.googlecode.lanterna.terminal.Terminal;
-/*
- *
- * Change in Lanterna 3.0.0-beta2 (issue and fix reported to GitHub):
- *
- * java.lang.StringIndexOutOfBoundsException: String index out of range: 83
- * at java.lang.String.charAt(String.java:686)
- * at com.googlecode.lanterna.TerminalTextUtils.getWordWrappedText(TerminalTextUtils.java:237)
- *
+/**
+ * Starting the TUI.
*
+ * @author niki
+ *
*/
-
public class TuiLauncher {
- public static void start(Boolean textMode, Window win) throws IOException {
+ /**
+ * Start the TUI program.
+ *
+ * @param textMode
+ * TRUE to force text mode, FALSE to force the Swing terminal
+ * emulator, null to automatically determine the best choice
+ * @param files
+ * the files to show at startup
+ *
+ * @throws IOException
+ * in case of IO error
+ */
+ static public void start(Boolean textMode, List<String> files)
+ throws IOException {
+ Window win = new MainWindow(new FileList(files));
+ TuiLauncher.start(textMode, win);
+ }
+
+ /**
+ * Start the TUI program.
+ *
+ * @param textMode
+ * TRUE to force text mode, FALSE to force the Swing terminal
+ * emulator, null to automatically determine the best choice
+ * @param win
+ * the window to show at start
+ *
+ * @throws IOException
+ * in case of IO error
+ */
+ static public void start(Boolean textMode, Window win) throws IOException {
Terminal terminal = null;
DefaultTerminalFactory factory = new DefaultTerminalFactory();
}
if (win instanceof MainWindow) {
- MainWindow mwin = (MainWindow) win;
+ final MainWindow mwin = (MainWindow) win;
mwin.refresh(terminal.getTerminalSize());
terminal.addResizeListener(new ResizeListener() {
@Override