Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / ui / mdiFrame / MainFrame.java @ 42351

History | View | Annotate | Download (8.95 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
import java.util.Locale;
29

    
30
import javax.swing.JComponent;
31
import javax.swing.JToolBar;
32

    
33
import org.gvsig.andami.actioninfo.ActionInfo;
34
import org.gvsig.andami.plugins.PluginClassLoader;
35
import org.gvsig.andami.plugins.config.generate.Label;
36
import org.gvsig.andami.plugins.config.generate.Menu;
37
import org.gvsig.gui.beans.controls.IControl;
38

    
39

    
40

    
41
/**
42
 * This interface represents the main application's window. It allow to access
43
 * the menus, the tool bars and the status bar. 
44
 */
45
public interface MainFrame extends ThreadSafeDialogs {
46
    
47
    public static final String MAIN_FRAME_POS = "MDIFramePos";
48
    public static final String MAIN_FRAME_SIZE = "MDIFrameSize";
49
    public static final String MAIN_FRAME_EXT_STATE = "MDIFrameState";
50
    
51
    public static final int[] MAIN_FRAME_POS_DEFAULT = { 0, 0 };
52
    public static final int[] MAIN_FRAME_SIZE_DEFAULT = { 1024, 768 };
53
    public static final int MAIN_FRAME_EXT_STATE_DEFAULT = Frame.MAXIMIZED_BOTH;
54

    
55
        /**
56
         * Adds the provided menu to the menu bar.
57
         *
58
         * @param menu A Menu object containing the menu definition
59
         * @param listener Object which receives the menu events
60
         * @param loader ClassLoader of the plug-in that installs this menu
61
         */
62
        public void addMenu(Menu menu, ActionListener listener,
63
                PluginClassLoader loader);
64

    
65
        public void addMenu(ActionInfo action, String text);
66

    
67
        public void addTool(final ActionInfo action, final String toolBarName, final String dropDownName);
68
        
69
        public void addTool(final ActionInfo action, final String toolBarName);
70
        
71
        public void addTool(final ActionInfo action, final String toolBarName, final boolean useText);
72
        
73
        public void addSelectableTool(final ActionInfo action, final String toolBarName, final String groupName, final boolean useText);
74
        
75

    
76
        /**
77
         * Changes the menu name, and thus also its location, as the name determines
78
         * the location of the menu. 
79
         *
80
         * @param menu An array of Strings which represents the full menu path,
81
         * for example, {"Vista", "export", "imagen"} is a reference to the menu
82
         * "Vista/export/imagen" (that is, the menu Image within the submenu
83
         * View-Export). Menu names are translation keys, "Vista", "export", etc will
84
         * be translated to the suitable language when they are displayed.
85
         * @param newName New menu's name, in the syntax "Vista/export/symbols". Each
86
         * part of the name is a translation key.
87
         * @param loader ClassLoader of the plug-in that added the menu
88
         *
89
         * @throws NoSuchMenuException If there is no menu matching the provided
90
         * menu path
91
         */
92
        public void changeMenuName(String[] menu, String newName,
93
                PluginClassLoader loader) throws NoSuchMenuException;
94

    
95
        /**
96
         * Deletes the provided menu, if found.
97
         *
98
         * @param menu The menu to delete from the menu bar
99
         */
100
        public void removeMenu(Menu menu);
101

    
102
        /**
103
         * It checks whether each extension is enabled and visible, in order to
104
         * enable/disable and show/hide their associated controls.
105
         * 
106
         * This method is thread safe.
107
         * 
108
         */
109
        public void enableControls();
110
        
111
        /**
112
         * This method is thread safe.
113
         * 
114
         */
115
        public void refreshControls();
116

    
117
        /**
118
         * Gets the status bar, the bar located in the bottom part of the main window.
119
         * It can be used to show messages, show progress bars, or change the status.
120
         *
121
         * @return The main application's status bar.
122
         */
123
        public NewStatusBar getStatusBar();
124

    
125
        /**
126
         * Sets the main window title.
127
         *
128
         * This method is thread safe.
129
         * 
130
         * @param titulo The title to be set in the main window
131
         */
132
        public void setTitle(String titulo);
133

    
134
    /**
135
     * Gets a previously added JComponent by name (including
136
     * tool bars, buttons from tool bars, status bar controls
137
     * and menus. For example
138
     * you can use it if you need to obtain an status bar
139
     * control or a JToolBar to
140
     * add some customized component
141
     * @param name
142
     * @return the JComponent or null if none has been found
143
     */
144
    public JComponent getComponentByName(String name);
145

    
146
    /**
147
     * Sets the tool associated to the provided actionComand
148
     * as the selected tool for the currently selected Andami window.
149
     */
150
    public void setSelectedTool(String actionCommand);
151
    
152
    /**
153
     * Gets an array containing all the toolbars.
154
     * 
155
     * @return An array containing all the toolbars.
156
     */
157
    public SelectableToolBar[] getToolbars();
158
    
159
    /**
160
     * Gets wheter or not this toolbar should be shown by Andami.
161
     * Note that this does not reflect the actual visibility
162
     * of the toolbar, because it also depends on other conditions
163
     * (the toolbar should contain at lest a currently visible button).
164
     * 
165
     * @param name The toolbar's name
166
     * @return
167
     */
168
    public boolean getToolbarVisibility(String name);
169
    
170
    /**
171
     * Sets wheter or not this toolbar should be shown by Andami.
172
     * This is useful if to hide some toolbars when they are not
173
     * going to be used.
174
     * If it's false, the toolbar will be
175
     * hidden even if its associated extensions are visible.
176
     * Note that setting visibility to true does not automatically
177
     * show the toolbar, because it also depends on other conditions
178
     * (the toolbar should contain at lest a currently visible button).
179
     * However, it allows the toolbar to be visible when necessary
180
     * conditions are fulfilled.
181
     * 
182
     * @param name The toolbar's name.
183
     * @param visibility
184
     * @return
185
     */
186
    public boolean setToolbarVisibility(String name, boolean visibility);
187

    
188
    /**
189
     * Gets the menu entry corresponding the provided menu path.
190
     * 
191
     * @param menuPath The menu path to the menu entry that we want to
192
     * retrieve. For example, if we want to retrieve the menu entry
193
     * corresponding to the XML menu "Layer/Export/Export_to_PDF" we
194
     * will provide an array containing ["Layer", "Export", "Export_to_PDF"].
195
     * 
196
     * @return The menu entry corresponding the provided menu path. Note that
197
     * the menu entry may be an instance of <code>javax.swing.JMenuItem</code>,
198
     * <code>javax.swing.JMenu</code> or
199
     * <code>com.iver.andami.ui.mdiFrame.JMenuItem</code>.
200
     */
201
    public javax.swing.JMenuItem getMenuEntry(String[] menuPath);
202
    
203
        /**
204
         * Adds a control to the status bar and associate it with the
205
         * provided extension. The control will be enabled and visible
206
         * when the extension is enabled and visible.
207
         * 
208
         * @param extensionClass Extension which will determine whether the
209
         * control is enabled and visible.
210
         * @param control The control to add.
211
         */
212
        public void addStatusBarControl(Class<?> extensionClass, IControl control);
213
        
214
        /**
215
         * Removes the providedcontrol from the status bar.
216
         * 
217
         * @param name The name of the control to remove
218
         */
219
        public void removeStatusBarControl(String name);
220
        
221
        /**
222
         * Sets the provided label-set as the labels associated with the provided
223
         * class. The labels will be visible in the status bar if the
224
         * currently selected Andami window is an instance of the provided
225
         * class.
226
         * 
227
         * @param clase The class which will be associated to the label-set. The
228
         * labels will be visible if the currently selected Andami window is an
229
         * instance of this class.
230
         * 
231
         * @param label An array of Labels. Each label has an ID which will be
232
         * used to write text on them.
233
         */
234
        public void setStatusBarLabels(Class<?> clase, Label[] label);
235

    
236
        /**
237
         * Removes the labels associated with the provided class.
238
         * 
239
         * @param clase The class whose associated labels are to be removed.
240
         */
241
        public void removeStatusBarLabels(Class<?> clase);
242
        
243
        public void addToolBarControl(Class<?> extensionClass, JToolBar control, String name);
244

    
245
        /**
246
         * Show the message in the status bar of the application.
247
         * 
248
         * The types of messages are:
249
         * 
250
         * JOptionPane.INFORMATION_MESSAGE
251
         * JOptionPane.WARNING_MESSAGE
252
         * JOptionPane.ERROR_MESSAGE
253
         * 
254
         * This method is thread safe to use.
255
         * 
256
         * @param msg to show
257
         * @param messageTyoe type of message.
258
         */
259
        public void message(String msg, int messageTyoe);
260
        
261
        public void setLocale(Locale locale);
262

    
263
}