svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / ui / mdiFrame / MainFrame.java @ 41080
History | View | Annotate | Download (8.52 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.andami.ui.mdiFrame; |
25 |
|
26 |
import java.awt.Frame; |
27 |
import java.awt.event.ActionListener; |
28 |
|
29 |
import javax.swing.JComponent; |
30 |
import javax.swing.JToolBar; |
31 |
|
32 |
import org.gvsig.andami.actioninfo.ActionInfo; |
33 |
import org.gvsig.andami.plugins.PluginClassLoader; |
34 |
import org.gvsig.andami.plugins.config.generate.Label; |
35 |
import org.gvsig.andami.plugins.config.generate.Menu; |
36 |
import org.gvsig.gui.beans.controls.IControl; |
37 |
|
38 |
|
39 |
|
40 |
/**
|
41 |
* This interface represents the main application's window. It allow to access
|
42 |
* the menus, the tool bars and the status bar.
|
43 |
*/
|
44 |
public interface MainFrame extends ThreadSafeDialogs { |
45 |
|
46 |
public static final String MAIN_FRAME_POS = "MDIFramePos"; |
47 |
public static final String MAIN_FRAME_SIZE = "MDIFrameSize"; |
48 |
public static final String MAIN_FRAME_EXT_STATE = "MDIFrameState"; |
49 |
|
50 |
public static final int[] MAIN_FRAME_POS_DEFAULT = { 0, 0 }; |
51 |
public static final int[] MAIN_FRAME_SIZE_DEFAULT = { 1024, 768 }; |
52 |
public static final int MAIN_FRAME_EXT_STATE_DEFAULT = Frame.MAXIMIZED_BOTH; |
53 |
|
54 |
/**
|
55 |
* Adds the provided menu to the menu bar.
|
56 |
*
|
57 |
* @param menu A Menu object containing the menu definition
|
58 |
* @param listener Object which receives the menu events
|
59 |
* @param loader ClassLoader of the plug-in that installs this menu
|
60 |
*/
|
61 |
public void addMenu(Menu menu, ActionListener listener, |
62 |
PluginClassLoader loader); |
63 |
|
64 |
public void addMenu(ActionInfo action, String text); |
65 |
|
66 |
public void addTool(final ActionInfo action, final String toolBarName); |
67 |
|
68 |
/**
|
69 |
* Changes the menu name, and thus also its location, as the name determines
|
70 |
* the location of the menu.
|
71 |
*
|
72 |
* @param menu An array of Strings which represents the full menu path,
|
73 |
* for example, {"Vista", "export", "imagen"} is a reference to the menu
|
74 |
* "Vista/export/imagen" (that is, the menu Image within the submenu
|
75 |
* View-Export). Menu names are translation keys, "Vista", "export", etc will
|
76 |
* be translated to the suitable language when they are displayed.
|
77 |
* @param newName New menu's name, in the syntax "Vista/export/symbols". Each
|
78 |
* part of the name is a translation key.
|
79 |
* @param loader ClassLoader of the plug-in that added the menu
|
80 |
*
|
81 |
* @throws NoSuchMenuException If there is no menu matching the provided
|
82 |
* menu path
|
83 |
*/
|
84 |
public void changeMenuName(String[] menu, String newName, |
85 |
PluginClassLoader loader) throws NoSuchMenuException;
|
86 |
|
87 |
/**
|
88 |
* Deletes the provided menu, if found.
|
89 |
*
|
90 |
* @param menu The menu to delete from the menu bar
|
91 |
*/
|
92 |
public void removeMenu(Menu menu); |
93 |
|
94 |
/**
|
95 |
* It checks whether each extension is enabled and visible, in order to
|
96 |
* enable/disable and show/hide their associated controls.
|
97 |
*
|
98 |
* This method is thread safe.
|
99 |
*
|
100 |
*/
|
101 |
public void enableControls(); |
102 |
|
103 |
/**
|
104 |
* This method is thread safe.
|
105 |
*
|
106 |
*/
|
107 |
public void refreshControls(); |
108 |
|
109 |
/**
|
110 |
* Gets the status bar, the bar located in the bottom part of the main window.
|
111 |
* It can be used to show messages, show progress bars, or change the status.
|
112 |
*
|
113 |
* @return The main application's status bar.
|
114 |
*/
|
115 |
public NewStatusBar getStatusBar();
|
116 |
|
117 |
/**
|
118 |
* Sets the main window title.
|
119 |
*
|
120 |
* This method is thread safe.
|
121 |
*
|
122 |
* @param titulo The title to be set in the main window
|
123 |
*/
|
124 |
public void setTitle(String titulo); |
125 |
|
126 |
/**
|
127 |
* Gets a previously added JComponent by name (including
|
128 |
* tool bars, buttons from tool bars, status bar controls
|
129 |
* and menus. For example
|
130 |
* you can use it if you need to obtain an status bar
|
131 |
* control or a JToolBar to
|
132 |
* add some customized component
|
133 |
* @param name
|
134 |
* @return the JComponent or null if none has been found
|
135 |
*/
|
136 |
public JComponent getComponentByName(String name); |
137 |
|
138 |
/**
|
139 |
* Sets the tool associated to the provided actionComand
|
140 |
* as the selected tool for the currently selected Andami window.
|
141 |
*/
|
142 |
public void setSelectedTool(String actionCommand); |
143 |
|
144 |
/**
|
145 |
* Gets an array containing all the toolbars.
|
146 |
*
|
147 |
* @return An array containing all the toolbars.
|
148 |
*/
|
149 |
public SelectableToolBar[] getToolbars(); |
150 |
|
151 |
/**
|
152 |
* Gets wheter or not this toolbar should be shown by Andami.
|
153 |
* Note that this does not reflect the actual visibility
|
154 |
* of the toolbar, because it also depends on other conditions
|
155 |
* (the toolbar should contain at lest a currently visible button).
|
156 |
*
|
157 |
* @param name The toolbar's name
|
158 |
* @return
|
159 |
*/
|
160 |
public boolean getToolbarVisibility(String name); |
161 |
|
162 |
/**
|
163 |
* Sets wheter or not this toolbar should be shown by Andami.
|
164 |
* This is useful if to hide some toolbars when they are not
|
165 |
* going to be used.
|
166 |
* If it's false, the toolbar will be
|
167 |
* hidden even if its associated extensions are visible.
|
168 |
* Note that setting visibility to true does not automatically
|
169 |
* show the toolbar, because it also depends on other conditions
|
170 |
* (the toolbar should contain at lest a currently visible button).
|
171 |
* However, it allows the toolbar to be visible when necessary
|
172 |
* conditions are fulfilled.
|
173 |
*
|
174 |
* @param name The toolbar's name.
|
175 |
* @param visibility
|
176 |
* @return
|
177 |
*/
|
178 |
public boolean setToolbarVisibility(String name, boolean visibility); |
179 |
|
180 |
/**
|
181 |
* Gets the menu entry corresponding the provided menu path.
|
182 |
*
|
183 |
* @param menuPath The menu path to the menu entry that we want to
|
184 |
* retrieve. For example, if we want to retrieve the menu entry
|
185 |
* corresponding to the XML menu "Layer/Export/Export_to_PDF" we
|
186 |
* will provide an array containing ["Layer", "Export", "Export_to_PDF"].
|
187 |
*
|
188 |
* @return The menu entry corresponding the provided menu path. Note that
|
189 |
* the menu entry may be an instance of <code>javax.swing.JMenuItem</code>,
|
190 |
* <code>javax.swing.JMenu</code> or
|
191 |
* <code>com.iver.andami.ui.mdiFrame.JMenuItem</code>.
|
192 |
*/
|
193 |
public javax.swing.JMenuItem getMenuEntry(String[] menuPath); |
194 |
|
195 |
/**
|
196 |
* Adds a control to the status bar and associate it with the
|
197 |
* provided extension. The control will be enabled and visible
|
198 |
* when the extension is enabled and visible.
|
199 |
*
|
200 |
* @param extensionClass Extension which will determine whether the
|
201 |
* control is enabled and visible.
|
202 |
* @param control The control to add.
|
203 |
*/
|
204 |
public void addStatusBarControl(Class<?> extensionClass, IControl control); |
205 |
|
206 |
/**
|
207 |
* Removes the providedcontrol from the status bar.
|
208 |
*
|
209 |
* @param name The name of the control to remove
|
210 |
*/
|
211 |
public void removeStatusBarControl(String name); |
212 |
|
213 |
/**
|
214 |
* Sets the provided label-set as the labels associated with the provided
|
215 |
* class. The labels will be visible in the status bar if the
|
216 |
* currently selected Andami window is an instance of the provided
|
217 |
* class.
|
218 |
*
|
219 |
* @param clase The class which will be associated to the label-set. The
|
220 |
* labels will be visible if the currently selected Andami window is an
|
221 |
* instance of this class.
|
222 |
*
|
223 |
* @param label An array of Labels. Each label has an ID which will be
|
224 |
* used to write text on them.
|
225 |
*/
|
226 |
public void setStatusBarLabels(Class<?> clase, Label[] label); |
227 |
|
228 |
/**
|
229 |
* Removes the labels associated with the provided class.
|
230 |
*
|
231 |
* @param clase The class whose associated labels are to be removed.
|
232 |
*/
|
233 |
public void removeStatusBarLabels(Class<?> clase); |
234 |
|
235 |
public void addToolBarControl(Class<?> extensionClass, JToolBar control, String name); |
236 |
|
237 |
/**
|
238 |
* Show the message in the status bar of the application.
|
239 |
*
|
240 |
* The types of messages are:
|
241 |
*
|
242 |
* JOptionPane.INFORMATION_MESSAGE
|
243 |
* JOptionPane.WARNING_MESSAGE
|
244 |
* JOptionPane.ERROR_MESSAGE
|
245 |
*
|
246 |
* This method is thread safe to use.
|
247 |
*
|
248 |
* @param msg to show
|
249 |
* @param messageTyoe type of message.
|
250 |
*/
|
251 |
public void message(String msg, int messageTyoe); |
252 |
|
253 |
|
254 |
|
255 |
} |