root / trunk / libraries / libJCRS / src / org / gvsig / crs / ui / TransformationManualPanel.java @ 6904
History | View | Annotate | Download (9.41 KB)
1 |
package org.gvsig.crs.ui; |
---|---|
2 |
|
3 |
import java.awt.Component; |
4 |
import java.awt.Dimension; |
5 |
import java.awt.FlowLayout; |
6 |
import java.awt.Font; |
7 |
import java.awt.GridLayout; |
8 |
import java.awt.Panel; |
9 |
import java.awt.event.ActionEvent; |
10 |
|
11 |
import javax.swing.BorderFactory; |
12 |
import javax.swing.JButton; |
13 |
import javax.swing.JLabel; |
14 |
import javax.swing.JPanel; |
15 |
import javax.swing.JScrollPane; |
16 |
import javax.swing.JTextArea; |
17 |
import javax.swing.JTextField; |
18 |
|
19 |
import org.cresques.ui.DefaultDialogPanel; |
20 |
import org.gvsig.crs.ICrs; |
21 |
|
22 |
import com.iver.andami.PluginServices; |
23 |
import com.iver.andami.ui.mdiManager.View; |
24 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
25 |
import com.iver.cit.gvsig.gui.panels.ProjChooserPanelTransformation; |
26 |
|
27 |
public class TransformationManualPanel extends DefaultDialogPanel implements View { |
28 |
|
29 |
private JLabel x_Translation; |
30 |
private JLabel y_Translation; |
31 |
private JLabel z_Translation; |
32 |
private JLabel x_Rotation; |
33 |
private JLabel y_Rotation; |
34 |
private JLabel z_Rotation; |
35 |
private JLabel scale; |
36 |
|
37 |
private JTextField tx_Translation; |
38 |
private JTextField ty_Translation; |
39 |
private JTextField tz_Translation; |
40 |
private JTextField tx_Rotation; |
41 |
private JTextField ty_Rotation; |
42 |
private JTextField tz_Rotation; |
43 |
private JTextField tScale; |
44 |
|
45 |
private JLabel wkt; |
46 |
private JTextArea info; |
47 |
private JScrollPane areaScrollPane; |
48 |
|
49 |
private JPanel panel; |
50 |
private JPanel buttonPane; |
51 |
private JButton accept; |
52 |
private JButton cancel; |
53 |
|
54 |
private String cadWKT = ""; |
55 |
|
56 |
ProjChooserPanelTransformation pcpt; |
57 |
|
58 |
public TransformationManualPanel(String cad, int code) { |
59 |
super(false); |
60 |
pcpt = new ProjChooserPanelTransformation();
|
61 |
cadWKT = cad; |
62 |
init(); |
63 |
} |
64 |
|
65 |
private void init() { |
66 |
this.add(getJPanel(), null); |
67 |
this.add(getJPanelParams(), null); |
68 |
this.add(getButtonPane(), null); |
69 |
|
70 |
} |
71 |
|
72 |
private JPanel getJPanelParams() { |
73 |
if(panel == null) { |
74 |
panel = new JPanel(); |
75 |
panel.setLayout(new GridLayout(4,4)); |
76 |
panel.setLayout(new FlowLayout(FlowLayout.LEFT,5,5)); |
77 |
panel.setPreferredSize(new Dimension(520,150)); |
78 |
panel.add(getX_Translation(),null);
|
79 |
panel.add(getTx_Translation(),null);
|
80 |
panel.add(getX_Rotation(),null);
|
81 |
panel.add(getTx_Rotation(),null);
|
82 |
panel.add(getY_Translation(),null);
|
83 |
panel.add(getTy_Translation(),null);
|
84 |
panel.add(getY_Rotation(),null);
|
85 |
panel.add(getTy_Rotation(),null);
|
86 |
panel.add(getZ_Translation(),null);
|
87 |
panel.add(getTz_Translation(),null);
|
88 |
panel.add(getZ_Rotation(),null);
|
89 |
panel.add(getTz_Rotation(),null);
|
90 |
panel.add(getScale(),null);
|
91 |
panel.add(getTscale(),null);
|
92 |
|
93 |
} |
94 |
return panel;
|
95 |
} |
96 |
|
97 |
private JLabel getX_Translation() { |
98 |
if(x_Translation == null ) { |
99 |
x_Translation = new JLabel(); |
100 |
x_Translation.setPreferredSize(new Dimension(100,20)); |
101 |
x_Translation.setFont(new Font("x_Translation:",Font.BOLD,15)); |
102 |
x_Translation.setText("x_Translation:");
|
103 |
} |
104 |
return x_Translation;
|
105 |
} |
106 |
|
107 |
private JLabel getY_Translation() { |
108 |
if(y_Translation == null ) { |
109 |
y_Translation = new JLabel(); |
110 |
y_Translation.setPreferredSize(new Dimension(100,20)); |
111 |
y_Translation.setFont(new Font("y_Translation:",Font.BOLD,15)); |
112 |
y_Translation.setText("y_Translation:");
|
113 |
} |
114 |
return y_Translation;
|
115 |
} |
116 |
|
117 |
private JLabel getZ_Translation() { |
118 |
if(z_Translation == null ) { |
119 |
z_Translation = new JLabel(); |
120 |
z_Translation.setPreferredSize(new Dimension(100,20)); |
121 |
z_Translation.setFont(new Font("z_Translation:",Font.BOLD,15)); |
122 |
z_Translation.setText("z_Translation:");
|
123 |
} |
124 |
return z_Translation;
|
125 |
} |
126 |
|
127 |
private JLabel getX_Rotation() { |
128 |
if(x_Rotation == null ) { |
129 |
x_Rotation = new JLabel(); |
130 |
x_Rotation.setPreferredSize(new Dimension(100,20)); |
131 |
x_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15)); |
132 |
x_Rotation.setText("x_Rotation:");
|
133 |
} |
134 |
return x_Translation;
|
135 |
} |
136 |
|
137 |
private JLabel getY_Rotation() { |
138 |
if(y_Rotation == null ) { |
139 |
y_Rotation = new JLabel(); |
140 |
y_Rotation.setPreferredSize(new Dimension(100,20)); |
141 |
y_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15)); |
142 |
y_Rotation.setText("y_Rotation:");
|
143 |
} |
144 |
return y_Translation;
|
145 |
} |
146 |
|
147 |
private JLabel getZ_Rotation() { |
148 |
if(z_Rotation == null ) { |
149 |
z_Rotation = new JLabel(); |
150 |
z_Rotation.setPreferredSize(new Dimension(100,20)); |
151 |
z_Rotation.setFont(new Font("x_Translation:",Font.BOLD,15)); |
152 |
z_Rotation.setText("z_Rotation:");
|
153 |
} |
154 |
return z_Rotation;
|
155 |
} |
156 |
|
157 |
private JLabel getScale() { |
158 |
if(scale == null ) { |
159 |
scale = new JLabel(); |
160 |
scale.setPreferredSize(new Dimension(100,20)); |
161 |
scale.setFont(new Font("scale:",Font.BOLD,15)); |
162 |
scale.setText("scale:");
|
163 |
} |
164 |
return scale;
|
165 |
} |
166 |
|
167 |
private JTextField getTx_Translation() { |
168 |
if(tx_Translation == null ) { |
169 |
tx_Translation = new JTextField(); |
170 |
tx_Translation.setPreferredSize(new Dimension(100,20)); |
171 |
tx_Translation.setFont(new Font("",Font.ITALIC,10)); |
172 |
tx_Translation.setText("");
|
173 |
tx_Translation.setEditable(true);
|
174 |
} |
175 |
return tx_Translation;
|
176 |
} |
177 |
|
178 |
private JTextField getTy_Translation() { |
179 |
if(ty_Translation == null ) { |
180 |
ty_Translation = new JTextField(); |
181 |
ty_Translation.setPreferredSize(new Dimension(100,20)); |
182 |
ty_Translation.setFont(new Font("",Font.ITALIC,10)); |
183 |
ty_Translation.setText("");
|
184 |
ty_Translation.setEditable(true);
|
185 |
} |
186 |
return ty_Translation;
|
187 |
} |
188 |
|
189 |
private JTextField getTz_Translation() { |
190 |
if(tz_Translation == null ) { |
191 |
tz_Translation = new JTextField(); |
192 |
tz_Translation.setPreferredSize(new Dimension(100,20)); |
193 |
tz_Translation.setFont(new Font("",Font.ITALIC,10)); |
194 |
tz_Translation.setText("");
|
195 |
tz_Translation.setEditable(true);
|
196 |
} |
197 |
return tz_Translation;
|
198 |
} |
199 |
|
200 |
private JTextField getTx_Rotation() { |
201 |
if(tx_Rotation == null ) { |
202 |
tx_Rotation = new JTextField(); |
203 |
tx_Rotation.setPreferredSize(new Dimension(100,20)); |
204 |
tx_Rotation.setFont(new Font("",Font.ITALIC,10)); |
205 |
tx_Rotation.setText("");
|
206 |
tx_Rotation.setEditable(true);
|
207 |
} |
208 |
return tx_Rotation;
|
209 |
} |
210 |
|
211 |
private JTextField getTy_Rotation() { |
212 |
if(ty_Rotation == null ) { |
213 |
ty_Rotation = new JTextField(); |
214 |
ty_Rotation.setPreferredSize(new Dimension(100,20)); |
215 |
ty_Rotation.setFont(new Font("",Font.ITALIC,10)); |
216 |
ty_Rotation.setText("");
|
217 |
ty_Rotation.setEditable(true);
|
218 |
} |
219 |
return ty_Rotation;
|
220 |
} |
221 |
|
222 |
private JTextField getTz_Rotation() { |
223 |
if(tz_Rotation == null ) { |
224 |
tz_Rotation = new JTextField(); |
225 |
tz_Rotation.setPreferredSize(new Dimension(100,20)); |
226 |
tz_Rotation.setFont(new Font("",Font.ITALIC,10)); |
227 |
tz_Rotation.setText("");
|
228 |
tz_Rotation.setEditable(true);
|
229 |
} |
230 |
return tz_Rotation;
|
231 |
} |
232 |
|
233 |
private JTextField getTscale() { |
234 |
if(tScale == null ) { |
235 |
tScale = new JTextField(); |
236 |
tScale.setPreferredSize(new Dimension(100,20)); |
237 |
tScale.setFont(new Font("",Font.ITALIC,10)); |
238 |
tScale.setText("");
|
239 |
tScale.setEditable(true);
|
240 |
} |
241 |
return tScale;
|
242 |
} |
243 |
|
244 |
private JPanel getJPanel(){ |
245 |
if (panel == null) { |
246 |
panel = new JPanel(); |
247 |
panel.setLayout(new GridLayout(1,2)); |
248 |
panel.setLayout(new FlowLayout(FlowLayout.LEADING,5,10)); |
249 |
panel.setPreferredSize(new Dimension(525, 110)); |
250 |
panel.add(getLabel()); |
251 |
panel.add(getScrollPanelArea()); |
252 |
} |
253 |
return panel;
|
254 |
} |
255 |
|
256 |
private JScrollPane getScrollPanelArea() { |
257 |
if(areaScrollPane == null) { |
258 |
areaScrollPane = new JScrollPane(getInfo()); |
259 |
areaScrollPane.setVerticalScrollBarPolicy( |
260 |
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
|
261 |
areaScrollPane.setPreferredSize(new Dimension(420, 100)); |
262 |
areaScrollPane.setBorder( |
263 |
BorderFactory.createCompoundBorder(
|
264 |
BorderFactory.createCompoundBorder(
|
265 |
BorderFactory.createTitledBorder("Wkt"), |
266 |
BorderFactory.createEmptyBorder(2,2,2,2)), |
267 |
areaScrollPane.getBorder())); |
268 |
} |
269 |
return areaScrollPane;
|
270 |
} |
271 |
|
272 |
private Component getLabel() { |
273 |
if (wkt == null){ |
274 |
wkt = new JLabel(); |
275 |
wkt.setPreferredSize(new Dimension(90, 80)); |
276 |
wkt.setText("Cadena WKT: ");
|
277 |
} |
278 |
return wkt;
|
279 |
} |
280 |
|
281 |
private Component getInfo() { |
282 |
if (info == null){ |
283 |
info = new JTextArea(); |
284 |
info.setLineWrap(true);
|
285 |
info.setWrapStyleWord(true);
|
286 |
info.setPreferredSize(new Dimension(400, 100)); |
287 |
info.setEditable(false);
|
288 |
info.setText(cadWKT); |
289 |
} |
290 |
return info;
|
291 |
} |
292 |
|
293 |
|
294 |
private JPanel getButtonPane() { |
295 |
if(buttonPane == null) { |
296 |
buttonPane = new JPanel(); |
297 |
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
298 |
buttonPane.setPreferredSize(new Dimension(525,50)); |
299 |
buttonPane.add(getButtonAccept(),null);
|
300 |
buttonPane.add(getButtonCancel(),null);
|
301 |
} |
302 |
return buttonPane;
|
303 |
} |
304 |
|
305 |
private JButton getButtonCancel() { |
306 |
if(cancel == null) { |
307 |
cancel = new JButton(); |
308 |
cancel.setText("Cancelar");
|
309 |
cancel.setPreferredSize(new Dimension(100,25)); |
310 |
cancel.setMnemonic('C');
|
311 |
cancel.setToolTipText("Cancel");
|
312 |
cancel.addActionListener(new java.awt.event.ActionListener() {
|
313 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
314 |
cancelButton_actionPerformed(e); |
315 |
} |
316 |
}); |
317 |
} |
318 |
return cancel;
|
319 |
} |
320 |
|
321 |
public void cancelButton_actionPerformed(ActionEvent e) { |
322 |
PluginServices.getMDIManager().closeView(this);
|
323 |
} |
324 |
|
325 |
private JButton getButtonAccept() { |
326 |
if(accept == null) { |
327 |
accept = new JButton(); |
328 |
accept.setText("Aceptar");
|
329 |
accept.setPreferredSize(new Dimension(100,25)); |
330 |
accept.setMnemonic('A');
|
331 |
accept.setToolTipText("Accept");
|
332 |
accept.addActionListener(new java.awt.event.ActionListener() {
|
333 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
334 |
acceptButton_actionPerformed(e); |
335 |
} |
336 |
}); |
337 |
} |
338 |
return accept;
|
339 |
} |
340 |
|
341 |
public void acceptButton_actionPerformed(ActionEvent e) { |
342 |
PluginServices.getMDIManager().closeView(this);
|
343 |
} |
344 |
|
345 |
public ViewInfo getViewInfo() {
|
346 |
ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
|
347 |
m_viewinfo.setTitle(PluginServices.getText(this,"Manual")); |
348 |
return m_viewinfo;
|
349 |
} |
350 |
|
351 |
} |