@ -1,6 +1,6 @@
package com.fr.van.chart.map.designer.type ;
import com.fr.decision.webservice.v10.map.WMSFactory ;
import com.fr.decision.webservice.v10.map.MapEditService ;
import com.fr.design.dialog.FineJOptionPane ;
import com.fr.design.event.UIObserver ;
import com.fr.design.event.UIObserverListener ;
@ -11,7 +11,6 @@ import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.layout.TableLayout ;
import com.fr.design.layout.TableLayoutHelper ;
import com.fr.general.http.HttpClient ;
import com.fr.plugin.chart.base.GisLayer ;
import com.fr.plugin.chart.map.layer.WMSLayer ;
import com.fr.van.chart.designer.TableLayout4VanChartHelper ;
@ -85,21 +84,13 @@ public class WMSLayerPane extends JPanel implements UIObserver {
public void actionPerformed ( ActionEvent e ) {
new SwingWorker < Void , Double > ( ) {
private java . util . List < WMSLayer > list = new ArrayList < > ( ) ;
private List < WMSLayer > list = new ArrayList < > ( ) ;
@Override
protected Void doInBackground ( ) {
HttpClient httpClient = new HttpClient ( wmsUrl . getText ( ) + "service=WMS&request=GetCapabilities" ) ;
httpClient . asGet ( ) ;
if ( ! httpClient . isServerAlive ( ) ) {
return null ;
}
String res = httpClient . getResponseText ( ) ;
List < String > layers = WMSFactory . readLayers ( res ) ;
List < String > wmsNames = MapEditService . getInstance ( ) . getWMSNames ( wmsUrl . getText ( ) ) ;
list . clear ( ) ;
for ( String layer : layer s) {
for ( String layer : wmsNames ) {
list . add ( new WMSLayer ( layer , false ) ) ;
}
return null ;
@ -108,9 +99,8 @@ public class WMSLayerPane extends JPanel implements UIObserver {
@Override
protected void done ( ) {
connectButton . setText ( Toolkit . i18nText ( "Fine-Design_Chart_Connect_WMP" ) ) ;
if ( list ! = null & & list . size ( ) > 0 ) {
resetWMSLayerPane ( list ) ;
} else {
if ( list = = null | | list . isEmpty ( ) ) {
FineJOptionPane . showMessageDialog ( null , Toolkit . i18nText ( "Fine-Design_Chart_Invalid_WMS" ) ) ;
}
}