misc cleanup
[fanfix.git] / src / jexer / TWidget.java
index 2a92d09d25c429a6afe916f80f055a54156e5a2e..d6864db746316659ef5d3ed4fed3cc76b0934d6a 100644 (file)
@@ -547,6 +547,21 @@ public abstract class TWidget implements Comparable<TWidget> {
         this(parent, true);
     }
 
+    /**
+     * Protected constructor.
+     *
+     * @param parent parent widget
+     * @param x column relative to parent
+     * @param y row relative to parent
+     * @param width width of widget
+     * @param height height of widget
+     */
+    protected TWidget(final TWidget parent, final int x, final int y,
+        final int width, final int height) {
+
+        this(parent, true, x, y, width, height);
+    }
+
     /**
      * Protected constructor used by subclasses that are disabled by default.
      *
@@ -561,6 +576,31 @@ public abstract class TWidget implements Comparable<TWidget> {
         parent.addChild(this);
     }
 
+    /**
+     * Protected constructor used by subclasses that are disabled by default.
+     *
+     * @param parent parent widget
+     * @param enabled if true assume enabled
+     * @param x column relative to parent
+     * @param y row relative to parent
+     * @param width width of widget
+     * @param height height of widget
+     */
+    protected TWidget(final TWidget parent, final boolean enabled,
+        final int x, final int y, final int width, final int height) {
+
+        this.enabled = enabled;
+        this.parent = parent;
+        this.window = parent.window;
+        children = new LinkedList<TWidget>();
+        parent.addChild(this);
+
+        this.x = x;
+        this.y = y;
+        this.width = width;
+        this.height = height;
+    }
+
     /**
      * Add a child widget to my list of children.  We set its tabOrder to 0
      * and increment the tabOrder of all other children.
@@ -723,7 +763,7 @@ public abstract class TWidget implements Comparable<TWidget> {
         if ((children.size() == 0)
             // TODO
             // || (cast(TTreeView)this)
-            // || (cast(TText)this)
+            || (this instanceof TText)
         ) {
 
             // Defaults: