root / branches / v2_0_0_prep / extensions / extWFS2 / src / org / gvsig / wfs / gui / toc / WFSProperties.java @ 34026
History | View | Annotate | Download (4.53 KB)
1 |
/* 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 |
package org.gvsig.wfs.gui.toc; |
29 |
|
30 |
import java.awt.BorderLayout; |
31 |
|
32 |
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 |
import org.gvsig.fmap.dal.DataStore; |
36 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer; |
37 |
import org.gvsig.fmap.dal.store.wfs.WFSStoreParameters; |
38 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
39 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
40 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
41 |
import org.gvsig.gui.beans.panelGroup.PanelGroupManager; |
42 |
import org.gvsig.wfs.gui.panels.WFSParamsPanel; |
43 |
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeatureManager; |
44 |
|
45 |
|
46 |
/**
|
47 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
48 |
*/
|
49 |
public class WFSProperties extends AbstractThemeManagerPage{ |
50 |
private WFSParamsPanel panel = null; |
51 |
private FLyrVect layer = null; |
52 |
private final String wfs_properties_extensionpoint_name = "WFSPropertiesDialog"; |
53 |
|
54 |
public WFSProperties() {
|
55 |
super();
|
56 |
setLayout(new BorderLayout()); |
57 |
} |
58 |
|
59 |
/* (non-Javadoc)
|
60 |
* @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#acceptAction()
|
61 |
*/
|
62 |
public void acceptAction() { |
63 |
applyAction(); |
64 |
} |
65 |
|
66 |
/* (non-Javadoc)
|
67 |
* @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#applyAction()
|
68 |
*/
|
69 |
public void applyAction() { |
70 |
if (panel != null){ |
71 |
FLyrVect newLayer = (FLyrVect)panel.getLayer(); |
72 |
if (newLayer != null){ |
73 |
try{
|
74 |
layer.getMapContext().getLayers().replaceLayer(layer.getName(), newLayer); |
75 |
layer = newLayer; |
76 |
} catch (LoadLayerException e) {
|
77 |
// TODO Auto-generated catch block
|
78 |
e.printStackTrace(); |
79 |
} |
80 |
} |
81 |
} |
82 |
} |
83 |
|
84 |
/* (non-Javadoc)
|
85 |
* @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#cancelAction()
|
86 |
*/
|
87 |
public void cancelAction() { |
88 |
// TODO Auto-generated method stub
|
89 |
|
90 |
} |
91 |
|
92 |
/* (non-Javadoc)
|
93 |
* @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#getName()
|
94 |
*/
|
95 |
public String getName() { |
96 |
return PluginServices.getText(this, "WFS"); |
97 |
} |
98 |
|
99 |
/* (non-Javadoc)
|
100 |
* @see com.iver.cit.gvsig.project.documents.view.legend.gui.AbstractThemeManagerPage#setModel(org.gvsig.fmap.mapcontext.layers.FLayer)
|
101 |
*/
|
102 |
public void setModel(FLayer layer) { |
103 |
this.layer = (FLyrVect)layer;
|
104 |
PanelGroupManager manager = PanelGroupManager.getManager(); |
105 |
manager.registerPanelGroup(WFSParamsPanel.class); |
106 |
manager.setDefaultType(WFSParamsPanel.class); |
107 |
try {
|
108 |
boolean firstExecution = (panel == null); |
109 |
WFSServerExplorer serverExplorer = (WFSServerExplorer)((DataStore)((FLyrVect)layer).getDataStore()).getExplorer(); |
110 |
WFSSelectedFeatureManager selectedFeatureManager = WFSSelectedFeatureManager.getInstance(serverExplorer); |
111 |
panel = (WFSParamsPanel) manager.getPanelGroup(null);
|
112 |
panel.loadPanels(new PanelGroupLoaderFromExtensionPoint(wfs_properties_extensionpoint_name));
|
113 |
panel.setServerExplorer(serverExplorer); |
114 |
panel.setVisible(true);
|
115 |
panel.setLayer((FLyrVect)layer); |
116 |
if (firstExecution){
|
117 |
add(panel, BorderLayout.CENTER);
|
118 |
} |
119 |
this.doLayout();
|
120 |
//Refresh the panel
|
121 |
|
122 |
WFSStoreParameters storeParameters = (WFSStoreParameters)((FLyrVect)layer).getDataStore().getParameters(); |
123 |
String featureType = storeParameters.getFeatureType();
|
124 |
panel.setSelectedFeature(selectedFeatureManager.getFeatureInfo(storeParameters.getFeatureNamespace(), |
125 |
storeParameters.getFeatureType()), |
126 |
(FLyrVect)layer); |
127 |
} catch (Exception e) { |
128 |
// TODO Auto-generated catch block
|
129 |
e.printStackTrace(); |
130 |
} |
131 |
} |
132 |
|
133 |
} |
134 |
|