Revision 1261 org.gvsig.geoprocess/trunk/org.gvsig.geoprocess/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.merge/src/main/java/org/gvsig/geoprocess/algorithm/merge/MergeParametersPanel.java

View differences:

MergeParametersPanel.java
54 54

  
55 55
/**
56 56
 * Panel for merge algorithm
57
 *
57 58
 * @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a>
58 59
 */
59 60
public class MergeParametersPanel extends GeoAlgorithmParametersPanel implements ActionListener {
60
	private static final long                serialVersionUID   = 1L;
61
	private GeoAlgorithm                     m_Algorithm        = null;
62
	private JComboBox                        fieldsCombo        = null;
63
	private JCheckBox                        allLayers          = null;
64
	//private AlgorithmOutputPanel             output             = null;
65
	private final String[]                   columnNames        = { GeoProcessLocator.getGeoProcessManager().getTranslation("Selected"),
66
																	GeoProcessLocator.getGeoProcessManager().getTranslation("Layer") };
67
	private final int[]                      columnWidths       = { 35, 334 };
68
	private TableContainer                   table              = null;
69
	private ObjectAndDescription[]           layerList          = null;
70
	private AlgorithmOutputPanel             algorithmOutputPanel  = null;
71
	private OutputChannelSelectionPanel      outputChannelSelectionPanelPol;
72
	private OutputChannelSelectionPanel      outputChannelSelectionPanelLine;
73
	private OutputChannelSelectionPanel      outputChannelSelectionPanelPoint;
74
	private JPanel                           outputPanel;
75 61

  
76
	public MergeParametersPanel() {
77
		super();
78
	}
62
    private static final long serialVersionUID = 1L;
63
    private GeoAlgorithm m_Algorithm = null;
64
    private JComboBox fieldsCombo = null;
65
    private JCheckBox allLayers = null;
66
    //private AlgorithmOutputPanel             output             = null;
67
    private final String[] columnNames = {GeoProcessLocator.getGeoProcessManager().getTranslation("Selected"),
68
        GeoProcessLocator.getGeoProcessManager().getTranslation("Layer")};
69
    private final int[] columnWidths = {35, 334};
70
    private TableContainer table = null;
71
    private ObjectAndDescription[] layerList = null;
72
    private AlgorithmOutputPanel algorithmOutputPanel = null;
73
    private OutputChannelSelectionPanel outputChannelSelectionPanelPol;
74
    private OutputChannelSelectionPanel outputChannelSelectionPanelLine;
75
    private OutputChannelSelectionPanel outputChannelSelectionPanelPoint;
76
    private JPanel outputPanel;
79 77

  
78
    public MergeParametersPanel() {
79
        super();
80
    }
81

  
80 82
    public void init(GeoAlgorithm algorithm) {
81
    	m_Algorithm = algorithm;
82
    	initGUI();
83
        m_Algorithm = algorithm;
84
        initGUI();
83 85
    }
84 86

  
85
	private void initGUI() {
86
		GridBagLayout gbl = new GridBagLayout();
87
		this.setLayout(gbl);
87
    private void initGUI() {
88
        GridBagLayout gbl = new GridBagLayout();
89
        this.setLayout(gbl);
88 90

  
89
		GridBagConstraints gbc = new GridBagConstraints();
90
		gbc.fill = GridBagConstraints.HORIZONTAL;
91
		gbc.weightx = 1.0;
92
		gbc.gridx = 0;
93
		gbc.gridy = 0;
94
		gbc.insets = new Insets(5, 5, 8, 5);
95
		this.add(getAllLayersCheck(), gbc);
91
        GridBagConstraints gbc = new GridBagConstraints();
92
        gbc.fill = GridBagConstraints.HORIZONTAL;
93
        gbc.weightx = 1.0;
94
        gbc.gridx = 0;
95
        gbc.gridy = 0;
96
        gbc.insets = new Insets(5, 5, 8, 5);
97
        this.add(getAllLayersCheck(), gbc);
96 98

  
97
		gbc.gridy = 1;
98
		gbc.fill = GridBagConstraints.BOTH;
99
		gbc.insets = new Insets(0, 0, 12, 0);
100
		gbc.weighty = 1.0;
101
		this.add(getCheckBoxTable(), gbc);
99
        gbc.gridy = 1;
100
        gbc.fill = GridBagConstraints.BOTH;
101
        gbc.insets = new Insets(0, 0, 12, 0);
102
        gbc.weighty = 1.0;
103
        this.add(getCheckBoxTable(), gbc);
102 104

  
103
		gbc.gridy = 2;
104
		gbc.fill = GridBagConstraints.HORIZONTAL;
105
		gbc.insets = new Insets(5, 5, 8, 5);
106
		gbc.weightx = 1.0;
107
		gbc.weighty = 0;
108
		this.add(getFieldsComboPanel(GeoProcessLocator.getGeoProcessManager().getTranslation("use_fields_from_layer"), getFieldsCombo()), gbc);
105
        gbc.gridy = 2;
106
        gbc.fill = GridBagConstraints.HORIZONTAL;
107
        gbc.insets = new Insets(5, 5, 8, 5);
108
        gbc.weightx = 1.0;
109
        gbc.weighty = 0;
110
        this.add(getFieldsComboPanel(GeoProcessLocator.getGeoProcessManager().getTranslation("use_fields_from_layer"), getFieldsCombo()), gbc);
109 111

  
110
		gbc.gridy = 3;
111
		this.add(getOutputChannelSelectionPanel(), gbc);
112
        gbc.gridy = 3;
113
        this.add(getOutputChannelSelectionPanel(), gbc);
112 114

  
113
		initTable();
114
	}
115
        initTable();
116
    }
115 117

  
116
	/**
117
	 * Gets the output panel (SEXTANTE)
118
	 * @return
119
	 */
120
	private JPanel getOutputChannelSelectionPanel() {
121
		if(outputPanel == null) {
122
			try {
123
				outputPanel = new JPanel();
124
				outputPanel.setLayout(new GridBagLayout());
125
				final OutputObjectsSet ooSet = m_Algorithm.getOutputObjects();
126
				final Output out_pol = ooSet.getOutput(MergeAlgorithm.RESULT_POL);
127
				final Output out_line = ooSet.getOutput(MergeAlgorithm.RESULT_LINE);
128
				final Output out_point = ooSet.getOutput(MergeAlgorithm.RESULT_POINT);
118
    /**
119
     * Gets the output panel (SEXTANTE)
120
     *
121
     * @return
122
     */
123
    private JPanel getOutputChannelSelectionPanel() {
124
        if (outputPanel == null) {
125
            try {
126
                outputPanel = new JPanel();
127
                outputPanel.setLayout(new GridBagLayout());
128
                final OutputObjectsSet ooSet = m_Algorithm.getOutputObjects();
129
                final Output out_pol = ooSet.getOutput(MergeAlgorithm.RESULT_POL);
130
                final Output out_line = ooSet.getOutput(MergeAlgorithm.RESULT_LINE);
131
                final Output out_point = ooSet.getOutput(MergeAlgorithm.RESULT_POINT);
129 132

  
130
				outputChannelSelectionPanelPol = new OutputChannelSelectionPanel(out_pol, m_Algorithm.getParameters());
131
				outputChannelSelectionPanelLine = new OutputChannelSelectionPanel(out_line, m_Algorithm.getParameters());
132
				outputChannelSelectionPanelPoint = new OutputChannelSelectionPanel(out_point, m_Algorithm.getParameters());
133
                outputChannelSelectionPanelPol = new OutputChannelSelectionPanel(out_pol, m_Algorithm.getParameters());
134
                outputChannelSelectionPanelLine = new OutputChannelSelectionPanel(out_line, m_Algorithm.getParameters());
135
                outputChannelSelectionPanelPoint = new OutputChannelSelectionPanel(out_point, m_Algorithm.getParameters());
133 136

  
134
				String label = GeoProcessLocator.getGeoProcessManager().getTranslation("Merge");
137
                String label = GeoProcessLocator.getGeoProcessManager().getTranslation("Merge");
135 138

  
136
				GridBagConstraints gbc = new GridBagConstraints();
137
				gbc.fill = GridBagConstraints.HORIZONTAL;
138
				gbc.insets = new Insets(0, 0, 4, 0);
139
				gbc.weightx = 1;
140
				gbc.gridx = 0;
141
				gbc.gridy = 0;
142
				outputPanel.add(new JLabel(" " + label + " [" +
143
						GeoProcessLocator.getGeoProcessManager().getTranslation("Polygon") + "]               "), gbc);
139
                GridBagConstraints gbc = new GridBagConstraints();
140
                gbc.fill = GridBagConstraints.HORIZONTAL;
141
                gbc.insets = new Insets(0, 0, 4, 0);
142
                gbc.weightx = 1;
143
                gbc.gridx = 0;
144
                gbc.gridy = 0;
145
                outputPanel.add(new JLabel(" " + label + " ["
146
                        + GeoProcessLocator.getGeoProcessManager().getTranslation("Polygon") + "]               "), gbc);
144 147

  
145
				gbc.gridx = 0;
146
				gbc.gridy = 1;
147
				outputPanel.add(new JLabel(" " + label + " [" +
148
						GeoProcessLocator.getGeoProcessManager().getTranslation("Line") + "]               "), gbc);
148
                gbc.gridx = 0;
149
                gbc.gridy = 1;
150
                outputPanel.add(new JLabel(" " + label + " ["
151
                        + GeoProcessLocator.getGeoProcessManager().getTranslation("Line") + "]               "), gbc);
149 152

  
150
				gbc.gridx = 0;
151
				gbc.gridy = 2;
152
				outputPanel.add(new JLabel(" " + label + " [" +
153
						GeoProcessLocator.getGeoProcessManager().getTranslation("Point") + "]               "), gbc);
153
                gbc.gridx = 0;
154
                gbc.gridy = 2;
155
                outputPanel.add(new JLabel(" " + label + " ["
156
                        + GeoProcessLocator.getGeoProcessManager().getTranslation("Point") + "]               "), gbc);
154 157

  
155
				gbc.fill = GridBagConstraints.HORIZONTAL;
156
				gbc.weightx = 1;
157
				gbc.gridx = 1;
158
				gbc.gridy = 0;
159
				outputPanel.add(outputChannelSelectionPanelPol, gbc);
158
                gbc.fill = GridBagConstraints.HORIZONTAL;
159
                gbc.weightx = 1;
160
                gbc.gridx = 1;
161
                gbc.gridy = 0;
162
                outputPanel.add(outputChannelSelectionPanelPol, gbc);
160 163

  
161
				gbc.gridx = 1;
162
				gbc.gridy = 1;
163
				outputPanel.add(outputChannelSelectionPanelLine, gbc);
164
                gbc.gridx = 1;
165
                gbc.gridy = 1;
166
                outputPanel.add(outputChannelSelectionPanelLine, gbc);
164 167

  
165
				gbc.gridx = 1;
166
				gbc.gridy = 2;
167
				outputPanel.add(outputChannelSelectionPanelPoint, gbc);
168
			} catch (final Exception e) {
169
				Sextante.addErrorToLog(e);
170
			}
171
		}
172
		return outputPanel;
173
	}
168
                gbc.gridx = 1;
169
                gbc.gridy = 2;
170
                outputPanel.add(outputChannelSelectionPanelPoint, gbc);
171
            } catch (final Exception e) {
172
                Sextante.addErrorToLog(e);
173
            }
174
        }
175
        return outputPanel;
176
    }
174 177

  
175
	/**
176
	 * Gets the output panel (DAL)
177
	 * @return
178
	 */
179
	@SuppressWarnings("unused")
180
	private AlgorithmOutputPanel getAlgorithmOutputPanel() {
181
		if(algorithmOutputPanel == null)
182
		    algorithmOutputPanel = new AlgorithmOutputPanel();
183
		return algorithmOutputPanel;
184
	}
178
    /**
179
     * Gets the output panel (DAL)
180
     *
181
     * @return
182
     */
183
    @SuppressWarnings("unused")
184
    private AlgorithmOutputPanel getAlgorithmOutputPanel() {
185
        if (algorithmOutputPanel == null) {
186
            algorithmOutputPanel = new AlgorithmOutputPanel();
187
        }
188
        return algorithmOutputPanel;
189
    }
185 190

  
186
	/**
187
	 * Gets a new JPanel with the text and JComboBox
188
	 * @param text
189
	 * @param combo
190
	 * @return
191
	 */
192
	public JPanel getFieldsComboPanel(String text, JComboBox combo) {
193
		JPanel panel = new JPanel();
194
		GridBagLayout gbl = new GridBagLayout();
195
		panel.setLayout(gbl);
191
    /**
192
     * Gets a new JPanel with the text and JComboBox
193
     *
194
     * @param text
195
     * @param combo
196
     * @return
197
     */
198
    public JPanel getFieldsComboPanel(String text, JComboBox combo) {
199
        JPanel panel = new JPanel();
200
        GridBagLayout gbl = new GridBagLayout();
201
        panel.setLayout(gbl);
196 202

  
197
		GridBagConstraints gbc = new GridBagConstraints();
198
		gbc.fill = GridBagConstraints.HORIZONTAL;
199
		gbc.weightx = 1.0;
200
		gbc.gridx = 0;
201
		gbc.insets = new Insets(0, 0, 4, 0);
202
		JLabel label = new JLabel(text);
203
        GridBagConstraints gbc = new GridBagConstraints();
204
        gbc.fill = GridBagConstraints.HORIZONTAL;
205
        gbc.weightx = 1.0;
206
        gbc.gridx = 0;
207
        gbc.insets = new Insets(0, 0, 4, 0);
208
        JLabel label = new JLabel(text);
203 209
//		label.setPreferredSize(new Dimension(80, 18));
204
		panel.add(label, gbc);
210
        panel.add(label, gbc);
205 211

  
206
		gbc.fill = GridBagConstraints.HORIZONTAL;
207
		gbc.weightx = 1.0;
208
		gbc.gridx = 1;
212
        gbc.fill = GridBagConstraints.HORIZONTAL;
213
        gbc.weightx = 1.0;
214
        gbc.gridx = 1;
209 215
//		gbc.anchor = GridBagConstraints.EAST;
210
		gbc.insets = new Insets(0, 0, 4, 0);
211
		panel.add(combo, gbc);
212
		return panel;
213
	}
216
        gbc.insets = new Insets(0, 0, 4, 0);
217
        panel.add(combo, gbc);
218
        return panel;
219
    }
214 220

  
215
	/**
216
	 * Gets a ComboBox
217
	 * @return
218
	 */
219
	public JComboBox getFieldsCombo() {
220
		if(fieldsCombo == null) {
221
			fieldsCombo = new JComboBox();
221
    /**
222
     * Gets a ComboBox
223
     *
224
     * @return
225
     */
226
    public JComboBox getFieldsCombo() {
227
        if (fieldsCombo == null) {
228
            fieldsCombo = new JComboBox();
222 229
//			fieldsCombo.setPreferredSize(new Dimension(0, 18));
223
			ObjectAndDescription[] fieldList = getLayerList();
224
			fieldsCombo.removeAllItems();
225
			for (int i = 0; i < fieldList.length; i++)
226
				fieldsCombo.addItem(fieldList[i]);
227
		}
228
		return fieldsCombo;
229
	}
230
            ObjectAndDescription[] fieldList = getLayerList();
231
            fieldsCombo.removeAllItems();
232
            for (int i = 0; i < fieldList.length; i++) {
233
                fieldsCombo.addItem(fieldList[i]);
234
            }
235
        }
236
        return fieldsCombo;
237
    }
230 238

  
231
	/**
232
	 * Gets a CheckBox
233
	 * @return
234
	 */
235
	public JCheckBox getAllLayersCheck() {
236
		if(allLayers == null) {
237
			allLayers = new JCheckBox(GeoProcessLocator.getGeoProcessManager().getTranslation("select_all_layers"));
238
			allLayers.addActionListener(this);
239
		}
240
		return allLayers;
241
	}
239
    /**
240
     * Gets a CheckBox
241
     *
242
     * @return
243
     */
244
    public JCheckBox getAllLayersCheck() {
245
        if (allLayers == null) {
246
            allLayers = new JCheckBox(GeoProcessLocator.getGeoProcessManager().getTranslation("select_all_layers"));
247
            allLayers.addActionListener(this);
248
        }
249
        return allLayers;
250
    }
242 251

  
243
	/**
244
	 * Gets the summary table
245
	 * @return TableContainer
246
	 */
247
	public TableContainer getCheckBoxTable() {
248
		if (table == null) {
249
			table = new TableContainer(columnNames, columnWidths, null);
250
			table.setModel("CheckBoxModel");
251
			table.setControlVisible(false);
252
			table.initialize();
253
		}
254
		return table;
255
	}
252
    /**
253
     * Gets the summary table
254
     *
255
     * @return TableContainer
256
     */
257
    public TableContainer getCheckBoxTable() {
258
        if (table == null) {
259
            table = new TableContainer(columnNames, columnWidths, null);
260
            table.setModel("CheckBoxModel");
261
            table.setControlVisible(false);
262
            table.initialize();
263
        }
264
        return table;
265
    }
256 266

  
257
	//------------------------------------------------------------
267
    //------------------------------------------------------------
258 268

  
259
	/*
269
    /*
260 270
	 * (non-Javadoc)
261 271
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
262
	 */
263
	public void actionPerformed(ActionEvent e) {
264
		if(e.getSource() == getAllLayersCheck()) {
265
			//Selecci?n de todas las capas de la tabla
266
			try {
267
				for (int i = 0; i < getCheckBoxTable().getRowCount(); i++) {
268
					if(getAllLayersCheck().isSelected())
269
						getCheckBoxTable().getModel().setValueAt(new Boolean(true), i, 0);
270
					else
271
						getCheckBoxTable().getModel().setValueAt(new Boolean(false), i, 0);
272
				}
273
			} catch (NotInitializeException e1) {
274
				Sextante.addErrorToLog(e1);
275
			}
276
		}
277
	}
272
     */
273
    public void actionPerformed(ActionEvent e) {
274
        if (e.getSource() == getAllLayersCheck()) {
275
            //Selecci?n de todas las capas de la tabla
276
            try {
277
                for (int i = 0; i < getCheckBoxTable().getRowCount(); i++) {
278
                    if (getAllLayersCheck().isSelected()) {
279
                        getCheckBoxTable().getModel().setValueAt(new Boolean(true), i, 0);
280
                    } else {
281
                        getCheckBoxTable().getModel().setValueAt(new Boolean(false), i, 0);
282
                    }
283
                }
284
            } catch (NotInitializeException e1) {
285
                Sextante.addErrorToLog(e1);
286
            }
287
        }
288
    }
278 289

  
279
	/**
280
	 * Adds to the table one entry for each field
281
	 */
282
	private void initTable() {
283
		try {
284
			getCheckBoxTable().removeAllRows();
285
			ObjectAndDescription[] layerList = getLayerList();
286
			for (int i = 0; i < layerList.length; i++)
287
				addTableRow(layerList[i].getDescription());
288
		} catch (NotInitializeException e) {
289
			Sextante.addErrorToLog(e);
290
		}
291
	}
290
    /**
291
     * Adds to the table one entry for each field
292
     */
293
    private void initTable() {
294
        try {
295
            getCheckBoxTable().removeAllRows();
296
            ObjectAndDescription[] layerList = getLayerList();
297
            for (int i = 0; i < layerList.length; i++) {
298
                addTableRow(layerList[i].getDescription());
299
            }
300
        } catch (NotInitializeException e) {
301
            Sextante.addErrorToLog(e);
302
        }
303
    }
292 304

  
293
	/**
294
	 * Adds one entry to the table
295
	 * @param layerName
296
	 *        Layer name
297
	 * @throws NotInitializeException
298
	 */
299
	private void addTableRow(String layerName) throws NotInitializeException {
300
		Object[] row = {	new Boolean(false),
301
							layerName };
302
		getCheckBoxTable().addRow(row);
303
	}
305
    /**
306
     * Adds one entry to the table
307
     *
308
     * @param layerName Layer name
309
     * @throws NotInitializeException
310
     */
311
    private void addTableRow(String layerName) throws NotInitializeException {
312
        Object[] row = {new Boolean(false),
313
            layerName};
314
        getCheckBoxTable().addRow(row);
315
    }
304 316

  
305
	@Override
317
    @Override
306 318
    public void assignParameters() {
307
		try {
308
			ParametersSet params = m_Algorithm.getParameters();
309
			params.getParameter(MergeAlgorithm.FIELDLAYER).setParameterValue(getSelectedVectorLayer());
310
			params.getParameter(MergeAlgorithm.LAYERS).setParameterValue(getSelectedLayerList());
319
        try {
320
            ParametersSet params = m_Algorithm.getParameters();
321
            params.getParameter(MergeAlgorithm.FIELDLAYER).setParameterValue(getSelectedVectorLayer());
322
            params.getParameter(MergeAlgorithm.LAYERS).setParameterValue(getSelectedLayerList());
311 323

  
312
			OutputObjectsSet ooSet = m_Algorithm.getOutputObjects();
313
			Output outPol = ooSet.getOutput(MergeAlgorithm.RESULT_POL);
314
			Output outLine = ooSet.getOutput(MergeAlgorithm.RESULT_LINE);
315
			Output outPoint = ooSet.getOutput(MergeAlgorithm.RESULT_POINT);
324
            OutputObjectsSet ooSet = m_Algorithm.getOutputObjects();
325
            Output outPol = ooSet.getOutput(MergeAlgorithm.RESULT_POL);
326
            Output outLine = ooSet.getOutput(MergeAlgorithm.RESULT_LINE);
327
            Output outPoint = ooSet.getOutput(MergeAlgorithm.RESULT_POINT);
316 328

  
317
			//Reponer estas l?neas para cambiar el panel de salida y comentar la siguiente
318
			//AlgorithmOutputPanel fsp = getAlgorithmOutputPanel();
319
			//out.setOutputChannel(new CompositeSourceOutputChannel(fsp.getOutputParameters()));
320
			outPol.setOutputChannel(outputChannelSelectionPanelPol.getOutputChannel());
321
			outLine.setOutputChannel(outputChannelSelectionPanelLine.getOutputChannel());
322
			outPoint.setOutputChannel(outputChannelSelectionPanelPoint.getOutputChannel());
323
		} catch (Exception e) {
324
			Sextante.addErrorToLog(e);
325
		}
326
	}
329
            //Reponer estas l?neas para cambiar el panel de salida y comentar la siguiente
330
            //AlgorithmOutputPanel fsp = getAlgorithmOutputPanel();
331
            //out.setOutputChannel(new CompositeSourceOutputChannel(fsp.getOutputParameters()));
332
            outPol.setOutputChannel(outputChannelSelectionPanelPol.getOutputChannel());
333
            outLine.setOutputChannel(outputChannelSelectionPanelLine.getOutputChannel());
334
            outPoint.setOutputChannel(outputChannelSelectionPanelPoint.getOutputChannel());
335
        } catch (Exception e) {
336
            Sextante.addErrorToLog(e);
337
        }
338
    }
