cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject [43/50] cayenne-modeler git commit: More helper methods to make it easier to show/hide Nodes.
Date Thu, 05 Jan 2017 22:09:51 GMT
More helper methods to make it easier to show/hide Nodes.


Project: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/commit/5d38ee6c
Tree: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/tree/5d38ee6c
Diff: http://git-wip-us.apache.org/repos/asf/cayenne-modeler/diff/5d38ee6c

Branch: refs/heads/master
Commit: 5d38ee6c39116837e88d729253e0697efd36b597
Parents: 5b78560
Author: mrg <blacknext@gmail.com>
Authored: Sat Oct 15 12:34:33 2016 -0400
Committer: mrg <blacknext@gmail.com>
Committed: Sat Oct 15 12:34:33 2016 -0400

----------------------------------------------------------------------
 .../modeler/layout/AbstractViewLayout.java      | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne-modeler/blob/5d38ee6c/src/main/java/org/apache/cayenne/modeler/layout/AbstractViewLayout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/cayenne/modeler/layout/AbstractViewLayout.java b/src/main/java/org/apache/cayenne/modeler/layout/AbstractViewLayout.java
index 7e08890..28707fd 100644
--- a/src/main/java/org/apache/cayenne/modeler/layout/AbstractViewLayout.java
+++ b/src/main/java/org/apache/cayenne/modeler/layout/AbstractViewLayout.java
@@ -20,10 +20,12 @@
 package org.apache.cayenne.modeler.layout;
 
 import java.io.IOException;
+import java.util.Arrays;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javafx.scene.Node;
 import javafx.scene.layout.AnchorPane;
 
 public abstract class AbstractViewLayout
@@ -48,6 +50,27 @@ public abstract class AbstractViewLayout
         displayView(destination, source);
     }
 
+    public void setVisibility(final Node item, final boolean state)
+    {
+        item.setVisible(state);
+        item.setManaged(state);
+    }
+
+    public void setVisibility(final Node[] items, final boolean state)
+    {
+        Arrays.stream(items).forEach(item -> setVisibility(item, state));
+    }
+
+    public void show(final Node... items)
+    {
+        setVisibility(items, true);
+    }
+
+    public void hide(final Node... items)
+    {
+        setVisibility(items, false);
+    }
+
     @Override
     public MainWindowLayout getMainWindow()
     {


Mime
View raw message