svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / FThemePropertiesDialog.java @ 775
History | View | Annotate | Download (10.9 KB)
1 |
/*
|
---|---|
2 |
* Created on 31-may-2004
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
package com.iver.cit.gvsig.gui; |
8 |
|
9 |
import javax.swing.JLabel; |
10 |
import javax.swing.JPanel; |
11 |
import javax.swing.JTextField; |
12 |
|
13 |
import com.hardcode.gdbms.engine.data.DataSource; |
14 |
import com.hardcode.gdbms.engine.data.DriverException; |
15 |
import com.iver.andami.PluginServices; |
16 |
import com.iver.andami.messages.NotificationManager; |
17 |
import com.iver.andami.ui.mdiManager.View; |
18 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
19 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
20 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
21 |
/**
|
22 |
* Di?logo de propiedades del tema.
|
23 |
*
|
24 |
* @author Vicente Caballero Navarro
|
25 |
*/
|
26 |
public class FThemePropertiesDialog extends JPanel implements View { |
27 |
private javax.swing.JPanel jContentPane = null; |
28 |
private javax.swing.JTabbedPane jTabbedPane = null; |
29 |
private javax.swing.JPanel phiperenlace = null; |
30 |
private javax.swing.JPanel phnorte = null; |
31 |
private javax.swing.JPanel phsur = null; |
32 |
private javax.swing.JLabel jLabel = null; |
33 |
private javax.swing.JComboBox jComboBox = null; |
34 |
private javax.swing.JLabel jLabel1 = null; |
35 |
private javax.swing.JComboBox jComboBox1 = null; |
36 |
private javax.swing.JPanel pbotones = null; |
37 |
private javax.swing.JButton baceptar = null; |
38 |
private javax.swing.JButton bcancelar = null; |
39 |
private javax.swing.JPanel pvisualizacion = null; |
40 |
private FLayer m_layer;
|
41 |
private javax.swing.JPanel pvnorte = null; |
42 |
private javax.swing.JPanel pvsur = null; |
43 |
private javax.swing.JLabel jLabel2 = null; |
44 |
private javax.swing.JLabel jLabel3 = null; |
45 |
private javax.swing.JTextField jTextField = null; |
46 |
private javax.swing.JTextField jTextField1 = null; |
47 |
private com.iver.cit.gvsig.gui.View view;
|
48 |
|
49 |
private JLabel jLabel4 = null; |
50 |
private JTextField jTextField2 = null; |
51 |
/**
|
52 |
* This is the default constructor
|
53 |
*
|
54 |
* @param layer DOCUMENT ME!
|
55 |
* @param view DOCUMENT ME!
|
56 |
*/
|
57 |
public FThemePropertiesDialog(FLayer layer, com.iver.cit.gvsig.gui.View view) {
|
58 |
super();
|
59 |
this.view = view;
|
60 |
m_layer = layer; |
61 |
initialize(); |
62 |
} |
63 |
|
64 |
/**
|
65 |
* This method initializes this
|
66 |
*/
|
67 |
private void initialize() { |
68 |
this.setSize(367, 184); |
69 |
this.add(getJContentPane());
|
70 |
} |
71 |
|
72 |
/**
|
73 |
* This method initializes jContentPane
|
74 |
*
|
75 |
* @return javax.swing.JPanel
|
76 |
*/
|
77 |
private javax.swing.JPanel getJContentPane() {
|
78 |
if (jContentPane == null) { |
79 |
jContentPane = new javax.swing.JPanel();
|
80 |
jContentPane.setLayout(new java.awt.BorderLayout());
|
81 |
jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER); |
82 |
jContentPane.add(getPbotones(), java.awt.BorderLayout.SOUTH); |
83 |
} |
84 |
|
85 |
return jContentPane;
|
86 |
} |
87 |
|
88 |
/**
|
89 |
* This method initializes jTabbedPane
|
90 |
*
|
91 |
* @return javax.swing.JTabbedPane
|
92 |
*/
|
93 |
private javax.swing.JTabbedPane getJTabbedPane() {
|
94 |
if (jTabbedPane == null) { |
95 |
jTabbedPane = new javax.swing.JTabbedPane();
|
96 |
jTabbedPane.setPreferredSize(new java.awt.Dimension(320,140)); |
97 |
jTabbedPane.addTab(PluginServices.getText(this, "Hiperenlace"), |
98 |
null, getPhiperenlace(), null); |
99 |
jTabbedPane.addTab(PluginServices.getText(this, "Visualizacion"), |
100 |
null, getPvisualizacion(), null); |
101 |
} |
102 |
|
103 |
return jTabbedPane;
|
104 |
} |
105 |
|
106 |
/**
|
107 |
* This method initializes phiperenlace
|
108 |
*
|
109 |
* @return javax.swing.JPanel
|
110 |
*/
|
111 |
private javax.swing.JPanel getPhiperenlace() {
|
112 |
if (phiperenlace == null) { |
113 |
phiperenlace = new javax.swing.JPanel();
|
114 |
phiperenlace.setLayout(new java.awt.BorderLayout());
|
115 |
phiperenlace.setPreferredSize(new java.awt.Dimension(300,150)); |
116 |
phiperenlace.add(getPhnorte(), java.awt.BorderLayout.NORTH); |
117 |
phiperenlace.add(getPhsur(), java.awt.BorderLayout.CENTER); |
118 |
} |
119 |
|
120 |
return phiperenlace;
|
121 |
} |
122 |
|
123 |
/**
|
124 |
* This method initializes phnorte
|
125 |
*
|
126 |
* @return javax.swing.JPanel
|
127 |
*/
|
128 |
private javax.swing.JPanel getPhnorte() {
|
129 |
if (phnorte == null) { |
130 |
jLabel4 = new JLabel(); |
131 |
phnorte = new javax.swing.JPanel();
|
132 |
jLabel4.setText(PluginServices.getText(this,"extension")); |
133 |
phnorte.add(getJLabel(), null);
|
134 |
phnorte.add(getJComboBox(), null);
|
135 |
phnorte.add(jLabel4, null);
|
136 |
phnorte.add(getJTextField2(), null);
|
137 |
} |
138 |
|
139 |
return phnorte;
|
140 |
} |
141 |
|
142 |
/**
|
143 |
* This method initializes phsur
|
144 |
*
|
145 |
* @return javax.swing.JPanel
|
146 |
*/
|
147 |
private javax.swing.JPanel getPhsur() {
|
148 |
if (phsur == null) { |
149 |
phsur = new javax.swing.JPanel();
|
150 |
phsur.add(getJLabel1(), null);
|
151 |
phsur.add(getJComboBox1(), null);
|
152 |
} |
153 |
|
154 |
return phsur;
|
155 |
} |
156 |
|
157 |
/**
|
158 |
* This method initializes jLabel
|
159 |
*
|
160 |
* @return javax.swing.JLabel
|
161 |
*/
|
162 |
private javax.swing.JLabel getJLabel() {
|
163 |
if (jLabel == null) { |
164 |
jLabel = new javax.swing.JLabel();
|
165 |
jLabel.setText(PluginServices.getText(this, "Campo") + " "); |
166 |
} |
167 |
|
168 |
return jLabel;
|
169 |
} |
170 |
|
171 |
/**
|
172 |
* This method initializes jComboBox
|
173 |
*
|
174 |
* @return javax.swing.JComboBox
|
175 |
*/
|
176 |
private javax.swing.JComboBox getJComboBox() {
|
177 |
if (jComboBox == null) { |
178 |
try {
|
179 |
if (m_layer instanceof AlphanumericData) { |
180 |
AlphanumericData layer = (AlphanumericData) m_layer; |
181 |
DataSource ds;
|
182 |
ds = layer.getRecordset(); |
183 |
|
184 |
String[] names = new String[ds.getFieldCount()]; |
185 |
|
186 |
for (int i = 0; i < ds.getFieldCount(); i++) { |
187 |
names[i] = ds.getFieldName(i); |
188 |
} |
189 |
|
190 |
jComboBox = new javax.swing.JComboBox(names);
|
191 |
|
192 |
if (view.getSelectedField() != null) { |
193 |
jComboBox.setSelectedItem(view.getSelectedField()); |
194 |
} |
195 |
} |
196 |
} catch (DriverException e) {
|
197 |
NotificationManager.addError("No se pudo obtener la tabla", e);
|
198 |
} catch (com.iver.cit.gvsig.fmap.DriverException e) {
|
199 |
NotificationManager.addError("Error accediendo a los datos", e);
|
200 |
} |
201 |
} |
202 |
|
203 |
return jComboBox;
|
204 |
} |
205 |
|
206 |
/**
|
207 |
* This method initializes jLabel1
|
208 |
*
|
209 |
* @return javax.swing.JLabel
|
210 |
*/
|
211 |
private javax.swing.JLabel getJLabel1() {
|
212 |
if (jLabel1 == null) { |
213 |
jLabel1 = new javax.swing.JLabel();
|
214 |
jLabel1.setText(PluginServices.getText(this, "Accion_Predefinida") + |
215 |
" ");
|
216 |
} |
217 |
|
218 |
return jLabel1;
|
219 |
} |
220 |
|
221 |
/**
|
222 |
* This method initializes jComboBox1
|
223 |
*
|
224 |
* @return javax.swing.JComboBox
|
225 |
*/
|
226 |
private javax.swing.JComboBox getJComboBox1() {
|
227 |
if (jComboBox1 == null) { |
228 |
jComboBox1 = new javax.swing.JComboBox();
|
229 |
jComboBox1.addItem(PluginServices.getText(this,
|
230 |
"Enlazar_a_ficheros_de_imagen"));
|
231 |
jComboBox1.addItem(PluginServices.getText(this,
|
232 |
"Enlazar_a_fichero_de_texto"));
|
233 |
if (view.getSelectedField() != null) { |
234 |
jComboBox1.setSelectedIndex(view.getTypeFile()); |
235 |
} |
236 |
} |
237 |
|
238 |
return jComboBox1;
|
239 |
} |
240 |
|
241 |
/**
|
242 |
* This method initializes pbotones
|
243 |
*
|
244 |
* @return javax.swing.JPanel
|
245 |
*/
|
246 |
private javax.swing.JPanel getPbotones() {
|
247 |
if (pbotones == null) { |
248 |
pbotones = new javax.swing.JPanel();
|
249 |
pbotones.add(getBaceptar(), null);
|
250 |
pbotones.add(getBcancelar(), null);
|
251 |
} |
252 |
|
253 |
return pbotones;
|
254 |
} |
255 |
|
256 |
/**
|
257 |
* This method initializes baceptar
|
258 |
*
|
259 |
* @return javax.swing.JButton
|
260 |
*/
|
261 |
private javax.swing.JButton getBaceptar() {
|
262 |
if (baceptar == null) { |
263 |
baceptar = new javax.swing.JButton();
|
264 |
baceptar.setText(PluginServices.getText(this, "Aceptar")); |
265 |
baceptar.addActionListener(new java.awt.event.ActionListener() {
|
266 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
267 |
view.setTypeFile(jComboBox1.getSelectedIndex()); |
268 |
view.setSelectedField((jComboBox.getSelectedItem()).toString() |
269 |
.trim()); |
270 |
view.setExtension(getJTextField2().getText()); |
271 |
PluginServices.getMDIManager().closeView(FThemePropertiesDialog.this); |
272 |
} |
273 |
}); |
274 |
} |
275 |
|
276 |
return baceptar;
|
277 |
} |
278 |
|
279 |
/**
|
280 |
* This method initializes bcancelar
|
281 |
*
|
282 |
* @return javax.swing.JButton
|
283 |
*/
|
284 |
private javax.swing.JButton getBcancelar() {
|
285 |
if (bcancelar == null) { |
286 |
bcancelar = new javax.swing.JButton();
|
287 |
bcancelar.setText(PluginServices.getText(this, "Cancelar")); |
288 |
bcancelar.addActionListener(new java.awt.event.ActionListener() {
|
289 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
290 |
// View view =(View)App.instance.getMDIContext().getActiveView();
|
291 |
//view.getMapControl().setTool(MapControl.);
|
292 |
PluginServices.getMDIManager().closeView(FThemePropertiesDialog.this); |
293 |
} |
294 |
}); |
295 |
} |
296 |
|
297 |
return bcancelar;
|
298 |
} |
299 |
|
300 |
/**
|
301 |
* This method initializes pvisualizacion
|
302 |
*
|
303 |
* @return javax.swing.JPanel
|
304 |
*/
|
305 |
private javax.swing.JPanel getPvisualizacion() {
|
306 |
if (pvisualizacion == null) { |
307 |
pvisualizacion = new javax.swing.JPanel();
|
308 |
pvisualizacion.setLayout(new java.awt.BorderLayout());
|
309 |
pvisualizacion.setPreferredSize(new java.awt.Dimension(300,60)); |
310 |
pvisualizacion.add(getPvnorte(), java.awt.BorderLayout.NORTH); |
311 |
pvisualizacion.add(getPvsur(), java.awt.BorderLayout.SOUTH); |
312 |
} |
313 |
|
314 |
return pvisualizacion;
|
315 |
} |
316 |
|
317 |
/**
|
318 |
* This method initializes pvnorte
|
319 |
*
|
320 |
* @return javax.swing.JPanel
|
321 |
*/
|
322 |
private javax.swing.JPanel getPvnorte() {
|
323 |
if (pvnorte == null) { |
324 |
pvnorte = new javax.swing.JPanel();
|
325 |
pvnorte.add(getJLabel2(), null);
|
326 |
pvnorte.add(getJTextField(), null);
|
327 |
} |
328 |
|
329 |
return pvnorte;
|
330 |
} |
331 |
|
332 |
/**
|
333 |
* This method initializes pvsur
|
334 |
*
|
335 |
* @return javax.swing.JPanel
|
336 |
*/
|
337 |
private javax.swing.JPanel getPvsur() {
|
338 |
if (pvsur == null) { |
339 |
pvsur = new javax.swing.JPanel();
|
340 |
pvsur.add(getJLabel3(), null);
|
341 |
pvsur.add(getJTextField1(), null);
|
342 |
} |
343 |
|
344 |
return pvsur;
|
345 |
} |
346 |
|
347 |
/**
|
348 |
* This method initializes jLabel2
|
349 |
*
|
350 |
* @return javax.swing.JLabel
|
351 |
*/
|
352 |
private javax.swing.JLabel getJLabel2() {
|
353 |
if (jLabel2 == null) { |
354 |
jLabel2 = new javax.swing.JLabel();
|
355 |
jLabel2.setText(PluginServices.getText(this, "Escala_Minima") + |
356 |
" ");
|
357 |
} |
358 |
|
359 |
return jLabel2;
|
360 |
} |
361 |
|
362 |
/**
|
363 |
* This method initializes jLabel3
|
364 |
*
|
365 |
* @return javax.swing.JLabel
|
366 |
*/
|
367 |
private javax.swing.JLabel getJLabel3() {
|
368 |
if (jLabel3 == null) { |
369 |
jLabel3 = new javax.swing.JLabel();
|
370 |
jLabel3.setText(PluginServices.getText(this, "Escala_Maxima") + |
371 |
" ");
|
372 |
} |
373 |
|
374 |
return jLabel3;
|
375 |
} |
376 |
|
377 |
/**
|
378 |
* This method initializes jTextField
|
379 |
*
|
380 |
* @return javax.swing.JTextField
|
381 |
*/
|
382 |
private javax.swing.JTextField getJTextField() {
|
383 |
if (jTextField == null) { |
384 |
jTextField = new javax.swing.JTextField();
|
385 |
jTextField.setPreferredSize(new java.awt.Dimension(150, 20)); |
386 |
} |
387 |
|
388 |
return jTextField;
|
389 |
} |
390 |
|
391 |
/**
|
392 |
* This method initializes jTextField1
|
393 |
*
|
394 |
* @return javax.swing.JTextField
|
395 |
*/
|
396 |
private javax.swing.JTextField getJTextField1() {
|
397 |
if (jTextField1 == null) { |
398 |
jTextField1 = new javax.swing.JTextField();
|
399 |
jTextField1.setPreferredSize(new java.awt.Dimension(150, 20)); |
400 |
} |
401 |
|
402 |
return jTextField1;
|
403 |
} |
404 |
|
405 |
/* (non-Javadoc)
|
406 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
407 |
*/
|
408 |
public ViewInfo getViewInfo() {
|
409 |
ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
|
410 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_tema")); |
411 |
|
412 |
return m_viewinfo;
|
413 |
} |
414 |
|
415 |
/**
|
416 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
417 |
*/
|
418 |
public void viewActivated() { |
419 |
} |
420 |
/**
|
421 |
* This method initializes jTextField2
|
422 |
*
|
423 |
* @return javax.swing.JTextField
|
424 |
*/
|
425 |
private JTextField getJTextField2() { |
426 |
if (jTextField2 == null) { |
427 |
jTextField2 = new JTextField(); |
428 |
jTextField2.setPreferredSize(new java.awt.Dimension(40,20)); |
429 |
if (view.getSelectedField() != null) { |
430 |
jTextField2.setText(view.getExtLink()); |
431 |
} |
432 |
} |
433 |
return jTextField2;
|
434 |
} |
435 |
} // @jve:visual-info decl-index=0 visual-constraint="10,10"
|