Revision 4342

View differences:

branches/v05/extensions/extWMS/src/com/iver/cit/gvsig/fmap/drivers/wms/FMapWMSDriver.java
141 141

  
142 142
    /**
143 143
     * Establishes the connection.
144
     * @param override, if true the previous downloaded data will be overridden
144 145
     * @return <b>true</b> if the connection was successful, or <b>false</b> if it was no possible
145 146
     * to establish the connection for any reason such as version negotiation.
146 147
     */
147
    public boolean connect() {
148
        return client.connect();
148
    public boolean connect(boolean override) {
149
        return client.connect(override);
149 150
    }
150 151

  
151 152
    /**
branches/v05/extensions/extWMS/src/com/iver/cit/gvsig/fmap/layers/FLyrWMS.java
864 864
        String[] layerNames = getLayerQuery().split(",");
865 865
        Vector layers = new Vector(layerNames.length);
866 866
        try {
867
            if(getDriver().connect()){
867
            if(getDriver().connect(false)){
868 868
                for (int i = 0; i < layerNames.length; i++) {
869 869
                    layers.add(i, wms.getLayer(layerNames[i]));
870 870
                }
branches/v05/extensions/extWMS/src/com/iver/cit/gvsig/gui/dialogs/WMSPropsDialog.java
155 155
	        	// host
156 156
                URL host = (URL) info.get("host");
157 157
                WMSWizardData dataSource = new WMSWizardData();
158
                dataSource.setHost(host);
158
                dataSource.setHost(host, false);
159 159
                
160 160
                // name
161 161
	            WMSParamsPanel toc = new WMSParamsPanel();
......
170 170

  
171 171
                // selected layers
172 172
	            for (int i = 0; i < selectedLayers.length; i++) {
173
                    //  Se aade a la lista de layers seleccionados
173
                    //  Se a?ade a la lista de layers seleccionados
174 174
                    JDnDListModel modelo = (JDnDListModel) toc.getLstSelectedLayers().getModel();
175 175
                    if (modelo.addElement(0, selectedLayers[i])) {
176 176
                        any = true;
branches/v05/extensions/extWMS/src/com/iver/cit/gvsig/gui/wizards/WMSWizardData.java
82 82
    }
83 83
    
84 84
   
85
    public void setHost(URL host) throws DriverException{
85
    public void setHost(URL host, boolean override) throws DriverException{
86 86
        wms = new FMapWMSDriver();
87
      	try {
88
			wms.createClient(host);
89
		
90
        // Send a getCapabilities request;
91
        if (!wms.connect())
92
            throw new DriverException(PluginServices.getText(this, "cant_connect") + host.toString());
87
        try {
88
        	wms.createClient(host);
89
        	
90
        	// Send a getCapabilities request;
91
        	if (!wms.connect(override))
92
        		throw new DriverException(PluginServices.getText(this, "cant_connect") + host.toString());
93 93
        } catch (ConnectException e) {
94 94
        	JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this,"server_timeout"));
95 95
			e.printStackTrace();
branches/v05/extensions/extWMS/src/com/iver/cit/gvsig/gui/wizards/WMSWizard.java
47 47
import java.net.URL;
48 48
import java.util.Hashtable;
49 49
import java.util.Vector;
50
import java.util.prefs.Preferences;
50 51

  
51 52
import javax.swing.DefaultComboBoxModel;
52 53
import javax.swing.JLabel;
......
65 66
import com.iver.cit.gvsig.gui.panels.WMSParamsPanel;
66 67
import com.iver.utiles.NotExistInXMLEntity;
67 68
import com.iver.utiles.XMLEntity;
69
import javax.swing.JCheckBox;
68 70

  
69 71

  
70 72
/**
......
92 94
	private WMSParamsPanel wmsParamsPanel = null;
93 95
    private JLabel lblServerType = null;
94 96
    private JLabel lblServerTypeValue = null;
95

  
97
	private JCheckBox chkCaching = null;
98
	private static Preferences fPrefs = Preferences.userRoot().node( "gvsig.wms-wizard" );
99
	private boolean refreshing = fPrefs.getBoolean("refresh_capabilities", chkCaching.isSelected());
100
	
96 101
	/**
97 102
	 * This is the default constructor
98 103
	 */
......
184 189
		try {
185 190
			String host = cmbHost.getModel().getSelectedItem().toString();
186 191
			//WMSWizardData data = dataSource.detalles(url);
187
            dataSource.setHost(new URL(host));
192
            dataSource.setHost(new URL(host), refreshing);
188 193
            lblTitle.setText(dataSource.getTitle());
189 194
			lblServerTypeValue.setText(dataSource.getServerType());
190 195
            txtAbstract.setText(dataSource.getAbstract());
......
489 494
			jPanel1.setBounds(2, 5, 477, 85);
490 495
			jPanel1.add(getTxtHost(), null);
491 496
			jPanel1.add(getBtnConnect(), null);
497
			jPanel1.add(getChkCaching(), null);
492 498
		}
493 499

  
494 500
		return jPanel1;
......
707 713
	public String getQueryableLayerQuery() {
708 714
		return wmsParamsPanel.getQueryableLayerQuery();
709 715
	}
716

  
717
	/**
718
	 * This method initializes chkCaching	
719
	 * 	
720
	 * @return javax.swing.JCheckBox	
721
	 */    
722
	private JCheckBox getChkCaching() {
723
		if (chkCaching == null) {
724
			chkCaching = new JCheckBox();
725
			chkCaching.setBounds(7, 51, 349, 20);
726
			chkCaching.setText(PluginServices.getText(this, "refresh_capabilities"));
727
			chkCaching.setToolTipText(PluginServices.getText(this, "refresh_capabilities_tooltip"));
728
			chkCaching.setSelected(refreshing);
729
			chkCaching.addItemListener(new java.awt.event.ItemListener() { 
730
				public void itemStateChanged(java.awt.event.ItemEvent e) {
731
					refreshing = chkCaching.isSelected();
732
				}
733
			});
734
			chkCaching.addActionListener(new java.awt.event.ActionListener() { 
735
				public void actionPerformed(java.awt.event.ActionEvent e) {    
736
					fPrefs.putBoolean("refresh_capabilities", chkCaching.isSelected());
737
				}
738
			});
739
			
740
		}
741
		return chkCaching;
742
	}
710 743
}  //  @jve:decl-index=0:visual-constraint="10,10"

Also available in: Unified diff