Revision 9002 trunk/extensions/extWCS/src/com/iver/cit/gvsig/gui/dialog/WCSPropsDialog.java

View differences:

WCSPropsDialog.java
65 65

  
66 66
/**
67 67
 *  The TOC WCS properties panel container.
68
 *  
68
 *
69 69
 * @author jaume - jaume.dominguez@iver.es
70 70
 *
71 71
 */
......
76 76
	private FLayer fLayer = null;
77 77
	boolean applied;
78 78
	private WindowInfo m_ViewInfo = null;
79
	
79

  
80 80
	private JButton btnApply = null;
81 81
	private JButton btnOk = null;
82 82
	private JButton btnCancel = null;
......
85 85

  
86 86
    /**
87 87
     * Creates a new instance of WCSPropsDialog
88
     * @param layer, 
88
     * @param layer,
89 89
     */
90 90
    public WCSPropsDialog(FLyrWCS layer) {
91 91
		super();
92 92
		initialize(layer);
93 93
	}
94
    
95
    
94

  
95

  
96 96
	private void initialize(FLyrWCS layer) {
97 97
		setBounds(0,0,500,333);
98 98
        setLayout(null);
......
108 108

  
109 109
			public void error(Exception e) {
110 110
			}
111
        	
112
        })  ; 
113
        
111

  
112
        })  ;
113

  
114 114
        this.add(wcsParamsTabbedPane);
115
		this.add(getButtonsPanel(), null);        
115
		this.add(getButtonsPanel(), null);
116 116
	}
117
	
118 117

  
118

  
119 119
	public void setFLayer(FLayer f) {
120 120
		fLayer = f;
121 121
	}
......
126 126
	 * recovered) it is been automatically constructed by connecting to the server,
127 127
	 * reloading the necessary data, filling up the content and setting the selected
128 128
	 * values that were selected when the projet was saved.
129
	 * 
129
	 *
130 130
	 * Since a connection to the server is needed when rebuiliding the panel, this
131 131
	 * causes a delay for the panel's showing up or a nullPointer error if there is
132 132
	 * no path to the server.
133
	 * 
134
	 * 
133
	 *
134
	 *
135 135
	 * Con getParamsPanel tenemos acceso a juego de pesta?as de configuraci?n
136 136
	 * de la cobertura. Si este panel todav?a no existe (como puede ser cuando
137 137
	 * recuperamos un proyecto guardado) ?ste se crea autom?ticamente conectando
138 138
	 * al servidor, recuperando los datos necesarios, rellenando el contenido y
139 139
	 * dejando seleccionados los valores que estaban seleccionados cuando se
140 140
	 * guard? el proyecto.
141
	 * 
141
	 *
142 142
	 * Como para reconstruirse requiere una conexi?n con el servidor esto causa
143 143
	 * un retardo en la aparici?n en el toc o un error de nullPointer si no
144 144
	 * hay conexi?n hasta el servidor.
145
	 * 
145
	 *
146 146
	 * @return WCSParamsPanel
147 147
	 */
148 148
	public WCSParamsPanel getParamsPanel(Hashtable info) {
149 149
		try {
150
			
150

  
151 151
			URL host = (URL) info.get("host");
152 152
			WCSWizardData dataSource = new WCSWizardData();
153
			dataSource.setHost(host);
154
			
153
			dataSource.setHost(host, false);
154

  
155 155
			WCSParamsPanel toc = new WCSParamsPanel();
156 156
			toc.setVisible(true);
157 157
			toc.setListenerSupport(new WizardListenerSupport());
158
			
158

  
159 159
			toc.setDataSource(dataSource);
160
			
160

  
161 161
			toc.getLstCoverages().setListData(dataSource.getCoverageList());
162
			
162

  
163 163
			String coverageName = (String) info.get("name");
164 164
			int index = toc.getCoverageIndex( coverageName );
165 165
			if (index != -1)
166 166
				toc.getLstCoverages().setSelectedIndex(index);
167
			
167

  
168 168
			toc.refreshData();
169
			
169

  
170 170
			index = toc.getSRSIndex((String) info.get("crs") );
171 171
			if (index != -1)
172 172
				toc.getLstCRSs().setSelectedIndex(index);
......
180 180
			if (!parameter.equals("")){
181 181
				String[] s = parameter.split("=");
182 182
				String pName = s[0];
183
				
183

  
184 184
				String regexDouble = "-?[0-9]+(\\.[0-9]+)?";
185 185
				String regexInterval = regexDouble+"/"+regexDouble;
186 186
				String regexIntervalList = regexInterval+"(,"+regexInterval+")*";
......
188 188
					// Single Interval
189 189
					toc.getJScrollPane5().setVisible(false);
190 190
					toc.getSingleParamValuesList().setEnabled(false);
191
					
192
				
191

  
192

  
193 193
				} else if (s[1].matches(regexIntervalList)){
194 194
					// Multiple Interval
195
					
195

  
196 196
				} else {
197 197
					// Single values
198 198
					toc.getJScrollPane5().setVisible(true);
199 199
					toc.getSingleParamValuesList().setEnabled(true);
200
					
200

  
201 201
					String[] pVals = s[1].split(",");
202
					index = toc.getParamIndex(pName); 
202
					index = toc.getParamIndex(pName);
203 203
					toc.getCmbParam().setSelectedIndex(index);
204 204
					//toc.refreshParamValues( coverageName );
205 205
					int[] indexes = new int[pVals.length];
206 206
					for (int i = 0; i < pVals.length; i++) {
207 207
						indexes[i] = toc.getValueIndex(pVals[i]);
208 208
					}
209
					
209

  
210 210
					toc.getSingleParamValuesList().setSelectedIndices(indexes);
211 211
				}
212
			}	
212
			}
