root / branches / gvSIG_03_SLD / applications / appgvSIG / src / com / iver / cit / gvsig / gui / thememanager / scalemanager / FPanelScaleManager.java @ 2077
History | View | Annotate | Download (18.9 KB)
1 | 1671 | jmorell | /*
|
---|---|---|---|
2 | * Created on 31-ene-2005
|
||
3 | *
|
||
4 | * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
5 | *
|
||
6 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
7 | *
|
||
8 | * This program is free software; you can redistribute it and/or
|
||
9 | * modify it under the terms of the GNU General Public License
|
||
10 | * as published by the Free Software Foundation; either version 2
|
||
11 | * of the License, or (at your option) any later version.
|
||
12 | *
|
||
13 | * This program is distributed in the hope that it will be useful,
|
||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
16 | * GNU General Public License for more details.
|
||
17 | *
|
||
18 | * You should have received a copy of the GNU General Public License
|
||
19 | * along with this program; if not, write to the Free Software
|
||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
21 | *
|
||
22 | * For more information, contact:
|
||
23 | *
|
||
24 | * Generalitat Valenciana
|
||
25 | * Conselleria d'Infraestructures i Transport
|
||
26 | * Av. Blasco Ib??ez, 50
|
||
27 | * 46010 VALENCIA
|
||
28 | * SPAIN
|
||
29 | *
|
||
30 | * +34 963862235
|
||
31 | * gvsig@gva.es
|
||
32 | * www.gvsig.gva.es
|
||
33 | *
|
||
34 | * or
|
||
35 | *
|
||
36 | * IVER T.I. S.A
|
||
37 | * Salamanca 50
|
||
38 | * 46005 Valencia
|
||
39 | * Spain
|
||
40 | *
|
||
41 | * +34 963163400
|
||
42 | * dac@iver.es
|
||
43 | */
|
||
44 | package com.iver.cit.gvsig.gui.thememanager.scalemanager; |
||
45 | |||
46 | 2077 | vcaballero | import java.text.NumberFormat; |
47 | 1671 | jmorell | |
48 | import javax.swing.ButtonGroup; |
||
49 | import javax.swing.DefaultComboBoxModel; |
||
50 | 2077 | vcaballero | import javax.swing.JComboBox; |
51 | 1671 | jmorell | import javax.swing.JLabel; |
52 | import javax.swing.JOptionPane; |
||
53 | 2077 | vcaballero | import javax.swing.JPanel; |
54 | import javax.swing.JRadioButton; |
||
55 | import javax.swing.JScrollPane; |
||
56 | 1671 | jmorell | import javax.swing.JTextArea; |
57 | 2077 | vcaballero | import javax.swing.JTextField; |
58 | 1671 | jmorell | |
59 | import org.apache.log4j.Logger; |
||
60 | |||
61 | import com.hardcode.gdbms.engine.data.DataSource; |
||
62 | import com.iver.andami.PluginServices; |
||
63 | import com.iver.andami.messages.Messages; |
||
64 | import com.iver.andami.messages.NotificationManager; |
||
65 | import com.iver.cit.gvsig.fmap.DriverException; |
||
66 | import com.iver.cit.gvsig.fmap.FMap; |
||
67 | import com.iver.cit.gvsig.fmap.layers.FLayer; |
||
68 | import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
||
69 | import com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable; |
||
70 | import com.iver.cit.gvsig.fmap.rendering.Legend; |
||
71 | import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
||
72 | import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
||
73 | 2077 | vcaballero | import com.iver.cit.gvsig.gui.thememanager.legendmanager.panels.FPanelLegendValues; |
74 | 1671 | jmorell | import com.iver.cit.gvsig.project.ProjectView; |
75 | /**
|
||
76 | * @author jmorell
|
||
77 | *
|
||
78 | * TODO To change the template for this generated type comment go to
|
||
79 | * Window - Preferences - Java - Code Style - Code Templates
|
||
80 | */
|
||
81 | public class FPanelScaleManager extends JPanel { |
||
82 | |||
83 | private static Logger logger = Logger.getLogger(FPanelLegendValues.class.getName()); |
||
84 | private FMap mapContext;
|
||
85 | private FLayer layer;
|
||
86 | //private ComandosListener actionListener = new ComandosListener(this);
|
||
87 | private ProjectView view;
|
||
88 | private NumberFormat nf = NumberFormat.getInstance(); |
||
89 | |||
90 | private JPanel jPanel = null; |
||
91 | private JPanel jPanel1 = null; |
||
92 | private JPanel jPanel2 = null; |
||
93 | private JPanel jPanel3 = null; |
||
94 | private JPanel jPanel4 = null; |
||
95 | private JPanel jPanel5 = null; |
||
96 | private JLabel jLabel = null; |
||
97 | private JTextField jTextField = null; |
||
98 | private JLabel jLabel1 = null; |
||
99 | private JTextField jTextField1 = null; |
||
100 | private JLabel jLabel2 = null; |
||
101 | private JTextArea jTextArea = null; |
||
102 | private JLabel jLabel5 = null; |
||
103 | private JComboBox jComboBox = null; |
||
104 | private JScrollPane jScrollPane = null; |
||
105 | private ButtonGroup buttonGroup = null; |
||
106 | private JRadioButton jRadioButton = null; |
||
107 | private JRadioButton jRadioButton1 = null; |
||
108 | private JLabel jLabel3 = null; |
||
109 | private JTextField jTextField2 = null; |
||
110 | private JLabel jLabel4 = null; |
||
111 | private String layerName = null; |
||
112 | /**
|
||
113 | * This is the default constructor
|
||
114 | */
|
||
115 | public FPanelScaleManager() {
|
||
116 | super();
|
||
117 | initialize(); |
||
118 | } |
||
119 | /**
|
||
120 | * This method initializes this
|
||
121 | *
|
||
122 | * @return void
|
||
123 | */
|
||
124 | private void initialize() { |
||
125 | //setView();
|
||
126 | this.setLayout(null); |
||
127 | //this.setLayer(null);
|
||
128 | this.setBounds(0, 0, 445, 332); |
||
129 | this.add(getJPanel(), null); |
||
130 | this.add(getJPanel1(), null); |
||
131 | this.add(getJPanel2(), null); |
||
132 | this.add(getJPanel3(), null); |
||
133 | } |
||
134 | |||
135 | private FLayer getFirstActiveLayerVect()
|
||
136 | { |
||
137 | // Comprobar en openLegendManager que hay alg?n tema activo!
|
||
138 | FLayer[] activeLyrs = mapContext.getLayers().getActives();
|
||
139 | if (activeLyrs.length == 0) |
||
140 | { |
||
141 | JOptionPane.showMessageDialog(null, |
||
142 | Messages.getString("necesita_un_tema_activo"), "", JOptionPane.ERROR_MESSAGE); |
||
143 | return null; |
||
144 | } |
||
145 | FLayer lyr = null;
|
||
146 | for (int i=0; i < activeLyrs.length; i++) |
||
147 | { |
||
148 | if (activeLyrs[i] instanceof Classifiable) |
||
149 | { |
||
150 | Classifiable auxC = (Classifiable) activeLyrs[i]; |
||
151 | Legend theLegend = auxC.getLegend(); |
||
152 | if (theLegend instanceof VectorialLegend) |
||
153 | lyr = (FLayer) auxC; |
||
154 | } |
||
155 | } |
||
156 | |||
157 | if (lyr == null) { |
||
158 | System.out.println(PluginServices.getText(this,"Por_favor_active_el_tema")+"."); |
||
159 | JOptionPane.showMessageDialog(null, |
||
160 | Messages.getString("necesita_un_tema_vectorial_activo"), "", JOptionPane.ERROR_MESSAGE); |
||
161 | |||
162 | return null; |
||
163 | } |
||
164 | return lyr;
|
||
165 | } |
||
166 | |||
167 | /**
|
||
168 | * Inicializa el ProjectView view. Es necesario para implementar el control de
|
||
169 | * escalas y para hiperenlazar documentos.
|
||
170 | * @return
|
||
171 | */
|
||
172 | /*private void setView() {
|
||
173 | View vista = (View) PluginServices.getMDIManager().getActiveView();
|
||
174 | view = vista.getModel();
|
||
175 | }*/
|
||
176 | |||
177 | /**
|
||
178 | * En esta funci?n se coge el primer tema activo del TOC y se usa su
|
||
179 | * renderer para inicializar. Hay que llamarla SIEMPRE que se abra el
|
||
180 | * cuadro de di?logo, en el openLegendManager() de la vista.
|
||
181 | *
|
||
182 | * @param mapContext TOC que abre este cuadro de di?logo.
|
||
183 | * @throws DriverException
|
||
184 | */
|
||
185 | public void setMapContext(FMap mapContext) throws DriverException { |
||
186 | this.mapContext = mapContext;
|
||
187 | layer = getFirstActiveLayerVect(); |
||
188 | layerName = layer.getName(); |
||
189 | /*try {
|
||
190 | ClassifiableVectorial aux = (ClassifiableVectorial) layer;
|
||
191 | renderer = (Legend) aux.getLegend().cloneLegend();
|
||
192 | } catch (XMLException e) {
|
||
193 | // TODO Auto-generated catch block
|
||
194 | e.printStackTrace();
|
||
195 | }*/
|
||
196 | actualizar(); |
||
197 | } |
||
198 | |||
199 | /**
|
||
200 | * DOCUMENT ME!
|
||
201 | */
|
||
202 | private void actualizar() { |
||
203 | // Avisar si no es Vectorial
|
||
204 | FLayer lyrSelected = getFirstActiveLayerVect(); |
||
205 | |||
206 | /*m_defaultLegendPanel.setLayer(lyrSelected, renderer);
|
||
207 | m_valuesLegendPanel.setLayer(lyrSelected, renderer);
|
||
208 | m_breaksLegendPanel.setLayer(lyrSelected, renderer);
|
||
209 | m_labelsLegendPanel.setLayer(lyrSelected, renderer);*/
|
||
210 | |||
211 | /*CardLayout cl = (CardLayout)(cards.getLayout());
|
||
212 | if (renderer instanceof SingleSymbolLegend) {
|
||
213 | //organizador.setSelectedIndex(0);
|
||
214 | cl.show(cards, "symbol");
|
||
215 | }
|
||
216 | if (renderer instanceof UniqueValueLegend) {
|
||
217 | //organizador.setSelectedIndex(1);
|
||
218 | cl.show(cards, "values");
|
||
219 | }
|
||
220 | if (renderer instanceof IntervalLegend) {
|
||
221 | //organizador.setSelectedIndex(2);
|
||
222 | cl.show(cards, "intervals");
|
||
223 | }*/
|
||
224 | |||
225 | /* switch (m_Renderer.getLegendType()) {
|
||
226 | case FConstant.LEGEND_TYPE_DEFAULT:
|
||
227 | organizador.setSelectedIndex(0);
|
||
228 | |||
229 | break;
|
||
230 | |||
231 | case FConstant.LEGEND_TYPE_VALUE:
|
||
232 | organizador.setSelectedIndex(1);
|
||
233 | |||
234 | break;
|
||
235 | |||
236 | case FConstant.LEGEND_TYPE_BREAK:
|
||
237 | organizador.setSelectedIndex(2);
|
||
238 | |||
239 | break;
|
||
240 | } */
|
||
241 | } |
||
242 | |||
243 | private void fillFieldNames() { |
||
244 | DataSource rs;
|
||
245 | try {
|
||
246 | rs = ((AlphanumericData)layer).getRecordset(); |
||
247 | logger.debug("rs.start()");
|
||
248 | rs.start(); |
||
249 | String[] nomFields = new String[rs.getFieldCount()]; |
||
250 | for (int i = 0; i < rs.getFieldCount(); i++) { |
||
251 | nomFields[i] = rs.getFieldName(i).trim(); |
||
252 | } |
||
253 | rs.stop(); |
||
254 | DefaultComboBoxModel cM = new DefaultComboBoxModel(nomFields); |
||
255 | getJComboBox().setModel(cM); |
||
256 | // fieldsListValor.setSelectedIndex(0);
|
||
257 | 1830 | fernando | } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
|
258 | 1671 | jmorell | // TODO Auto-generated catch block
|
259 | e.printStackTrace(); |
||
260 | 1830 | fernando | } catch (DriverException e) {
|
261 | 1671 | jmorell | e.printStackTrace(); |
262 | } |
||
263 | } |
||
264 | |||
265 | public void setLayer(FLayer lyr, Legend r) { |
||
266 | if (layer.getMinScale() != -1) |
||
267 | getJTextField1().setText(nf.format(layer.getMinScale())); |
||
268 | if (layer.getMaxScale() != -1) |
||
269 | getJTextField2().setText(nf.format(layer.getMaxScale())); |
||
270 | if (layer.getMinScale() == -1 && layer.getMaxScale() == -1) { |
||
271 | getJRadioButton().setSelected(true);
|
||
272 | jLabel1.setEnabled(false);
|
||
273 | jTextField1.setEnabled(false);
|
||
274 | jLabel2.setEnabled(false);
|
||
275 | jLabel3.setEnabled(false);
|
||
276 | jTextField2.setEnabled(false);
|
||
277 | jLabel4.setEnabled(false);
|
||
278 | } else {
|
||
279 | getJRadioButton1().setSelected(true);
|
||
280 | jLabel1.setEnabled(true);
|
||
281 | jTextField1.setEnabled(true);
|
||
282 | jLabel2.setEnabled(true);
|
||
283 | jLabel3.setEnabled(true);
|
||
284 | jTextField2.setEnabled(true);
|
||
285 | jLabel4.setEnabled(true);
|
||
286 | } |
||
287 | fillFieldNames(); |
||
288 | //getJComboBox().getModel().setSelectedItem(renderer.getFieldName());
|
||
289 | layer = lyr; |
||
290 | jTextField.setText(layer.getName()); |
||
291 | try {
|
||
292 | getJTextArea().setText("Extent\n\tSuperior:\t" + layer.getFullExtent().getMaxY() + "\n\tInferior:\t" + layer.getFullExtent().getMinY() + "\n\tIzquierda:\t" + layer.getFullExtent().getMinX() + "\n\tDerecha:\t" + layer.getFullExtent().getMaxX() + "\n\nOrigen de datos: " + layer.getName()); |
||
293 | } catch (DriverException e) {
|
||
294 | // TODO Auto-generated catch block
|
||
295 | e.printStackTrace(); |
||
296 | } |
||
297 | |||
298 | // Si es de valor ?nico, rellenamos la tabla
|
||
299 | // y seleccionamos el campo que estamos usando
|
||
300 | //m_symbolTable.removeAllItems();
|
||
301 | if (r instanceof VectorialUniqueValueLegend) |
||
302 | { |
||
303 | //renderer = (VectorialUniqueValueLegend) r;
|
||
304 | //m_cboFields.getModel().setSelectedItem(m_Renderer.getFieldName());
|
||
305 | //m_symbolTable.fillTableFromSymbolList(m_Renderer.getSymbols(),
|
||
306 | //m_Renderer.getValues(), m_Renderer.getDescriptions());
|
||
307 | } |
||
308 | /*else
|
||
309 | {
|
||
310 | try {
|
||
311 | // Si la capa viene con otro tipo de leyenda, creamos
|
||
312 | // una nueva del tipo que maneja este panel
|
||
313 | renderer = new VectorialUniqueValueLegend(layer.getShapeType());
|
||
314 | } catch (com.iver.cit.gvsig.fmap.DriverException e) {
|
||
315 | // TODO Auto-generated catch block
|
||
316 | e.printStackTrace();
|
||
317 | }
|
||
318 | }*/
|
||
319 | } |
||
320 | |||
321 | /*public void setLayerName(String layerName)
|
||
322 | {
|
||
323 | this.layerName = layerName;
|
||
324 | }*/
|
||
325 | |||
326 | /**
|
||
327 | * This method initializes jPanel
|
||
328 | *
|
||
329 | * @return javax.swing.JPanel
|
||
330 | */
|
||
331 | private JPanel getJPanel() { |
||
332 | if (jPanel == null) { |
||
333 | jLabel = new JLabel(); |
||
334 | jPanel = new JPanel(); |
||
335 | jPanel.setLayout(null);
|
||
336 | jLabel.setText("Nombre:");
|
||
337 | jLabel.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN); |
||
338 | jLabel.setBounds(0, 3, 40, 15); |
||
339 | jPanel.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN); |
||
340 | jPanel.setLocation(5, 6); |
||
341 | jPanel.setSize(305, 20); |
||
342 | jPanel.add(jLabel, null);
|
||
343 | jPanel.add(getJTextField(), null);
|
||
344 | } |
||
345 | return jPanel;
|
||
346 | } |
||
347 | /**
|
||
348 | * This method initializes jPanel1
|
||
349 | *
|
||
350 | * @return javax.swing.JPanel
|
||
351 | */
|
||
352 | private JPanel getJPanel1() { |
||
353 | if (jPanel1 == null) { |
||
354 | jPanel1 = new JPanel(); |
||
355 | jPanel1.setLayout(null);
|
||
356 | jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Rango de escalas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
357 | jPanel1.setBounds(5, 32, 432, 131); |
||
358 | jPanel1.add(getJPanel4(), null);
|
||
359 | jPanel1.add(getJPanel5(), null);
|
||
360 | } |
||
361 | return jPanel1;
|
||
362 | } |
||
363 | /**
|
||
364 | * This method initializes jPanel2
|
||
365 | *
|
||
366 | * @return javax.swing.JPanel
|
||
367 | */
|
||
368 | private JPanel getJPanel2() { |
||
369 | if (jPanel2 == null) { |
||
370 | jPanel2 = new JPanel(); |
||
371 | jPanel2.setLayout(null);
|
||
372 | jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Propiedades", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
373 | jPanel2.setBounds(5, 170, 361, 127); |
||
374 | jPanel2.add(getJScrollPane(), null);
|
||
375 | } |
||
376 | return jPanel2;
|
||
377 | } |
||
378 | /**
|
||
379 | * This method initializes jPanel3
|
||
380 | *
|
||
381 | * @return javax.swing.JPanel
|
||
382 | */
|
||
383 | private JPanel getJPanel3() { |
||
384 | if (jPanel3 == null) { |
||
385 | jLabel5 = new JLabel(); |
||
386 | jPanel3 = new JPanel(); |
||
387 | jPanel3.setLayout(null);
|
||
388 | jLabel5.setText("Campo de documentos asociados:");
|
||
389 | jLabel5.setBounds(0, 2, 166, 15); |
||
390 | jPanel3.setLocation(5, 304); |
||
391 | jPanel3.setSize(387, 20); |
||
392 | jPanel3.add(jLabel5, null);
|
||
393 | jPanel3.add(getJComboBox(), null);
|
||
394 | } |
||
395 | return jPanel3;
|
||
396 | } |
||
397 | /**
|
||
398 | * This method initializes jPanel4
|
||
399 | *
|
||
400 | * @return javax.swing.JPanel
|
||
401 | */
|
||
402 | private JPanel getJPanel4() { |
||
403 | if (jPanel4 == null) { |
||
404 | jPanel4 = new JPanel(); |
||
405 | jPanel4.setLayout(null);
|
||
406 | jPanel4.setBounds(6, 21, 201, 46); |
||
407 | jPanel4.add(getJRadioButton(), null);
|
||
408 | jPanel4.add(getJRadioButton1(), null);
|
||
409 | buttonGroup = new ButtonGroup(); |
||
410 | buttonGroup.add(getJRadioButton()); |
||
411 | buttonGroup.add(getJRadioButton1()); |
||
412 | } |
||
413 | return jPanel4;
|
||
414 | } |
||
415 | /**
|
||
416 | * This method initializes jPanel5
|
||
417 | *
|
||
418 | * @return javax.swing.JPanel
|
||
419 | */
|
||
420 | private JPanel getJPanel5() { |
||
421 | if (jPanel5 == null) { |
||
422 | jLabel4 = new JLabel(); |
||
423 | jLabel3 = new JLabel(); |
||
424 | jLabel2 = new JLabel(); |
||
425 | jLabel1 = new JLabel(); |
||
426 | jPanel5 = new JPanel(); |
||
427 | jPanel5.setLayout(null);
|
||
428 | jLabel1.setText("est? por debajo de ");
|
||
429 | jLabel1.setBounds(6, 6, 93, 20); |
||
430 | jLabel1.setEnabled(false);
|
||
431 | jLabel2.setText("(escala m?nima)");
|
||
432 | jLabel2.setBounds(277, 6, 82, 20); |
||
433 | jLabel2.setEnabled(false);
|
||
434 | jPanel5.setBounds(36, 69, 386, 53); |
||
435 | jLabel3.setBounds(6, 31, 93, 20); |
||
436 | jLabel3.setText("est? por encima de");
|
||
437 | jLabel3.setEnabled(false);
|
||
438 | jLabel4.setBounds(277, 31, 82, 20); |
||
439 | jLabel4.setText("(escala m?xima)");
|
||
440 | jLabel4.setEnabled(false);
|
||
441 | jPanel5.add(jLabel1, null);
|
||
442 | jPanel5.add(getJTextField1(), null);
|
||
443 | jPanel5.add(jLabel2, null);
|
||
444 | jPanel5.add(jLabel3, null);
|
||
445 | jPanel5.add(getJTextField2(), null);
|
||
446 | jPanel5.add(jLabel4, null);
|
||
447 | } |
||
448 | return jPanel5;
|
||
449 | } |
||
450 | /**
|
||
451 | * This method initializes jTextField
|
||
452 | *
|
||
453 | * @return javax.swing.JTextField
|
||
454 | */
|
||
455 | private JTextField getJTextField() { |
||
456 | if (jTextField == null) { |
||
457 | //layerName = "Hooooola";
|
||
458 | //System.out.println("getJTestField(): layer = " + layer);
|
||
459 | //layerName = layer.getName();
|
||
460 | jTextField = new JTextField(); |
||
461 | //jTextField.setText(layerName);
|
||
462 | jTextField.setEditable(false);
|
||
463 | jTextField.setBounds(40, 0, 229, 20); |
||
464 | } |
||
465 | return jTextField;
|
||
466 | } |
||
467 | /**
|
||
468 | * This method initializes jTextField1
|
||
469 | *
|
||
470 | * @return javax.swing.JTextField
|
||
471 | */
|
||
472 | public JTextField getJTextField1() { |
||
473 | if (jTextField1 == null) { |
||
474 | jTextField1 = new JTextField(); |
||
475 | jTextField1.setBounds(100, 6, 176, 20); |
||
476 | jTextField1.setEnabled(false);
|
||
477 | } |
||
478 | return jTextField1;
|
||
479 | } |
||
480 | /**
|
||
481 | * This method initializes jTextArea
|
||
482 | *
|
||
483 | * @return javax.swing.JTextArea
|
||
484 | */
|
||
485 | private JTextArea getJTextArea() { |
||
486 | if (jTextArea == null) { |
||
487 | jTextArea = new JTextArea(); |
||
488 | jTextArea.setEditable(false);
|
||
489 | jTextArea.setBackground(java.awt.SystemColor.control); |
||
490 | //jTextArea.setText("Extent\n\tSuperior\n\tInferior\n\tIzquierda\n\tDerecha\n\nOrigen de datos\n\n... y movidas ...");
|
||
491 | } |
||
492 | return jTextArea;
|
||
493 | } |
||
494 | |||
495 | /**
|
||
496 | * This method initializes jComboBox
|
||
497 | *
|
||
498 | * @return javax.swing.JComboBox
|
||
499 | */
|
||
500 | public javax.swing.JComboBox getJComboBox() {
|
||
501 | if (jComboBox == null) { |
||
502 | try {
|
||
503 | if (layer instanceof AlphanumericData) { |
||
504 | AlphanumericData lyr = (AlphanumericData) layer; |
||
505 | DataSource ds;
|
||
506 | ds = lyr.getRecordset(); |
||
507 | |||
508 | String[] names = new String[ds.getFieldCount()]; |
||
509 | |||
510 | for (int i = 0; i < ds.getFieldCount(); i++) { |
||
511 | names[i] = ds.getFieldName(i); |
||
512 | } |
||
513 | |||
514 | jComboBox = new javax.swing.JComboBox(names);
|
||
515 | |||
516 | if (view.getSelectedField() != null) { |
||
517 | jComboBox.setSelectedItem(view.getSelectedField()); |
||
518 | } |
||
519 | }else{
|
||
520 | jComboBox = new javax.swing.JComboBox();
|
||
521 | } |
||
522 | 1830 | fernando | } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
|
523 | NotificationManager.addError("Error accediendo a los datos", e);
|
||
524 | 1671 | jmorell | } catch (DriverException e) {
|
525 | NotificationManager.addError("Error accediendo a los datos", e);
|
||
526 | } |
||
527 | } |
||
528 | jComboBox.setBounds(166, 0, 192, 20); |
||
529 | jComboBox.addActionListener(new java.awt.event.ActionListener() {
|
||
530 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
531 | //JComboBox cb = (JComboBox) e.getSource();
|
||
532 | /*String fieldName = (String) cb.getSelectedItem();
|
||
533 | System.out.println("Nombre del campo: " + fieldName);
|
||
534 | m_symbolTable.removeAllItems();
|
||
535 | if (fieldName != m_Renderer.getFieldName())
|
||
536 | m_bCacheDirty = true;
|
||
537 | m_Renderer.setFieldName(fieldName);*/
|
||
538 | } |
||
539 | }); |
||
540 | return jComboBox;
|
||
541 | } |
||
542 | |||
543 | /*public void setLayer(FLayer layer) {
|
||
544 | this.layer = layer;
|
||
545 | }*/
|
||
546 | /**
|
||
547 | * This method initializes jScrollPane
|
||
548 | *
|
||
549 | * @return javax.swing.JScrollPane
|
||
550 | */
|
||
551 | private JScrollPane getJScrollPane() { |
||
552 | if (jScrollPane == null) { |
||
553 | jScrollPane = new JScrollPane(); |
||
554 | jScrollPane.setViewportView(getJTextArea()); |
||
555 | jScrollPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); |
||
556 | jScrollPane.setPreferredSize(new java.awt.Dimension(100,100)); |
||
557 | jScrollPane.setBounds(6, 21, 335, 100); |
||
558 | } |
||
559 | return jScrollPane;
|
||
560 | } |
||
561 | /**
|
||
562 | * This method initializes jRadioButton
|
||
563 | *
|
||
564 | * @return javax.swing.JRadioButton
|
||
565 | */
|
||
566 | public JRadioButton getJRadioButton() { |
||
567 | if (jRadioButton == null) { |
||
568 | jRadioButton = new JRadioButton(); |
||
569 | jRadioButton.setText("Mostrar siempre");
|
||
570 | jRadioButton.setBounds(0, 0, 103, 23); |
||
571 | jRadioButton.setSelected(true);
|
||
572 | jRadioButton.addActionListener(new java.awt.event.ActionListener() {
|
||
573 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
574 | System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed() |
||
575 | //jPanel5.setEnabled(false);
|
||
576 | jLabel1.setEnabled(false);
|
||
577 | jTextField1.setEnabled(false);
|
||
578 | jLabel2.setEnabled(false);
|
||
579 | jLabel3.setEnabled(false);
|
||
580 | jTextField2.setEnabled(false);
|
||
581 | jLabel4.setEnabled(false);
|
||
582 | } |
||
583 | }); |
||
584 | } |
||
585 | return jRadioButton;
|
||
586 | } |
||
587 | /**
|
||
588 | * This method initializes jRadioButton1
|
||
589 | *
|
||
590 | * @return javax.swing.JRadioButton
|
||
591 | */
|
||
592 | public JRadioButton getJRadioButton1() { |
||
593 | if (jRadioButton1 == null) { |
||
594 | jRadioButton1 = new JRadioButton(); |
||
595 | jRadioButton1.setText("No mostrar la capa cuando la escala");
|
||
596 | jRadioButton1.setBounds(0, 23, 201, 23); |
||
597 | jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
|
||
598 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
599 | System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed() |
||
600 | //jPanel5.setEnabled(true);
|
||
601 | jLabel1.setEnabled(true);
|
||
602 | jTextField1.setEnabled(true);
|
||
603 | jLabel2.setEnabled(true);
|
||
604 | jLabel3.setEnabled(true);
|
||
605 | jTextField2.setEnabled(true);
|
||
606 | jLabel4.setEnabled(true);
|
||
607 | } |
||
608 | }); |
||
609 | } |
||
610 | return jRadioButton1;
|
||
611 | } |
||
612 | /**
|
||
613 | * This method initializes jTextField2
|
||
614 | *
|
||
615 | * @return javax.swing.JTextField
|
||
616 | */
|
||
617 | public JTextField getJTextField2() { |
||
618 | if (jTextField2 == null) { |
||
619 | jTextField2 = new JTextField(); |
||
620 | jTextField2.setBounds(100, 31, 176, 20); |
||
621 | jTextField2.setEnabled(false);
|
||
622 | } |
||
623 | return jTextField2;
|
||
624 | } |
||
625 | } // @jve:decl-index=0:visual-constraint="10,10" |