Statistics
| Revision:

root / trunk / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / selectPoints / ErrorPointPanel.java @ 5217

History | View | Annotate | Download (7.74 KB)

1
package org.gvsig.georeferencing.gui.selectPoints;
2

    
3
import java.awt.Color;
4
import java.awt.FlowLayout;
5
import java.awt.GridBagConstraints;
6
import java.awt.GridBagLayout;
7
import java.awt.Insets;
8

    
9
import javax.swing.JLabel;
10
import javax.swing.JPanel;
11
import javax.swing.JTextField;
12

    
13
import com.iver.andami.PluginServices;
14
/**
15
 * Panel que contiene la informaci?n de cada punto. 
16
 * No contiene eventos, estos deben ser manejados desde la 
17
 * clase que lo llame.
18
 * 
19
 * @author Nacho Brodin (brodin_ign@gva.es)
20
 *
21
 */
22
public class ErrorPointPanel extends JPanel{
23

    
24
        private JPanel pInfoPoint = null;
25
        private JPanel pX = null;
26
        private JPanel pY = null;
27
        private JPanel pRms = null;
28
        private JPanel pTotal = null;
29
        private JTextField tResX = null;
30
        private JLabel lX = null;
31
        private JLabel lY = null;
32
        private JTextField tResY = null;
33
        private JLabel lRms = null;
34
        private JLabel lTotal = null;
35
        private JTextField tTotal = null;
36
        private JTextField tRms = null;
37

    
38
        
39
        
40
        private JPanel pError = null;
41
        /**
42
         * This is the default constructor
43
         */
44
        public ErrorPointPanel() {
45
                super();
46
                initialize();
47
        }
48

    
49
        /**
50
         * This method initializes this
51
         * 
52
         * @return void
53
         */
54
        private void initialize() {                
55
                GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
56
                GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
57
                gridBagConstraints6.insets = new java.awt.Insets(0,0,0,0);
58
                gridBagConstraints6.gridy = 1;
59
                gridBagConstraints6.gridx = 0;
60
                
61
                this.setLayout(new GridBagLayout());
62
                this.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0));
63
                this.setSize(new java.awt.Dimension(175,125));
64
                this.setPreferredSize(new java.awt.Dimension(175,125));
65
                gridBagConstraints4.gridx = 0;
66
                gridBagConstraints4.gridy = 0;
67
                this.add(getPTotal(), gridBagConstraints6);
68
                this.add(getPError(), gridBagConstraints4);
69
        }
70
        
71
        /**
72
         * This method initializes pX        
73
         *         
74
         * @return javax.swing.JPanel        
75
         */
76
        private JPanel getPX() {
77
                if (pX == null) {
78
                        lX = new JLabel();
79
                        lX.setText("Res X: ");
80
                        lX.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12));
81
                        FlowLayout flowLayout2 = new FlowLayout();
82
                        flowLayout2.setAlignment(java.awt.FlowLayout.RIGHT);
83
                        pX = new JPanel();
84
                        pX.setLayout(flowLayout2);
85
                        pX.setPreferredSize(new java.awt.Dimension(140,20));
86
                        flowLayout2.setHgap(0);
87
                        flowLayout2.setVgap(1);
88
                        pX.add(lX, null);
89
                        pX.add(getTResX(), null);
90
                }
91
                return pX;
92
        }
93

    
94
        /**
95
         * This method initializes pY        
96
         *         
97
         * @return javax.swing.JPanel        
98
         */
99
        private JPanel getPY() {
100
                if (pY == null) {
101
                        lY = new JLabel();
102
                        lY.setText("Res Y:");
103
                        lY.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12));
104
                        FlowLayout flowLayout1 = new FlowLayout();
105
                        flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
106
                        pY = new JPanel();
107
                        pY.setLayout(flowLayout1);
108
                        pY.setPreferredSize(new java.awt.Dimension(140,20));
109
                        flowLayout1.setHgap(0);
110
                        flowLayout1.setVgap(1);
111
                        pY.add(lY, null);
112
                        pY.add(getTResY(), null);
113
                }
114
                return pY;
115
        }
116

    
117
        /**
118
         * This method initializes pLatitud        
119
         *         
120
         * @return javax.swing.JPanel        
121
         */
122
        private JPanel getPRms() {
123
                if (pRms == null) {
124
                        lRms = new JLabel();
125
                        lRms.setText("RMS:");
126
                        lRms.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12));
127
                        FlowLayout flowLayout3 = new FlowLayout();
128
                        flowLayout3.setAlignment(java.awt.FlowLayout.RIGHT);
129
                        pRms = new JPanel();
130
                        pRms.setLayout(flowLayout3);
131
                        pRms.setPreferredSize(new java.awt.Dimension(140,20));
132
                        flowLayout3.setHgap(0);
133
                        flowLayout3.setVgap(1);
134
                        pRms.add(lRms, null);
135
                        pRms.add(getTRMS(), null);
136
                }
137
                return pRms;
138
        }
139

    
140
        /**
141
         * This method initializes pLongitud        
142
         *         
143
         * @return javax.swing.JPanel        
144
         */