213 213
			toc.refreshInfo();
214 214
			return toc;
215 215
		} catch (DriverException soe) {
......
219 219
		}
220 220
		return null;
221 221
	}
222
	
222

  
223 223
	public JPanel getButtonsPanel() {
224 224
		if (buttonsPanel == null) {
225 225
			m_actionListener = new ComandosListener(this);
226 226
			buttonsPanel = new JPanel();
227 227
	        buttonsPanel.setBounds(5, wcsParamsTabbedPane.getHeight(), 471, 40);
228
			buttonsPanel.setLayout(null);     
228
			buttonsPanel.setLayout(null);
229 229
			buttonsPanel.setName("buttonPanel");
230
			
230

  
231 231
	        buttonsPanel.add(getBtnOk(), null);
232 232
	        buttonsPanel.add(getBtnApply(), null);
233 233
	        buttonsPanel.add(getBtnCancel(), null);
234 234
		}
235 235
		return buttonsPanel;
236 236
	}
237
	
237

  
238 238
	public JButton getBtnOk() {
239 239
		if (btnOk == null) {
240 240
	        btnOk = new JButton("Ok");
......
245 245
		}
246 246
		return btnOk;
247 247
	}
248
	
248

  
249 249
	public JButton getBtnApply() {
250 250
		if (btnApply == null) {
251 251
	        btnApply = new JButton("Apply");
......
257 257
		}
258 258
		return btnApply;
259 259
	}
260
	
260

  
261 261
	public JButton getBtnCancel() {
262 262
		if (btnCancel == null) {
263 263
	        btnCancel = new JButton("Cancel");
......
268 268
		}
269 269
		return btnCancel;
270 270
	}
271
	
271

  
272 272
    private class ComandosListener implements ActionListener {
273 273
        private WCSPropsDialog m_tp;
274 274

  
......
289 289
				close();
290 290
			} else {
291 291
				applied = false;
292
				
292

  
293 293
            	((FLyrWCS) fLayer).setCoverageName(wcsParamsTabbedPane.getCurrentCoverageName());
294 294
            	((FLyrWCS) fLayer).setName(wcsParamsTabbedPane.getCoverageName());
295 295
            	((FLyrWCS) fLayer).setSRS(wcsParamsTabbedPane.getSRS());
......
297 297
            	((FLyrWCS) fLayer).setFullExtent(wcsParamsTabbedPane.getExtent());
298 298
            	((FLyrWCS) fLayer).setTime(wcsParamsTabbedPane.getTime());
299 299
            	((FLyrWCS) fLayer).setParameter(wcsParamsTabbedPane.getParameterString());
300
            	
300

  
301 301
            	if (e.getActionCommand() == "APPLY") {
302 302
            		com.iver.cit.gvsig.project.documents.view.gui.View vista = (com.iver.cit.gvsig.project.documents.view.gui.View) PluginServices.getMDIManager().getActiveWindow();
303 303
            		MapControl mapCtrl = vista.getMapControl();
......
305 305
            		applied = true;
306 306
            		getBtnApply().setEnabled(!applied);
307 307
            	}
308
            	
308

  
309 309
            	if (e.getActionCommand() == "OK") {
310 310
            		if (!applied) {
311 311
            			com.iver.cit.gvsig.project.documents.view.gui.View vista = (com.iver.cit.gvsig.project.documents.view.gui.View) PluginServices.getMDIManager().getActiveWindow();
......
317 317
             }
318 318
		}
319 319
    }
320
    
320

  
321 321
	public WindowInfo getWindowInfo() {
322 322
		if (m_ViewInfo==null){
323 323
			m_ViewInfo=new WindowInfo(WindowInfo.MODALDIALOG);
......
327 327
		}
328 328
		return m_ViewInfo;
329 329
	}
330
	
330

  
331 331
	public void viewActivated() {
332 332
	}
333 333

  
......
340 340
			dlg.setBounds(bnds);
341 341
			dlg.setSize(getSize());
342 342
			dlg.getContentPane().add(this);
343
			dlg.setModal(true);			
343
			dlg.setModal(true);
344 344
			dlg.pack();
345 345
			dlg.show();
346 346
		} else
347 347
			PluginServices.getMDIManager().addWindow(this);
348 348
	}
349
	
349

  
350 350
	public void close() {
351
		PluginServices.getMDIManager().closeWindow(this);		
351
		PluginServices.getMDIManager().closeWindow(this);
352 352
	}
353 353

  
354 354
}

Also available in: Unified diff