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

View differences:

GeoProcessingMergePanel2.java
45 45
 *
46 46
 * $Id$
47 47
 * $Log$
48
 * Revision 1.3  2006-09-25 18:28:50  azabala
48
 * Revision 1.4  2007-03-06 16:47:58  caballero
49
 * Exceptions
50
 *
51
 * Revision 1.3  2006/09/25 18:28:50  azabala
49 52
 * fixed bug: now, when some data file in directory to merge is wrong, it ignores it and reports user at the end of the data file searching task
50 53
 *
51 54
 * Revision 1.2  2006/09/15 10:42:54  caballero
......
68 71
import java.io.File;
69 72
import java.io.FileNotFoundException;
70 73
import java.io.FilenameFilter;
71
import java.io.IOException;
72 74
import java.util.ArrayList;
73 75
import java.util.Arrays;
74 76

  
......
90 92
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
91 93
import org.gvsig.gui.beans.swing.JButton;
92 94

  
95
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
93 96
import com.iver.andami.PluginServices;
94
import com.iver.cit.gvsig.fmap.DriverException;
95
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
96 97
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
97 98
import com.iver.cit.gvsig.fmap.drivers.dgn.DgnMemoryDriver;
98 99
import com.iver.cit.gvsig.fmap.drivers.dxf.DXFMemoryDriver;
......
133 134
	private JLabel directoryLyrsLabel;
134 135

  
135 136
	private JList directoryLayerList;
136
	
137

  
137 138
	protected JTextField resultTf;
138
	
139
	
139

  
140

  
140 141
	/**
141 142
	 * Constructor
142 143
	 * @param layers
......
171 172
		inputLayersScrollPane.setPreferredSize(new Dimension(520, 110));
172 173
		inputLayersScrollPane.setMinimumSize(new Dimension(520, 90));
173 174
		int numRows = 2;
174
		addComponent(inputLayersScrollPane, 
175
		addComponent(inputLayersScrollPane,
175 176
								insets,
176 177
								numRows);
177 178

  
......
198 199
		directoryLayerScrollPane.setViewportView(directoryLayerList);
199 200
		directoryLayerScrollPane.setBorder(BorderFactory
200 201
				.createEtchedBorder(EtchedBorder.RAISED));
201
		
202

  
202 203
		//If we dont do this, GridBagLayout wont resize well the scrollpane
203 204
		directoryLayerScrollPane.setPreferredSize(new Dimension(520, 110));
204 205
		directoryLayerScrollPane.setMinimumSize(new Dimension(520, 90));
205
		
206
		
207
		addComponent(directoryLayerScrollPane, insets,  
206

  
207

  
208
		addComponent(directoryLayerScrollPane, insets,
208 209
				 numRows );
209
		
210
		
210

  
211

  
211 212
		JLabel resultSchemaLabel = new JLabel(PluginServices.
212 213
				getText(this, "Usar_los_campos_de_la_capa") + ":");
213
		
214

  
214 215
		fieldsJComboBox = new JComboBox();
215
		addComponent(resultSchemaLabel, 
216
		addComponent(resultSchemaLabel,
216 217
				fieldsJComboBox,
217 218
				GridBagConstraints.HORIZONTAL,
218 219
				insets);
219
		
220
		
220

  
221

  
221 222
		//FIXME Create an open result layer control
222 223
		JPanel aux = new JPanel(new BorderLayout());
223 224
		String resultLayerText = PluginServices.
......
236 237
        aux.add(openResultButton, BorderLayout.EAST);
237 238
        addComponent(resultLayerText, aux, GridBagConstraints.HORIZONTAL, insets );
238 239
	}
239
	
240

  
240 241
	//FIXME Move this to an open result layer control
241
	
242

  
242 243
	/**
243 244
	 * Opens a dialog to select where (file, database, etc)
244 245
	 * to save the result layer.
......
314 315
		ArrayList newLyrList = new ArrayList();
315 316
		if (inputLayersToAdd == null)
316 317
			return solution;
317
		
318

  
318 319
		// sin florituras. cogemos la primera que haya
319 320
		IProjection projection = layers.getLayer(0).getProjection();
320 321
		DgnMemoryDriver dgnDriver = null;
......
345 346
				}
346 347
				newLyrList.add((FLyrVect) LayerFactory.
347 348
						createLayer(fileName,
348
									driver, 
349
									afile, 
349
									driver,
350
									afile,
350 351
									projection));
351 352
			} catch(Exception e){
352 353
				String errorText =  fullPath + "\n";
......
431 432
		layersSelected();
432 433
	}
433 434

  
434
	
435

  
435 436
	// mover a una utility class
436 437
	protected String[] getLayerNames() {
437 438
		String[] solution = null;
......
508 509
	/**
509 510
	 * Listens selection of layers in input layers list, and refresh selected
510 511
	 * layers list
511
	 * 
512
	 *
512 513
	 * @author azabala
513
	 * 
514
	 *
514 515
	 */