327 339

  
328
	@Override
329
	public void setOutputValue(String arg0, String arg1) {
340
    @Override
341
    public void setOutputValue(String arg0, String arg1) {
330 342

  
331
	}
343
    }
332 344

  
333
	@Override
334
	public void setParameterValue(String arg0, String arg1) {
345
    @Override
346
    public void setParameterValue(String arg0, String arg1) {
335 347

  
336
	}
348
    }
337 349

  
338
	/**
339
	 * Gets the input layer list
340
	 * @return
341
	 */
342
	private ObjectAndDescription[] getLayerList() {
343
		if(layerList == null) {
344
			IVectorLayer[] layers = SextanteGUI.getInputFactory()
345
			.getVectorLayers(IVectorLayer.SHAPE_TYPE_WRONG);
346
			layerList = new ObjectAndDescription[layers.length];
347
			for (int i = 0; i < layers.length; i++)
348
				layerList[i] = new ObjectAndDescription(layers[i].getName(), layers[i]);
349
		}
350
		return layerList;
351
	}
350
    /**
351
     * Gets the input layer list
352
     *
353
     * @return
354
     */
355
    private ObjectAndDescription[] getLayerList() {
356
        if (layerList == null) {
357
            IVectorLayer[] layers = SextanteGUI.getInputFactory()
358
                    .getVectorLayers(IVectorLayer.SHAPE_TYPE_WRONG);
359
            layerList = new ObjectAndDescription[layers.length];
360
            for (int i = 0; i < layers.length; i++) {
361
                layerList[i] = new ObjectAndDescription(layers[i].getName(), layers[i]);
362
            }
363
        }
364
        return layerList;
365
    }
