Statistics
| Revision:

root / branches / v2_0_0_prep / frameworks / _fwAndami / src / org / gvsig / andami / ui / mdiFrame / MainFrame.java @ 38608

History | View | Annotate | Download (7.7 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.event.ActionListener;
44

    
45
import javax.swing.JComponent;
46

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

    
52

    
53

    
54
/**
55
 * This interface represents the main application's window. It allow to access
56
 * the menus, the tool bars and the status bar. 
57
 */
58
public interface MainFrame {
59
        /**
60
         * Adds the provided menu to the menu bar.
61
         *
62
         * @param menu A Menu object containing the menu definition
63
         * @param listener Object which receives the menu events
64
         * @param loader ClassLoader of the plug-in that installs this menu
65
         */
66
        public void addMenu(Menu menu, ActionListener listener,
67
                PluginClassLoader loader);
68

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

    
88
        /**
89
         * Deletes the provided menu, if found.
90
         *
91
         * @param menu The menu to delete from the menu bar
92
         */
93
        public void removeMenu(Menu menu);
94

    
95
        /**
96
         * It checks whether each extension is enabled and visible, in order to
97
         * enable/disable and show/hide their associated controls.
98
         */
99
        public void enableControls();
100
        
101
        public void refreshControls();
102

    
103
        /**
104
         * Gets the status bar, the bar located in the bottom part of the main window.
105
         * It can be used to show messages, show progress bars, or change the status.
106
         *
107
         * @return The main application's status bar.
108
         */
109
        public NewStatusBar getStatusBar();
110

    
111
        /**
112
         * Sets the main window title.
113
         *
114
         * @param titulo The title to be set in the main window
115
         */
116
        public void setTitle(String titulo);
117

    
118
    /**
119
     * Gets a previously added JComponent by name (including
120
     * tool bars, buttons from tool bars, status bar controls
121
     * and menus. For example
122
     * you can use it if you need to obtain an status bar
123
     * control or a JToolBar to
124
     * add some customized component
125
     * @param name
126
     * @return the JComponent or null if none has been found
127
     */
128
    public JComponent getComponentByName(String name);
129

    
130
    /**
131
     * Sets the tool associated to the provided actionComand
132
     * as the selected tool for the currently selected Andami window.
133
     */
134
    public void setSelectedTool(String actionCommand);
135
    
136
    /**
137
     * Gets an array containing all the toolbars.
138
     * 
139
     * @return An array containing all the toolbars.
140
     */
141
    public SelectableToolBar[] getToolbars();
142
    
143
    /**
144
     * Gets wheter or not this toolbar should be shown by Andami.
145
     * Note that this does not reflect the actual visibility
146
     * of the toolbar, because it also depends on other conditions
147
     * (the toolbar should contain at lest a currently visible button).
148
     * 
149
     * @param name The toolbar's name
150
     * @return
151
     */
152
    public boolean getToolbarVisibility(String name);
153
    
154
    /**
155
     * Sets wheter or not this toolbar should be shown by Andami.
156
     * This is useful if to hide some toolbars when they are not
157
     * going to be used.
158
     * If it's false, the toolbar will be
159
     * hidden even if its associated extensions are visible.
160
     * Note that setting visibility to true does not automatically
161
     * show the toolbar, because it also depends on other conditions
162
     * (the toolbar should contain at lest a currently visible button).
163
     * However, it allows the toolbar to be visible when necessary
164
     * conditions are fulfilled.
165
     * 
166
     * @param name The toolbar's name.
167
     * @param visibility
168
     * @return
169
     */
170
    public boolean setToolbarVisibility(String name, boolean visibility);
171

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

    
220
        /**
221
         * Removes the labels associated with the provided class.
222
         * 
223
         * @param clase The class whose associated labels are to be removed.
224
         */
225
        public void removeStatusBarLabels(Class clase);
226

    
227
        public void messageDialog(String message, String title, int messageType);
228
        
229
        public void messageDialog(String message, String messageArgs[], String title, int messageType);
230
}