cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skolbac...@apache.org
Subject cayenne git commit: redesign filter and collapse buttons
Date Thu, 04 Jun 2015 14:36:16 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master b9f15e7fb -> ec150004d


redesign filter and collapse buttons


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

Branch: refs/heads/master
Commit: ec150004d0be944d1112af87a33834c1f82eb4a9
Parents: b9f15e7
Author: Savva Kolbachev <s.kolbachev@gmail.com>
Authored: Thu Jun 4 17:35:56 2015 +0300
Committer: Savva Kolbachev <s.kolbachev@gmail.com>
Committed: Thu Jun 4 17:35:56 2015 +0300

----------------------------------------------------------------------
 .../modeler/dialog/datadomain/FilterDialog.java | 30 +++++------
 .../cayenne/modeler/editor/EditorView.java      | 12 +++--
 .../modeler/util/StayOpenJCheckBoxMenuItem.java | 56 --------------------
 3 files changed, 22 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/ec150004/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/FilterDialog.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/FilterDialog.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/FilterDialog.java
index cef6bee..6ffaa1f 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/FilterDialog.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/FilterDialog.java
@@ -19,9 +19,9 @@
 package org.apache.cayenne.modeler.dialog.datadomain;
 
 import org.apache.cayenne.modeler.ProjectController;
-import org.apache.cayenne.modeler.util.StayOpenJCheckBoxMenuItem;
 import org.apache.cayenne.swing.BindingBuilder;
 
+import javax.swing.JCheckBox;
 import javax.swing.JPopupMenu;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -31,12 +31,12 @@ public class FilterDialog extends JPopupMenu {
 	
 	private String SHOW_ALL = "Show all";
 	
-	private StayOpenJCheckBoxMenuItem dbEntity;
-	private StayOpenJCheckBoxMenuItem objEntity;
-	private StayOpenJCheckBoxMenuItem embeddable;
-	private StayOpenJCheckBoxMenuItem procedure;
-	private StayOpenJCheckBoxMenuItem query;
-	private StayOpenJCheckBoxMenuItem all;
+	private JCheckBox dbEntity;
+	private JCheckBox objEntity;
+	private JCheckBox embeddable;
+	private JCheckBox procedure;
+	private JCheckBox query;
+	private JCheckBox all;
 	private ProjectController eventController;
 	private FilterController filterController;
 	
@@ -102,13 +102,13 @@ public class FilterDialog extends JPopupMenu {
 	}
 	
 	public void initView(){
-		
-		all = new StayOpenJCheckBoxMenuItem(SHOW_ALL);
-		dbEntity = new StayOpenJCheckBoxMenuItem("DbEntity");
-		objEntity = new StayOpenJCheckBoxMenuItem("ObjEntity");
-		embeddable = new StayOpenJCheckBoxMenuItem("Embeddable");
-		procedure = new StayOpenJCheckBoxMenuItem("Procedure");
-		query = new StayOpenJCheckBoxMenuItem("Query");
+
+		all = new JCheckBox(SHOW_ALL);
+		dbEntity = new JCheckBox("DbEntity");
+		objEntity = new JCheckBox("ObjEntity");
+		embeddable = new JCheckBox("Embeddable");
+		procedure = new JCheckBox("Procedure");
+		query = new JCheckBox("Query");
 
 		add(all);
 		addSeparator();
@@ -188,7 +188,7 @@ public class FilterDialog extends JPopupMenu {
 
 		@Override
 		public void actionPerformed(ActionEvent e) {
-			filterController.getFilterMap().put(key, ((StayOpenJCheckBoxMenuItem) e.getSource()).isSelected());
+			filterController.getFilterMap().put(key, ((JCheckBox) e.getSource()).isSelected());
 			filterController.getTreeModel().setFiltered(filterController.getFilterMap());
             filterController.getTree().updateUI();
             checkAllStates();

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ec150004/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java
index 8fbd9e9..72a42ac 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java
@@ -55,6 +55,7 @@ import org.apache.commons.logging.LogFactory;
 
 import javax.swing.Action;
 import javax.swing.BorderFactory;
+import javax.swing.Box;
 import javax.swing.JButton;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
@@ -63,11 +64,10 @@ import javax.swing.JTabbedPane;
 import javax.swing.JToolBar;
 import java.awt.BorderLayout;
 import java.awt.CardLayout;
-import java.awt.Color;
 import java.awt.Component;
+import java.awt.ComponentOrientation;
 import java.awt.Container;
 import java.awt.Dimension;
-import java.awt.FlowLayout;
 
 /**
  * Main display area split into the project navigation tree on the left and selected
@@ -189,10 +189,12 @@ public class EditorView extends JPanel implements ObjEntityDisplayListener,
 
         JToolBar barPanel = new JToolBar();
         barPanel.setMinimumSize(new Dimension(75, 25));
-        barPanel.setLayout(new FlowLayout(FlowLayout.TRAILING, 1, 0));
-        barPanel.add(collapseButton);
+        barPanel.setBorder(BorderFactory.createEtchedBorder());
+        barPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        barPanel.add(Box.createHorizontalStrut(3));
         barPanel.add(filterButton);
-        barPanel.setBorder(BorderFactory.createLineBorder(Color.gray));
+        barPanel.addSeparator();
+        barPanel.add(collapseButton);
 
         treePanel = new ProjectTreeView(eventController);
         treePanel.setMinimumSize(new Dimension(75, 180));

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ec150004/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/StayOpenJCheckBoxMenuItem.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/StayOpenJCheckBoxMenuItem.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/StayOpenJCheckBoxMenuItem.java
deleted file mode 100644
index 5abd75d..0000000
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/StayOpenJCheckBoxMenuItem.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-
-package org.apache.cayenne.modeler.util;
-
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.MenuElement;
-import javax.swing.MenuSelectionManager;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-public class StayOpenJCheckBoxMenuItem extends JCheckBoxMenuItem {
-
-    private static MenuElement[] path;
-
-    {
-        getModel().addChangeListener(new ChangeListener() {
-            @Override
-            public void stateChanged(ChangeEvent e) {
-                if (getModel().isArmed() && isShowing()) {
-                    path = MenuSelectionManager.defaultManager().getSelectedPath();
-                }
-            }
-        });
-    }
-
-    public StayOpenJCheckBoxMenuItem(String text) {
-        super(text);
-    }
-
-    @Override
-    public void doClick(int pressTime) {
-        super.doClick(pressTime);
-        MenuSelectionManager.defaultManager().setSelectedPath(path);
-
-        if (!getParent().isVisible()) {
-            getParent().setVisible(true);
-        }
-    }
-}
\ No newline at end of file


Mime
View raw message