svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.geodb.app / org.gvsig.geodb.app.mainplugin / src / main / java / org / gvsig / geodb / ExtDB_Spatial.java @ 45635
History | View | Annotate | Download (4.18 KB)
1 | 40557 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40557 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
6 | 41427 | jjdelcerro | * This program is free software; you can redistribute it and/or modify it under
|
7 | * the terms of the GNU General Public License as published by the Free Software
|
||
8 | * Foundation; either version 3 of the License, or (at your option) any later
|
||
9 | * version.
|
||
10 | 40435 | jjdelcerro | *
|
11 | 41427 | jjdelcerro | * This program is distributed in the hope that it will be useful, but WITHOUT
|
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||
14 | * details.
|
||
15 | 40435 | jjdelcerro | *
|
16 | 41427 | jjdelcerro | * You should have received a copy of the GNU General Public License along with
|
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
|
||
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
19 | 40435 | jjdelcerro | *
|
20 | 41427 | jjdelcerro | * For any additional information, do not hesitate to contact us at info AT
|
21 | * gvsig.com, or visit our website www.gvsig.com.
|
||
22 | 40435 | jjdelcerro | */
|
23 | package org.gvsig.geodb; |
||
24 | |||
25 | 45160 | fdiaz | import java.util.ArrayList; |
26 | import java.util.HashMap; |
||
27 | import java.util.List; |
||
28 | import java.util.Map; |
||
29 | 40435 | jjdelcerro | import org.gvsig.andami.IconThemeHelper; |
30 | 41427 | jjdelcerro | import org.gvsig.andami.PluginsLocator; |
31 | import org.gvsig.andami.PluginsManager; |
||
32 | 40435 | jjdelcerro | import org.gvsig.andami.plugins.Extension; |
33 | 45160 | fdiaz | import org.gvsig.andami.preferences.IPreference; |
34 | import org.gvsig.andami.preferences.IPreferenceExtension; |
||
35 | 40435 | jjdelcerro | import org.gvsig.app.ApplicationLocator; |
36 | import org.gvsig.app.extension.AddLayer; |
||
37 | 41495 | jjdelcerro | import org.gvsig.fmap.dal.DALLocator; |
38 | import org.gvsig.fmap.dal.DataManager; |
||
39 | 41427 | jjdelcerro | import org.gvsig.tools.dynobject.DynObject; |
40 | 41495 | jjdelcerro | import org.gvsig.fmap.dal.DataServerExplorerPool; |
41 | 45160 | fdiaz | import static org.gvsig.geodb.WizardDBVectorial.LAYERS_SCALE_VISIBILITY_PARAMETER; |
42 | import org.gvsig.geodb.preferences.layersVisibility.LayersVisibilityReminderPage; |
||
43 | import org.gvsig.geodb.vectorialdb.visibility.LayerScaleVisibility; |
||
44 | 40435 | jjdelcerro | |
45 | /**
|
||
46 | * This extension adds the export-to-oracle button.
|
||
47 | *
|
||
48 | * @author jldominguez
|
||
49 | *
|
||
50 | */
|
||
51 | 45160 | fdiaz | public class ExtDB_Spatial extends Extension implements IPreferenceExtension{ |
52 | 40435 | jjdelcerro | |
53 | 44533 | jjdelcerro | @Override
|
54 | 41427 | jjdelcerro | public void initialize() { |
55 | 40435 | jjdelcerro | IconThemeHelper.registerIcon("geodb", "geodb-connection-add", this); |
56 | IconThemeHelper.registerIcon("geodb", "geodb-advanced-properties", this); |
||
57 | IconThemeHelper.registerIcon("geodb", "geodb-get-view-extent", this); |
||
58 | 41495 | jjdelcerro | |
59 | 45160 | fdiaz | LayerScaleVisibility.selfRegister(); |
60 | |||
61 | 41495 | jjdelcerro | DataManager dataManager = DALLocator.getDataManager(); |
62 | PluginsManager manager = PluginsLocator.getManager(); |
||
63 | DynObject pluginProperties = manager.getPlugin(ExtDB_Spatial.class).getPluginProperties(); |
||
64 | if( pluginProperties.getDynValue("explorersPool")==null ) { |
||
65 | pluginProperties.setDynValue("explorersPool", dataManager.getDataServerExplorerPool());
|
||
66 | } else {
|
||
67 | dataManager.setDataServerExplorerPool((DataServerExplorerPool)pluginProperties.getDynValue("explorersPool"));
|
||
68 | } |
||
69 | |||
70 | 45160 | fdiaz | HashMap<Object, Object> layersScaleVisibility = new HashMap<>(); |
71 | Map<String, LayerScaleVisibility> tmp = (Map) pluginProperties.getDynValue(LAYERS_SCALE_VISIBILITY_PARAMETER); |
||
72 | if(tmp != null){ |
||
73 | layersScaleVisibility.putAll(tmp); |
||
74 | } |
||
75 | pluginProperties.setDynValue(LAYERS_SCALE_VISIBILITY_PARAMETER, layersScaleVisibility); |
||
76 | |||
77 | IconThemeHelper.registerIcon("preferences", "layers-visibility-remember-preferences", this); |
||
78 | 40435 | jjdelcerro | } |
79 | |||
80 | 44533 | jjdelcerro | @Override
|
81 | 40435 | jjdelcerro | public void execute(String actionCommand) { |
82 | //do nothing
|
||
83 | } |
||
84 | |||
85 | 44533 | jjdelcerro | @Override
|
86 | 40435 | jjdelcerro | public boolean isEnabled() { |
87 | return isVisible();
|
||
88 | } |
||
89 | |||
90 | 44533 | jjdelcerro | @Override
|
91 | 40435 | jjdelcerro | public boolean isVisible() { |
92 | return false; |
||
93 | } |
||
94 | |||
95 | 41427 | jjdelcerro | @Override
|
96 | public void postInitialize() { |
||
97 | super.postInitialize();
|
||
98 | 40435 | jjdelcerro | |
99 | 44533 | jjdelcerro | // ApplicationLocator.getManager().registerAddTableWizard("DB","DB Tables", WizardDB.class);
|
100 | // AddLayer.addWizard(WizardVectorialDB.class);
|
||
101 | 40435 | jjdelcerro | |
102 | 44533 | jjdelcerro | ApplicationLocator.getManager().registerAddTableWizard("DB","DB Tables", WizardDBTabular.class); |
103 | AddLayer.addWizard(WizardDBVectorial.class); |
||
104 | 40435 | jjdelcerro | |
105 | 41427 | jjdelcerro | } |
106 | 45160 | fdiaz | |
107 | @Override
|
||
108 | public IPreference[] getPreferencesPages() { |
||
109 | List<IPreference> prefs = new ArrayList<>(); |
||
110 | prefs.add(new LayersVisibilityReminderPage());
|
||
111 | 41427 | jjdelcerro | |
112 | 45160 | fdiaz | return prefs.toArray(new IPreference[prefs.size()]); |
113 | } |
||
114 | |||
115 | |||
116 | 40435 | jjdelcerro | } |