Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_892 / extensions / extJDBC / src / com / iver / cit / gvsig / jdbc_spatial / gui / jdbcwizard / GeomFieldSelection.java @ 10278

History | View | Annotate | Download (3 KB)

1
package com.iver.cit.gvsig.jdbc_spatial.gui.jdbcwizard;
2

    
3
import java.awt.BorderLayout;
4

    
5
import javax.swing.DefaultListModel;
6
import javax.swing.JLabel;
7
import javax.swing.JList;
8
import javax.swing.JPanel;
9
import javax.swing.JScrollPane;
10

    
11
import com.iver.andami.PluginServices;
12
/**
13
 * @author Fernando Gonz?lez Cort?s
14
 */
15
public class GeomFieldSelection extends JPanel {
16

    
17
        private JLabel jLabel = null;
18
        private JList lstFields = null;
19
        private JScrollPane jScrollPane = null;
20
    private JPanel jPanel = null;  //  @jve:decl-index=0:visual-constraint="215,282"
21
    private JPanel jPanel1 = null;  //  @jve:decl-index=0:visual-constraint="9,197"
22
        /**
23
         * This is the default constructor
24
         */
25
        public GeomFieldSelection() {
26
                super();
27
                initialize();
28
        }
29
        /**
30
         * This method initializes this
31
         * 
32
         * @return void
33
         */
34
        private  void initialize() {
35
                jLabel = new JLabel();
36
                this.setLayout(new BorderLayout());
37
                this.setSize(300, 263);
38
                jLabel.setText(PluginServices.getText(this, "select_geom_field") + ":");
39
                jLabel.setPreferredSize(new java.awt.Dimension(359,15));
40
                jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
41
                this.add(getJPanel1(), java.awt.BorderLayout.WEST);
42
                this.add(getJPanel(), java.awt.BorderLayout.EAST);
43
                this.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
44
                this.add(jLabel, java.awt.BorderLayout.NORTH);
45
        }
46
        /**
47
         * This method initializes jList        
48
         *         
49
         * @return javax.swing.JList        
50
         */    
51
        private JList getLstFields() {
52
                if (lstFields == null) {
53
                        lstFields = new JList();
54
                        lstFields.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
55
                }
56
                return lstFields;
57
        }
58
        /**
59
         * This method initializes jScrollPane        
60
         *         
61
         * @return javax.swing.JScrollPane        
62
         */    
63
        private JScrollPane getJScrollPane() {
64
                if (jScrollPane == null) {
65
                        jScrollPane = new JScrollPane();
66
                        jScrollPane.setViewportView(getLstFields());
67
                        jScrollPane.setPreferredSize(new java.awt.Dimension(260,131));
68
                }
69
                return jScrollPane;
70
        }
71
        
72
        public boolean done() {
73
                return (lstFields.getSelectedIndex() != -1);
74
        }
75
        /**
76
         * @param fields
77
         */
78
        public void setFields(String[] fields) {
79
                DefaultListModel model = new DefaultListModel();
80
                for (int i = 0; i < fields.length; i++) {
81
                        model.addElement(fields[i]);
82
                }
83
                
84
                lstFields.setModel(model);
85
        }
86
        
87
        public String getField(){
88
                return (String) getLstFields().getSelectedValue();
89
        }
90
    /**
91
     * This method initializes jPanel        
92
     *         
93
     * @return javax.swing.JPanel        
94
     */    
95
    private JPanel getJPanel() {
96
            if (jPanel == null) {
97
                    jPanel = new JPanel();
98
                    jPanel.setSize(46, 32);
99
                    jPanel.setPreferredSize(new java.awt.Dimension(80,10));
100
            }
101
            return jPanel;
102
    }
103
    /**
104
     * This method initializes jPanel1        
105
     *         
106
     * @return javax.swing.JPanel        
107
     */    
108
    private JPanel getJPanel1() {
109
            if (jPanel1 == null) {
110
                    jPanel1 = new JPanel();
111
                    jPanel1.setSize(47, 66);
112
                    jPanel1.setPreferredSize(new java.awt.Dimension(80,10));
113
            }
114
            return jPanel1;
115
    }
116
  }  //  @jve:decl-index=0:visual-constraint="10,10"