Revision 5262 branches/MULTITHREADING_DEVELOPMENT/extensions/extWMS/src/com/iver/cit/gvsig/gui/wizards/WMSWizardData.java
WMSWizardData.java | ||
---|---|---|
47 | 47 |
import java.net.URL; |
48 | 48 |
import java.util.ArrayList; |
49 | 49 |
import java.util.Hashtable; |
50 |
import java.util.NoSuchElementException; |
|
50 | 51 |
import java.util.Vector; |
51 | 52 |
|
52 | 53 |
import javax.swing.JOptionPane; |
53 | 54 |
|
55 |
import org.gvsig.gui.beans.ProgressDialog; |
|
56 |
|
|
54 | 57 |
import com.iver.andami.PluginServices; |
55 | 58 |
import com.iver.cit.gvsig.fmap.DriverException; |
56 | 59 |
import com.iver.cit.gvsig.fmap.drivers.WMSListener; |
... | ... | |
66 | 69 |
public class WMSWizardData { // should implemement any kind of wizard data interface? |
67 | 70 |
private String title; |
68 | 71 |
private String theAbstract; |
69 |
private WMSLayerNode layer; |
|
72 |
private WMSLayerNode layers;
|
|
70 | 73 |
private String[] formats; |
71 | 74 |
private String serverVersion; |
72 | 75 |
private FMapWMSDriver wms = null; |
73 | 76 |
private Hashtable onlineResources = null; |
74 | 77 |
private EventListener listener = new EventListener(); |
75 | 78 |
private WMSListener wizardListener; |
79 |
|
|
76 | 80 |
/** |
77 | 81 |
* @return Returns the serverVersion. |
78 | 82 |
*/ |
... | ... | |
101 | 105 |
e.printStackTrace(); |
102 | 106 |
return; |
103 | 107 |
} |
104 |
|
|
105 | 108 |
} |
106 | 109 |
|
107 | 110 |
/** |
... | ... | |
134 | 137 |
} |
135 | 138 |
|
136 | 139 |
public WMSLayerNode getLayer() { |
137 |
return layer; |
|
140 |
return layers;
|
|
138 | 141 |
} |
139 | 142 |
|
140 | 143 |
public String getTitle() { |
... | ... | |
164 | 167 |
|
165 | 168 |
private class EventListener implements WMSListener { |
166 | 169 |
public void newEvent(int idRequest, int eventType) { |
167 |
if (idRequest == EventListener.CAPABILITIES && eventType == EventListener.FINISHED) { |
|
168 |
if (wms.getAbstract() != null) |
|
169 |
theAbstract = wms.getAbstract(); |
|
170 |
|
|
171 |
|
|
172 |
|
|
173 |
Vector f = wms.getFormats(); |
|
174 |
ArrayList formatos = new ArrayList(); |
|
175 |
for (int i = 0; i < f.size(); i++) { |
|
176 |
if (isValidFormat((String)f.elementAt(i))) { |
|
177 |
formatos.add(f.elementAt(i)); |
|
178 |
} |
|
179 |
} |
|
180 |
formats = (String[]) formatos.toArray(new String[0]); |
|
181 |
serverVersion = (wms.getVersion() == null) ? "" : wms.getVersion(); |
|
182 |
onlineResources = wms.getOnlineResources(); |
|
183 |
layer = wms.getLayersTree(); // LayersTree as they are defined in the Capabilities document |
|
184 |
|
|
185 |
if (wizardListener!=null) |
|
186 |
wizardListener.newEvent(idRequest, eventType); |
|
170 |
if (idRequest == EventListener.CAPABILITIES) { |
|
171 |
|
|
172 |
if(eventType == EventListener.FINISHED) { |
|
173 |
// Transfer complete -> initialize properties. |
|
174 |
if (wms.getAbstract() != null) |
|
175 |
theAbstract = wms.getAbstract(); |
|
176 |
|
|
177 |
Vector f = wms.getFormats(); |
|
178 |
ArrayList formatos = new ArrayList(); |
|
179 |
for (int i = 0; i < f.size(); i++) { |
|
180 |
if (isValidFormat((String)f.elementAt(i))) { |
|
181 |
formatos.add(f.elementAt(i)); |
|
182 |
} |
|
183 |
} |
|
184 |
formats = (String[]) formatos.toArray(new String[0]); |
|
185 |
serverVersion = (wms.getVersion() == null) ? "" : wms.getVersion(); |
|
186 |
onlineResources = wms.getOnlineResources(); |
|
187 |
layers = wms.getLayersTree(); // LayersTree as they are defined in the Capabilities document |
|
188 |
} |
|
189 |
if (wizardListener!=null) |
|
190 |
// Notify WMSWizard that the data is ready. |
|
191 |
wizardListener.newEvent(idRequest, eventType); |
|
192 |
|
|
187 | 193 |
} |
188 | 194 |
} |
189 | 195 |
} |
... | ... | |
191 | 197 |
public void setWizardListener(WMSListener listener) { |
192 | 198 |
this.wizardListener = listener; |
193 | 199 |
} |
200 |
|
|
201 |
public void cancelTransfer() { |
|
202 |
wms.cancel(FMapWMSDriver.GET_CAPABILITIES); |
|
203 |
} |
|
194 | 204 |
} |
Also available in: Unified diff