Revision 4356 trunk/extensions/extWCS/src/com/iver/cit/gvsig/gui/wcs/WCSWizard.java
WCSWizard.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import java.awt.geom.Point2D; |
44 | 44 |
import java.awt.geom.Rectangle2D; |
45 |
import java.io.IOException; |
|
46 | 45 |
import java.net.MalformedURLException; |
47 | 46 |
import java.net.URL; |
48 | 47 |
|
... | ... | |
50 | 49 |
import javax.swing.JOptionPane; |
51 | 50 |
|
52 | 51 |
import com.iver.andami.PluginServices; |
53 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
54 | 52 |
import com.iver.cit.gvsig.fmap.drivers.wcs.FMapWCSDriver; |
55 | 53 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
56 | 54 |
import com.iver.cit.gvsig.fmap.layers.FLyrWCS; |
57 |
import com.iver.cit.gvsig.fmap.layers.FMapWCSAdapter; |
|
58 |
import com.iver.cit.gvsig.gui.WCSDataSourceAdapter; |
|
59 | 55 |
import com.iver.cit.gvsig.gui.WizardPanel; |
60 | 56 |
import com.iver.cit.gvsig.gui.panels.WCSParamsPanel; |
61 | 57 |
import com.iver.cit.gvsig.gui.wizards.WizardListener; |
... | ... | |
72 | 68 |
*/ |
73 | 69 |
public class WCSWizard extends WizardPanel { |
74 | 70 |
private int page = 0; |
75 |
private boolean conectado = false;
|
|
71 |
private boolean connected = false;
|
|
76 | 72 |
private JComboBox cmbHost = null; |
77 | 73 |
private javax.swing.JButton btnDetalles = null; |
78 | 74 |
private javax.swing.JPanel jPanel = null; |
... | ... | |
87 | 83 |
private javax.swing.JPanel jPanel1 = null; |
88 | 84 |
private WizardListenerSupport listenerSupport = new WizardListenerSupport(); |
89 | 85 |
private WCSParamsPanel wcsParamsTabbedPanel = null; |
90 |
private WCSWizardDataSource dataSource; |
|
91 |
private WCSWizardData data = null; |
|
86 |
private WCSWizardData dataSource = null; |
|
92 | 87 |
|
93 | 88 |
/** |
94 | 89 |
* This is the default constructor |
... | ... | |
121 | 116 |
* @return String |
122 | 117 |
*/ |
123 | 118 |
private String getNomCobertura(){ |
124 |
return (String) wcsParamsTabbedPanel.getNomCobertura();
|
|
119 |
return (String) wcsParamsTabbedPanel.getCurrentCoverageName();
|
|
125 | 120 |
} |
126 | 121 |
|
127 | 122 |
/** |
... | ... | |
179 | 174 |
try { |
180 | 175 |
String host = cmbHost.getModel().getSelectedItem().toString(); |
181 | 176 |
|
182 |
data = dataSource.detalles(new URL(host));
|
|
177 |
dataSource.setHost(new URL(host));
|
|
183 | 178 |
|
184 | 179 |
addHost(host); |
185 |
getLblTitle().setText(data.getTitle()); |
|
186 |
getTxtAbstract().setText(data.getDescription()); |
|
180 |
getLblTitle().setText(dataSource.getTitle());
|
|
181 |
getTxtAbstract().setText(dataSource.getDescription());
|
|
187 | 182 |
wcsParamsTabbedPanel.getLstCoverages().setListData( |
188 |
data.getCoverageNames());
|
|
189 |
wcsParamsTabbedPanel.setWizardData(data); |
|
190 |
wcsParamsTabbedPanel.setDataSource(dataSource); |
|
191 |
conectado = true;
|
|
183 |
dataSource.getCoverageList());
|
|
184 |
wcsParamsTabbedPanel.setWizardData(dataSource);
|
|
185 |
|
|
186 |
connected = true;
|
|
192 | 187 |
activarVisualizarBotones(); |
193 |
} catch (DriverException soe) { |
|
194 |
alert(PluginServices.getText(this, "servidor_wcs_no_responde")); |
|
195 |
} catch (IOException ioe){ |
|
196 |
alert(PluginServices.getText(this, "error_comunicacion_servidor")); |
|
197 | 188 |
} catch (Exception e) { |
198 | 189 |
listenerSupport.callError(e); |
190 |
e.printStackTrace(); |
|
199 | 191 |
} |
200 | 192 |
} |
201 | 193 |
|
... | ... | |
207 | 199 |
if (page == 0) { |
208 | 200 |
getBtnAnterior().setEnabled(false); |
209 | 201 |
getBtnSiguiente().setVisible(true); |
210 |
if (conectado) {
|
|
202 |
if (connected) {
|
|
211 | 203 |
getBtnSiguiente().setEnabled(true); |
212 | 204 |
} else { |
213 | 205 |
getBtnSiguiente().setEnabled(false); |
... | ... | |
285 | 277 |
btnDetalles.addActionListener(new java.awt.event.ActionListener() { |
286 | 278 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
287 | 279 |
wcsParamsTabbedPanel.limpiaWizard(); |
288 |
conectado = false;
|
|
280 |
connected = false;
|
|
289 | 281 |
rellenarControles(); |
290 | 282 |
} |
291 | 283 |
}); |
... | ... | |
557 | 549 |
getPanelPage1().setVisible(true); |
558 | 550 |
getPanelPage2().setVisible(false); |
559 | 551 |
getBtnSiguiente().setEnabled(false); |
560 |
conectado = false;
|
|
552 |
connected = false;
|
|
561 | 553 |
} |
562 | 554 |
listenerSupport.callStateChanged(wcsParamsTabbedPanel.isCorretlyConfigured()); |
563 | 555 |
} |
... | ... | |
610 | 602 |
* |
611 | 603 |
* @return |
612 | 604 |
*/ |
613 |
public WCSWizardDataSource getDataSource() {
|
|
605 |
public WCSWizardData getDataSource() { |
|
614 | 606 |
return dataSource; |
615 | 607 |
} |
616 | 608 |
|
... | ... | |
619 | 611 |
* |
620 | 612 |
* @param source |
621 | 613 |
*/ |
622 |
public void setDataSource(WCSWizardDataSource source) {
|
|
614 |
public void setDataSource(WCSWizardData source) { |
|
623 | 615 |
dataSource = source; |
624 |
|
|
625 | 616 |
} |
626 | 617 |
|
627 | 618 |
|
... | ... | |
648 | 639 |
* |
649 | 640 |
* @return Rectangle2D |
650 | 641 |
*/ |
651 |
public Rectangle2D getLayersRectangle() {
|
|
652 |
return wcsParamsTabbedPanel.getLayersRectangle();
|
|
642 |
public Rectangle2D getExtent() {
|
|
643 |
return wcsParamsTabbedPanel.getExtent();
|
|
653 | 644 |
} |
654 | 645 |
|
655 | 646 |
/** |
... | ... | |
698 | 689 |
} |
699 | 690 |
|
700 | 691 |
public void initWizard() { |
701 |
setDataSource(new WCSDataSourceAdapter());
|
|
692 |
setDataSource(new WCSWizardData());
|
|
702 | 693 |
} |
703 | 694 |
|
704 | 695 |
public void execute() { |
... | ... | |
738 | 729 |
* return null. |
739 | 730 |
*/ |
740 | 731 |
public FLayer getLayer() { |
741 |
FLyrWCS layer = new FLyrWCS(); |
|
742 |
|
|
743 |
FMapWCSAdapter wcsAdap = new FMapWCSAdapter(); |
|
744 |
wcsAdap.setDriver((FMapWCSDriver)((WCSDataSourceAdapter)dataSource).getDriver()); |
|
732 |
FLyrWCS layer = new FLyrWCS(); |
|
745 | 733 |
layer.setHost(this.getHost().toString()); |
746 | 734 |
layer.setCoverageName(this.getNomCobertura()); |
747 | 735 |
layer.setLabel(this.getEtiquetaCobertura()); |
748 | 736 |
layer.setSRS(this.getSRS()); |
749 | 737 |
layer.setFormat(this.getFormat()); |
750 |
layer.setFullExtent(this.getLayersRectangle()); |
|
738 |
layer.setFullExtent(this.getExtent()); |
|
739 |
layer.setDriver(this.getDriver()); |
|
751 | 740 |
layer.setTime(this.getSelectedTimes()); |
752 | 741 |
layer.setParameter(this.getParametro()); |
753 |
layer.setName(layer.getLabel());
|
|
742 |
layer.setName(this.getEtiquetaCobertura());
|
|
754 | 743 |
layer.setMaxResolution(getMaxResolution()); |
755 | 744 |
return layer; |
756 | 745 |
} |
757 | 746 |
|
747 |
private FMapWCSDriver getDriver() { |
|
748 |
return wcsParamsTabbedPanel.getDriver(); |
|
749 |
} |
|
750 |
|
|
758 | 751 |
/** |
759 | 752 |
* Returns the max supported resolution for the coverage. |
760 | 753 |
* |
Also available in: Unified diff