145
        private JPanel getPTotal() {
146
                if (pTotal == null) {
147
                        lTotal = new JLabel();
148
                        lTotal.setText(PluginServices.getText(this, "total")+":");
149
                        FlowLayout flowLayout4 = new FlowLayout();
150
                        flowLayout4.setAlignment(java.awt.FlowLayout.RIGHT);
151
                        pTotal = new JPanel();
152
                        pTotal.setLayout(flowLayout4);
153
                        pTotal.setPreferredSize(new java.awt.Dimension(160,20));
154
                        flowLayout4.setHgap(7);
155
                        flowLayout4.setVgap(1);
156
                        pTotal.add(lTotal, null);
157
                        pTotal.add(getTTotal(), null);
158
                }
159
                return pTotal;
160
        }
161
        
162
        /**
163
         * Este m?todo inicializa el campo de texto que tiene la coordenada en X 
164
         * de la vista. Controla que le sean introducidos valores numericos y
165
         * salva el valor que contiene en la capa.        
166
         *         
167
         * @return javax.swing.JTextField        
168
         */
169
        public JTextField getTResX() {
170
                if (tResX == null) {
171
                        tResX = new JTextField();
172
                        tResX.setPreferredSize(new java.awt.Dimension(75,18));
173
                        tResX.setEnabled(false);
174
                }
175
                return tResX;
176
        }
177

    
178
        /**
179
         * Este m?todo inicializa el campo de texto que tiene la coordenada en Y 
180
         * de la vista. Controla que le sean introducidos valores numericos y
181
         * salva el valor que contiene en la capa.        
182
         *         
183
         * @return javax.swing.JTextField        
184
         */
185
        public JTextField getTResY() {
186
                if (tResY == null) {
187
                        tResY = new JTextField();
188
                        tResY.setPreferredSize(new java.awt.Dimension(75,18));
189
                        tResY.setEnabled(false);
190
                }
191
                return tResY;
192
        }
193

    
194
        /**
195
         * Este m?todo inicializa el campo de texto que tiene la coordenada en Y 
196
         * del mundo real. Controla que le sean introducidos valores numericos y
197
         * salva el valor que contiene en la capa.        
198
         *         
199
         * @return javax.swing.JTextField        
200
         */
201
        public JTextField getTTotal() {
202
                if (tTotal == null) {
203
                        tTotal = new JTextField();
204
                        tTotal.setPreferredSize(new java.awt.Dimension(90,18));
205
                        tTotal.setEnabled(false);
206
                        tTotal.setHorizontalAlignment(javax.swing.JTextField.LEFT);
207
                }
208
                return tTotal;
209
        }
210

    
211
        /**
212
         * Este m?todo inicializa el campo de texto que tiene la coordenada en X 
213
         * del mundo real. Controla que le sean introducidos valores numericos y
214
         * salva el valor que contiene en la capa.
215
         *         
216
         * @return javax.swing.JTextField        
217
         */
218
        public JTextField getTRMS() {
219
                if (tRms == null) {
220
                        tRms = new JTextField();
221
                        tRms.setPreferredSize(new java.awt.Dimension(75,18));
222
                        tRms.setEnabled(false);
223
                        tRms.setHorizontalAlignment(javax.swing.JTextField.LEFT);
224
                }
225
                return tRms;
226
        }
227
        
228
        
229
        /**
230
         * This method initializes jPanel        
231
         *         
232
         * @return javax.swing.JPanel        
233
         */    
234
        private JPanel getPError() {
235
                if (pError == null) {
236
                        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
237
                        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
238
                        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
239
                        pError = new JPanel();
240
                        pError.setLayout(new GridBagLayout());
241
                        gridBagConstraints1.gridx = 0;
242
                        gridBagConstraints1.gridy = 0;
243
                        gridBagConstraints1.ipadx = 0;
244
                        gridBagConstraints1.insets = new Insets(0, 0, 0, 0);
245
                        gridBagConstraints1.gridwidth = 2;
246
                        gridBagConstraints2.gridx = 0;
247
                        gridBagConstraints2.gridy = 1;
248
                        gridBagConstraints2.weighty = 0.0D;
249
                        gridBagConstraints2.insets = new Insets(0, 0, 0, 0);
250
                        gridBagConstraints3.gridx = 0;
251
                        gridBagConstraints3.gridy = 2;
252
                        gridBagConstraints3.weighty = 0.0D;
253
                        gridBagConstraints3.insets = new Insets(0, 0, 0, 0);
254
                        pError.setPreferredSize(new java.awt.Dimension(175,105));
255
                        pError.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Error", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
256
                        pError.add(getPX(), gridBagConstraints1);
257
                        pError.add(getPY(), gridBagConstraints2);
258
                        pError.add(getPRms(), gridBagConstraints3);
259
                }
260
                return pError;
261
        }
262
        
263
        /**
264
     * Activa o desactiva este panel y todos los que lo componen
265
     * @param enabled variable booleana para la activaci?n y/o desactivaci?n
266
     */
267
    public void setEnabled(boolean enabled){
268
            Color color = Color.WHITE;
269
            if(!enabled)
270
                    color = this.getBackground();
271
            this.getTResX().setBackground(color);
272
            this.getTResY().setBackground(color);
273
            this.getTRMS().setBackground(color);
274
            this.getTTotal().setBackground(color);
275
    }
276
 }