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

History | View | Annotate | Download (10.6 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
import javax.swing.tree.TreeModel;
31

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

    
66

    
67
public interface ApplicationManager 
68
        extends ThreadSafeDialogs, PropertiesSupport
69
    {
70

    
71
    /**
72
     * Return the version of the application.
73
     * 
74
     * @return the version
75
     */
76
        public Version getVersion() ;
77

    
78
    /**
79
     * Return the active window, IWindow, in the application.
80
     * 
81
     * @return the active window
82
     */
83
        public IWindow getActiveWindow();
84

    
85
        /**
86
         * Return the project that is loaded and in use in the application.
87
         * 
88
         * @return the project 
89
         */
90
    public Project getCurrentProject();
91

    
92
    /**
93
     * Returns the active document of the application or null 
94
     * if there is no active document.
95
     * 
96
     * @return the active document
97
     */
98
    public Document getActiveDocument();
99

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

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

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

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

    
241
    /**
242
     * Utility method to obtain the DynObjectManager used in the application at this moment.
243
     * 
244
     * @return the DynObjectManager
245
     */
246
    public DynObjectManager getDynObjectManager() ;
247

    
248
    /**
249
     * Utility method to obtain the ExtensionPointManager used in the application at this moment.
250
     * 
251
     * @return the ExtensionPointManager
252
     */
253
    public ExtensionPointManager getExtensionPointManager();
254

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

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

    
281
        List<WizardPanel> getWizardPanels() throws Exception;
282

    
283

    
284

    
285
        void registerPrepareOpenDataStore(PrepareDataStore action);
286
        void registerPrepareOpenDataStoreParameters(        PrepareDataStoreParameters action);
287
        void registerPrepareOpenLayer(PrepareLayer action);
288

    
289
        DataStore pepareOpenDataSource(DataStore store,
290
                        PrepareContext context)
291
                        throws Exception;
292

    
293
        DataStoreParameters prepareOpenDataStoreParameters(
294
                        DataStoreParameters storeParameters, PrepareContext context)
295
                        throws Exception;
296
        
297
        List<DataStoreParameters> prepareOpenDataStoreParameters(
298
                        List<DataStoreParameters> storeParameters, PrepareContext context)
299
                        throws Exception;
300

    
301
        FLayer prepareOpenLayer(FLayer layer,
302
                        PrepareContextView context)
303
                        throws Exception;
304
        
305
        
306
        public ColorTablesFactory getColorTablesFactory();
307
        
308
        public void registerColorTablesFactory(ColorTablesFactory factory);
309

    
310
        public String getLocaleLanguage();
311

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

    
325
    public Component getRootComponent();
326

    
327
    public void refreshMenusAndToolBars();
328

    
329
    public MainFrame getMainFrame();
330

    
331
    public void addMenu(ActionInfo action, String text);
332
    public void addTool(ActionInfo action, String toolBarName);
333
    public void addSelectableTool(ActionInfo action, String toolBarName);
334

    
335
    public void showTextDialog(final WindowManager.MODE mode, final String title, final String htmlText);
336
    public void showTextDialog(final WindowManager.MODE mode, final String title, final String htmlText, HyperlinkListener hyperlinkListener);
337

    
338
    public TreeModel createProjectLayersTreeModel(); 
339
}