svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / ViewManager.java @ 46089
History | View | Annotate | Download (20.7 KB)
1 | 40558 | jjdelcerro | /**
|
---|---|---|---|
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 | 40435 | jjdelcerro | package org.gvsig.app.project.documents.view; |
25 | |||
26 | 44281 | jjdelcerro | import java.util.HashMap; |
27 | import java.util.Iterator; |
||
28 | import java.util.List; |
||
29 | 41081 | jjdelcerro | import java.util.Map; |
30 | 44281 | jjdelcerro | import java.util.function.Predicate; |
31 | 41081 | jjdelcerro | |
32 | 40435 | jjdelcerro | import javax.swing.ImageIcon; |
33 | 44281 | jjdelcerro | import org.apache.commons.lang3.StringUtils; |
34 | 40435 | jjdelcerro | |
35 | import org.gvsig.andami.IconThemeHelper; |
||
36 | import org.gvsig.andami.PluginServices; |
||
37 | 41081 | jjdelcerro | import org.gvsig.andami.PluginsLocator; |
38 | import org.gvsig.andami.actioninfo.ActionInfo; |
||
39 | import org.gvsig.andami.actioninfo.ActionInfoManager; |
||
40 | 40435 | jjdelcerro | import org.gvsig.andami.ui.mdiManager.IWindow; |
41 | 44281 | jjdelcerro | import org.gvsig.app.project.Project; |
42 | 40435 | jjdelcerro | import org.gvsig.app.project.ProjectManager; |
43 | import org.gvsig.app.project.documents.AbstractDocument; |
||
44 | import org.gvsig.app.project.documents.AbstractDocumentManager; |
||
45 | import org.gvsig.app.project.documents.Document; |
||
46 | import org.gvsig.app.project.documents.actions.CopyDocumentAction; |
||
47 | import org.gvsig.app.project.documents.actions.CutDocumentAction; |
||
48 | import org.gvsig.app.project.documents.actions.PasteDocumentAction; |
||
49 | import org.gvsig.app.project.documents.gui.IDocumentWindow; |
||
50 | import org.gvsig.app.project.documents.gui.WindowLayout; |
||
51 | 46089 | omartinez | import org.gvsig.app.project.documents.view.dalactions.AddFilterToLayerAction.AddFilterToLayerActionFactory; |
52 | import org.gvsig.app.project.documents.view.dalactions.CreateTemporalLayerAction; |
||
53 | 44281 | jjdelcerro | import org.gvsig.app.project.documents.view.dalactions.ViewZoomAction.ViewZoomActionFactory; |
54 | 40435 | jjdelcerro | import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
55 | import org.gvsig.app.project.documents.view.gui.ViewProperties; |
||
56 | 41559 | jjdelcerro | import org.gvsig.app.project.documents.view.toc.AbstractActionInfoAdapterToTocContextMenuAction; |
57 | 44304 | jjdelcerro | import org.gvsig.fmap.dal.AbstractStoresRepository; |
58 | 44281 | jjdelcerro | import org.gvsig.fmap.dal.DALLocator; |
59 | import org.gvsig.fmap.dal.DataManager; |
||
60 | import org.gvsig.fmap.dal.DataStore; |
||
61 | import org.gvsig.fmap.dal.DataStoreParameters; |
||
62 | import org.gvsig.fmap.dal.feature.FeatureStore; |
||
63 | 40435 | jjdelcerro | import org.gvsig.fmap.mapcontext.MapContext; |
64 | import org.gvsig.fmap.mapcontext.MapContextLocator; |
||
65 | import org.gvsig.fmap.mapcontext.MapContextManager; |
||
66 | 41350 | jjdelcerro | import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesHelper; |
67 | 44281 | jjdelcerro | import org.gvsig.fmap.mapcontext.layers.FLayer; |
68 | import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
||
69 | 40435 | jjdelcerro | import org.gvsig.tools.ToolsLocator; |
70 | import org.gvsig.tools.dynobject.DynStruct; |
||
71 | 41081 | jjdelcerro | import org.gvsig.tools.extensionpoint.ExtensionBuilder; |
72 | import org.gvsig.tools.extensionpoint.ExtensionPoint; |
||
73 | 41104 | jjdelcerro | import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
74 | 40435 | jjdelcerro | import org.gvsig.tools.persistence.PersistenceManager; |
75 | 44281 | jjdelcerro | import org.gvsig.tools.util.UnmodifiableBasicSet; |
76 | import org.gvsig.tools.util.UnmodifiableBasicSetAdapter; |
||
77 | 40435 | jjdelcerro | import org.slf4j.Logger; |
78 | import org.slf4j.LoggerFactory; |
||
79 | |||
80 | /**
|
||
81 | * Factory of View.
|
||
82 | *
|
||
83 | 45543 | jjdelcerro | * @author gvSIG Team
|
84 | 44281 | jjdelcerro | *
|
85 | 40435 | jjdelcerro | */
|
86 | public class ViewManager extends AbstractDocumentManager { |
||
87 | 44281 | jjdelcerro | |
88 | private static final Logger LOGGER = LoggerFactory.getLogger(ViewManager.class); |
||
89 | |||
90 | 44304 | jjdelcerro | private static class ViewDocumentStoresRepository extends AbstractStoresRepository { |
91 | 44281 | jjdelcerro | |
92 | 44304 | jjdelcerro | public ViewDocumentStoresRepository(String name) { |
93 | super(name);
|
||
94 | } |
||
95 | |||
96 | 44281 | jjdelcerro | private Map<String, DataStoreParameters> getAll(Predicate<DataStore> filter, int limit) { |
97 | Map<String, DataStoreParameters> all = new HashMap<>(); |
||
98 | Project project = ProjectManager.getInstance().getCurrentProject(); |
||
99 | List<Document> views = project.getDocuments(TYPENAME); |
||
100 | for (Document view : views) { |
||
101 | for (FLayer layer : ((ViewDocument) view).layers()) {
|
||
102 | if (layer instanceof FLyrVect) { |
||
103 | FeatureStore store = ((FLyrVect) layer).getFeatureStore(); |
||
104 | 45543 | jjdelcerro | if (store!=null && (filter == null || filter.test(store))) { |
105 | 44281 | jjdelcerro | all.put(store.getName(), store.getParameters()); |
106 | } |
||
107 | 44307 | jjdelcerro | // UnmodifiableBasicMap<String, DataStore> children = store.getChildren();
|
108 | // if (children != null) {
|
||
109 | // for (DataStore dataStore : children) {
|
||
110 | // if (filter == null || filter.test(dataStore)) {
|
||
111 | // all.put(dataStore.getName(), dataStore.getParameters());
|
||
112 | // }
|
||
113 | // }
|
||
114 | // }
|
||
115 | 44281 | jjdelcerro | } |
116 | if (limit > 0 && all.size() >= limit) { |
||
117 | break;
|
||
118 | } |
||
119 | } |
||
120 | } |
||
121 | if (all.isEmpty()) {
|
||
122 | return null; |
||
123 | } |
||
124 | return all;
|
||
125 | } |
||
126 | |||
127 | @Override
|
||
128 | 44304 | jjdelcerro | protected DataStoreParameters getMyParameters(final String name) { |
129 | 45543 | jjdelcerro | Map<String, DataStoreParameters> all = this.getAll((DataStore t) -> { |
130 | String x = t==null? null:t.getName(); |
||
131 | return StringUtils.equalsIgnoreCase(name, x);
|
||
132 | 44281 | jjdelcerro | }, 1);
|
133 | if (all == null) { |
||
134 | return null; |
||
135 | } |
||
136 | return all.get(name);
|
||
137 | } |
||
138 | |||
139 | @Override
|
||
140 | public boolean containsKey(final String key) { |
||
141 | 45543 | jjdelcerro | Map<String, DataStoreParameters> all = this.getAll((DataStore t) -> { |
142 | String x = t==null? null:t.getName(); |
||
143 | return StringUtils.equalsIgnoreCase(key, x);
|
||
144 | 44281 | jjdelcerro | }, 1);
|
145 | if (all == null) { |
||
146 | return false; |
||
147 | } |
||
148 | return all.containsKey(key);
|
||
149 | } |
||
150 | |||
151 | @Override
|
||
152 | 44304 | jjdelcerro | protected UnmodifiableBasicSet<String> getMyKeySet() { |
153 | 44281 | jjdelcerro | Map<String, DataStoreParameters> all = this.getAll(null, 0); |
154 | if (all == null) { |
||
155 | return null; |
||
156 | } |
||
157 | return new UnmodifiableBasicSetAdapter<>(all.keySet()); |
||
158 | } |
||
159 | |||
160 | @Override
|
||
161 | 44304 | jjdelcerro | protected boolean isEmptyMyRepository() { |
162 | 44281 | jjdelcerro | Map<String, DataStoreParameters> all = this.getAll(null, 1); |
163 | return all.isEmpty();
|
||
164 | } |
||
165 | |||
166 | @Override
|
||
167 | 44304 | jjdelcerro | protected int getMySize() { |
168 | 44281 | jjdelcerro | Map<String, DataStoreParameters> all = this.getAll(null, 0); |
169 | return all.size();
|
||
170 | } |
||
171 | |||
172 | @Override
|
||
173 | public Iterator<DataStoreParameters> iterator() { |
||
174 | Map<String, DataStoreParameters> all = this.getAll(null, 0); |
||
175 | return all.values().iterator();
|
||
176 | } |
||
177 | |||
178 | public static void selfRegister() { |
||
179 | DataManager dataManager = DALLocator.getDataManager(); |
||
180 | 44306 | jjdelcerro | dataManager.getStoresRepository().addRepository(new ViewDocumentStoresRepository("Project layers")); |
181 | 44281 | jjdelcerro | } |
182 | } |
||
183 | private static final String PERSISTENCE_VIEW_DOCUMENT_DEFINITION_NAME |
||
184 | = "DefaultViewDocument";
|
||
185 | 40435 | jjdelcerro | public static String TYPENAME = "project.document.view2d"; |
186 | private DynStruct persistenceDefinition;
|
||
187 | 44281 | jjdelcerro | |
188 | 40435 | jjdelcerro | public ViewManager() {
|
189 | 44281 | jjdelcerro | // Do nothing
|
190 | 40435 | jjdelcerro | } |
191 | 44281 | jjdelcerro | |
192 | 45543 | jjdelcerro | @Override
|
193 | 40435 | jjdelcerro | public int getPriority() { |
194 | return 0; |
||
195 | } |
||
196 | |||
197 | 45543 | jjdelcerro | @Override
|
198 | 40435 | jjdelcerro | public ImageIcon getIcon() { |
199 | 44281 | jjdelcerro | return PluginServices.getIconTheme().get("document-view-icon"); |
200 | 40435 | jjdelcerro | } |
201 | |||
202 | 45543 | jjdelcerro | @Override
|
203 | 40435 | jjdelcerro | public ImageIcon getIconSelected() { |
204 | 44281 | jjdelcerro | return PluginServices.getIconTheme().get("document-view-icon-sel"); |
205 | 40435 | jjdelcerro | } |
206 | |||
207 | 45543 | jjdelcerro | @Override
|
208 | 40435 | jjdelcerro | public String getTitle() { |
209 | return PluginServices.getText(this, "Vista"); |
||
210 | } |
||
211 | |||
212 | 45543 | jjdelcerro | @Override
|
213 | 40435 | jjdelcerro | public String getTypeName() { |
214 | return TYPENAME;
|
||
215 | } |
||
216 | 44281 | jjdelcerro | |
217 | 45543 | jjdelcerro | @Override
|
218 | 40435 | jjdelcerro | public Class getMainWindowClass() { |
219 | return DefaultViewPanel.class;
|
||
220 | } |
||
221 | 44281 | jjdelcerro | |
222 | 45543 | jjdelcerro | @Override
|
223 | 40435 | jjdelcerro | public AbstractDocument createDocument() { |
224 | 41634 | jjdelcerro | AbstractDocument doc = new DefaultViewDocument(this); |
225 | 44281 | jjdelcerro | if (this.notifyObservers(NOTIFY_AFTER_CREATEDOCUMENT, doc).isCanceled()) { |
226 | 41634 | jjdelcerro | return null; |
227 | } |
||
228 | 44281 | jjdelcerro | return doc;
|
229 | |||
230 | 40435 | jjdelcerro | } |
231 | |||
232 | 42873 | jjdelcerro | @Override
|
233 | 41634 | jjdelcerro | public IWindow getMainWindow(Document doc, WindowLayout layout) { |
234 | 42873 | jjdelcerro | IDocumentWindow win = (IDocumentWindow) super.getMainWindow(doc, layout);
|
235 | 44281 | jjdelcerro | if (win == null) { |
236 | 42873 | jjdelcerro | win = this.createDocumentWindow(doc);
|
237 | 44281 | jjdelcerro | if (layout != null && win != null) { |
238 | 42873 | jjdelcerro | win.setWindowLayout(layout); |
239 | } |
||
240 | 44281 | jjdelcerro | if (this.notifyObservers(NOTIFY_AFTER_CREATEMAINWINDOW, win).isCanceled()) { |
241 | 43633 | jjdelcerro | return null; |
242 | } |
||
243 | 41634 | jjdelcerro | } |
244 | 44281 | jjdelcerro | if (this.notifyObservers(NOTIFY_AFTER_GETMAINWINDOW, win).isCanceled()) { |
245 | 41634 | jjdelcerro | return null; |
246 | } |
||
247 | ((AbstractDocument) doc).raiseEventCreateWindow(win);
|
||
248 | return win;
|
||
249 | } |
||
250 | 40435 | jjdelcerro | |
251 | 42873 | jjdelcerro | @Override
|
252 | 41634 | jjdelcerro | public IWindow getPropertiesWindow(Document doc) { |
253 | 42873 | jjdelcerro | IWindow win = super.getPropertiesWindow(doc);
|
254 | 44281 | jjdelcerro | if (win == null) { |
255 | 42873 | jjdelcerro | win = new ViewProperties((DefaultViewDocument) doc);
|
256 | 44281 | jjdelcerro | if (this.notifyObservers(NOTIFY_AFTER_CREATEPROPERTIESWINDOW, win).isCanceled()) { |
257 | 43633 | jjdelcerro | return null; |
258 | } |
||
259 | 42873 | jjdelcerro | } |
260 | 44281 | jjdelcerro | if (this.notifyObservers(NOTIFY_AFTER_GETPROPERTIESWINDOW, win).isCanceled()) { |
261 | 41634 | jjdelcerro | return null; |
262 | } |
||
263 | return win;
|
||
264 | } |
||
265 | |||
266 | 41081 | jjdelcerro | public void addTOCContextAction(String theAction) { |
267 | 44281 | jjdelcerro | ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
268 | ActionInfo action = actionManager.getAction(theAction); |
||
269 | if (action == null) { |
||
270 | String errmsg = "Action '" + theAction + "' not found"; |
||
271 | LOGGER.info(errmsg); |
||
272 | throw new RuntimeException(errmsg); |
||
273 | } |
||
274 | this.addTOCContextAction(action);
|
||
275 | 41081 | jjdelcerro | } |
276 | 44281 | jjdelcerro | |
277 | 42175 | jjdelcerro | public void addTOCContextAction(String theAction, String group, int groupOrder, int order) { |
278 | 44281 | jjdelcerro | ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
279 | ActionInfo action = actionManager.getAction(theAction); |
||
280 | if (action == null) { |
||
281 | String errmsg = "Action '" + theAction + "' not found"; |
||
282 | LOGGER.info(errmsg); |
||
283 | throw new RuntimeException(errmsg); |
||
284 | } |
||
285 | this.addTOCContextAction(
|
||
286 | action.getName(), |
||
287 | 45130 | omartinez | new ActionInfoAdapterToContextMenuAction(action, group, groupOrder, order)
|
288 | 42175 | jjdelcerro | ); |
289 | } |
||
290 | 44281 | jjdelcerro | |
291 | 41081 | jjdelcerro | public void addTOCContextAction(ActionInfo action) { |
292 | 44281 | jjdelcerro | this.addTOCContextAction(action.getName(), new ActionInfoAdapterToContextMenuAction(action, "default", 9000)); |
293 | 41081 | jjdelcerro | } |
294 | 44281 | jjdelcerro | |
295 | 41559 | jjdelcerro | public void addTOCContextAction(ActionInfo action, String group, int groupOrder) { |
296 | 44281 | jjdelcerro | this.addTOCContextAction(action.getName(), new ActionInfoAdapterToContextMenuAction(action, group, groupOrder)); |
297 | 41559 | jjdelcerro | } |
298 | 44281 | jjdelcerro | |
299 | 45945 | fdiaz | public void addTOCSeparator(String group, int groupOrder, int order) { |
300 | this.addTOCContextAction(
|
||
301 | group + "/-",
|
||
302 | new IContextMenuAction() {
|
||
303 | @Override
|
||
304 | public boolean isVisible(Object item, Object[] selectedItems) { |
||
305 | return true; |
||
306 | } |
||
307 | |||
308 | @Override
|
||
309 | public boolean isEnabled(Object item, Object[] selectedItems) { |
||
310 | return true; |
||
311 | } |
||
312 | |||
313 | @Override
|
||
314 | public void execute(Object item, Object[] selectedItems) { |
||
315 | } |
||
316 | |||
317 | @Override
|
||
318 | public String getGroup() { |
||
319 | return group + "/-"; |
||
320 | } |
||
321 | |||
322 | @Override
|
||
323 | public int getGroupOrder() { |
||
324 | return groupOrder;
|
||
325 | } |
||
326 | |||
327 | @Override
|
||
328 | public int getOrder() { |
||
329 | return order;
|
||
330 | } |
||
331 | |||
332 | @Override
|
||
333 | public String getText() { |
||
334 | return "-"; |
||
335 | } |
||
336 | |||
337 | @Override
|
||
338 | public String getDescription() { |
||
339 | return ""; |
||
340 | } |
||
341 | } |
||
342 | ); |
||
343 | } |
||
344 | |||
345 | 41559 | jjdelcerro | class ActionInfoAdapterToContextMenuAction extends AbstractActionInfoAdapterToTocContextMenuAction { |
346 | 44281 | jjdelcerro | |
347 | ActionInfoAdapterToContextMenuAction(ActionInfo action, String group, int groupOrder) { |
||
348 | 41559 | jjdelcerro | super(action, group, groupOrder);
|
349 | 44281 | jjdelcerro | } |
350 | |||
351 | ActionInfoAdapterToContextMenuAction(ActionInfo action, String group, int groupOrder, int order) { |
||
352 | super(action, group, groupOrder, order);
|
||
353 | } |
||
354 | 41081 | jjdelcerro | } |
355 | 44281 | jjdelcerro | |
356 | 41559 | jjdelcerro | /**
|
357 | 44281 | jjdelcerro | * @deprecated use addTOCContextAction(ActionInfo action, String group, int
|
358 | * groupOrder)
|
||
359 | 41559 | jjdelcerro | * @param id
|
360 | 44281 | jjdelcerro | * @param action
|
361 | 41559 | jjdelcerro | */
|
362 | 41081 | jjdelcerro | public void addTOCContextAction(String id, IContextMenuAction action) { |
363 | 44281 | jjdelcerro | initializeRegisterTOCActions(); |
364 | ExtensionPoint exPoint = ToolsLocator.getExtensionPointManager().add( |
||
365 | "View_TocActions", ""); |
||
366 | if (action instanceof ExtensionBuilder) { |
||
367 | exPoint.append(id, "", (ExtensionBuilder) action);
|
||
368 | return;
|
||
369 | } |
||
370 | exPoint.append(id, "", new ContextMenuActionAdapterToExtensionBuilder(action)); |
||
371 | 41081 | jjdelcerro | } |
372 | |||
373 | class ContextMenuActionAdapterToExtensionBuilder implements ExtensionBuilder { |
||
374 | 44281 | jjdelcerro | |
375 | IContextMenuAction menuAction = null;
|
||
376 | |||
377 | ContextMenuActionAdapterToExtensionBuilder(IContextMenuAction menuAction) { |
||
378 | this.menuAction = menuAction;
|
||
379 | } |
||
380 | |||
381 | 45543 | jjdelcerro | @Override
|
382 | 44281 | jjdelcerro | public Object create() { |
383 | return this.menuAction; |
||
384 | } |
||
385 | |||
386 | 45543 | jjdelcerro | @Override
|
387 | 44281 | jjdelcerro | public Object create(Object[] args) { |
388 | return this.menuAction; |
||
389 | } |
||
390 | |||
391 | 45543 | jjdelcerro | @Override
|
392 | 44281 | jjdelcerro | public Object create(Map args) { |
393 | return this.menuAction; |
||
394 | } |
||
395 | 41081 | jjdelcerro | } |
396 | 44281 | jjdelcerro | |
397 | 41104 | jjdelcerro | private static void initializeRegisterTOCActions() { |
398 | 44281 | jjdelcerro | ExtensionPointManager epManager = ToolsLocator.getExtensionPointManager(); |
399 | 41104 | jjdelcerro | |
400 | 44281 | jjdelcerro | if (!epManager.has("View_TocActions")) { |
401 | epManager.add( |
||
402 | "View_TocActions",
|
||
403 | "Context menu options of the TOC "
|
||
404 | + " in the view window "
|
||
405 | + "(register instances of "
|
||
406 | + "org.gvsig.app.gui.toc.AbstractTocContextMenuAction)"
|
||
407 | ); |
||
408 | } |
||
409 | 41104 | jjdelcerro | } |
410 | 44281 | jjdelcerro | |
411 | 40435 | jjdelcerro | /**
|
412 | * Registers in the points of extension the Factory with alias.
|
||
413 | *
|
||
414 | */
|
||
415 | public static void register() { |
||
416 | ViewManager factory = new ViewManager();
|
||
417 | 44281 | jjdelcerro | ProjectManager.getInstance().registerDocumentFactory(factory); |
418 | |||
419 | 40435 | jjdelcerro | PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
420 | manager.registerFactory(factory); |
||
421 | |||
422 | 41104 | jjdelcerro | initializeRegisterTOCActions(); |
423 | 40435 | jjdelcerro | |
424 | 44281 | jjdelcerro | ProjectManager.getInstance().registerDocumentAction(TYPENAME, new CopyDocumentAction());
|
425 | ProjectManager.getInstance().registerDocumentAction(TYPENAME, new CutDocumentAction());
|
||
426 | ProjectManager.getInstance().registerDocumentAction(TYPENAME, new PasteDocumentAction());
|
||
427 | |||
428 | IconThemeHelper.registerIcon("document", "document-view-icon", ViewManager.class); |
||
429 | IconThemeHelper.registerIcon("document", "document-view-icon-sel", ViewManager.class); |
||
430 | |||
431 | IconThemeHelper.registerIcon("cursor", "cursor-crux", ViewManager.class); |
||
432 | IconThemeHelper.registerIcon("cursor", "cursor-info-by-point", ViewManager.class); |
||
433 | IconThemeHelper.registerIcon("cursor", "cursor-pan", ViewManager.class); |
||
434 | IconThemeHelper.registerIcon("cursor", "cursor-query-area", ViewManager.class); |
||
435 | IconThemeHelper.registerIcon("cursor", "cursor-select-by-point", ViewManager.class); |
||
436 | 41121 | jldominguez | IconThemeHelper.registerIcon("cursor", "cursor-select-by-polygon", ViewManager.class); |
437 | IconThemeHelper.registerIcon("cursor", "cursor-select-by-rectangle", ViewManager.class); |
||
438 | 44281 | jjdelcerro | IconThemeHelper.registerIcon("cursor", "cursor-zoom-in", ViewManager.class); |
439 | IconThemeHelper.registerIcon("cursor", "cursor-zoom-out", ViewManager.class); |
||
440 | 40435 | jjdelcerro | |
441 | 44281 | jjdelcerro | IconThemeHelper.registerIcon("layer", "layer-icon", ViewManager.class); |
442 | IconThemeHelper.registerIcon("layer", "layer-icon-group", ViewManager.class); |
||
443 | IconThemeHelper.registerIcon("layer", "layer-icon-vectorial", ViewManager.class); |
||
444 | IconThemeHelper.registerIcon("layer", "layer-icon-csv", ViewManager.class); |
||
445 | IconThemeHelper.registerIcon("layer", "layer-icon-dgn", ViewManager.class); |
||
446 | IconThemeHelper.registerIcon("layer", "layer-icon-dxf", ViewManager.class); |
||
447 | IconThemeHelper.registerIcon("layer", "layer-icon-postgresql", ViewManager.class); |
||
448 | IconThemeHelper.registerIcon("layer", "layer-icon-mysql", ViewManager.class); |
||
449 | IconThemeHelper.registerIcon("layer", "layer-icon-jdbc", ViewManager.class); |
||
450 | //IconThemeHelper.registerIcon("layer", "layer-icon-unavailable", ViewManager.class);
|
||
451 | IconThemeHelper.registerIcon("layer", "layer-chk-unavailable", ViewManager.class); |
||
452 | IconThemeHelper.registerIcon("layer", "layer-chk-temporary", ViewManager.class); |
||
453 | 45128 | omartinez | IconThemeHelper.registerIcon("layer", "active-layer-bring-front", ViewManager.class); |
454 | IconThemeHelper.registerIcon("layer", "active-layer-move-ahead", ViewManager.class); |
||
455 | IconThemeHelper.registerIcon("layer", "active-layer-move-behind", ViewManager.class); |
||
456 | IconThemeHelper.registerIcon("layer", "active-layer-send-back", ViewManager.class); |
||
457 | IconThemeHelper.registerIcon("layer", "active-layer-set-hide", ViewManager.class); |
||
458 | IconThemeHelper.registerIcon("layer", "active-layer-set-visible", ViewManager.class); |
||
459 | IconThemeHelper.registerIcon("layer", "layer-set-visible", ViewManager.class); |
||
460 | IconThemeHelper.registerIcon("layer", "layer-set-hide", ViewManager.class); |
||
461 | IconThemeHelper.registerIcon("layer", "layer-set-inactive", ViewManager.class); |
||
462 | IconThemeHelper.registerIcon("layer", "layer-set-active", ViewManager.class); |
||
463 | 40435 | jjdelcerro | |
464 | 44281 | jjdelcerro | IconThemeHelper.registerIcon("legend", "legend-overview-single-symbol", ViewManager.class); |
465 | IconThemeHelper.registerIcon("legend", "legend-overview-vectorial-interval", ViewManager.class); |
||
466 | IconThemeHelper.registerIcon("legend", "legend-overview-vectorial-unique-value", ViewManager.class); |
||
467 | 40435 | jjdelcerro | |
468 | 44281 | jjdelcerro | MapContextManager mapContextMgr = MapContextLocator.getMapContextManager(); |
469 | mapContextMgr.registerIconLayer("CSV", "layer-icon-csv"); |
||
470 | mapContextMgr.registerIconLayer("DGN", "layer-icon-dgn"); |
||
471 | mapContextMgr.registerIconLayer("DXF", "layer-icon-dxf"); |
||
472 | mapContextMgr.registerIconLayer("jdbc", "layer-icon-jdbc"); |
||
473 | mapContextMgr.registerIconLayer("PostgreSQL", "layer-icon-postgresql"); |
||
474 | mapContextMgr.registerIconLayer("MySQL", "layer-icon-mysql"); |
||
475 | |||
476 | if (factory.persistenceDefinition == null) { |
||
477 | 40435 | jjdelcerro | factory.persistenceDefinition = manager.addDefinition( |
478 | 44281 | jjdelcerro | ViewDocument.class, |
479 | PERSISTENCE_VIEW_DOCUMENT_DEFINITION_NAME, |
||
480 | "Default view document persistence definition",
|
||
481 | null,
|
||
482 | null
|
||
483 | 40435 | jjdelcerro | ); |
484 | factory.persistenceDefinition.extend(manager.getDefinition(AbstractDocument.PERSISTENCE_DEFINITION_NAME));
|
||
485 | |||
486 | factory.persistenceDefinition.addDynFieldBoolean("useMapOverview").setMandatory(true); |
||
487 | factory.persistenceDefinition.addDynFieldObject("mainMapContext").setClassOfValue(MapContext.class).setMandatory(true); |
||
488 | factory.persistenceDefinition.addDynFieldObject("overviewMapContext").setClassOfValue(MapContext.class).setMandatory(false); |
||
489 | 41350 | jjdelcerro | factory.persistenceDefinition.addDynFieldObject("propertiesHelper").setClassOfValue(ExtendedPropertiesHelper.class)
|
490 | 44281 | jjdelcerro | .setMandatory(false);
|
491 | |||
492 | 40435 | jjdelcerro | } |
493 | 44281 | jjdelcerro | ViewDocumentStoresRepository.selfRegister(); |
494 | ViewZoomActionFactory.selfRegister(); |
||
495 | 46089 | omartinez | AddFilterToLayerActionFactory.selfRegister(); |
496 | CreateTemporalLayerAction.CreateTemporalLayerActionFactory.selfRegister(); |
||
497 | 40435 | jjdelcerro | } |
498 | |||
499 | @SuppressWarnings("rawtypes") |
||
500 | 45543 | jjdelcerro | @Override
|
501 | 40435 | jjdelcerro | public DynStruct getDefinition(String className) { |
502 | |||
503 | 44281 | jjdelcerro | if (this.persistenceDefinition.getName().equalsIgnoreCase(className)) { |
504 | 40435 | jjdelcerro | return this.persistenceDefinition; |
505 | } |
||
506 | 44281 | jjdelcerro | if (this.persistenceDefinition.getFullName().equalsIgnoreCase(className)) { |
507 | 40435 | jjdelcerro | return this.persistenceDefinition; |
508 | } |
||
509 | 44281 | jjdelcerro | if (this.getDocumentClass().getName().equals(className)) { |
510 | 40435 | jjdelcerro | return this.persistenceDefinition; |
511 | } |
||
512 | |||
513 | return null; |
||
514 | } |
||
515 | |||
516 | @SuppressWarnings("rawtypes") |
||
517 | 45543 | jjdelcerro | @Override
|
518 | 40435 | jjdelcerro | protected Class getDocumentClass() { |
519 | return DefaultViewDocument.class;
|
||
520 | } |
||
521 | |||
522 | 45543 | jjdelcerro | @Override
|
523 | 40435 | jjdelcerro | public boolean manages(Object object) { |
524 | return object instanceof ViewDocument; |
||
525 | } |
||
526 | } |