515 516
	private class LayerSelectorListener implements ListSelectionListener {
516 517
		private FLayers layers;
......
570 571
			fieldsJComboBox.setModel(defaultModel);
571 572
		}// valueChanged
572 573
	}
573
	
574

  
574 575
	/**
575 576
     * ListModel for input layer list (which has layers of the TOC)
576 577
     * @author azabala
......
582 583
		LayersListModel(FLayers layers){
583 584
			this.layers = layers;
584 585
		}
585
		
586

  
586 587
		public int getSize() {
587 588
			return layers.getLayersCount();
588 589
		}
......
603 604
			}//else
604 605
		}//getElementAt
605 606
    }
606
    
607

  
607 608
    class AditionalLayersListModel extends AbstractListModel{
608 609
		private static final long serialVersionUID = 6123487908892908100L;
609 610
		private FLyrVect[] layers;
610
		
611

  
611 612
		AditionalLayersListModel(FLyrVect[] layers){
612 613
			this.layers = layers;
613 614
		}
......
639 640
		}
640 641
		return new File(fileName);
641 642
	}
642
    
643

  
643 644
    //FIXME Move to an abstract base class
644 645
    /**
645 646
	 * Returns layers.
646
	 * 
647
	 *
647 648
	 * @return
648 649
	 */
649 650
	public FLayers getFLayers() {
......
652 653
    /**
653 654
	 * Shows to the user a dialog error, whith the title and message body
654 655
	 * specified as parameters.
655
	 * 
656
	 *
656 657
	 * @param message
657 658
	 *            body of the error message
658 659
	 * @param title
......
665 666
    /**
666 667
	 * Asks to the user for the creation of a spatial index for the specified
667 668
	 * layer. It will be of help for certain geoprocesses.
668
	 * 
669
	 *
669 670
	 * FLyrVect default spatial index is MapServer quadtree, that hasnt the
670 671
	 * ability to do nearest neighbour searches.
671
	 * 
672
	 *
672 673
	 * For those geoprocesses that needs it (NN searches) overwrite this method
673 674
	 * and use JSI RTree, or SIL RTree.
674
	 * 
675
	 *
675 676
	 * It returns an IMonitorableTask, a task to build the spatial index in
676 677
	 * background.
677
	 * 
678
	 *
678 679
	 * @param layer
679 680
	 * @return an ITask
680 681
	 */
......
698 699
				CreateSpatialIndexMonitorableTask task = new CreateSpatialIndexMonitorableTask(
699 700
						layer);
700 701
				return task;
701
			} catch (DriverIOException e) {
702
			} catch (ReadDriverException e) {
702 703
				// TODO Auto-generated catch block
703 704
				e.printStackTrace();
704 705
				return null;
705
			} catch (DriverException e) {
706
				// TODO Auto-generated catch block
707
				e.printStackTrace();
708
				return null;
709 706
			}
710 707
		} else
711 708
			return null;
......
714 711

  
715 712
	/**
716 713
	 * Confirm overwrite the output file if it allready exist.
717
	 * 
718
	 * 
714
	 *
715
	 *
719 716
	 * @param outputFile
720 717
	 * @return answer
721 718
	 */

Also available in: Unified diff