Revision 904 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/FileOpenDialog.java

View differences:

FileOpenDialog.java
11 11
import java.awt.Component;
12 12
import java.io.File;
13 13
import java.util.ArrayList;
14
import java.util.Iterator;
15
import java.util.Vector;
14 16

  
15 17
import javax.swing.BorderFactory;
18
import javax.swing.ComboBoxModel;
19
import javax.swing.DefaultComboBoxModel;
16 20
import javax.swing.DefaultListModel;
17 21
import javax.swing.JFileChooser;
18 22
import javax.swing.JList;
......
28 32
import com.iver.cit.gvsig.fmap.drivers.RasterDriver;
29 33
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
30 34
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
35
import javax.swing.JLabel;
36
import javax.swing.JComboBox;
37

  
38
import org.cresques.cts.IProjection;
39
import org.cresques.cts.ProjectionPool;
31 40
/**
32 41
 * Di?logo para cargar las dieferentes capas a la vista.
33 42
 *
......
44 53
    private JFileChooser fileChooser;
45 54
    private Class[] driverClasses;
46 55

  
56
	private JPanel jPanel = null;
57
	private JLabel jLabel = null;
58
	private JComboBox jCboProjections = null;
47 59
    /**
48 60
     * Creates a new FOpenDialog object.
49 61
     *
......
67 79
     */
68 80
    private void initialize() {
69 81
        this.setLayout(new BorderLayout());
70
        this.setSize(514, 323);
82
        this.setSize(514, 280);
71 83
        this.setLayout(null);
72 84
//        this.setBorder(javax.swing.BorderFactory.createBevelBorder(
73 85
  //              javax.swing.border.BevelBorder.RAISED));
......
107 119
            titledBorder1.setTitle(PluginServices.getText(this,"Capas"));
108 120
            jPanel2.add(getJListLayers(), null);
109 121
            jPanel2.add(getBExaminar(), null);
122
            jPanel2.add(getJPanel(), null);
110 123
        }
111 124

  
112 125
        return jPanel2;
......
279 292
        if (jListLayers == null) {
280 293
            jListLayers = new JList();
281 294
            jListLayers.setPreferredSize(new java.awt.Dimension(350, 50));
282
            jListLayers.setBounds(12, 20, 350, 240);
295
            jListLayers.setBounds(12, 20, 350, 184);
283 296
            jListLayers.setBorder(BorderFactory.createLineBorder(Color.BLACK));
284 297
        }
285 298

  
......
325 338
	public void setDriverClasses(Class[] driverClasses) {
326 339
		this.driverClasses = driverClasses;
327 340
	}
328
}  //  @jve:decl-index=0:visual-constraint="10,10"
341
	/**
342
	 * This method initializes jPanel	
343
	 * 	
344
	 * @return javax.swing.JPanel	
345
	 */    
346
	private JPanel getJPanel() {
347
		if (jPanel == null) {
348
			jPanel = new JPanel();
349
			jLabel = new JLabel();
350
			jPanel.setBounds(11, 214, 448, 37);
351
			jLabel.setText("Seleccione la proyecci?n:");
352
			jPanel.add(jLabel, null);
353
			jPanel.add(getJCboProjections(), null);
354
		}
355
		return jPanel;
356
	}
357
	/**
358
	 * This method initializes jComboBox	
359
	 * 	
360
	 * @return javax.swing.JComboBox	
361
	 */    
362
	private JComboBox getJCboProjections() {
363
		if (jCboProjections == null) {
364
			Iterator it = ProjectionPool.iterator();
365
			Vector vector = new Vector();
366
			int selected = -1;
367
			int i=0;
368
			while (it.hasNext())
369
			{				
370
				IProjection auxP =(IProjection) it.next();
371
				if (auxP == FOpenDialog.getLastProjection())
372
						selected = i;
373
				vector.add(auxP.getAbrev());
374
				i++;
375
			}
376
			DefaultComboBoxModel cModel = new DefaultComboBoxModel(vector);
377
			cModel.setSelectedItem(vector.get(selected));
378
			jCboProjections = new JComboBox(cModel);
379
			jCboProjections.setPreferredSize(new java.awt.Dimension(124,19));
380
			jCboProjections.addActionListener(new java.awt.event.ActionListener() { 
381
				public void actionPerformed(java.awt.event.ActionEvent e) {    
382
					System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
383
					String strProj = (String) jCboProjections.getSelectedItem();
384
					FOpenDialog.setLastProjection(ProjectionPool.get(strProj));
385
				}
386
			});
387
		}
388
		return jCboProjections;
389
	}
390
  }  //  @jve:decl-index=0:visual-constraint="10,10"
329 391
 //  @jve:visual-info  decl-index=0 visual-constraint="10,10"
330 392
//  @jve:visual-info  decl-index=0 visual-constraint="10,10"

Also available in: Unified diff