Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / DefaultWFSDialogPanel.java @ 17593

History | View | Annotate | Download (5.1 KB)

1
package com.iver.cit.gvsig.gui.panels;
2

    
3
import java.awt.Dimension;
4
import java.net.URL;
5
import java.util.HashMap;
6

    
7
import org.gvsig.gui.beans.panelGroup.AbstractPanelGroup;
8
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
9
import org.gvsig.remoteClient.wfs.WFSStatus;
10

    
11
import com.iver.cit.gvsig.fmap.layers.FLyrWFS;
12
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
13
import com.iver.cit.gvsig.gui.wizards.WFSWizardData;
14
import com.iver.cit.gvsig.gui.wizards.WizardData;
15
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport;
16
import com.sun.medialib.codec.jp2k.Params;
17

    
18
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
19
 *
20
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
21
 *
22
 * This program is free software; you can redistribute it and/or
23
 * modify it under the terms of the GNU General Public License
24
 * as published by the Free Software Foundation; either version 2
25
 * of the License, or (at your option) any later version.
26
 *
27
 * This program is distributed in the hope that it will be useful,
28
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30
 * GNU General Public License for more details.
31
 *
32
 * You should have received a copy of the GNU General Public License
33
 * along with this program; if not, write to the Free Software
34
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
35
 *
36
 * For more information, contact:
37
 *
38
 *  Generalitat Valenciana
39
 *   Conselleria d'Infraestructures i Transport
40
 *   Av. Blasco Ib??ez, 50
41
 *   46010 VALENCIA
42
 *   SPAIN
43
 *
44
 *      +34 963862235
45
 *   gvsig@gva.es
46
 *      www.gvsig.gva.es
47
 *
48
 *    or
49
 *
50
 *   IVER T.I. S.A
51
 *   Salamanca 50
52
 *   46005 Valencia
53
 *   Spain
54
 *
55
 *   +34 963163400
56
 *   dac@iver.es
57
 */
58
/* CVS MESSAGES:
59
 *
60
 * $Id$
61
 * $Log$
62
 *
63
 */
64
/**
65
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
66
 */
67
public abstract class DefaultWFSDialogPanel extends AbstractPanel implements IWFSDialogPanel  {
68
        private FLyrWFS layer = null;        
69
        //Params panel has to be the same instance
70
        private static WFSParamsPanelData paramsPanel = null;
71
        //Panel dimension
72
        static final int PANEL_WIDTH = 40;
73
        static final int PANEL_LENGHT = 40;
74
        
75
        static{
76
                paramsPanel = new WFSParamsPanelData();
77
        }
78
        
79
        /**
80
         * Gets the params panel data object
81
         * @return
82
         */
83
        public static WFSParamsPanelData getDeafultParamsPanelData(){
84
                return paramsPanel;
85
        }
86
        
87
        public DefaultWFSDialogPanel(){
88
                super();
89
                setPreferredSize(new Dimension(PANEL_LENGHT,PANEL_WIDTH));
90
        }
91

    
92
        /*
93
         * (non-Javadoc)
94
         * @see com.iver.cit.gvsig.gui.panels.IWFSDialogPanel#getParamsPanel()
95
         */
96
        public WFSParamsPanelData getParamsPanelData() {
97
                return paramsPanel;
98
        }
99
        
100
        /*
101
         * (non-Javadoc)
102
         * @see com.iver.cit.gvsig.gui.panels.IWFSDialogPanel#setParamsPanel(com.iver.cit.gvsig.gui.panels.WFSParamsPanel)
103
         */
104
        public void setParamsPanelData(WFSParamsPanelData paramsPanel) {
105
                this.paramsPanel = paramsPanel;
106
        }
107
        
108
        /**
109
         * @return the wizard data
110
         */
111
        public WFSWizardData getWizardData(){
112
                return paramsPanel.getWizardData();
113
        }
114

    
115
        /*
116
         * (non-Javadoc)
117
         * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#setReference(java.lang.Object)
118
         */
119
        public void setReference(Object ref) {
120
                super.setReference(ref);
121
                if (ref instanceof FLyrWFS){                        
122
                        layer = (FLyrWFS)ref;
123
                        refresh(layer.getWfsLayerNode());
124
                }                
125
        }        
126
        
127
        /**
128
         * Retrieve the WFS parameters
129
         * @param layer
130
         * The WFSLayer
131
         * @return
132
         * The WFS parameters
133
         */
134
        public static WFSParamsPanelData getParamsPanelData(FLyrWFS layer) {
135
                HashMap<String, Object> info = layer.getProperties();
136
                if (info!=null){
137
                        paramsPanel.updateStatus((WFSStatus)info.get("status"));
138
                        //Sets the wizard data
139
                        URL host = (URL) info.get("host");
140
                        WFSWizardData dataSource = new WFSWizardData();
141
                        dataSource.setHost(host, false);
142
                        dataSource.setDriver(layer.getWfsDriver());
143
                        paramsPanel.setWizardData(dataSource);                
144
                        //The features panel
145
                        paramsPanel.getFeaturePanel().setSelectedFeature((WFSLayerNode)info.get("wfsLayerNode"));
146
                        paramsPanel.getFeaturePanel().setLayerName(layer.getName());                        
147
                        return paramsPanel;
148
                }
149
                return null;
150
        }
151

    
152
        /* (non-Javadoc)
153
         * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#setPanelGroup(org.gvsig.gui.beans.panelGroup.AbstractPanelGroup)
154
         */
155
        @Override
156
        public void setPanelGroup(AbstractPanelGroup panelGroup) {
157
                super.setPanelGroup(panelGroup);
158
                paramsPanel.setPanel(this);                
159
        }
160
        
161
        /*
162
         * (non-Javadoc)
163
         * @see com.iver.cit.gvsig.gui.panels.IWFSDialogPanel#updatePanel(org.gvsig.remoteClient.wfs.WFSStatus)
164
         */
165
        public void updateStatus(WFSStatus status) {
166
                
167
        }
168

    
169
        /**
170
         * @return the layer
171
         */
172
        public FLyrWFS getLayer() {
173
                return layer;
174
        }
175
        
176
        /*
177
         * (non-Javadoc)
178
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#accept()
179
         */
180
        public void accept() {
181
                                
182
        }
183

    
184
        /*
185
         * (non-Javadoc)
186
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#apply()
187
         */        
188
        public void apply() {
189
                                
190
        }
191

    
192
        /*
193
         * (non-Javadoc)
194
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#cancel()
195
         */
196
        public void cancel() {
197
                
198
        }
199
        
200
        /*
201
         * (non-Javadoc)
202
         * @see org.gvsig.gui.beans.panelGroup.panels.IPanel#selected()
203
         */
204
        public void selected() {
205
                                
206
        }
207

    
208
}