svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / FThemePropertiesDialog.java @ 596
History | View | Annotate | Download (9.96 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 com.hardcode.driverManager.DriverLoadException; |
10 |
|
11 |
import com.hardcode.gdbms.engine.data.DataSource; |
12 |
import com.hardcode.gdbms.engine.data.DriverException; |
13 |
|
14 |
import com.iver.andami.PluginServices; |
15 |
import com.iver.andami.Utilities; |
16 |
import com.iver.andami.messages.NotificationManager; |
17 |
import com.iver.andami.ui.mdiManager.View; |
18 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
19 |
|
20 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
21 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
22 |
|
23 |
import javax.swing.JPanel; |
24 |
|
25 |
|
26 |
/**
|
27 |
* Di?logo de propiedades del tema.
|
28 |
*
|
29 |
* @author Vicente Caballero Navarro
|
30 |
*/
|
31 |
public class FThemePropertiesDialog extends JPanel implements View { |
32 |
private javax.swing.JPanel jContentPane = null; |
33 |
private javax.swing.JTabbedPane jTabbedPane = null; |
34 |
private javax.swing.JPanel phiperenlace = null; |
35 |
private javax.swing.JPanel phnorte = null; |
36 |
private javax.swing.JPanel phsur = null; |
37 |
private javax.swing.JLabel jLabel = null; |
38 |
private javax.swing.JComboBox jComboBox = null; |
39 |
private javax.swing.JLabel jLabel1 = null; |
40 |
private javax.swing.JComboBox jComboBox1 = null; |
41 |
private javax.swing.JPanel pbotones = null; |
42 |
private javax.swing.JButton baceptar = null; |
43 |
private javax.swing.JButton bcancelar = null; |
44 |
private javax.swing.JPanel pvisualizacion = null; |
45 |
private FLayer m_layer;
|
46 |
private javax.swing.JPanel pvnorte = null; |
47 |
private javax.swing.JPanel pvsur = null; |
48 |
private javax.swing.JLabel jLabel2 = null; |
49 |
private javax.swing.JLabel jLabel3 = null; |
50 |
private javax.swing.JTextField jTextField = null; |
51 |
private javax.swing.JTextField jTextField1 = null; |
52 |
private com.iver.cit.gvsig.gui.View view;
|
53 |
|
54 |
/**
|
55 |
* This is the default constructor
|
56 |
*
|
57 |
* @param layer DOCUMENT ME!
|
58 |
* @param view DOCUMENT ME!
|
59 |
*/
|
60 |
public FThemePropertiesDialog(FLayer layer, com.iver.cit.gvsig.gui.View view) {
|
61 |
super();
|
62 |
this.view = view;
|
63 |
|
64 |
//this.setTitle("Propiedades del Tema");
|
65 |
//this.setModal(true);
|
66 |
m_layer = layer; |
67 |
initialize(); |
68 |
} |
69 |
|
70 |
/**
|
71 |
* This method initializes this
|
72 |
*/
|
73 |
private void initialize() { |
74 |
this.setSize(290, 130); |
75 |
this.add(getJContentPane());
|
76 |
} |
77 |
|
78 |
/**
|
79 |
* This method initializes jContentPane
|
80 |
*
|
81 |
* @return javax.swing.JPanel
|
82 |
*/
|
83 |
private javax.swing.JPanel getJContentPane() {
|
84 |
if (jContentPane == null) { |
85 |
jContentPane = new javax.swing.JPanel();
|
86 |
jContentPane.setLayout(new java.awt.BorderLayout());
|
87 |
jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER); |
88 |
jContentPane.add(getPbotones(), java.awt.BorderLayout.SOUTH); |
89 |
} |
90 |
|
91 |
return jContentPane;
|
92 |
} |
93 |
|
94 |
/**
|
95 |
* This method initializes jTabbedPane
|
96 |
*
|
97 |
* @return javax.swing.JTabbedPane
|
98 |
*/
|
99 |
private javax.swing.JTabbedPane getJTabbedPane() {
|
100 |
if (jTabbedPane == null) { |
101 |
jTabbedPane = new javax.swing.JTabbedPane();
|
102 |
jTabbedPane.addTab(PluginServices.getText(this, "Hiperenlace"), |
103 |
null, getPhiperenlace(), null); |
104 |
jTabbedPane.addTab(PluginServices.getText(this, "Visualizacion"), |
105 |
null, getPvisualizacion(), null); |
106 |
} |
107 |
|
108 |
return jTabbedPane;
|
109 |
} |
110 |
|
111 |
/**
|
112 |
* This method initializes phiperenlace
|
113 |
*
|
114 |
* @return javax.swing.JPanel
|
115 |
*/
|
116 |
private javax.swing.JPanel getPhiperenlace() {
|
117 |
if (phiperenlace == null) { |
118 |
phiperenlace = new javax.swing.JPanel();
|
119 |
phiperenlace.setLayout(new java.awt.BorderLayout());
|
120 |
phiperenlace.add(getPhnorte(), java.awt.BorderLayout.NORTH); |
121 |
phiperenlace.add(getPhsur(), java.awt.BorderLayout.SOUTH); |
122 |
} |
123 |
|
124 |
return phiperenlace;
|
125 |
} |
126 |
|
127 |
/**
|
128 |
* This method initializes phnorte
|
129 |
*
|
130 |
* @return javax.swing.JPanel
|
131 |
*/
|
132 |
private javax.swing.JPanel getPhnorte() {
|
133 |
if (phnorte == null) { |
134 |
phnorte = new javax.swing.JPanel();
|
135 |
phnorte.add(getJLabel(), null);
|
136 |
phnorte.add(getJComboBox(), 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 (DriverLoadException e) {
|
197 |
NotificationManager.addError("No se pudo obtener la tabla", e);
|
198 |
} catch (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 |
String[] options = new String[1]; |
229 |
options[0] = PluginServices.getText(this, |
230 |
"Enlazar_a_ficheros_de_imagen");
|
231 |
jComboBox1 = new javax.swing.JComboBox(options);
|
232 |
} |
233 |
|
234 |
return jComboBox1;
|
235 |
} |
236 |
|
237 |
/**
|
238 |
* This method initializes pbotones
|
239 |
*
|
240 |
* @return javax.swing.JPanel
|
241 |
*/
|
242 |
private javax.swing.JPanel getPbotones() {
|
243 |
if (pbotones == null) { |
244 |
pbotones = new javax.swing.JPanel();
|
245 |
pbotones.add(getBaceptar(), null);
|
246 |
pbotones.add(getBcancelar(), null);
|
247 |
} |
248 |
|
249 |
return pbotones;
|
250 |
} |
251 |
|
252 |
/**
|
253 |
* This method initializes baceptar
|
254 |
*
|
255 |
* @return javax.swing.JButton
|
256 |
*/
|
257 |
private javax.swing.JButton getBaceptar() {
|
258 |
if (baceptar == null) { |
259 |
baceptar = new javax.swing.JButton();
|
260 |
baceptar.setText(PluginServices.getText(this, "Aceptar")); |
261 |
baceptar.addActionListener(new java.awt.event.ActionListener() {
|
262 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
263 |
view.setSelectedField((jComboBox.getSelectedItem()).toString() |
264 |
.trim()); |
265 |
PluginServices.getMDIManager().closeView(FThemePropertiesDialog.this); |
266 |
} |
267 |
}); |
268 |
} |
269 |
|
270 |
return baceptar;
|
271 |
} |
272 |
|
273 |
/**
|
274 |
* This method initializes bcancelar
|
275 |
*
|
276 |
* @return javax.swing.JButton
|
277 |
*/
|
278 |
private javax.swing.JButton getBcancelar() {
|
279 |
if (bcancelar == null) { |
280 |
bcancelar = new javax.swing.JButton();
|
281 |
bcancelar.setText(PluginServices.getText(this, "Cancelar")); |
282 |
bcancelar.addActionListener(new java.awt.event.ActionListener() {
|
283 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
284 |
// View view =(View)App.instance.getMDIContext().getActiveView();
|
285 |
//view.getMapControl().setTool(MapControl.);
|
286 |
PluginServices.getMDIManager().closeView(FThemePropertiesDialog.this); |
287 |
} |
288 |
}); |
289 |
} |
290 |
|
291 |
return bcancelar;
|
292 |
} |
293 |
|
294 |
/**
|
295 |
* This method initializes pvisualizacion
|
296 |
*
|
297 |
* @return javax.swing.JPanel
|
298 |
*/
|
299 |
private javax.swing.JPanel getPvisualizacion() {
|
300 |
if (pvisualizacion == null) { |
301 |
pvisualizacion = new javax.swing.JPanel();
|
302 |
pvisualizacion.setLayout(new java.awt.BorderLayout());
|
303 |
pvisualizacion.add(getPvnorte(), java.awt.BorderLayout.NORTH); |
304 |
pvisualizacion.add(getPvsur(), java.awt.BorderLayout.SOUTH); |
305 |
} |
306 |
|
307 |
return pvisualizacion;
|
308 |
} |
309 |
|
310 |
/**
|
311 |
* This method initializes pvnorte
|
312 |
*
|
313 |
* @return javax.swing.JPanel
|
314 |
*/
|
315 |
private javax.swing.JPanel getPvnorte() {
|
316 |
if (pvnorte == null) { |
317 |
pvnorte = new javax.swing.JPanel();
|
318 |
pvnorte.add(getJLabel2(), null);
|
319 |
pvnorte.add(getJTextField(), null);
|
320 |
} |
321 |
|
322 |
return pvnorte;
|
323 |
} |
324 |
|
325 |
/**
|
326 |
* This method initializes pvsur
|
327 |
*
|
328 |
* @return javax.swing.JPanel
|
329 |
*/
|
330 |
private javax.swing.JPanel getPvsur() {
|
331 |
if (pvsur == null) { |
332 |
pvsur = new javax.swing.JPanel();
|
333 |
pvsur.add(getJLabel3(), null);
|
334 |
pvsur.add(getJTextField1(), null);
|
335 |
} |
336 |
|
337 |
return pvsur;
|
338 |
} |
339 |
|
340 |
/**
|
341 |
* This method initializes jLabel2
|
342 |
*
|
343 |
* @return javax.swing.JLabel
|
344 |
*/
|
345 |
private javax.swing.JLabel getJLabel2() {
|
346 |
if (jLabel2 == null) { |
347 |
jLabel2 = new javax.swing.JLabel();
|
348 |
jLabel2.setText(PluginServices.getText(this, "Escala_Minima") + |
349 |
" ");
|
350 |
} |
351 |
|
352 |
return jLabel2;
|
353 |
} |
354 |
|
355 |
/**
|
356 |
* This method initializes jLabel3
|
357 |
*
|
358 |
* @return javax.swing.JLabel
|
359 |
*/
|
360 |
private javax.swing.JLabel getJLabel3() {
|
361 |
if (jLabel3 == null) { |
362 |
jLabel3 = new javax.swing.JLabel();
|
363 |
jLabel3.setText(PluginServices.getText(this, "Escala_Maxima") + |
364 |
" ");
|
365 |
} |
366 |
|
367 |
return jLabel3;
|
368 |
} |
369 |
|
370 |
/**
|
371 |
* This method initializes jTextField
|
372 |
*
|
373 |
* @return javax.swing.JTextField
|
374 |
*/
|
375 |
private javax.swing.JTextField getJTextField() {
|
376 |
if (jTextField == null) { |
377 |
jTextField = new javax.swing.JTextField();
|
378 |
jTextField.setPreferredSize(new java.awt.Dimension(150, 20)); |
379 |
} |
380 |
|
381 |
return jTextField;
|
382 |
} |
383 |
|
384 |
/**
|
385 |
* This method initializes jTextField1
|
386 |
*
|
387 |
* @return javax.swing.JTextField
|
388 |
*/
|
389 |
private javax.swing.JTextField getJTextField1() {
|
390 |
if (jTextField1 == null) { |
391 |
jTextField1 = new javax.swing.JTextField();
|
392 |
jTextField1.setPreferredSize(new java.awt.Dimension(150, 20)); |
393 |
} |
394 |
|
395 |
return jTextField1;
|
396 |
} |
397 |
|
398 |
/* (non-Javadoc)
|
399 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
400 |
*/
|
401 |
public ViewInfo getViewInfo() {
|
402 |
ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
|
403 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_tema")); |
404 |
|
405 |
return m_viewinfo;
|
406 |
} |
407 |
|
408 |
/**
|
409 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
410 |
*/
|
411 |
public void viewActivated() { |
412 |
} |
413 |
} // @jve:visual-info decl-index=0 visual-constraint="10,10"
|