Statistics
| Revision:

root / trunk / extensions / extSDE / src / com / iver / cit / gvsig / sde / gui / sdewizard / UniqueFieldSelection.java @ 11193

History | View | Annotate | Download (3.48 KB)

1
package com.iver.cit.gvsig.sde.gui.sdewizard;
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
import com.iver.cit.gvsig.gui.WizardPanel;
13
/**
14
 * @author   Fernando Gonz?lez Cort?s
15
 */
16
public class UniqueFieldSelection extends JPanel {
17

    
18
        private JLabel jLabel = null;
19
        /**
20
         * @uml.property  name="jScrollPane"
21
         */
22
        private JScrollPane jScrollPane = null;
23
        /**
24
         * @uml.property  name="lstFields"
25
         */
26
        private JList lstFields = null;
27
        private WizardPanel w;
28
    /**
29
         * @uml.property  name="jPanel"
30
         */
31
    private JPanel jPanel = null;  //  @jve:decl-index=0:visual-constraint="312,136"
32
    /**
33
         * @uml.property  name="jPanel1"
34
         */
35
    private JPanel jPanel1 = null;  //  @jve:decl-index=0:visual-constraint="2,118"
36
        /**
37
         * This is the default constructor
38
         */
39
        public UniqueFieldSelection() {
40
                super();
41
                initialize();
42
        }
43
        /**
44
         * This method initializes this
45
         *
46
         * @return void
47
         */
48
        private  void initialize() {
49
                jLabel = new JLabel();
50
                this.setLayout(new BorderLayout());
51
                this.setSize(300, 226);
52
                jLabel.setText(PluginServices.getText(this, "select_unique_field")+":");
53
                jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
54
                jLabel.setPreferredSize(new java.awt.Dimension(315,15));
55
                this.add(getJPanel(), java.awt.BorderLayout.EAST);
56
                this.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
57
                this.add(getJPanel1(), java.awt.BorderLayout.WEST);
58
                this.add(jLabel, java.awt.BorderLayout.NORTH);
59
                this.add(getJScrollPane(), null);
60
        }
61
        /**
62
         * This method initializes jScrollPane
63
         * @return  javax.swing.JScrollPane
64
         * @uml.property  name="jScrollPane"
65
         */
66
        private JScrollPane getJScrollPane() {
67
                if (jScrollPane == null) {
68
                        jScrollPane = new JScrollPane();
69
                        jScrollPane.setViewportView(getLstFields());
70
                        jScrollPane.setPreferredSize(new java.awt.Dimension(260,131));
71
                }
72
                return jScrollPane;
73
        }
74
        /**
75
         * This method initializes jList
76
         * @return  javax.swing.JList
77
         * @uml.property  name="lstFields"
78
         */
79
        private JList getLstFields() {
80
                if (lstFields == null) {
81
                        lstFields = new JList();
82
                        lstFields.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
83
                                public void valueChanged(javax.swing.event.ListSelectionEvent e) {
84
                                        w.callStateChanged(lstFields.getSelectedIndices().length > 0);
85
                                }
86
                        });
87
                }
88
                return lstFields;
89
        }
90
        public void setWizard(WizardPanel w) {
91
                this.w = w;
92
        }
93

    
94
        /**
95
         * @param fields
96
         */
97
        public void setFields(String[] fields) {
98
                DefaultListModel model = new DefaultListModel();
99
                for (int i = 0; i < fields.length; i++) {
100
                        model.addElement(fields[i]);
101
                }
102

    
103
                lstFields.setModel(model);
104
        }
105

    
106
        public String getField(){
107
                return (String) getLstFields().getSelectedValue();
108
        }
109
    /**
110
         * This method initializes jPanel
111
         * @return  javax.swing.JPanel
112
         * @uml.property  name="jPanel"
113
         */
114
    private JPanel getJPanel() {
115
            if (jPanel == null) {
116
                    jPanel = new JPanel();
117
                    jPanel.setSize(77, 60);
118
                    jPanel.setPreferredSize(new java.awt.Dimension(80,10));
119
            }
120
            return jPanel;
121
    }
122
    /**
123
         * This method initializes jPanel1
124
         * @return  javax.swing.JPanel
125
         * @uml.property  name="jPanel1"
126
         */
127
    private JPanel getJPanel1() {
128
            if (jPanel1 == null) {
129
                    jPanel1 = new JPanel();
130
                    jPanel1.setSize(37, 71);
131
                    jPanel1.setPreferredSize(new java.awt.Dimension(80,10));
132
            }
133
            return jPanel1;
134
    }
135
}  //  @jve:decl-index=0:visual-constraint="10,10"