List<TWidget> widgets = null;
switch (menu.getId()) {
case TMenu.MID_SPLIT_VERTICAL:
+ if (children.size() == 0) {
+ break;
+ }
panel = new TPanel(null, x, y, width, height);
pane = new TSplitPane(null, x, y, width, height, true);
widgets = new ArrayList<TWidget>(children);
assert (panel.isActive() == true);
return;
case TMenu.MID_SPLIT_HORIZONTAL:
+ if (children.size() == 0) {
+ break;
+ }
panel = new TPanel(null, x, y, width, height);
pane = new TSplitPane(null, x, y, width, height, false);
widgets = new ArrayList<TWidget>(children);
assert (window != null);
+ if (window instanceof TDesktop) {
+ // Desktop doesn't have a window border.
+ return cursorVisible;
+ }
+
// If cursor is out of my window's bounds, it is not visible.
if ((getCursorAbsoluteX() >= window.getAbsoluteX()
+ window.getWidth() - 1)
/**
* Get this TWidget's parent TApplication.
*
- * @return the parent TApplication
+ * @return the parent TApplication, or null if not assigned
*/
public TApplication getApplication() {
- return window.getApplication();
+ if (window != null) {
+ return window.getApplication();
+ }
+ return null;
}
/**
* Get the Screen.
*
- * @return the Screen
+ * @return the Screen, or null if not assigned
*/
public Screen getScreen() {
- return window.getScreen();
+ if (window != null) {
+ return window.getScreen();
+ }
+ return null;
}
/**
* Called by parent to render to TWindow. Note package private access.
*/
final void drawChildren() {
+ if (window == null) {
+ return;
+ }
+
// Set my clipping rectangle
assert (window != null);
assert (getScreen() != null);
int absoluteRightEdge = window.getAbsoluteX() + window.getWidth();
int absoluteBottomEdge = window.getAbsoluteY() + window.getHeight();
- if (!(this instanceof TWindow) && !(this instanceof TVScroller)) {
+ if (!(this instanceof TWindow)
+ && !(this instanceof TVScroller)
+ && !(parent instanceof TDesktop)
+ ) {
absoluteRightEdge -= 1;
}
- if (!(this instanceof TWindow) && !(this instanceof THScroller)) {
+ if (!(this instanceof TWindow)
+ && !(this instanceof THScroller)
+ && !(parent instanceof TDesktop)
+ ) {
absoluteBottomEdge -= 1;
}
int myRightEdge = getAbsoluteX() + width;