Revision 10626 trunk/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/impl/convexhull/gui/GeoProcessingConvexHullPanel.java

View differences:

GeoProcessingConvexHullPanel.java
45 45
 *
46 46
 * $Id$
47 47
 * $Log$
48
 * Revision 1.6  2006-08-29 07:56:30  cesar
48
 * Revision 1.7  2007-03-06 16:47:58  caballero
49
 * Exceptions
50
 *
51
 * Revision 1.6  2006/08/29 07:56:30  cesar
49 52
 * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
50 53
 *
51 54
 * Revision 1.5  2006/08/29 07:13:56  cesar
......
97 100
import javax.swing.JComboBox;
98 101
import javax.swing.JFileChooser;
99 102
import javax.swing.JLabel;
103
import javax.swing.JPanel;
100 104
import javax.swing.JTextField;
101 105

  
106
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
102 107
import com.iver.andami.PluginServices;
103 108
import com.iver.andami.ui.mdiManager.IWindow;
104 109
import com.iver.andami.ui.mdiManager.WindowInfo;
105
import com.iver.cit.gvsig.fmap.DriverException;
106 110
import com.iver.cit.gvsig.fmap.layers.FBitSet;
107 111
import com.iver.cit.gvsig.fmap.layers.FLayers;
108 112
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
109 113
import com.iver.cit.gvsig.geoprocess.core.gui.AbstractGeoprocessPanel;
110 114
import com.iver.utiles.GenericFileFilter;
111
import javax.swing.JPanel;
112 115

  
113
public class GeoProcessingConvexHullPanel extends AbstractGeoprocessPanel 
116
public class GeoProcessingConvexHullPanel extends AbstractGeoprocessPanel
114 117
implements IWindow, ConvexHullPanelIF{
115
	
118

  
116 119
	private static final long serialVersionUID = 1L;
117 120
    private JLabel jLabel = null;
118 121
	private JCheckBox selectedOnlyCheckbox = null;
......
133 136
	}
134 137
	/**
135 138
	 * This method initializes this
136
	 * 
139
	 *
137 140
	 * @return void
138 141
	 */
139 142
	private  void initialize() {
......
149 152
        layersComboBox.setSelectedIndex(0);
150 153
        initSelectedItemsJCheckBox();
151 154
	}
152
	
153
   
155

  
156

  
154 157
    private void initSelectedItemsJCheckBox() {
155 158
    	String selectedLayer = (String)layersComboBox.getSelectedItem();
156 159
        FLyrVect inputLayer = (FLyrVect)layers.getLayer(selectedLayer);
157 160
        FBitSet fBitSet = null;
158 161
		try {
159 162
			fBitSet = inputLayer.getRecordset().getSelection();
160
		} catch (DriverException e) {
163
		} catch (ReadDriverException e) {
161 164
			// TODO Auto-generated catch block
162 165
			e.printStackTrace();
163 166
		}
......
168 171
        }
169 172
        selectedOnlyCheckbox.setSelected(false);
170 173
    }
171
	
172
    
174

  
175

  
173 176
	private JCheckBox getSelectedOnlyCheckBox() {
174 177
		if (selectedOnlyCheckbox == null) {
175 178
			selectedOnlyCheckbox = new JCheckBox();
......
179 182
		return selectedOnlyCheckbox;
180 183
	}
181 184
	/**
182
	 * This method initializes layersComboBox	
183
	 * 	
184
	 * @return javax.swing.JComboBox	
185
	 */    
185
	 * This method initializes layersComboBox
186
	 *
187
	 * @return javax.swing.JComboBox
188
	 */
186 189
	private JComboBox getLayersComboBox() {
187 190
		if (layersComboBox == null) {
188 191
            layersComboBox = new JComboBox();
189 192
            DefaultComboBoxModel defaultModel = new DefaultComboBoxModel(getLayerNames());
190 193
            layersComboBox.setModel(defaultModel);
191 194
			layersComboBox.setBounds(142, 26, 123, 23);
192
			layersComboBox.addItemListener(new java.awt.event.ItemListener() { 
193
				public void itemStateChanged(java.awt.event.ItemEvent e) {    
195
			layersComboBox.addItemListener(new java.awt.event.ItemListener() {
196
				public void itemStateChanged(java.awt.event.ItemEvent e) {
194 197
                    // Cambiar el estado del CheckBox
195 198
                    initSelectedItemsJCheckBox();
196 199
				}
......
200 203
	}
201 204
	/* (non-Javadoc)
202 205
	 * @see com.iver.cit.gvsig.geoprocess.impl.convexhull.gui.ConvexHullPanelIF#getFileNameResultTextField()
203
	 */    
206
	 */
204 207
	public JTextField getFileNameResultTextField() {
205 208
		if (fileNameResultTextField == null) {
206 209
			super.getFileNameResultTextField().
......
209 212
		return fileNameResultTextField;
210 213
	}
211 214
	/**
212
	 * This method initializes openFileButton	
213
	 * 	
214
	 * @return javax.swing.JButton	
215
	 */    
215
	 * This method initializes openFileButton
216
	 *
217
	 * @return javax.swing.JButton
218
	 */
216 219
	private JButton getOpenFileButton() {
217 220
		if (openFileButton == null) {
218 221
			openFileButton = new JButton();
219 222
			openFileButton.setText(PluginServices.getText(this,"Abrir"));
220 223
			openFileButton.setBounds(new java.awt.Rectangle(311,12,101,21));
221
			openFileButton.addActionListener(new java.awt.event.ActionListener() { 
222
				public void actionPerformed(java.awt.event.ActionEvent e) {    
224
			openFileButton.addActionListener(new java.awt.event.ActionListener() {
225
				public void actionPerformed(java.awt.event.ActionEvent e) {
223 226
					openResultFile();
224 227
				}
225 228
			});
226 229
		}
227 230
		return openFileButton;
228 231
	}
229
	
232

  
230 233
    /* (non-Javadoc)
231 234
	 * @see com.iver.cit.gvsig.geoprocess.impl.convexhull.gui.ConvexHullPanelIF#openResultFile()
232 235
	 */
......
234 237
		JFileChooser jfc = new JFileChooser();
235 238
        jfc.addChoosableFileFilter(new GenericFileFilter("shp",
236 239
        									"Ficheros SHP"));
237
        if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) == 
240
        if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) ==
238 241
        										JFileChooser.APPROVE_OPTION) {
239 242
            File file = jfc.getSelectedFile();
240 243
            if (!(file.getPath().endsWith(".shp") || file.getPath().endsWith(".SHP"))){
......
245 248
        	getFileNameResultTextField().setText(
246 249
        			jfc.getSelectedFile().getAbsolutePath());
247 250
        }
248
		
251

  
249 252
	}
250
	
253

  
251 254
	/* (non-Javadoc)
252 255
	 * @see com.iver.cit.gvsig.geoprocess.impl.convexhull.gui.ConvexHullPanelIF#getInputLayer()
253 256
	 */
......
257 260
        solution = (FLyrVect)layers.getLayer(selectedLayer);
258 261
        return solution;
259 262
	}
260
	
263

  
261 264
	/* (non-Javadoc)
262 265
	 * @see com.iver.cit.gvsig.geoprocess.impl.convexhull.gui.ConvexHullPanelIF#isConvexHullOnlySelected()
263 266
	 */
264 267
	public boolean isConvexHullOnlySelected() {
265 268
		return selectedOnlyCheckbox.isSelected();
266 269
	}
267
	
270

  
268 271
	public WindowInfo getWindowInfo() {
269 272
		if (viewInfo == null) {
270 273
			viewInfo = new WindowInfo(WindowInfo.MODALDIALOG);
......
274 277
		return viewInfo;
275 278
	}
276 279
	/**
277
	 * This method initializes resultLayerPanel	
278
	 * 	
279
	 * @return javax.swing.JPanel	
280
	 * This method initializes resultLayerPanel
281
	 *
282
	 * @return javax.swing.JPanel
280 283
	 */
281 284
	private JPanel getResultLayerPanel() {
282 285
		if (resultLayerPanel == null) {
......
294 297
		return resultLayerPanel;
295 298
	}
296 299
	/**
297
	 * This method initializes inputLayerPanel	
298
	 * 	
299
	 * @return javax.swing.JPanel	
300
	 * This method initializes inputLayerPanel
301
	 *
302
	 * @return javax.swing.JPanel
300 303
	 */
301 304
	private JPanel getInputLayerPanel() {
302 305
		if (inputLayerPanel == null) {
......
313 316
		}
314 317
		return inputLayerPanel;
315 318
	}
316
	
319

  
317 320
}  //  @jve:decl-index=0:visual-constraint="15,20"

Also available in: Unified diff