super(application, i18n.getString("windowTitle"), x, y,
80 + 2, 24 + 2, flags);
+ // Require at least one line for the display.
+ setMinimumWindowHeight(3);
+
this.closeOnExit = closeOnExit;
vScroller = new TVScroller(this, getWidth() - 2, 0, getHeight() - 2);
newStatusBar(i18n.getString("statusBarRunning"));
// Spin it up
- terminal = new TTerminalWidget(this, 0, 0, new TAction() {
+ terminal = new TTerminalWidget(this, 0, 0, command, new TAction() {
public void DO() {
onShellExit();
}
super(application, i18n.getString("windowTitle"), x, y,
80 + 2, 24 + 2, flags);
+ // Require at least one line for the display.
+ setMinimumWindowHeight(3);
+
this.closeOnExit = closeOnExit;
vScroller = new TVScroller(this, getWidth() - 2, 0, getHeight() - 2);
*/
@Override
public void draw() {
- setTitle(terminal.getTitle());
+ if (terminal != null) {
+ setTitle(terminal.getTitle());
+ }
reflowData();
super.draw();
}
@Override
public void onResize(final TResizeEvent resize) {
if (resize.getType() == TResizeEvent.Type.WIDGET) {
- terminal.onResize(new TResizeEvent(TResizeEvent.Type.WIDGET,
- getWidth() - 2, getHeight() - 2));
+ if (terminal != null) {
+ terminal.onResize(new TResizeEvent(TResizeEvent.Type.WIDGET,
+ getWidth() - 2, getHeight() - 2));
+ }
// Resize the scroll bars
reflowData();
@Override
public void reflowData() {
// Vertical scrollbar
- terminal.reflowData();
- setTopValue(terminal.getTopValue());
- setBottomValue(terminal.getBottomValue());
- setVerticalBigChange(terminal.getVerticalBigChange());
- setVerticalValue(terminal.getVerticalValue());
+ if (terminal != null) {
+ terminal.reflowData();
+ setTopValue(terminal.getTopValue());
+ setBottomValue(terminal.getBottomValue());
+ setVerticalBigChange(terminal.getVerticalBigChange());
+ setVerticalValue(terminal.getVerticalValue());
+ }
}
/**
*/
@Override
public void onKeypress(final TKeypressEvent keypress) {
- if (terminal.isReading()) {
+ if ((terminal != null) && (terminal.isReading())) {
terminal.onKeypress(keypress);
} else {
super.onKeypress(keypress);
}
super.onMouseUp(mouse);
+
+ if (mouse.isMouse1() && mouseOnVerticalScroller(mouse)) {
+ // Clicked on vertical scrollbar
+ if (terminal != null) {
+ terminal.setVerticalValue(getVerticalValue());
+ }
+ }
}
/**
}
super.onMouseMotion(mouse);
+
+ if (mouse.isMouse1() && mouseOnVerticalScroller(mouse)) {
+ // Clicked/dragged on vertical scrollbar
+ if (terminal != null) {
+ terminal.setVerticalValue(getVerticalValue());
+ }
+ }
}
// ------------------------------------------------------------------------
*/
@Override
public boolean hasHiddenMouse() {
- return terminal.hasHiddenMouse();
+ if (terminal != null) {
+ return terminal.hasHiddenMouse();
+ }
+ return false;
}
/**
getApplication().postEvent(new TMenuEvent(TMenu.MID_REPAINT));
}
+ /**
+ * Wait for a period of time to get output from the launched process.
+ *
+ * @param millis millis to wait for, or 0 to wait forever
+ * @return true if the launched process has emitted something
+ */
+ public boolean waitForOutput(final int millis) {
+ if (terminal == null) {
+ return false;
+ }
+ return terminal.waitForOutput(millis);
+ }
+
}