root / branches / v2_0_0_prep / extensions / extWFS2 / src / org / gvsig / wfs / gui / toc / WFSProperties.java @ 38564
History | View | Annotate | Download (4.91 KB)
1 | 27885 | jpiera | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
4 | * of the Valencian Government (CIT)
|
||
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 2
|
||
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 | */
|
||
22 | |||
23 | /*
|
||
24 | * AUTHORS (In addition to CIT):
|
||
25 | * 2009 {Iver T.I.} {Task}
|
||
26 | */
|
||
27 | |||
28 | 29645 | jpiera | package org.gvsig.wfs.gui.toc; |
29 | 27885 | jpiera | |
30 | 27940 | jpiera | import java.awt.BorderLayout; |
31 | |||
32 | 29645 | jpiera | import org.gvsig.andami.PluginServices; |
33 | import org.gvsig.app.panelGroup.loaders.PanelGroupLoaderFromExtensionPoint; |
||
34 | import org.gvsig.app.project.documents.view.legend.gui.AbstractThemeManagerPage; |
||
35 | 27885 | jpiera | import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer; |
36 | 36033 | jpiera | import org.gvsig.fmap.mapcontext.exceptions.CreateLayerException; |
37 | 27885 | jpiera | import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
38 | import org.gvsig.fmap.mapcontext.layers.FLayer; |
||
39 | import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
||
40 | 36469 | jpiera | import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
41 | import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
||
42 | 27885 | jpiera | import org.gvsig.gui.beans.panelGroup.PanelGroupManager; |
43 | 29645 | jpiera | import org.gvsig.wfs.gui.panels.WFSParamsPanel; |
44 | import org.gvsig.wfs.gui.panels.model.WFSSelectedFeatureManager; |
||
45 | 38564 | jjdelcerro | import org.slf4j.Logger; |
46 | import org.slf4j.LoggerFactory; |
||
47 | 27885 | jpiera | |
48 | |||
49 | /**
|
||
50 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
||
51 | */
|
||
52 | public class WFSProperties extends AbstractThemeManagerPage{ |
||
53 | 36033 | jpiera | private static final long serialVersionUID = -3666226507540534256L; |
54 | |||
55 | private static final Logger LOG = LoggerFactory.getLogger(WFSProperties.class); |
||
56 | |||
57 | private WFSParamsPanel panel = null; |
||
58 | 27885 | jpiera | private FLyrVect layer = null; |
59 | private final String wfs_properties_extensionpoint_name = "WFSPropertiesDialog"; |
||
60 | |||
61 | public WFSProperties() {
|
||
62 | 27940 | jpiera | super();
|
63 | setLayout(new BorderLayout()); |
||
64 | 27885 | jpiera | } |
65 | |||
66 | /* (non-Javadoc)
|
||
67 | * @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#acceptAction()
|
||
68 | */
|
||
69 | public void acceptAction() { |
||
70 | applyAction(); |
||
71 | } |
||
72 | |||
73 | /* (non-Javadoc)
|
||
74 | * @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#applyAction()
|
||
75 | */
|
||
76 | 32719 | jpiera | public void applyAction() { |
77 | 36033 | jpiera | if (panel != null){ |
78 | try{
|
||
79 | 36469 | jpiera | ILegend legend = layer.getLegend(); |
80 | 36033 | jpiera | FLyrVect newLayer = (FLyrVect)panel.createLayer(); |
81 | 36469 | jpiera | if (newLayer != null){ |
82 | layer.getMapContext().getLayers().replaceLayer(layer, newLayer); |
||
83 | 36033 | jpiera | layer = newLayer; |
84 | 36469 | jpiera | layer.setLegend((IVectorLegend)legend); |
85 | 36033 | jpiera | } |
86 | } catch (LoadLayerException e) {
|
||
87 | LOG.error("Error loading the new layer", e);
|
||
88 | } catch (CreateLayerException e) {
|
||
89 | LOG.error("Error creating the new layer", e);
|
||
90 | } |
||
91 | |||
92 | 27885 | jpiera | } |
93 | } |
||
94 | |||
95 | /* (non-Javadoc)
|
||
96 | * @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#cancelAction()
|
||
97 | */
|
||
98 | public void cancelAction() { |
||
99 | // TODO Auto-generated method stub
|
||
100 | |||
101 | } |
||
102 | |||
103 | /* (non-Javadoc)
|
||
104 | * @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#getName()
|
||
105 | */
|
||
106 | public String getName() { |
||
107 | return PluginServices.getText(this, "WFS"); |
||
108 | } |
||
109 | |||
110 | /* (non-Javadoc)
|
||
111 | * @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#setModel(org.gvsig.fmap.mapcontext.layers.FLayer)
|
||
112 | */
|
||
113 | public void setModel(FLayer layer) { |
||
114 | this.layer = (FLyrVect)layer;
|
||
115 | PanelGroupManager manager = PanelGroupManager.getManager(); |
||
116 | manager.registerPanelGroup(WFSParamsPanel.class); |
||
117 | manager.setDefaultType(WFSParamsPanel.class); |
||
118 | try {
|
||
119 | 35980 | jjdelcerro | if( ! (this.layer.getDataStore().getExplorer() instanceof WFSServerExplorer) ) { |
120 | return;
|
||
121 | } |
||
122 | 27885 | jpiera | boolean firstExecution = (panel == null); |
123 | 35980 | jjdelcerro | WFSServerExplorer serverExplorer = (WFSServerExplorer)this.layer.getDataStore().getExplorer();
|
124 | 27945 | jpiera | WFSSelectedFeatureManager selectedFeatureManager = WFSSelectedFeatureManager.getInstance(serverExplorer); |
125 | 27885 | jpiera | panel = (WFSParamsPanel) manager.getPanelGroup(null);
|
126 | panel.loadPanels(new PanelGroupLoaderFromExtensionPoint(wfs_properties_extensionpoint_name));
|
||
127 | panel.setServerExplorer(serverExplorer); |
||
128 | 36033 | jpiera | panel.setVisible(true);
|
129 | 27940 | jpiera | if (firstExecution){
|
130 | add(panel, BorderLayout.CENTER);
|
||
131 | 36033 | jpiera | } |
132 | 27885 | jpiera | |
133 | 36033 | jpiera | //Refresh the forms with the capabilities information
|
134 | panel.refreshCapabilitiesInfo(); |
||
135 | 36036 | jpiera | |
136 | //Set the datastore
|
||
137 | panel.setDataStore(((FLyrVect)layer).getDataStore()); |
||
138 | 27885 | jpiera | } catch (Exception e) { |
139 | 36033 | jpiera | LOG.error("Error loading the layer", e);
|
140 | 27885 | jpiera | } |
141 | } |
||
142 | |||
143 | } |