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

History | View | Annotate | Download (10.5 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

    
65

    
66
public interface ApplicationManager extends ThreadSafeDialogs {
67

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

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

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

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

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

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

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

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

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

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

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

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

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

    
280

    
281

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

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

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

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

    
307
        public String getLocaleLanguage();
308

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

    
322
    public Component getRootComponent();
323

    
324
    public void refreshMenusAndToolBars();
325

    
326
    public MainFrame getMainFrame();
327

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

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

    
335
    public TreeModel createProjectLayersTreeModel(); 
336
}