352 366

  
353
	/**
354
	 * Gets the list of selected layers
355
	 * @return
356
	 */
357
	private ArrayList<IVectorLayer> getSelectedLayerList() {
358
		ObjectAndDescription[] layerList = getLayerList();
359
		ArrayList<IVectorLayer> vLayer = new ArrayList<IVectorLayer>();
360
		for (int i = 0; i < layerList.length; i++) {
361
			Boolean check = (Boolean)getCheckBoxTable().getModel().getValueAt(i, 0);
362
			if(check.booleanValue())
363
				vLayer.add((IVectorLayer)layerList[i].getObject());
364
		}
365
		return vLayer;
366
	}
367
    /**
368
     * Gets the list of selected layers
369
     *
370
     * @return
371
     */
372
    private ArrayList<IVectorLayer> getSelectedLayerList() {
373
        ObjectAndDescription[] layerList = getLayerList();
374
        ArrayList<IVectorLayer> vLayer = new ArrayList<IVectorLayer>();
375
        for (int i = 0; i < layerList.length; i++) {
376
            Boolean check = (Boolean) getCheckBoxTable().getModel().getValueAt(i, 0);
377
            if (check.booleanValue()) {
378
                vLayer.add((IVectorLayer) layerList[i].getObject());
379
            }
380
        }
381
        return vLayer;
382
    }
367 383

  
368
	/**
369
	 * Gets the selected vector layer in the JComboBox
370
	 * @return
371
	 */
372
	private IVectorLayer getSelectedVectorLayer() {
373
		if(getFieldsCombo().getSelectedItem() != null)
374
			return (IVectorLayer)((ObjectAndDescription)getFieldsCombo().getSelectedItem()).getObject();
375
		return null;
376
	}
384
    /**
385
     * Gets the selected vector layer in the JComboBox
386
     *
387
     * @return
388
     */
389
    private IVectorLayer getSelectedVectorLayer() {
390
        if (getFieldsCombo().getSelectedItem() != null) {
391
            return (IVectorLayer) ((ObjectAndDescription) getFieldsCombo().getSelectedItem()).getObject();
392
        }
393
        return null;
394
    }
377 395

  
378 396
}

Also available in: Unified diff