Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / frameworks / _fwAndami / src / org / gvsig / andami / ui / mdiFrame / MainFrame.java @ 38611

History | View | Annotate | Download (7.81 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
import javax.swing.JToolBar;
47

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

    
53

    
54

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

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

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

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

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

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

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

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

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

    
221
        /**
222
         * Removes the labels associated with the provided class.
223
         * 
224
         * @param clase The class whose associated labels are to be removed.
225
         */
226
        public void removeStatusBarLabels(Class clase);
227
        
228
        public void addToolBarControl(Class extensionClass, JToolBar control, String name);
229

    
230
        public void messageDialog(String message, String title, int messageType);
231
        
232
        public void messageDialog(String message, String messageArgs[], String title, int messageType);
233
}