Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
NavigatorPane |
|
| 1.5;1.5 |
1 | /* $Id: NavigatorPane.java 18817 2010-10-27 15:52:25Z tfmorris $ | |
2 | ***************************************************************************** | |
3 | * Copyright (c) 2009 Contributors - see below | |
4 | * All rights reserved. This program and the accompanying materials | |
5 | * are made available under the terms of the Eclipse Public License v1.0 | |
6 | * which accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * mvw | |
11 | ***************************************************************************** | |
12 | * | |
13 | * Some portions of this file was previously release using the BSD License: | |
14 | */ | |
15 | ||
16 | // Copyright (c) 1996-2007 The Regents of the University of California. All | |
17 | // Rights Reserved. Permission to use, copy, modify, and distribute this | |
18 | // software and its documentation without fee, and without a written | |
19 | // agreement is hereby granted, provided that the above copyright notice | |
20 | // and this paragraph appear in all copies. This software program and | |
21 | // documentation are copyrighted by The Regents of the University of | |
22 | // California. The software program and documentation are supplied "AS | |
23 | // IS", without any accompanying services from The Regents. The Regents | |
24 | // does not warrant that the operation of the program will be | |
25 | // uninterrupted or error-free. The end-user understands that the program | |
26 | // was developed for research purposes and is advised not to rely | |
27 | // exclusively on the program for any reason. IN NO EVENT SHALL THE | |
28 | // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, | |
29 | // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, | |
30 | // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF | |
31 | // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF | |
32 | // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY | |
33 | // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
34 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE | |
35 | // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF | |
36 | // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, | |
37 | // UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
38 | ||
39 | package org.argouml.ui; | |
40 | ||
41 | import java.awt.BorderLayout; | |
42 | import java.awt.Dimension; | |
43 | import java.util.ArrayList; | |
44 | import java.util.Collection; | |
45 | ||
46 | import javax.swing.JComboBox; | |
47 | import javax.swing.JPanel; | |
48 | import javax.swing.JScrollPane; | |
49 | import javax.swing.JToolBar; | |
50 | ||
51 | import org.argouml.i18n.Translator; | |
52 | import org.argouml.taskmgmt.ProgressMonitor; | |
53 | import org.argouml.ui.explorer.ActionPerspectiveConfig; | |
54 | import org.argouml.ui.explorer.DnDExplorerTree; | |
55 | import org.argouml.ui.explorer.ExplorerTree; | |
56 | import org.argouml.ui.explorer.ExplorerTreeModel; | |
57 | import org.argouml.ui.explorer.NameOrder; | |
58 | import org.argouml.ui.explorer.PerspectiveComboBox; | |
59 | import org.argouml.ui.explorer.PerspectiveManager; | |
60 | import org.argouml.ui.explorer.TypeThenNameOrder; | |
61 | import org.tigris.toolbar.ToolBarFactory; | |
62 | ||
63 | /** | |
64 | * The upper-left pane of the main ArgoUML window, contains a tree view | |
65 | * of the UML model. Currently named "Explorer" instead of "Navigator".<p> | |
66 | * | |
67 | * The model can be viewed from different tree "Perspectives".<p> | |
68 | * | |
69 | * Perspectives are now built in the Perspective Manager.<p> | |
70 | */ | |
71 | class NavigatorPane | |
72 | extends JPanel { | |
73 | ||
74 | /** | |
75 | * Constructs a new navigator panel.<p> | |
76 | * | |
77 | * This panel consists of a Combobox to select a navigation | |
78 | * perspective, a combobox to select ordering, | |
79 | * a JTree to display the UML model, | |
80 | * and a configuration dialog to tailor the perspectives. | |
81 | * | |
82 | * @param splash The splash screen where to show progress. | |
83 | * @deprecated for 0.31.7 by tfmorris. | |
84 | * Use {@link NavigatorPane#NavigatorPane(ProgressMonitor)}. | |
85 | */ | |
86 | @Deprecated | |
87 | public NavigatorPane(SplashScreen splash) { | |
88 | 900 | this(splash, null); |
89 | 900 | } |
90 | ||
91 | /** | |
92 | * Construct a new navigator panel.<p> | |
93 | * | |
94 | * This panel consists of a Combobox to select a navigation | |
95 | * perspective, a combobox to select ordering, | |
96 | * a JTree to display the UML model, | |
97 | * and a configuration dialog to tailor the perspectives. | |
98 | * | |
99 | * @param pm ProgressMonitor to receive progress updates. May be null. | |
100 | */ | |
101 | @Deprecated | |
102 | public NavigatorPane(ProgressMonitor pm) { | |
103 | 0 | this(null, pm); |
104 | 0 | } |
105 | ||
106 | /** | |
107 | * Constructs a new navigator panel.<p> | |
108 | * | |
109 | * This panel consists of a Combobox to select a navigation | |
110 | * perspective, a combobox to select ordering, | |
111 | * a JTree to display the UML model, | |
112 | * and a configuration dialog to tailor the perspectives. | |
113 | * | |
114 | * @param splash The splash screen where to show progress. | |
115 | */ | |
116 | 900 | private NavigatorPane(SplashScreen splash, ProgressMonitor pm) { |
117 | ||
118 | 900 | JComboBox perspectiveCombo = new PerspectiveComboBox(); |
119 | 900 | JComboBox orderByCombo = new JComboBox(); |
120 | 900 | ExplorerTree tree = new DnDExplorerTree(); |
121 | ||
122 | 900 | Collection<Object> toolbarTools = new ArrayList<Object>(); |
123 | 900 | toolbarTools.add(new ActionPerspectiveConfig()); |
124 | 900 | toolbarTools.add(perspectiveCombo); |
125 | 900 | JToolBar toolbar = (new ToolBarFactory(toolbarTools)).createToolBar(); |
126 | 900 | toolbar.setFloatable(false); |
127 | ||
128 | 900 | orderByCombo.addItem(new TypeThenNameOrder()); |
129 | 900 | orderByCombo.addItem(new NameOrder()); |
130 | ||
131 | 900 | Collection<Object> toolbarTools2 = new ArrayList<Object>(); |
132 | 900 | toolbarTools2.add(orderByCombo); |
133 | 900 | JToolBar toolbar2 = (new ToolBarFactory(toolbarTools2)).createToolBar(); |
134 | 900 | toolbar2.setFloatable(false); |
135 | ||
136 | 900 | JPanel toolbarpanel = new JPanel(); |
137 | 900 | toolbarpanel.setLayout(new BorderLayout()); |
138 | 900 | toolbarpanel.add(toolbar, BorderLayout.NORTH); |
139 | 900 | toolbarpanel.add(toolbar2, BorderLayout.SOUTH); |
140 | ||
141 | 900 | setLayout(new BorderLayout()); |
142 | 900 | add(toolbarpanel, BorderLayout.NORTH); |
143 | 900 | add(new JScrollPane(tree), BorderLayout.CENTER); |
144 | ||
145 | 900 | if (splash != null) { |
146 | 0 | splash.getStatusBar().showStatus(Translator.localize( |
147 | "statusmsg.bar.making-navigator-pane-perspectives")); | |
148 | 0 | splash.getStatusBar().showProgress(25); |
149 | 900 | } else if (pm != null) { |
150 | 0 | pm.updateSubTask(Translator.localize( |
151 | "statusmsg.bar.making-navigator-pane-perspectives")); | |
152 | 0 | pm.updateProgress(25); |
153 | } | |
154 | ||
155 | 900 | perspectiveCombo.addItemListener((ExplorerTreeModel) tree.getModel()); |
156 | 900 | orderByCombo.addItemListener((ExplorerTreeModel) tree.getModel()); |
157 | 900 | PerspectiveManager.getInstance().loadUserPerspectives(); |
158 | 900 | } |
159 | ||
160 | /* | |
161 | * @see java.awt.Component#getMinimumSize() | |
162 | * | |
163 | * sets minimum size to 120,100 | |
164 | */ | |
165 | public Dimension getMinimumSize() { | |
166 | 0 | return new Dimension(120, 100); |
167 | } | |
168 | ||
169 | /** | |
170 | * The UID. | |
171 | */ | |
172 | private static final long serialVersionUID = 8403903607517813289L; | |
173 | } /* end class NavigatorPane */ |