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 @ 41314

History | View | Annotate | Download (8.59 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);
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
         * This method is thread safe.
100
         * 
101
         */
102
        public void enableControls();
103
        
104
        /**
105
         * This method is thread safe.
106
         * 
107
         */
108
        public void refreshControls();
109

    
110
        /**
111
         * Gets the status bar, the bar located in the bottom part of the main window.
112
         * It can be used to show messages, show progress bars, or change the status.
113
         *
114
         * @return The main application's status bar.
115
         */
116
        public NewStatusBar getStatusBar();
117

    
118
        /**
119
         * Sets the main window title.
120
         *
121
         * This method is thread safe.
122
         * 
123
         * @param titulo The title to be set in the main window
124
         */
125
        public void setTitle(String titulo);
126

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

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

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

    
229
        /**
230
         * Removes the labels associated with the provided class.
231
         * 
232
         * @param clase The class whose associated labels are to be removed.
233
         */
234
        public void removeStatusBarLabels(Class<?> clase);
235
        
236
        public void addToolBarControl(Class<?> extensionClass, JToolBar control, String name);
237

    
238
        /**
239
         * Show the message in the status bar of the application.
240
         * 
241
         * The types of messages are:
242
         * 
243
         * JOptionPane.INFORMATION_MESSAGE
244
         * JOptionPane.WARNING_MESSAGE
245
         * JOptionPane.ERROR_MESSAGE
246
         * 
247
         * This method is thread safe to use.
248
         * 
249
         * @param msg to show
250
         * @param messageTyoe type of message.
251
         */
252
        public void message(String msg, int messageTyoe);
253
        
254
        public void setLocale(Locale locale);
255

    
256
}