Revision 1356 org.gvsig.raster.wcs/trunk/org.gvsig.raster.wcs/org.gvsig.raster.wcs.app/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/wizard/WCSWizard.java

View differences:

WCSWizard.java
27 27
import java.awt.event.ActionEvent;
28 28
import java.awt.event.ActionListener;
29 29
import java.awt.geom.Rectangle2D;
30
import java.io.IOException;
30 31
import java.net.MalformedURLException;
31 32
import java.net.URL;
32 33
import java.util.prefs.Preferences;
......
56 57
import org.gvsig.fmap.dal.exception.InitializeException;
57 58
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
58 59
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
59
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
60 60
import org.gvsig.fmap.mapcontext.exceptions.ProjectionLayerException;
61 61
import org.gvsig.fmap.mapcontext.layers.FLayer;
62
import org.gvsig.gui.beans.Messages;
62 63
import org.gvsig.raster.cache.tile.TileCacheLibrary;
63 64
import org.gvsig.raster.util.CancelTaskImpl;
64 65
import org.gvsig.raster.wcs.app.wcsclient.gui.panel.WCSParamsPanel;
......
148 149
		this.add(wcsParamsPanel, null);
149 150
		this.add(lblServerType, null);
150 151
		this.add(lblServerTypeValue, null);
151
		getPanelPage2().setVisible(true);
152
		getWCSParamsPanel().setVisible(true);
152 153

  
153 154
		connected = true;
154 155
	}
......
190 191
		this.setPreferredSize(new java.awt.Dimension(750, 420));
191 192
		this.setVisible(true);
192 193
		this.add(getPanelPage1(), null);
193
		this.add(getPanelPage2(), null);
194
		this.add(getWCSParamsPanel(), null);
194 195
		this.add(getBtnAnterior(), null);
195 196
		this.add(getBtnSiguiente(), null);
196 197
		this.add(lblServerType, null);
......
199 200
	}
200 201

  
201 202

  
202
	protected JPanel getPanelPage2(){
203
	protected JPanel getWCSParamsPanel(){
203 204
		if (wcsParamsPanel == null){
204 205
			wcsParamsPanel = new WCSParamsPanel();
205 206
			wcsParamsPanel.setListenerSupport(this.listenerSupport);
......
257 258
	    	try {
258 259
	    		explorer.connect(cancel);
259 260
			} catch (RemoteServiceException e) {
260
				logger.info("The connection cannot be established", e);
261
				String msg = getIOExceptionMessage(e);
262
				if(msg != null) {
263
					logger.info(msg, e);
264
					JOptionPane.showMessageDialog(getWCSParamsPanel(), msg, Messages.getText("Error"), JOptionPane.ERROR_MESSAGE);
265
				} else
266
					logger.info("IOException", e);
261 267
				return;
262 268
			} finally {
263 269
				((CancelTaskImpl)cancel).setCanceled(false);
......
267 273
			
268 274
			wizard.rellenarControles();
269 275
	    }
276
	    
277
	    /**
278
		 * Gets the <code>IOException</code> message. The message 
279
		 * of this exception is returned by the server
280
		 * @param e
281
		 * @return
282
		 */
283
		private String getIOExceptionMessage(Exception e) {
284
			Throwable ex = e;
285
			final int MAX_DEEP = 10;
286
			int deep = 0;
287
			while(deep < MAX_DEEP) {
288
				Throwable t = null;
289
				if(ex instanceof IOException) {
290
					return ex.getMessage();
291
				} else if(ex instanceof RemoteServiceException) {
292
					t = ex.getCause();
293
				}
294
				if(t == null)
295
					return null;
296
				else
297
					ex = t;
298
				deep++;
299
			}
300
			return null;
301
		}
270 302
	}
271 303

  
272 304
	/**
......
298 330
		}
299 331
	}
300 332
	
333
	@SuppressWarnings("deprecation")
301 334
	public void actionPerformed(ActionEvent e) {
302 335
		if(e.getSource() == getBtnConnect()) {
303 336
			getBtnCancel().setEnabled(true);
......
561 594
					}
562 595
					page++;
563 596
					getPanelPage1().setVisible(false);
564
					getPanelPage2().setVisible(true);
597
					getWCSParamsPanel().setVisible(true);
565 598
					activarVisualizarBotones();
566 599
				}
567 600
			});
......
613 646
						getTxtAbstract().setText("");
614 647
						wcsParamsPanel.retrocedeTab();
615 648
						getPanelPage1().setVisible(true);
616
						getPanelPage2().setVisible(false);
649
						getWCSParamsPanel().setVisible(false);
617 650
						getBtnSiguiente().setEnabled(false);
618 651
						connected = false;
619 652
					}
......
712 745
			if(layer == null)
713 746
				return;
714 747
			this.getMapCtrl().getMapContext().getLayers().addLayer(layer);
715
		} catch (LoadLayerException e) {
748
		} catch (InitializeException e) {
716 749
			logger.info("The layer cannot be added", e);
717 750
		}
718 751

  

Also available in: Unified diff