Statistics
| Revision:

svn-gvsig-desktop / tags / v2_0_0_Build_2060 / frameworks / _fwAndami / src / org / gvsig / andami / ui / mdiFrame / MainFrame.java @ 39339

History | View | Annotate | Download (8.61 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.andami.ui.mdiFrame;
42

    
43
import java.awt.Frame;
44
import java.awt.event.ActionListener;
45

    
46
import javax.swing.JComponent;
47
import javax.swing.JToolBar;
48

    
49
import org.gvsig.andami.plugins.PluginClassLoader;
50
import org.gvsig.andami.plugins.config.generate.Label;
51
import org.gvsig.andami.plugins.config.generate.Menu;
52
import org.gvsig.gui.beans.controls.IControl;
53

    
54

    
55

    
56
/**
57
 * This interface represents the main application's window. It allow to access
58
 * the menus, the tool bars and the status bar. 
59
 */
60
public interface MainFrame extends ThreadSafeDialogs {
61
    
62
    public static final String MAIN_FRAME_POS = "MDIFramePos";
63
    public static final String MAIN_FRAME_SIZE = "MDIFrameSize";
64
    public static final String MAIN_FRAME_EXT_STATE = "MDIFrameState";
65
    
66
    public static final int[] MAIN_FRAME_POS_DEFAULT = { 0, 0 };
67
    public static final int[] MAIN_FRAME_SIZE_DEFAULT = { 1024, 768 };
68
    public static final int MAIN_FRAME_EXT_STATE_DEFAULT = Frame.MAXIMIZED_BOTH;
69

    
70
        /**
71
         * Adds the provided menu to the menu bar.
72
         *
73
         * @param menu A Menu object containing the menu definition
74
         * @param listener Object which receives the menu events
75
         * @param loader ClassLoader of the plug-in that installs this menu
76
         */
77
        public void addMenu(Menu menu, ActionListener listener,
78
                PluginClassLoader loader);
79

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

    
99
        /**
100
         * Deletes the provided menu, if found.
101
         *
102
         * @param menu The menu to delete from the menu bar
103
         */
104
        public void removeMenu(Menu menu);
105

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

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

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

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

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

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

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

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

    
266

    
267
}