Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / ApplicationManager.java @ 41442

History | View | Annotate | Download (10.3 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.app;
25

    
26
import java.awt.Component;
27
import java.util.List;
28
import javax.swing.JComponent;
29
import javax.swing.event.HyperlinkListener;
30

    
31
import org.cresques.cts.IProjection;
32
import org.gvsig.about.AboutManager;
33
import org.gvsig.andami.actioninfo.ActionInfo;
34
import org.gvsig.andami.ui.mdiFrame.MainFrame;
35
import org.gvsig.andami.ui.mdiFrame.ThreadSafeDialogs;
36
import org.gvsig.andami.ui.mdiManager.IWindow;
37
import org.gvsig.andami.ui.mdiManager.MDIManager;
38
import org.gvsig.app.extension.Version;
39
import org.gvsig.app.gui.WizardPanel;
40
import org.gvsig.app.prepareAction.PrepareContext;
41
import org.gvsig.app.prepareAction.PrepareContextView;
42
import org.gvsig.app.prepareAction.PrepareDataStore;
43
import org.gvsig.app.prepareAction.PrepareDataStoreParameters;
44
import org.gvsig.app.prepareAction.PrepareLayer;
45
import org.gvsig.app.project.Project;
46
import org.gvsig.app.project.ProjectManager;
47
import org.gvsig.app.project.documents.Document;
48
import org.gvsig.app.project.documents.gui.IDocumentWindow;
49
import org.gvsig.fmap.dal.DataManager;
50
import org.gvsig.fmap.dal.DataStore;
51
import org.gvsig.fmap.dal.DataStoreParameters;
52
import org.gvsig.fmap.geom.GeometryManager;
53
import org.gvsig.fmap.mapcontext.MapContextManager;
54
import org.gvsig.fmap.mapcontext.layers.FLayer;
55
import org.gvsig.gui.ColorTablesFactory;
56
import org.gvsig.tools.dataTypes.DataTypesManager;
57
import org.gvsig.tools.dispose.DisposableManager;
58
import org.gvsig.tools.dynobject.DynObjectManager;
59
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
60
import org.gvsig.tools.persistence.PersistenceManager;
61
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
62
import org.gvsig.tools.swing.icontheme.IconThemeManager;
63

    
64

    
65
public interface ApplicationManager extends ThreadSafeDialogs {
66

    
67
    /**
68
     * Return the version of the application.
69
     * 
70
     * @return the version
71
     */
72
        public Version getVersion() ;
73

    
74
    /**
75
     * Return the active window, IWindow, in the application.
76
     * 
77
     * @return the active window
78
     */
79
        public IWindow getActiveWindow();
80

    
81
        /**
82
         * Return the project that is loaded and in use in the application.
83
         * 
84
         * @return the project 
85
         */
86
    public Project getCurrentProject();
87

    
88
    /**
89
     * Returns the active document of the application or null 
90
     * if there is no active document.
91
     * 
92
     * @return the active document
93
     */
94
    public Document getActiveDocument();
95

    
96
    /**
97
     * Returns the active document of the application that is of the 
98
     * requested type or null if there is no active document or the
99
     * active document is not of the requested type.
100
     * 
101
     * @param documentTypeName, type name of the document requested.
102
     * @return the active document
103
     */
104
    public Document getActiveDocument(String documentTypeName);
105

    
106
    /**
107
     * Returns the active document of the application that is of the 
108
     * requested type or null if there is no active document or the
109
     * active document is not of the requested type.
110
     * 
111
     * @param documentClass, class of the document requested.
112
     * @return the active document
113
     */
114
    public Document getActiveDocument(Class<? extends Document> documentClass);
115
    
116
    /**
117
     * Returns the JComponent associated to the active document for the
118
     * specified type of document.
119
     * If not is active the specified type of document return null.
120
     * 
121
     * @param documentClass
122
     * @return the component associated to the active document of type documentClass
123
     */
124
    public JComponent getActiveComponent(Class<? extends Document> documentClass);
125
    
126
    /**
127
     * Returns the window associated with the document passed as 
128
     * parameter or null if there is no window associated with 
129
     * the document.
130
     * 
131
     * @param document to search the window
132
     * @return window associated to the document
133
     */
134
    public IDocumentWindow getDocumentWindow(Document document);
135
    
136
    
137
    /**
138
     * Return the root of the nodes of preferences in the application.
139
     * 
140
     * @return the root of preferences.
141
     */
142
    PreferencesNode getPreferences();
143
        
144
    /**
145
     * Search and return the node of preferences required as nodeName.
146
     *  
147
     * @param nodeName, name of the node to return
148
     * @return the preferences node requested
149
     */
150
        PreferencesNode getPreferences(String nodeName);
151
        
152
        /**
153
         * Return the arguments passed to the application in the command line
154
         *  
155
         * @return arguments as a string array
156
         */
157
        public String[] getArguments();
158
        
159
        /**
160
         * Return the value of the argument passed in the command line by
161
         * the name indicated as the parameter. This is passed as:
162
         * <code>
163
         * application --name=value
164
         * </code>
165
         * @param name of the requested argument
166
         * @return value of the requested argument
167
         */
168
        public String getArgument(String name);
169
        
170
        /**
171
         * Get the value of the system clipboard as a string.
172
         * 
173
         * @return the clipboard value
174
         */
175
        public String getFromClipboard();
176
        
177
        /**
178
         * Put the string value passed as parameter in the clipboard of
179
         * the system.
180
         * 
181
         * @param data to put in the clipboard.
182
         */
183
        public void putInClipboard(String data) ;
184

    
185
        /**
186
         * Obtain the projection associated by the code of projection
187
         * Passed as parameter. If passed code of projection it not
188
         * a valid projection code null is returned.
189
         * 
190
         * @param code of the projection requested
191
         * @return the requested projection or null
192
         */
193
    public IProjection getCRS(String code);
194
    
195
        /**
196
     * Utility method to obtain the DataManager used in the application at this moment.
197
     * 
198
     * @return the DataManager
199
         */
200
        public DataManager getDataManager();
201
    
202
    /**
203
     * Utility method to obtain the ProjectManager used in the application at this moment.
204
     * 
205
     * @return the ProjectManager
206
     */
207
    public ProjectManager getProjectManager();
208

    
209
    /**
210
     * Utility method to obtain the UIManager used in the application at this moment.
211
     * 
212
     * @return the UIManager
213
     */
214
    public MDIManager getUIManager();
215
    
216
    /**
217
     * Utility method to obtain the GeometryManager used in the application at this moment.
218
     * 
219
     * @return the GeometryManager
220
     */
221
    public GeometryManager getGeometryManager();
222
    
223
    /**
224
     * Utility method to obtain the PersistenceManager used in the application at this moment.
225
     * 
226
     * @return the PersistenceManager
227
     */
228
    public PersistenceManager getPersistenceManager();
229
    
230
    /**
231
     * Utility method to obtain the DisposableManager used in the application at this moment.
232
     * 
233
     * @return the DisposableManager
234
     */
235
    public DisposableManager getDisposableManager() ;
236

    
237
    /**
238
     * Utility method to obtain the DynObjectManager used in the application at this moment.
239
     * 
240
     * @return the DynObjectManager
241
     */
242
    public DynObjectManager getDynObjectManager() ;
243

    
244
    /**
245
     * Utility method to obtain the ExtensionPointManager used in the application at this moment.
246
     * 
247
     * @return the ExtensionPointManager
248
     */
249
    public ExtensionPointManager getExtensionPointManager();
250

    
251
    /**
252
     * Utility method to obtain the MapContextManager used in the application at this moment.
253
     * 
254
     * @return the MapContextManager
255
     */
256
    public MapContextManager getMapContextManager();
257
    
258
    /**
259
     * Utility method to obtain the AboutManager used in the application at this moment.
260
     * 
261
     * @return the AboutManager
262
     */
263
    public AboutManager getAbout();
264

    
265
    public DataTypesManager getDataTypesManager();
266
    
267
    /**
268
     * Utility method to obtain the IconThemeManager used in the application at this moment.
269
     * 
270
     * @return the IconThemeManager
271
     */
272
    IconThemeManager getIconThemeManager();
273
    
274
        void registerAddTableWizard(String name, String description,
275
                        Class<? extends WizardPanel> wpClass);
276

    
277
        List<WizardPanel> getWizardPanels() throws Exception;
278

    
279

    
280

    
281
        void registerPrepareOpenDataStore(PrepareDataStore action);
282
        void registerPrepareOpenDataStoreParameters(        PrepareDataStoreParameters action);
283
        void registerPrepareOpenLayer(PrepareLayer action);
284

    
285
        DataStore pepareOpenDataSource(DataStore store,
286
                        PrepareContext context)
287
                        throws Exception;
288

    
289
        DataStoreParameters prepareOpenDataStoreParameters(
290
                        DataStoreParameters storeParameters, PrepareContext context)
291
                        throws Exception;
292
        
293
        List<DataStoreParameters> prepareOpenDataStoreParameters(
294
                        List<DataStoreParameters> storeParameters, PrepareContext context)
295
                        throws Exception;
296

    
297
        FLayer prepareOpenLayer(FLayer layer,
298
                        PrepareContextView context)
299
                        throws Exception;
300
        
301
        
302
        public ColorTablesFactory getColorTablesFactory();
303
        
304
        public void registerColorTablesFactory(ColorTablesFactory factory);
305

    
306
        public String getLocaleLanguage();
307

    
308
    /**
309
     * sets message in status bar
310
     * 
311
     * This method is thread safe.
312
     * 
313
     * @param message
314
     * @param message_type One of: JOptionPane.ERROR_MESSAGE,
315
     * JOptionPane.WARNING_MESSAGE, JOptionPane.INFORMATION_MESSAGE 
316
     */
317
    public void message(String message, int message_type);
318
    
319
    public String translate(String message, String... args) ;
320

    
321
    public Component getRootComponent();
322

    
323
    public void refreshMenusAndToolBars();
324

    
325
    public MainFrame getMainFrame();
326

    
327
    public void addMenu(ActionInfo action, String text);
328
    public void addTool(ActionInfo action, String toolBarName);
329

    
330
    public void showTextDialog(final WindowManager.MODE mode, final String title, final String htmlText);
331
    public void showTextDialog(final WindowManager.MODE mode, final String title, final String htmlText, HyperlinkListener hyperlinkListener);
332

    
333
}