#51 wip
[nikiroo-utils.git] / examples / JexerTilingWindowManager2.java
index bef3637119b7d676ce2ecd27dbcc406979d3e074..cb7f0d0263659a4be295d7c0397f3836ce0d3098 100644 (file)
@@ -97,9 +97,16 @@ public class JexerTilingWindowManager2 extends TApplication {
                     active.getY(), active.getWidth(), active.getHeight(),
                     new TAction() {
                         public void DO() {
-                            // TODO
+                            if (source.getParent() instanceof TSplitPane) {
+                                ((TSplitPane) source.getParent()).removeSplit(source, true);
+                            } else if (source == root) {
+                                assert (root != null);
+                                root.remove();
+                                root = null;
+                            }
                         }
                     }));
+
             if (active == root) {
                 root = split;
             }
@@ -116,7 +123,13 @@ public class JexerTilingWindowManager2 extends TApplication {
                     active.getY(), active.getWidth(), active.getHeight(),
                     new TAction() {
                         public void DO() {
-                            // TODO
+                            if (source.getParent() instanceof TSplitPane) {
+                                ((TSplitPane) source.getParent()).removeSplit(source, true);
+                            } else if (source == root) {
+                                assert (root != null);
+                                root.remove();
+                                root = null;
+                            }
                         }
                     }));
             return true;
@@ -134,10 +147,9 @@ public class JexerTilingWindowManager2 extends TApplication {
             getDesktop().getWidth(), getDesktop().getHeight(),
             new TAction() {
                 public void DO() {
-                    TWidget target = (TWidget) data;
-                    if (target.getParent() instanceof TPanel) {
-                        ((TSplitPane) target.getParent().getParent()).removeSplit(target, true);
-                    } else {
+                    if (source.getParent() instanceof TSplitPane) {
+                        ((TSplitPane) source.getParent()).removeSplit(source, true);
+                    } else if (source == root) {
                         assert (root != null);
                         root.remove();
                         root = null;