small ui enhencements
authorNiki Roo <niki@nikiroo.be>
Thu, 7 May 2020 20:18:26 +0000 (22:18 +0200)
committerNiki Roo <niki@nikiroo.be>
Thu, 7 May 2020 20:18:26 +0000 (22:18 +0200)
src/be/nikiroo/utils/ui/BreadCrumbsBar.java
src/be/nikiroo/utils/ui/UIUtils.java
src/be/nikiroo/utils/ui/ZoomBox.java

index da382f9ceaeb9ef8c5638dca51c09576db75a79d..ed7e0bb0f9012d710ea113c9064117ec09c0759a 100644 (file)
@@ -39,11 +39,12 @@ public class BreadCrumbsBar<T> extends ListenerPanel {
                                                }
                                        }
                                });
-                               
+
                                this.add(button, BorderLayout.CENTER);
                        }
 
-                       if (!node.getChildren().isEmpty()) {
+                       if ((node.isRoot() && node.getChildren().isEmpty())
+                                       || !node.getChildren().isEmpty()) {
                                // TODO allow an image or ">", viewer
                                down = new JToggleButton(">");
                                final JPopupMenu popup = new JPopupMenu();
@@ -112,6 +113,8 @@ public class BreadCrumbsBar<T> extends ListenerPanel {
                        }
                });
 
+               setSelectedNode(new DataNode<T>(null, null));
+
                new SwingWorker<DataNode<T>, Void>() {
                        @Override
                        protected DataNode<T> doInBackground() throws Exception {
@@ -122,7 +125,10 @@ public class BreadCrumbsBar<T> extends ListenerPanel {
                        @Override
                        protected void done() {
                                try {
-                                       node = get();
+                                       DataNode<T> node = get();
+
+                                       setSelectedNode(null);
+                                       BreadCrumbsBar.this.node = node;
                                        addCrumb(node);
 
                                        // TODO: option?
index c7fcf623cd01274d60716658eabcc27a7b46a626..6c4038977d9ed001934944128c8632dbb6dfe301 100644 (file)
@@ -107,9 +107,9 @@ public class UIUtils {
         * @param color
         *            the base colour
         * @param x
-        *            the X coordinate
+        *            the X coordinate of the upper left corner
         * @param y
-        *            the Y coordinate
+        *            the Y coordinate of the upper left corner
         * @param width
         *            the width radius
         * @param height
index c2a7e13d50400059335d328aff5fe74b48ceaa19..a8f96095928a8a9dba8a92fde829f6e31019f817 100644 (file)
@@ -179,7 +179,7 @@ public class ZoomBox extends ListenerPanel {
                });
 
                zoomLabel = new JLabel();
-               zoomLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+               zoomLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
 
                setIcons(null, null, null, null);
                setOrientation(vertical);