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

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

    
68

    
69
public interface ApplicationManager 
70
        extends ThreadSafeDialogs, PropertiesSupport
71
    {
72

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

    
80
    /**
81
     * Close the application.
82
     * 
83
     * @param quietly
84
     */
85
    public void close(boolean quietly);
86
     
87
    /**
88
     * Return the active window, IWindow, in the application.
89
     * 
90
     * @return the active window
91
     */
92
        public IWindow getActiveWindow();
93

    
94
        /**
95
         * Return the project that is loaded and in use in the application.
96
         * 
97
         * @return the project 
98
         */
99
    public Project getCurrentProject();
100

    
101
    /**
102
     * Returns the active document of the application or null 
103
     * if there is no active document.
104
     * 
105
     * @return the active document
106
     */
107
    public Document getActiveDocument();
108

    
109
    /**
110
     * Returns the active document of the application that is of the 
111
     * requested type or null if there is no active document or the
112
     * active document is not of the requested type.
113
     * 
114
     * @param documentTypeName, type name of the document requested.
115
     * @return the active document
116
     */
117
    public Document getActiveDocument(String documentTypeName);
118

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

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

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

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

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

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

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

    
279
        List<WizardPanel> getWizardPanels() throws Exception;
280

    
281

    
282

    
283
        void registerPrepareOpenDataStore(PrepareDataStore action);
284
        void registerPrepareOpenDataStoreParameters(        PrepareDataStoreParameters action);
285
        void registerPrepareOpenLayer(PrepareLayer action);
286

    
287
        DataStore pepareOpenDataSource(DataStore store,
288
                        PrepareContext context)
289
                        throws Exception;
290

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

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

    
308
        public String getLocaleLanguage();
309

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

    
323
    public Component getRootComponent();
324

    
325
    public void refreshMenusAndToolBars();
326

    
327
    public MainFrame getMainFrame();
328

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

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

    
336
    public TreeModel createProjectLayersTreeModel(); 
337

    
338
    public void addPropertiesObserver(Observer o);
339

    
340
    public void deletePropertiesObserver(Observer o);
341
    
342
    public void deletePropertiesObservers();
343

    
344
}