svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / imp / DefaultApplicationManager.java @ 42651
History | View | Annotate | Download (18.7 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 |
|
25 |
package org.gvsig.app.imp; |
26 |
|
27 |
import java.awt.Component; |
28 |
import java.io.File; |
29 |
import java.util.ArrayList; |
30 |
import java.util.Iterator; |
31 |
import java.util.List; |
32 |
import javax.swing.JComponent; |
33 |
|
34 |
import javax.swing.JFileChooser; |
35 |
import javax.swing.SwingUtilities; |
36 |
import javax.swing.event.HyperlinkListener; |
37 |
import javax.swing.filechooser.FileFilter; |
38 |
import javax.swing.tree.TreeModel; |
39 |
|
40 |
import org.cresques.cts.IProjection; |
41 |
import org.gvsig.about.AboutLocator; |
42 |
import org.gvsig.about.AboutManager; |
43 |
import org.gvsig.andami.Launcher; |
44 |
import org.gvsig.andami.PluginServices; |
45 |
import org.gvsig.andami.actioninfo.ActionInfo; |
46 |
import org.gvsig.andami.ui.mdiFrame.MainFrame; |
47 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
48 |
import org.gvsig.andami.ui.mdiManager.MDIManager; |
49 |
import org.gvsig.app.ApplicationManager; |
50 |
import org.gvsig.app.PreferencesNode; |
51 |
import org.gvsig.app.extension.Version; |
52 |
import org.gvsig.app.extension.develtools.InfoPanel; |
53 |
import org.gvsig.app.gui.WizardPanel; |
54 |
import org.gvsig.app.prepareAction.PrepareContext; |
55 |
import org.gvsig.app.prepareAction.PrepareContextView; |
56 |
import org.gvsig.app.prepareAction.PrepareDataStore; |
57 |
import org.gvsig.app.prepareAction.PrepareDataStoreParameters; |
58 |
import org.gvsig.app.prepareAction.PrepareLayer; |
59 |
import org.gvsig.app.project.DefaultProject; |
60 |
import org.gvsig.app.project.Project; |
61 |
import org.gvsig.app.project.ProjectManager; |
62 |
import org.gvsig.app.project.documents.Document; |
63 |
import org.gvsig.app.project.documents.gui.IDocumentWindow; |
64 |
import org.gvsig.app.project.documents.view.ViewDocument; |
65 |
import org.gvsig.app.project.documents.view.ViewManager; |
66 |
import org.gvsig.fmap.crs.CRSFactory; |
67 |
import org.gvsig.fmap.dal.DALLocator; |
68 |
import org.gvsig.fmap.dal.DataManager; |
69 |
import org.gvsig.fmap.dal.DataStore; |
70 |
import org.gvsig.fmap.dal.DataStoreParameters; |
71 |
import org.gvsig.fmap.geom.GeometryLocator; |
72 |
import org.gvsig.fmap.geom.GeometryManager; |
73 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
74 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
75 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
76 |
import org.gvsig.fmap.mapcontrol.CompoundLayersTreeModel; |
77 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
78 |
import org.gvsig.gui.ColorTablesFactory; |
79 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
80 |
import org.gvsig.tools.ToolsLocator; |
81 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
82 |
import org.gvsig.tools.dispose.DisposableManager; |
83 |
import org.gvsig.tools.dynobject.DynObjectManager; |
84 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
85 |
import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension; |
86 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
87 |
import org.gvsig.tools.persistence.PersistenceManager; |
88 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
89 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
90 |
import org.gvsig.tools.swing.icontheme.IconThemeManager; |
91 |
import org.slf4j.Logger; |
92 |
import org.slf4j.LoggerFactory; |
93 |
|
94 |
|
95 |
|
96 |
|
97 |
/**
|
98 |
* @author jmvivo
|
99 |
*
|
100 |
*/
|
101 |
public class DefaultApplicationManager implements ApplicationManager { |
102 |
|
103 |
@SuppressWarnings("unused") |
104 |
private static Logger logger = LoggerFactory.getLogger(DefaultApplicationManager.class); |
105 |
|
106 |
private static final String EPNAME_PREPARE_OPEN_DATASTORE = "org.gvsig.datastore.open.prepare"; //"PrepareOpenDataStore"; |
107 |
private static final String EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS = "org.gvsig.datastoreparameters.open.prepare"; //"PrepareOpenDataStoreParameters"; |
108 |
private static final String EPNAME_PREPARE_OPEN_LAYER = "org.gvsig.layer.open.prepare"; // "PrepareOpenLayer"; |
109 |
|
110 |
private static final String EPNAME_ADD_TABLE_WIZARD = "AddLayerWizard"; |
111 |
|
112 |
private ExtensionPointManager epManager;
|
113 |
|
114 |
private Version version;
|
115 |
|
116 |
public DefaultApplicationManager() {
|
117 |
epManager = ToolsLocator.getExtensionPointManager(); |
118 |
epManager.add(EPNAME_PREPARE_OPEN_DATASTORE, |
119 |
"Actions to do when open a DataStore");
|
120 |
epManager.add(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS, |
121 |
"Actions to do before open a DataStore with parameters");
|
122 |
epManager.add(EPNAME_PREPARE_OPEN_LAYER, |
123 |
"Actions to do after create a Layer");
|
124 |
epManager.add(EPNAME_ADD_TABLE_WIZARD, |
125 |
"Wizards to add new document table");
|
126 |
|
127 |
version = new Version();
|
128 |
} |
129 |
|
130 |
/* (non-Javadoc)
|
131 |
* @see org.gvsig.appGvSigManager#pepareOpenDataSource(org.gvsig.fmap.dal.DataStore)
|
132 |
*/
|
133 |
@SuppressWarnings("unchecked") |
134 |
public DataStore pepareOpenDataSource(DataStore store,
|
135 |
PrepareContext context) throws Exception { |
136 |
ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_DATASTORE); |
137 |
if (ep.getCount() == 0) { |
138 |
return store;
|
139 |
} |
140 |
DataStore result = store; |
141 |
Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
142 |
PrepareDataStore prepare; |
143 |
while (iter.hasNext()) {
|
144 |
prepare = (PrepareDataStore) iter.next().create(); |
145 |
result = prepare.prepare(store, context); |
146 |
} |
147 |
return result;
|
148 |
} |
149 |
|
150 |
/* (non-Javadoc)
|
151 |
* @see org.gvsig.appGvSigManager#prepareOpenDataStoreParameters(org.gvsig.fmap.dal.DataStoreParameters)
|
152 |
*/
|
153 |
@SuppressWarnings("unchecked") |
154 |
public DataStoreParameters prepareOpenDataStoreParameters(
|
155 |
DataStoreParameters storeParameters, PrepareContext context) |
156 |
throws Exception { |
157 |
|
158 |
ExtensionPoint ep = epManager |
159 |
.get(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS); |
160 |
if (ep.getCount() == 0) { |
161 |
return storeParameters;
|
162 |
} |
163 |
DataStoreParameters result = storeParameters; |
164 |
Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
165 |
PrepareDataStoreParameters prepare; |
166 |
while (iter.hasNext()) {
|
167 |
prepare = (PrepareDataStoreParameters) iter.next().create(); |
168 |
result = prepare.prepare(storeParameters, context); |
169 |
} |
170 |
|
171 |
return result;
|
172 |
} |
173 |
|
174 |
/*
|
175 |
* (non-Javadoc)
|
176 |
* @see org.gvsig.app.ApplicationManager#prepareOpenDataStoreParameters(java.util.List, org.gvsig.app.prepareAction.PrepareContext)
|
177 |
*/
|
178 |
@SuppressWarnings("unchecked") |
179 |
public List<DataStoreParameters> prepareOpenDataStoreParameters( |
180 |
List<DataStoreParameters> storeParameters, PrepareContext context)
|
181 |
throws Exception { |
182 |
|
183 |
ExtensionPoint ep = epManager |
184 |
.get(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS); |
185 |
if (ep.getCount() == 0) { |
186 |
return storeParameters;
|
187 |
} |
188 |
|
189 |
List<DataStoreParameters> result = new ArrayList<DataStoreParameters>(); |
190 |
|
191 |
Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
192 |
List<PrepareDataStoreParameters> prepareList = new ArrayList<PrepareDataStoreParameters>(); |
193 |
while (iter.hasNext()) {
|
194 |
prepareList.add((PrepareDataStoreParameters) iter.next().create()); |
195 |
} |
196 |
|
197 |
for (int i = 0; i < storeParameters.size(); i++) { |
198 |
DataStoreParameters param = storeParameters.get(i); |
199 |
for (int j = 0; j < prepareList.size(); j++) { |
200 |
prepareList.get(j).pre(param, context); |
201 |
} |
202 |
} |
203 |
|
204 |
for (int i = 0; i < storeParameters.size(); i++) { |
205 |
DataStoreParameters param = storeParameters.get(i); |
206 |
if(param != null) { |
207 |
for (int j = 0; j < prepareList.size(); j++) { |
208 |
param = prepareList.get(j).prepare(param, context); |
209 |
if(param == null) |
210 |
break;
|
211 |
} |
212 |
if(param != null) |
213 |
result.add(param); |
214 |
} |
215 |
} |
216 |
|
217 |
for (int i = 0; i < storeParameters.size(); i++) { |
218 |
DataStoreParameters param = storeParameters.get(i); |
219 |
for (int j = 0; j < prepareList.size(); j++) { |
220 |
prepareList.get(j).post(param, context); |
221 |
} |
222 |
} |
223 |
|
224 |
return result;
|
225 |
} |
226 |
|
227 |
public void registerPrepareOpenDataStore(PrepareDataStore action) { |
228 |
ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_DATASTORE); |
229 |
ep.append(action.getName(), action.getDescription(), action); |
230 |
} |
231 |
|
232 |
public void registerPrepareOpenDataStoreParameters( |
233 |
PrepareDataStoreParameters action) { |
234 |
ExtensionPoint ep = epManager |
235 |
.get(EPNAME_PREPARE_OPEN_DATASTOREPARAMETERS); |
236 |
ep.append(action.getName(), action.getDescription(), action); |
237 |
|
238 |
|
239 |
} |
240 |
|
241 |
@SuppressWarnings("unchecked") |
242 |
public FLayer prepareOpenLayer(FLayer layer,
|
243 |
PrepareContextView context) |
244 |
throws Exception { |
245 |
|
246 |
ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_LAYER); |
247 |
|
248 |
if (ep.getCount() == 0) { |
249 |
return layer;
|
250 |
} |
251 |
FLayer result = layer; |
252 |
Iterator<ExtensionPoint.Extension> iter = ep.iterator();
|
253 |
PrepareLayer prepare; |
254 |
while (iter.hasNext()) {
|
255 |
prepare = (PrepareLayer) iter.next().create(); |
256 |
result = prepare.prepare(result, context); |
257 |
} |
258 |
|
259 |
return result;
|
260 |
|
261 |
} |
262 |
|
263 |
public void registerPrepareOpenLayer(PrepareLayer action) { |
264 |
ExtensionPoint ep = epManager.get(EPNAME_PREPARE_OPEN_LAYER); |
265 |
ep.append(action.getName(), action.getDescription(), action); |
266 |
} |
267 |
|
268 |
public void registerAddTableWizard(String name, String description, |
269 |
Class<? extends WizardPanel> wpClass) { |
270 |
ExtensionPoint ep = epManager.get(EPNAME_ADD_TABLE_WIZARD); |
271 |
ep.append(name, description, wpClass); |
272 |
} |
273 |
|
274 |
@SuppressWarnings("unchecked") |
275 |
public List<WizardPanel> getWizardPanels() throws Exception { |
276 |
ExtensionPoint ep = epManager.get(EPNAME_ADD_TABLE_WIZARD); |
277 |
List<WizardPanel> result = new ArrayList<WizardPanel>(); |
278 |
Iterator<Extension> iter = ep.iterator();
|
279 |
while (iter.hasNext()) {
|
280 |
result.add((WizardPanel) iter.next().create()); |
281 |
} |
282 |
return result;
|
283 |
} |
284 |
|
285 |
public DataManager getDataManager() {
|
286 |
return DALLocator.getDataManager();
|
287 |
} |
288 |
|
289 |
public GeometryManager getGeometryManager() {
|
290 |
return GeometryLocator.getGeometryManager();
|
291 |
} |
292 |
|
293 |
public PersistenceManager getPersistenceManager() {
|
294 |
return ToolsLocator.getPersistenceManager();
|
295 |
} |
296 |
|
297 |
public DisposableManager getDisposableManager() {
|
298 |
return ToolsLocator.getDisposableManager();
|
299 |
} |
300 |
|
301 |
public DynObjectManager getDynObjectManager() {
|
302 |
return ToolsLocator.getDynObjectManager();
|
303 |
} |
304 |
|
305 |
public ExtensionPointManager getExtensionPointManager() {
|
306 |
return ToolsLocator.getExtensionPointManager();
|
307 |
} |
308 |
|
309 |
public ProjectManager getProjectManager() {
|
310 |
return ProjectManager.getInstance();
|
311 |
} |
312 |
|
313 |
public MDIManager getUIManager() {
|
314 |
return PluginServices.getMDIManager();
|
315 |
} |
316 |
|
317 |
public MapContextManager getMapContextManager() {
|
318 |
return MapContextLocator.getMapContextManager();
|
319 |
} |
320 |
|
321 |
public DataTypesManager getDataTypesManager() {
|
322 |
return ToolsLocator.getDataTypesManager();
|
323 |
} |
324 |
|
325 |
public IProjection getCRS(String code) { |
326 |
return CRSFactory.getCRS(code);
|
327 |
} |
328 |
|
329 |
public IconThemeManager getIconThemeManager() {
|
330 |
return ToolsSwingLocator.getIconThemeManager();
|
331 |
} |
332 |
|
333 |
public String getArgument(String name) { |
334 |
return PluginServices.getArgumentByName(name);
|
335 |
} |
336 |
|
337 |
public String[] getArguments() { |
338 |
return PluginServices.getArguments();
|
339 |
} |
340 |
|
341 |
public String getFromClipboard() { |
342 |
return PluginServices.getFromClipboard();
|
343 |
} |
344 |
|
345 |
public void putInClipboard(String data) { |
346 |
PluginServices.putInClipboard(data); |
347 |
} |
348 |
|
349 |
public Project getCurrentProject() {
|
350 |
return ProjectManager.getInstance().getCurrentProject();
|
351 |
} |
352 |
|
353 |
public PreferencesNode getPreferences(String node) { |
354 |
if( node.equalsIgnoreCase("project")) { |
355 |
return DefaultProject.getPreferences();
|
356 |
} |
357 |
return new DefaultPreferencesNode(node); |
358 |
} |
359 |
|
360 |
public PreferencesNode getPreferences() {
|
361 |
return new DefaultPreferencesNode(); |
362 |
} |
363 |
|
364 |
public Version getVersion() {
|
365 |
return version;
|
366 |
} |
367 |
|
368 |
public AboutManager getAbout() {
|
369 |
AboutManager manager = AboutLocator.getManager(); |
370 |
return manager;
|
371 |
} |
372 |
|
373 |
public ColorTablesFactory getColorTablesFactory() {
|
374 |
return SymbologySwingLocator.getSwingManager().getColorTablesFactory();
|
375 |
} |
376 |
|
377 |
public void registerColorTablesFactory(ColorTablesFactory factory) { |
378 |
SymbologySwingLocator.getSwingManager().setColorTablesFactory(factory); |
379 |
|
380 |
} |
381 |
|
382 |
public IWindow getActiveWindow() {
|
383 |
try {
|
384 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
385 |
return window;
|
386 |
} catch (Exception ex) { |
387 |
return null; |
388 |
} |
389 |
} |
390 |
|
391 |
public Document getActiveDocument() { |
392 |
return this.getActiveDocument((Class<? extends Document>)null); |
393 |
} |
394 |
|
395 |
public Document getActiveDocument(String documentTypeName) { |
396 |
Document document = this.getActiveDocument(); |
397 |
if( document!= null && document.getTypeName().equalsIgnoreCase(documentTypeName) ) { |
398 |
return document;
|
399 |
} |
400 |
return null; |
401 |
} |
402 |
|
403 |
public Document getActiveDocument(Class<? extends Document> documentClass) { |
404 |
Project project = this.getCurrentProject();
|
405 |
if( project == null ) { |
406 |
return null; |
407 |
} |
408 |
return project.getActiveDocument(documentClass);
|
409 |
} |
410 |
|
411 |
public JComponent getActiveComponent(Class<? extends Document> documentClass) { |
412 |
Document document = this.getActiveDocument(documentClass); |
413 |
if (document == null) { |
414 |
return null; |
415 |
} |
416 |
return document.getMainComponent();
|
417 |
} |
418 |
|
419 |
|
420 |
public IDocumentWindow getDocumentWindow(Document document) { |
421 |
Class<? extends IDocumentWindow> defaultDocumentClass = |
422 |
document.getFactory().getMainWindowClass(); |
423 |
return (IDocumentWindow) this.getUIManager().getSingletonWindow(defaultDocumentClass, document); |
424 |
} |
425 |
|
426 |
public String getLocaleLanguage() { |
427 |
return Launcher.getAndamiConfig().getLocaleLanguage();
|
428 |
} |
429 |
|
430 |
public void message(String message, int message_type) { |
431 |
MainFrame main = PluginServices.getMainFrame(); |
432 |
main.message(message, message_type); |
433 |
} |
434 |
|
435 |
public void messageDialog(String message, String title, int messageType) { |
436 |
MainFrame main = PluginServices.getMainFrame(); |
437 |
main.messageDialog(message, title, messageType); |
438 |
} |
439 |
|
440 |
public void messageDialog(String message, String[] messageArgs, |
441 |
String title, int messageType) { |
442 |
MainFrame main = PluginServices.getMainFrame(); |
443 |
main.messageDialog(message, messageArgs, title, messageType); |
444 |
} |
445 |
|
446 |
public int confirmDialog(String message, String title, int optionType, |
447 |
int messageType) {
|
448 |
MainFrame main = PluginServices.getMainFrame(); |
449 |
return main.confirmDialog(message, title, optionType, messageType);
|
450 |
} |
451 |
|
452 |
public String inputDialog(String message, String title, int messageType, |
453 |
String initialValue) {
|
454 |
MainFrame main = PluginServices.getMainFrame(); |
455 |
return main.inputDialog(message, title, messageType, initialValue);
|
456 |
} |
457 |
|
458 |
public String inputDialog(String message, String title) { |
459 |
MainFrame main = PluginServices.getMainFrame(); |
460 |
return main.inputDialog(message, title);
|
461 |
} |
462 |
|
463 |
public void showDialog(Component contents, String title) { |
464 |
MainFrame main = PluginServices.getMainFrame(); |
465 |
main.showDialog(contents, title); |
466 |
} |
467 |
|
468 |
public Component createComponent(Class<? extends Component> theClass, |
469 |
Object... parameters) {
|
470 |
MainFrame main = PluginServices.getMainFrame(); |
471 |
return main.createComponentWithParams(theClass, parameters);
|
472 |
} |
473 |
|
474 |
public Component createComponentWithParams( |
475 |
Class<? extends Component> theClass, Object[] parameters) { |
476 |
MainFrame main = PluginServices.getMainFrame(); |
477 |
return main.createComponentWithParams(theClass, parameters);
|
478 |
} |
479 |
|
480 |
|
481 |
public File[] showChooserDialog( |
482 |
final String title, |
483 |
final int type, // SAVE_DIALOG / OPEN_DIALOG |
484 |
final int selectionMode, // JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES |
485 |
final boolean multiselection, |
486 |
final File initialPath, |
487 |
final FileFilter filter, |
488 |
final boolean fileHidingEnabled |
489 |
) { |
490 |
MainFrame main = PluginServices.getMainFrame(); |
491 |
return main.showChooserDialog(title, type, selectionMode, multiselection, initialPath, filter, fileHidingEnabled);
|
492 |
} |
493 |
|
494 |
public File[] showOpenDirectoryDialog(String title, File initialPath) { |
495 |
return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.DIRECTORIES_ONLY, false, initialPath, null, false); |
496 |
} |
497 |
|
498 |
|
499 |
public File[] showOpenFileDialog(String title, File initialPath) { |
500 |
return showChooserDialog(title, JFileChooser.OPEN_DIALOG, JFileChooser.FILES_ONLY, false, initialPath, null, false); |
501 |
} |
502 |
|
503 |
|
504 |
public File[] showSaveFileDialog(String title, File initialPath) { |
505 |
return showChooserDialog(title, JFileChooser.SAVE_DIALOG, JFileChooser.FILES_ONLY, false, initialPath, null, false); |
506 |
} |
507 |
|
508 |
public String translate(String message, String... args) { |
509 |
return org.gvsig.i18n.Messages.translate(message, args);
|
510 |
} |
511 |
|
512 |
public Component getRootComponent() { |
513 |
return (Component) PluginServices.getMainFrame(); |
514 |
} |
515 |
|
516 |
public void refreshMenusAndToolBars() { |
517 |
PluginServices.getMainFrame().refreshControls(); |
518 |
} |
519 |
|
520 |
public MainFrame getMainFrame() {
|
521 |
return PluginServices.getMainFrame();
|
522 |
} |
523 |
|
524 |
public void addMenu(ActionInfo action, String text) { |
525 |
MainFrame f = this.getMainFrame();
|
526 |
f.addMenu(action,text); |
527 |
} |
528 |
|
529 |
public void addTool(ActionInfo action, String toolBarName) { |
530 |
MainFrame f = this.getMainFrame();
|
531 |
f.addTool(action,toolBarName); |
532 |
f.refreshControls(); |
533 |
} |
534 |
|
535 |
public void showTextDialog(final WindowManager.MODE mode, final String title, final String htmlText) { |
536 |
this.showTextDialog(mode, title, htmlText, null); |
537 |
} |
538 |
|
539 |
public void showTextDialog(final WindowManager.MODE mode, final String title, final String htmlText, final HyperlinkListener hyperlinkListener) { |
540 |
if (!SwingUtilities.isEventDispatchThread()) { |
541 |
if( mode == WindowManager.MODE.DIALOG ) {
|
542 |
try {
|
543 |
SwingUtilities.invokeAndWait(new Runnable() { |
544 |
public void run() { |
545 |
showTextDialog(mode, title, htmlText,hyperlinkListener); |
546 |
} |
547 |
}); |
548 |
} catch (Exception ex) { |
549 |
logger.warn("Can't show text dialog:\n"+htmlText,ex);
|
550 |
} |
551 |
} else {
|
552 |
SwingUtilities.invokeLater(new Runnable() { |
553 |
public void run() { |
554 |
showTextDialog(mode, title, htmlText,hyperlinkListener); |
555 |
} |
556 |
}); |
557 |
} |
558 |
return;
|
559 |
} |
560 |
InfoPanel.showPanel(title, mode, htmlText,hyperlinkListener); |
561 |
} |
562 |
|
563 |
@Override
|
564 |
public TreeModel createProjectLayersTreeModel() { |
565 |
CompoundLayersTreeModel model = (CompoundLayersTreeModel) MapControlLocator.getMapControlManager().createCompoundLayersTreeModel(); |
566 |
Project project = this.getCurrentProject();
|
567 |
List<Document> views = project.getDocuments(ViewManager.TYPENAME); |
568 |
for (Document view : views) { |
569 |
model.addLayers( ((ViewDocument)view).getMapContext().getLayers() ); |
570 |
} |
571 |
return model;
|
572 |
} |
573 |
} |