svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / fframes / dialogs / FFrameScaleBarDialog.java @ 2592
History | View | Annotate | Download (30.5 KB)
1 |
/*
|
---|---|
2 |
* Created on 02-jun-2004
|
3 |
*
|
4 |
*/
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 |
*
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
8 |
*
|
9 |
* This program is free software; you can redistribute it and/or
|
10 |
* modify it under the terms of the GNU General Public License
|
11 |
* as published by the Free Software Foundation; either version 2
|
12 |
* of the License, or (at your option) any later version.
|
13 |
*
|
14 |
* This program is distributed in the hope that it will be useful,
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
* GNU General Public License for more details.
|
18 |
*
|
19 |
* You should have received a copy of the GNU General Public License
|
20 |
* along with this program; if not, write to the Free Software
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
22 |
*
|
23 |
* For more information, contact:
|
24 |
*
|
25 |
* Generalitat Valenciana
|
26 |
* Conselleria d'Infraestructures i Transport
|
27 |
* Av. Blasco Ib??ez, 50
|
28 |
* 46010 VALENCIA
|
29 |
* SPAIN
|
30 |
*
|
31 |
* +34 963862235
|
32 |
* gvsig@gva.es
|
33 |
* www.gvsig.gva.es
|
34 |
*
|
35 |
* or
|
36 |
*
|
37 |
* IVER T.I. S.A
|
38 |
* Salamanca 50
|
39 |
* 46005 Valencia
|
40 |
* Spain
|
41 |
*
|
42 |
* +34 963163400
|
43 |
* dac@iver.es
|
44 |
*/
|
45 |
package com.iver.cit.gvsig.gui.layout.fframes.dialogs; |
46 |
|
47 |
import com.iver.andami.PluginServices; |
48 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
49 |
|
50 |
import com.iver.cit.gvsig.AddLayer; |
51 |
import com.iver.cit.gvsig.gui.Dialogs.FontChooser; |
52 |
import com.iver.cit.gvsig.gui.layout.Attributes; |
53 |
import com.iver.cit.gvsig.gui.layout.FLayoutUtilities; |
54 |
import com.iver.cit.gvsig.gui.layout.Layout; |
55 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameScaleBar; |
56 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameView; |
57 |
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame; |
58 |
import com.iver.cit.gvsig.gui.layout.fframes.ListViewModel; |
59 |
|
60 |
import java.awt.Color; |
61 |
import java.awt.Component; |
62 |
import java.awt.Dimension; |
63 |
import java.awt.geom.Rectangle2D; |
64 |
|
65 |
import javax.swing.ImageIcon; |
66 |
import javax.swing.JButton; |
67 |
import javax.swing.JCheckBox; |
68 |
import javax.swing.JColorChooser; |
69 |
import javax.swing.JDialog; |
70 |
import javax.swing.JFrame; |
71 |
import javax.swing.JLabel; |
72 |
import javax.swing.JList; |
73 |
import javax.swing.JPanel; |
74 |
import javax.swing.JTextField; |
75 |
import javax.swing.ListCellRenderer; |
76 |
|
77 |
|
78 |
/**
|
79 |
* Dialogo para a?adir una barra de escala al Layout.
|
80 |
*
|
81 |
* @author Vicente Caballero Navarro
|
82 |
*/
|
83 |
public class FFrameScaleBarDialog extends JPanel implements IFFrameDialog { |
84 |
private static final ImageIcon inumero = new ImageIcon(AddLayer.class.getClassLoader() |
85 |
.getResource("images/numero.png"));
|
86 |
private static final ImageIcon ibarra1 = new ImageIcon(AddLayer.class.getClassLoader() |
87 |
.getResource("images/barra1.png"));
|
88 |
private static final ImageIcon ibarra2 = new ImageIcon(AddLayer.class.getClassLoader() |
89 |
.getResource("images/barra2.png"));
|
90 |
private static final ImageIcon ibarra3 = new ImageIcon(AddLayer.class.getClassLoader() |
91 |
.getResource("images/barra3.png"));
|
92 |
private javax.swing.JPanel jContentPane = null; |
93 |
private javax.swing.JScrollPane jScrollPane = null; |
94 |
private javax.swing.JList liVistas = null; |
95 |
private javax.swing.JCheckBox chbMantenerIntervalo = null; |
96 |
private javax.swing.JComboBox cbEscala = null; |
97 |
private javax.swing.JComboBox cbUnidades = null; |
98 |
private javax.swing.JLabel lIntervalo = null; |
99 |
private javax.swing.JTextField tIntervalo = null; |
100 |
private javax.swing.JLabel lNumIntervalos = null; |
101 |
private javax.swing.JTextField tNumIntervalos = null; |
102 |
private javax.swing.JLabel lDivIzquierda = null; |
103 |
private javax.swing.JTextField tDivIzquierda = null; |
104 |
private javax.swing.JButton bAceptar = null; |
105 |
private javax.swing.JButton bCancelar = null; |
106 |
|
107 |
//private ProjectView m_projectView=null;
|
108 |
private FFrameView fframeview = null; |
109 |
private Rectangle2D rect = new Rectangle2D.Double(); |
110 |
private Layout m_layout = null; |
111 |
private FFrameScaleBar fframescalebar = null; //new FFrameScaleBar(); |
112 |
private boolean isAcepted = false; |
113 |
private ImageIcon[] images = new ImageIcon[4]; |
114 |
private javax.swing.JButton bFuente = null; |
115 |
private JPanel pMarcoVista = null; |
116 |
private JPanel pDescripcion = null; |
117 |
private JTextField tfDescripcion = null; |
118 |
private JPanel pUnidades = null; |
119 |
private JCheckBox chbSobreDescripcion = null; |
120 |
private JCheckBox chbMostrarUnidades = null; |
121 |
private JCheckBox chbSobreUnidades = null; |
122 |
private JPanel pEtiquetas = null; |
123 |
private JCheckBox chbEtiquetas = null; |
124 |
private JPanel pBarra = null; |
125 |
private JPanel jPanel5 = null; |
126 |
private JPanel jPanel6 = null; |
127 |
private JPanel jPanel7 = null; |
128 |
private JButton bUnidadesColor = null; |
129 |
private JButton bBarraColor = null; |
130 |
private Color barcolor = null; |
131 |
private Color textcolor = null; |
132 |
|
133 |
//private JPanel jPanel = null;
|
134 |
//private JPanel jPanel1 = null;
|
135 |
private JPanel jPanel2 = null; |
136 |
private JCheckBox jCheckBox = null; |
137 |
private JPRotation pRotation = null; |
138 |
private JLabel lblBarColor = null; |
139 |
private JLabel lblLabelColor = null; |
140 |
|
141 |
/**
|
142 |
* This is the default constructor
|
143 |
*
|
144 |
* @param layout DOCUMENT ME!
|
145 |
* @param fframe DOCUMENT ME!
|
146 |
*/
|
147 |
public FFrameScaleBarDialog(Layout layout, FFrameScaleBar fframe) {
|
148 |
super();
|
149 |
fframescalebar = fframe; |
150 |
barcolor = fframescalebar.getBarColor(); |
151 |
textcolor = fframescalebar.getTextColor(); |
152 |
|
153 |
if (fframescalebar.getFFrameView() != null) { |
154 |
getTfDescripcion().setText("escala 1:" +
|
155 |
String.valueOf(fframescalebar.getFFrameView().getScale()));
|
156 |
} |
157 |
|
158 |
m_layout = layout; |
159 |
initialize(); |
160 |
} |
161 |
|
162 |
/**
|
163 |
* DOCUMENT ME!
|
164 |
*
|
165 |
* @param r DOCUMENT ME!
|
166 |
*/
|
167 |
public void setRectangle(Rectangle2D r) { |
168 |
rect.setRect(r); |
169 |
} |
170 |
|
171 |
/**
|
172 |
* This method initializes this
|
173 |
*/
|
174 |
private void initialize() { |
175 |
this.setLayout(null); |
176 |
this.add(getJContentPane(), null); |
177 |
this.setSize(621, 400); |
178 |
|
179 |
if (fframescalebar.getStyle() == 0) { |
180 |
getChbMantenerIntervalo().setEnabled(false);
|
181 |
|
182 |
///getLUnidades().setEnabled(false);
|
183 |
getCbUnidades().setEnabled(false);
|
184 |
getChbEtiquetas().setEnabled(false);
|
185 |
getBBarraColor().setEnabled(false);
|
186 |
getChbMostrarUnidades().setEnabled(false);
|
187 |
getChbSobreUnidades().setEnabled(false);
|
188 |
getLIntervalo().setEnabled(false);
|
189 |
getTIntervalo().setEnabled(false);
|
190 |
getLNumIntervalos().setEnabled(false);
|
191 |
getTNumIntervalos().setEnabled(false);
|
192 |
getLDivIzquierda().setEnabled(false);
|
193 |
getTDivIzquierda().setEnabled(false);
|
194 |
} |
195 |
getPRotation().setRotation(fframescalebar.getRotation()); |
196 |
} |
197 |
|
198 |
/**
|
199 |
* This method initializes jContentPane
|
200 |
*
|
201 |
* @return javax.swing.JPanel
|
202 |
*/
|
203 |
private javax.swing.JPanel getJContentPane() {
|
204 |
if (jContentPane == null) { |
205 |
jContentPane = new javax.swing.JPanel();
|
206 |
jContentPane.setLayout(null);
|
207 |
jContentPane.add(getBAceptar(), null);
|
208 |
jContentPane.add(getBCancelar(), null);
|
209 |
jContentPane.add(getPRotation(), null);
|
210 |
jContentPane.setSize(617, 386); |
211 |
jContentPane.setPreferredSize(new java.awt.Dimension(50, 50)); |
212 |
jContentPane.setLocation(0, 6); |
213 |
jContentPane.add(getPMarcoVista(), null);
|
214 |
jContentPane.add(getPDescripcion(), null);
|
215 |
jContentPane.add(getPUnidades(), null);
|
216 |
jContentPane.add(getPBarra(), null);
|
217 |
jContentPane.add(getPEtiquetas(), null);
|
218 |
} |
219 |
|
220 |
return jContentPane;
|
221 |
} |
222 |
|
223 |
/**
|
224 |
* This method initializes jScrollPane
|
225 |
*
|
226 |
* @return javax.swing.JScrollPane
|
227 |
*/
|
228 |
private javax.swing.JScrollPane getJScrollPane() {
|
229 |
if (jScrollPane == null) { |
230 |
jScrollPane = new javax.swing.JScrollPane();
|
231 |
jScrollPane.setPreferredSize(new java.awt.Dimension(220, 50)); |
232 |
jScrollPane.setViewportView(getLiVistas()); |
233 |
} |
234 |
|
235 |
return jScrollPane;
|
236 |
} |
237 |
|
238 |
/**
|
239 |
* This method initializes liVistas
|
240 |
*
|
241 |
* @return javax.swing.JList
|
242 |
*/
|
243 |
private javax.swing.JList getLiVistas() {
|
244 |
if (liVistas == null) { |
245 |
ListViewModel listmodel = new ListViewModel();
|
246 |
listmodel.addViewsforScale(m_layout); |
247 |
|
248 |
///ArrayList list = listmodel.getViews();
|
249 |
|
250 |
liVistas = new javax.swing.JList();
|
251 |
|
252 |
liVistas.setModel(listmodel); |
253 |
|
254 |
for (int i = 0; i < liVistas.getModel().getSize(); i++) { |
255 |
if (fframescalebar.getFFrameView() != null) { |
256 |
fframeview = (FFrameView) liVistas.getModel().getElementAt(i); |
257 |
|
258 |
if (fframeview == fframescalebar.getFFrameView()) {
|
259 |
liVistas.setSelectedIndex(i); |
260 |
} |
261 |
} |
262 |
} |
263 |
|
264 |
liVistas.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
265 |
public void valueChanged( |
266 |
javax.swing.event.ListSelectionEvent e) { |
267 |
int selectInt = (int) e.getFirstIndex(); |
268 |
fframeview = (FFrameView) liVistas.getModel() |
269 |
.getElementAt(selectInt); |
270 |
|
271 |
for (int i = 0; i < m_layout.getFFrames().size(); |
272 |
i++) { |
273 |
IFFrame f = (IFFrame) m_layout.getFFrames().get(i); |
274 |
|
275 |
if (f instanceof FFrameView) { |
276 |
if (((FFrameView) f).getView() == fframeview.getView()) {
|
277 |
fframescalebar.setFFrameView(fframeview); |
278 |
} |
279 |
} |
280 |
} |
281 |
|
282 |
getTNumIntervalos().setText(String.valueOf(
|
283 |
fframescalebar.getNumInterval())); |
284 |
getTDivIzquierda().setText(String.valueOf(
|
285 |
fframescalebar.getNumLeft())); |
286 |
getTIntervalo().setText(String.valueOf(
|
287 |
fframescalebar.obtainInterval())); |
288 |
getTfDescripcion().setText(fframescalebar.getDescripcion()); |
289 |
} |
290 |
}); |
291 |
} |
292 |
|
293 |
return liVistas;
|
294 |
} |
295 |
|
296 |
/**
|
297 |
* This method initializes chbMantenerIntervalo
|
298 |
*
|
299 |
* @return javax.swing.JCheckBox
|
300 |
*/
|
301 |
private javax.swing.JCheckBox getChbMantenerIntervalo() {
|
302 |
if (chbMantenerIntervalo == null) { |
303 |
chbMantenerIntervalo = new javax.swing.JCheckBox();
|
304 |
chbMantenerIntervalo.setSelected(fframescalebar.isbIntervalSet()); |
305 |
chbMantenerIntervalo.setText(PluginServices.getText(this,
|
306 |
"mantener_intervalo"));
|
307 |
chbMantenerIntervalo.setPreferredSize(new java.awt.Dimension(200, 20)); |
308 |
chbMantenerIntervalo.addActionListener(new java.awt.event.ActionListener() {
|
309 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
310 |
fframescalebar.setIntervalSet(getChbMantenerIntervalo() |
311 |
.isSelected()); |
312 |
} |
313 |
}); |
314 |
} |
315 |
|
316 |
return chbMantenerIntervalo;
|
317 |
} |
318 |
|
319 |
/**
|
320 |
* This method initializes cbEscala
|
321 |
*
|
322 |
* @return javax.swing.JComboBox
|
323 |
*/
|
324 |
private javax.swing.JComboBox getCbEscala() {
|
325 |
if (cbEscala == null) { |
326 |
//String[] s={"n?merico","barra1","barra2","barra3","barra4"};
|
327 |
cbEscala = new javax.swing.JComboBox();
|
328 |
images[0] = inumero;
|
329 |
images[1] = ibarra1;
|
330 |
images[2] = ibarra2;
|
331 |
images[3] = ibarra3;
|
332 |
|
333 |
/* Image img=img = new BufferedImage(100, 25,
|
334 |
BufferedImage.TYPE_INT_ARGB);
|
335 |
img.getGraphics().drawImage(images[3].getImage(),0,0,null);
|
336 |
img.getGraphics().setXORMode(Color.yellow);
|
337 |
images[3]=new ImageIcon(img);
|
338 |
*/
|
339 |
ComboBoxRenderer renderer = new ComboBoxRenderer();
|
340 |
renderer.setPreferredSize(new Dimension(100, 25)); |
341 |
cbEscala.setRenderer(renderer); |
342 |
cbEscala.setMaximumRowCount(4);
|
343 |
|
344 |
cbEscala.addItem("0");
|
345 |
cbEscala.addItem("1");
|
346 |
cbEscala.addItem("2");
|
347 |
cbEscala.addItem("3");
|
348 |
cbEscala.setSelectedIndex(fframescalebar.getStyle()); |
349 |
cbEscala.setPreferredSize(new java.awt.Dimension(200, 20)); |
350 |
cbEscala.addActionListener(new java.awt.event.ActionListener() {
|
351 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
352 |
fframescalebar.setStyle(getCbEscala().getSelectedIndex()); |
353 |
|
354 |
if (cbEscala.getSelectedIndex() == 0) { |
355 |
getChbMantenerIntervalo().setEnabled(false);
|
356 |
getChbMostrarUnidades().setEnabled(false);
|
357 |
getChbSobreUnidades().setEnabled(false);
|
358 |
getCbUnidades().setEnabled(false);
|
359 |
getChbEtiquetas().setEnabled(false);
|
360 |
getBBarraColor().setEnabled(false);
|
361 |
getLIntervalo().setEnabled(false);
|
362 |
getTIntervalo().setEnabled(false);
|
363 |
getLNumIntervalos().setEnabled(false);
|
364 |
getTNumIntervalos().setEnabled(false);
|
365 |
getLDivIzquierda().setEnabled(false);
|
366 |
getTDivIzquierda().setEnabled(false);
|
367 |
} else {
|
368 |
getChbMantenerIntervalo().setEnabled(true);
|
369 |
getChbMostrarUnidades().setEnabled(true);
|
370 |
getChbSobreUnidades().setEnabled(true);
|
371 |
getCbUnidades().setEnabled(true);
|
372 |
getChbEtiquetas().setEnabled(true);
|
373 |
getBBarraColor().setEnabled(true);
|
374 |
getLIntervalo().setEnabled(true);
|
375 |
getTIntervalo().setEnabled(true);
|
376 |
getLNumIntervalos().setEnabled(true);
|
377 |
getTNumIntervalos().setEnabled(true);
|
378 |
getLDivIzquierda().setEnabled(true);
|
379 |
getTDivIzquierda().setEnabled(true);
|
380 |
} |
381 |
} |
382 |
}); |
383 |
} |
384 |
|
385 |
return cbEscala;
|
386 |
} |
387 |
|
388 |
/**
|
389 |
* This method initializes cbUnidades
|
390 |
*
|
391 |
* @return javax.swing.JComboBox
|
392 |
*/
|
393 |
private javax.swing.JComboBox getCbUnidades() {
|
394 |
if (cbUnidades == null) { |
395 |
//String[] s={"Kil?metros","metros","cent?metros","mil?metros","millas","yardas","pies","pulgadas"};
|
396 |
cbUnidades = new javax.swing.JComboBox(Attributes.NAMES); |
397 |
cbUnidades.setSelectedIndex(fframescalebar.getUnits()); |
398 |
cbUnidades.setPreferredSize(new java.awt.Dimension(150, 20)); |
399 |
cbUnidades.addActionListener(new java.awt.event.ActionListener() {
|
400 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
401 |
fframescalebar.setUnits(getCbUnidades() |
402 |
.getSelectedIndex()); |
403 |
getTIntervalo().setText(Long.toString(
|
404 |
fframescalebar.obtainInterval())); |
405 |
} |
406 |
}); |
407 |
} |
408 |
|
409 |
return cbUnidades;
|
410 |
} |
411 |
|
412 |
/**
|
413 |
* This method initializes lIntervalo
|
414 |
*
|
415 |
* @return javax.swing.JLabel
|
416 |
*/
|
417 |
private javax.swing.JLabel getLIntervalo() {
|
418 |
if (lIntervalo == null) { |
419 |
lIntervalo = new javax.swing.JLabel();
|
420 |
lIntervalo.setText(PluginServices.getText(this, "Intervalo")); |
421 |
lIntervalo.setPreferredSize(new java.awt.Dimension(90, 20)); |
422 |
} |
423 |
|
424 |
return lIntervalo;
|
425 |
} |
426 |
|
427 |
/**
|
428 |
* This method initializes tIntervalo
|
429 |
*
|
430 |
* @return javax.swing.JTextField
|
431 |
*/
|
432 |
private javax.swing.JTextField getTIntervalo() {
|
433 |
if (tIntervalo == null) { |
434 |
tIntervalo = new javax.swing.JTextField();
|
435 |
tIntervalo.setPreferredSize(new java.awt.Dimension(90, 20)); |
436 |
tIntervalo.setText(Long.toString(fframescalebar.getInterval()));
|
437 |
tIntervalo.addKeyListener(new java.awt.event.KeyAdapter() {
|
438 |
public void keyReleased(java.awt.event.KeyEvent e) { |
439 |
if (!tIntervalo.getText().toString().equals("")) { |
440 |
fframescalebar.setInterval(Long.parseLong(
|
441 |
tIntervalo.getText().toString())); |
442 |
getTNumIntervalos().setText(String.valueOf(
|
443 |
fframescalebar.getNumInterval())); |
444 |
} |
445 |
} |
446 |
}); |
447 |
} |
448 |
|
449 |
return tIntervalo;
|
450 |
} |
451 |
|
452 |
/**
|
453 |
* This method initializes lNumIntervalos
|
454 |
*
|
455 |
* @return javax.swing.JLabel
|
456 |
*/
|
457 |
private javax.swing.JLabel getLNumIntervalos() {
|
458 |
if (lNumIntervalos == null) { |
459 |
lNumIntervalos = new javax.swing.JLabel();
|
460 |
lNumIntervalos.setText(PluginServices.getText(this, "N?m_intervalos")); |
461 |
lNumIntervalos.setPreferredSize(new java.awt.Dimension(90, 20)); |
462 |
} |
463 |
|
464 |
return lNumIntervalos;
|
465 |
} |
466 |
|
467 |
/**
|
468 |
* This method initializes tNumIntervalos
|
469 |
*
|
470 |
* @return javax.swing.JTextField
|
471 |
*/
|
472 |
private javax.swing.JTextField getTNumIntervalos() {
|
473 |
if (tNumIntervalos == null) { |
474 |
tNumIntervalos = new javax.swing.JTextField();
|
475 |
tNumIntervalos.setPreferredSize(new java.awt.Dimension(90, 20)); |
476 |
tNumIntervalos.setText(Integer.toString(
|
477 |
fframescalebar.getNumInterval())); |
478 |
tNumIntervalos.addKeyListener(new java.awt.event.KeyAdapter() {
|
479 |
public void keyReleased(java.awt.event.KeyEvent e) { |
480 |
if (!tNumIntervalos.getText().toString().equals("")) { |
481 |
fframescalebar.setNumInterval(Integer.parseInt(
|
482 |
tNumIntervalos.getText().toString())); |
483 |
getTIntervalo().setText(String.valueOf(
|
484 |
fframescalebar.obtainInterval())); |
485 |
} |
486 |
} |
487 |
}); |
488 |
} |
489 |
|
490 |
return tNumIntervalos;
|
491 |
} |
492 |
|
493 |
/**
|
494 |
* This method initializes lDivIzquierda
|
495 |
*
|
496 |
* @return javax.swing.JLabel
|
497 |
*/
|
498 |
private javax.swing.JLabel getLDivIzquierda() {
|
499 |
if (lDivIzquierda == null) { |
500 |
lDivIzquierda = new javax.swing.JLabel();
|
501 |
lDivIzquierda.setText(PluginServices.getText(this,
|
502 |
"divisiones_izquierda"));
|
503 |
lDivIzquierda.setPreferredSize(new java.awt.Dimension(90, 20)); |
504 |
} |
505 |
|
506 |
return lDivIzquierda;
|
507 |
} |
508 |
|
509 |
/**
|
510 |
* This method initializes tDivIzquierda
|
511 |
*
|
512 |
* @return javax.swing.JTextField
|
513 |
*/
|
514 |
private javax.swing.JTextField getTDivIzquierda() {
|
515 |
if (tDivIzquierda == null) { |
516 |
tDivIzquierda = new javax.swing.JTextField();
|
517 |
tDivIzquierda.setPreferredSize(new java.awt.Dimension(90, 20)); |
518 |
tDivIzquierda.setText(Integer.toString(fframescalebar.getNumLeft()));
|
519 |
tDivIzquierda.addKeyListener(new java.awt.event.KeyAdapter() {
|
520 |
public void keyReleased(java.awt.event.KeyEvent e) { |
521 |
if (tDivIzquierda.getText().toString().equals("")) { |
522 |
tDivIzquierda.setText("0");
|
523 |
} else {
|
524 |
fframescalebar.setNumLeft(Integer.parseInt(
|
525 |
tDivIzquierda.getText())); |
526 |
} |
527 |
} |
528 |
}); |
529 |
} |
530 |
|
531 |
return tDivIzquierda;
|
532 |
} |
533 |
|
534 |
/**
|
535 |
* This method initializes bAceptar
|
536 |
*
|
537 |
* @return javax.swing.JButton
|
538 |
*/
|
539 |
private javax.swing.JButton getBAceptar() {
|
540 |
if (bAceptar == null) { |
541 |
bAceptar = new javax.swing.JButton();
|
542 |
bAceptar.setSize(85, 26); |
543 |
bAceptar.setText(PluginServices.getText(this, "Aceptar")); |
544 |
bAceptar.setLocation(106, 347); |
545 |
bAceptar.setPreferredSize(new java.awt.Dimension(79, 23)); |
546 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
547 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
548 |
fframescalebar.setUnits(getCbUnidades() |
549 |
.getSelectedIndex()); |
550 |
fframescalebar.setBoundBox(FLayoutUtilities.toSheetRect( |
551 |
rect, m_layout.getAT())); |
552 |
|
553 |
fframescalebar.setBarColor(barcolor); |
554 |
fframescalebar.setTextColor(textcolor); |
555 |
fframescalebar.setShowNameUnits(getChbMostrarUnidades() |
556 |
.isSelected()); |
557 |
fframescalebar.setShowDescription(getJCheckBox() |
558 |
.isSelected()); |
559 |
fframescalebar.setAboveDescription(getChbSobreDescripcion() |
560 |
.isSelected()); |
561 |
fframescalebar.setAboveIntervals(getChbEtiquetas() |
562 |
.isSelected()); |
563 |
fframescalebar.setAboveName(getChbSobreUnidades() |
564 |
.isSelected()); |
565 |
fframescalebar.setDescripcion(getTfDescripcion() |
566 |
.getText()); |
567 |
fframescalebar.setRotation(getPRotation().getRotation()); |
568 |
PluginServices.getMDIManager().closeView(FFrameScaleBarDialog.this); |
569 |
m_layout.refresh(); |
570 |
isAcepted = true;
|
571 |
} |
572 |
}); |
573 |
} |
574 |
|
575 |
return bAceptar;
|
576 |
} |
577 |
|
578 |
/**
|
579 |
* This method initializes bCancelar
|
580 |
*
|
581 |
* @return javax.swing.JButton
|
582 |
*/
|
583 |
private javax.swing.JButton getBCancelar() {
|
584 |
if (bCancelar == null) { |
585 |
bCancelar = new javax.swing.JButton();
|
586 |
bCancelar.setSize(85, 26); |
587 |
bCancelar.setText(PluginServices.getText(this, "Cancelar")); |
588 |
bCancelar.setLocation(297, 347); |
589 |
bCancelar.setPreferredSize(new java.awt.Dimension(85, 23)); |
590 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
591 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
592 |
PluginServices.getMDIManager().closeView(FFrameScaleBarDialog.this); |
593 |
} |
594 |
}); |
595 |
} |
596 |
|
597 |
return bCancelar;
|
598 |
} |
599 |
|
600 |
/* (non-Javadoc)
|
601 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
602 |
*/
|
603 |
public ViewInfo getViewInfo() {
|
604 |
ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
|
605 |
m_viewinfo.setTitle(PluginServices.getText(this,
|
606 |
"Propiedades_escala_grafica"));
|
607 |
|
608 |
return m_viewinfo;
|
609 |
} |
610 |
|
611 |
/**
|
612 |
* @see com.iver.cit.gvsig.gui.layout.fframes.dialogs.IFFrameDialog#getIsAcepted()
|
613 |
*/
|
614 |
public boolean getIsAcepted() { |
615 |
return isAcepted;
|
616 |
} |
617 |
|
618 |
/**
|
619 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
620 |
*/
|
621 |
public void viewActivated() { |
622 |
} |
623 |
|
624 |
/**
|
625 |
* This method initializes bFuente
|
626 |
*
|
627 |
* @return javax.swing.JButton
|
628 |
*/
|
629 |
private javax.swing.JButton getBFuente() {
|
630 |
if (bFuente == null) { |
631 |
bFuente = new javax.swing.JButton();
|
632 |
bFuente.setText(PluginServices.getText(this, "fuente")); |
633 |
bFuente.addActionListener(new java.awt.event.ActionListener() {
|
634 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
635 |
fframescalebar.setFont(FontChooser.showDialog( |
636 |
PluginServices.getText(this, "seleccion_fuente"), |
637 |
fframescalebar.getFont())); // fchoser=new FontChooser();
|
638 |
} |
639 |
}); |
640 |
} |
641 |
|
642 |
return bFuente;
|
643 |
} |
644 |
|
645 |
/**
|
646 |
* This method initializes pMarcoVista
|
647 |
*
|
648 |
* @return javax.swing.JPanel
|
649 |
*/
|
650 |
private JPanel getPMarcoVista() { |
651 |
if (pMarcoVista == null) { |
652 |
pMarcoVista = new JPanel(); |
653 |
pMarcoVista.setBounds(7, 9, 240, 86); |
654 |
pMarcoVista.setBorder(javax.swing.BorderFactory.createTitledBorder( |
655 |
null, PluginServices.getText(this,PluginServices.getText(this,"marco_vista")), |
656 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
657 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
658 |
pMarcoVista.add(getJScrollPane(), null);
|
659 |
} |
660 |
|
661 |
return pMarcoVista;
|
662 |
} |
663 |
|
664 |
/**
|
665 |
* This method initializes pDescripcion
|
666 |
*
|
667 |
* @return javax.swing.JPanel
|
668 |
*/
|
669 |
private JPanel getPDescripcion() { |
670 |
if (pDescripcion == null) { |
671 |
pDescripcion = new JPanel(); |
672 |
pDescripcion.setBounds(256, 9, 216, 110); |
673 |
pDescripcion.setBorder(javax.swing.BorderFactory.createTitledBorder( |
674 |
null, PluginServices.getText(this,"descripcion"), |
675 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
676 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
677 |
pDescripcion.add(getTfDescripcion(), null);
|
678 |
pDescripcion.add(getJCheckBox(), null);
|
679 |
pDescripcion.add(getChbSobreDescripcion(), null);
|
680 |
} |
681 |
|
682 |
return pDescripcion;
|
683 |
} |
684 |
|
685 |
/**
|
686 |
* This method initializes tfDescripcion
|
687 |
*
|
688 |
* @return javax.swing.JTextField
|
689 |
*/
|
690 |
private JTextField getTfDescripcion() { |
691 |
if (tfDescripcion == null) { |
692 |
tfDescripcion = new JTextField(); |
693 |
tfDescripcion.setPreferredSize(new java.awt.Dimension(190, 20)); |
694 |
|
695 |
/*if (fframeview!=null){
|
696 |
getTfDescripcion().setText("escala 1:"+String.valueOf(fframeview.getScale()));
|
697 |
}
|
698 |
*/
|
699 |
tfDescripcion.setText(fframescalebar.getDescripcion()); |
700 |
} |
701 |
|
702 |
return tfDescripcion;
|
703 |
} |
704 |
|
705 |
/**
|
706 |
* This method initializes pUnidades
|
707 |
*
|
708 |
* @return javax.swing.JPanel
|
709 |
*/
|
710 |
private JPanel getPUnidades() { |
711 |
if (pUnidades == null) { |
712 |
pUnidades = new JPanel(); |
713 |
pUnidades.setLocation(255, 129); |
714 |
pUnidades.setSize(216, 107); |
715 |
pUnidades.setBorder(javax.swing.BorderFactory.createTitledBorder( |
716 |
null, PluginServices.getText(this, "unidades"), |
717 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
718 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
719 |
pUnidades.add(getCbUnidades(), null);
|
720 |
pUnidades.add(getChbMostrarUnidades(), null);
|
721 |
pUnidades.add(getChbSobreUnidades(), null);
|
722 |
} |
723 |
|
724 |
return pUnidades;
|
725 |
} |
726 |
|
727 |
/**
|
728 |
* This method initializes chbSobreDescripcion
|
729 |
*
|
730 |
* @return javax.swing.JCheckBox
|
731 |
*/
|
732 |
private JCheckBox getChbSobreDescripcion() { |
733 |
if (chbSobreDescripcion == null) { |
734 |
chbSobreDescripcion = new JCheckBox(); |
735 |
chbSobreDescripcion.setSelected(fframescalebar.isAboveDescription()); |
736 |
chbSobreDescripcion.setText(PluginServices.getText(this,"sobre_la_barra")); |
737 |
} |
738 |
|
739 |
return chbSobreDescripcion;
|
740 |
} |
741 |
|
742 |
/**
|
743 |
* This method initializes chbMostrarUnidades
|
744 |
*
|
745 |
* @return javax.swing.JCheckBox
|
746 |
*/
|
747 |
private JCheckBox getChbMostrarUnidades() { |
748 |
if (chbMostrarUnidades == null) { |
749 |
chbMostrarUnidades = new JCheckBox(); |
750 |
chbMostrarUnidades.setText(PluginServices.getText(this,"mostrar_unidades")); |
751 |
chbMostrarUnidades.setSelected(fframescalebar.isShowNameUnits()); |
752 |
chbMostrarUnidades.setPreferredSize(new java.awt.Dimension(150, 24)); |
753 |
} |
754 |
|
755 |
return chbMostrarUnidades;
|
756 |
} |
757 |
|
758 |
/**
|
759 |
* This method initializes chbSobreUnidades
|
760 |
*
|
761 |
* @return javax.swing.JCheckBox
|
762 |
*/
|
763 |
private JCheckBox getChbSobreUnidades() { |
764 |
if (chbSobreUnidades == null) { |
765 |
chbSobreUnidades = new JCheckBox(); |
766 |
chbSobreUnidades.setSelected(fframescalebar.isAboveName()); |
767 |
chbSobreUnidades.setText(PluginServices.getText(this,"sobre_la_barra")); |
768 |
chbSobreUnidades.setPreferredSize(new java.awt.Dimension(150, 24)); |
769 |
} |
770 |
|
771 |
return chbSobreUnidades;
|
772 |
} |
773 |
|
774 |
/**
|
775 |
* This method initializes pEtiquetas
|
776 |
*
|
777 |
* @return javax.swing.JPanel
|
778 |
*/
|
779 |
private JPanel getPEtiquetas() { |
780 |
if (pEtiquetas == null) { |
781 |
pEtiquetas = new JPanel(); |
782 |
pEtiquetas.setBorder(javax.swing.BorderFactory.createTitledBorder( |
783 |
null, PluginServices.getText(this, "etiquetas"), |
784 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
785 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
786 |
pEtiquetas.setBounds(257, 246, 216, 93); |
787 |
pEtiquetas.add(getChbEtiquetas(), null);
|
788 |
pEtiquetas.add(getJPanel2(), null);
|
789 |
} |
790 |
|
791 |
return pEtiquetas;
|
792 |
} |
793 |
|
794 |
/**
|
795 |
* This method initializes chbEtiquetas
|
796 |
*
|
797 |
* @return javax.swing.JCheckBox
|
798 |
*/
|
799 |
private JCheckBox getChbEtiquetas() { |
800 |
if (chbEtiquetas == null) { |
801 |
chbEtiquetas = new JCheckBox(); |
802 |
chbEtiquetas.setSelected(fframescalebar.isAboveIntervals()); |
803 |
chbEtiquetas.setText(PluginServices.getText(this,"sobre_la_barra")); |
804 |
} |
805 |
|
806 |
return chbEtiquetas;
|
807 |
} |
808 |
|
809 |
/**
|
810 |
* This method initializes pBarra
|
811 |
*
|
812 |
* @return javax.swing.JPanel
|
813 |
*/
|
814 |
private JPanel getPBarra() { |
815 |
if (pBarra == null) { |
816 |
lblBarColor = new JLabel(); |
817 |
lblBarColor.setText(PluginServices.getText(this,"color")); |
818 |
pBarra = new JPanel(); |
819 |
pBarra.setBounds(8, 104, 240, 235); |
820 |
pBarra.setBorder(javax.swing.BorderFactory.createTitledBorder( |
821 |
null, PluginServices.getText(this,"barra"), |
822 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
823 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
824 |
pBarra.add(getCbEscala(), null);
|
825 |
pBarra.add(getChbMantenerIntervalo(), null);
|
826 |
pBarra.add(getJPanel5(), null);
|
827 |
pBarra.add(getJPanel7(), null);
|
828 |
pBarra.add(getJPanel6(), null);
|
829 |
pBarra.add(lblBarColor, null);
|
830 |
pBarra.add(getBBarraColor(), null);
|
831 |
|
832 |
//pBarra.add(getJPanel(), null);
|
833 |
} |
834 |
|
835 |
return pBarra;
|
836 |
} |
837 |
|
838 |
/**
|
839 |
* This method initializes jPanel5
|
840 |
*
|
841 |
* @return javax.swing.JPanel
|
842 |
*/
|
843 |
private JPanel getJPanel5() { |
844 |
if (jPanel5 == null) { |
845 |
jPanel5 = new JPanel(); |
846 |
jPanel5.setPreferredSize(new java.awt.Dimension(200, 30)); |
847 |
jPanel5.add(getLIntervalo(), null);
|
848 |
jPanel5.add(getTIntervalo(), null);
|
849 |
} |
850 |
|
851 |
return jPanel5;
|
852 |
} |
853 |
|
854 |
/**
|
855 |
* This method initializes jPanel6
|
856 |
*
|
857 |
* @return javax.swing.JPanel
|
858 |
*/
|
859 |
private JPanel getJPanel6() { |
860 |
if (jPanel6 == null) { |
861 |
jPanel6 = new JPanel(); |
862 |
jPanel6.add(getLDivIzquierda(), null);
|
863 |
jPanel6.add(getTDivIzquierda(), null);
|
864 |
} |
865 |
|
866 |
return jPanel6;
|
867 |
} |
868 |
|
869 |
/**
|
870 |
* This method initializes jPanel7
|
871 |
*
|
872 |
* @return javax.swing.JPanel
|
873 |
*/
|
874 |
private JPanel getJPanel7() { |
875 |
if (jPanel7 == null) { |
876 |
jPanel7 = new JPanel(); |
877 |
jPanel7.add(getLNumIntervalos(), null);
|
878 |
jPanel7.add(getTNumIntervalos(), null);
|
879 |
} |
880 |
|
881 |
return jPanel7;
|
882 |
} |
883 |
|
884 |
/**
|
885 |
* This method initializes bUnidadesColor
|
886 |
*
|
887 |
* @return javax.swing.JButton
|
888 |
*/
|
889 |
private JButton getBUnidadesColor() { |
890 |
if (bUnidadesColor == null) { |
891 |
bUnidadesColor = new JButton(); |
892 |
bUnidadesColor.setForeground(Color.white);
|
893 |
bUnidadesColor.setPreferredSize(new java.awt.Dimension(25,25)); |
894 |
bUnidadesColor.setBackground(textcolor); |
895 |
bUnidadesColor.addActionListener(new java.awt.event.ActionListener() {
|
896 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
897 |
JDialog dlg;
|
898 |
JColorChooser colorChooser;
|
899 |
colorChooser = new JColorChooser(); |
900 |
dlg = JColorChooser.createDialog((JFrame) null, |
901 |
PluginServices.getText(this, "Elegir_Color"), |
902 |
true, colorChooser, null, null); |
903 |
dlg.show(true);
|
904 |
|
905 |
textcolor = (Color) colorChooser.getColor();
|
906 |
|
907 |
//getJPanel1().setBackground(textcolor);
|
908 |
bUnidadesColor.setBackground(textcolor); |
909 |
} |
910 |
}); |
911 |
} |
912 |
|
913 |
return bUnidadesColor;
|
914 |
} |
915 |
|
916 |
/**
|
917 |
* This method initializes bBarraColor
|
918 |
*
|
919 |
* @return javax.swing.JButton
|
920 |
*/
|
921 |
private JButton getBBarraColor() { |
922 |
if (bBarraColor == null) { |
923 |
bBarraColor = new JButton(); |
924 |
bBarraColor.setForeground(Color.white);
|
925 |
bBarraColor.setPreferredSize(new java.awt.Dimension(25,25)); |
926 |
bBarraColor.setBackground(barcolor); |
927 |
bBarraColor.addActionListener(new java.awt.event.ActionListener() {
|
928 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
929 |
JDialog dlg;
|
930 |
JColorChooser colorChooser;
|
931 |
colorChooser = new JColorChooser(); |
932 |
dlg = JColorChooser.createDialog((JFrame) null, |
933 |
PluginServices.getText(this, "Elegir_Color"), |
934 |
true, colorChooser, null, null); |
935 |
dlg.show(true);
|
936 |
|
937 |
barcolor = (Color) colorChooser.getColor();
|
938 |
|
939 |
//getJPanel().setBackground(barcolor);
|
940 |
bBarraColor.setBackground(barcolor); |
941 |
} |
942 |
}); |
943 |
} |
944 |
|
945 |
return bBarraColor;
|
946 |
} |
947 |
|
948 |
/**
|
949 |
* This method initializes jPanel
|
950 |
*
|
951 |
* @return javax.swing.JPanel
|
952 |
*/
|
953 |
|
954 |
/*private JPanel getJPanel() {
|
955 |
if (jPanel == null) {
|
956 |
jPanel = new JPanel();
|
957 |
jPanel.setPreferredSize(new java.awt.Dimension(44,24));
|
958 |
jPanel.setForeground(barcolor);
|
959 |
jPanel.setBackground(barcolor);
|
960 |
}
|
961 |
return jPanel;
|
962 |
}
|
963 |
*/
|
964 |
|
965 |
/**
|
966 |
* This method initializes jPanel1
|
967 |
*
|
968 |
* @return javax.swing.JPanel
|
969 |
*/
|
970 |
|
971 |
/* private JPanel getJPanel1() {
|
972 |
if (jPanel1 == null) {
|
973 |
jPanel1 = new JPanel();
|
974 |
jPanel1.setBackground(textcolor);
|
975 |
jPanel1.setPreferredSize(new java.awt.Dimension(44,24));
|
976 |
}
|
977 |
return jPanel1;
|
978 |
}
|
979 |
*/
|
980 |
|
981 |
/**
|
982 |
* This method initializes jPanel2
|
983 |
*
|
984 |
* @return javax.swing.JPanel
|
985 |
*/
|
986 |
private JPanel getJPanel2() { |
987 |
if (jPanel2 == null) { |
988 |
lblLabelColor = new JLabel(); |
989 |
lblLabelColor.setText(PluginServices.getText(this,"color")); |
990 |
jPanel2 = new JPanel(); |
991 |
jPanel2.add(getBFuente(), null);
|
992 |
jPanel2.add(lblLabelColor, null);
|
993 |
jPanel2.add(getBUnidadesColor(), null);
|
994 |
|
995 |
//jPanel2.add(getJPanel1(), null);
|
996 |
} |
997 |
|
998 |
return jPanel2;
|
999 |
} |
1000 |
|
1001 |
/**
|
1002 |
* This method initializes jCheckBox
|
1003 |
*
|
1004 |
* @return javax.swing.JCheckBox
|
1005 |
*/
|
1006 |
private JCheckBox getJCheckBox() { |
1007 |
if (jCheckBox == null) { |
1008 |
jCheckBox = new JCheckBox(); |
1009 |
jCheckBox.setSelected(fframescalebar.isShowDescription()); |
1010 |
jCheckBox.setText(PluginServices.getText(this,"mostrar_descripcion")); |
1011 |
} |
1012 |
|
1013 |
return jCheckBox;
|
1014 |
} |
1015 |
|
1016 |
/**
|
1017 |
* DOCUMENT ME!
|
1018 |
*
|
1019 |
* @author Vicente Caballero Navarro
|
1020 |
*/
|
1021 |
class ComboBoxRenderer extends JLabel implements ListCellRenderer { |
1022 |
/**
|
1023 |
* Crea un nuevo ComboBoxRenderer.
|
1024 |
*/
|
1025 |
public ComboBoxRenderer() {
|
1026 |
setOpaque(true);
|
1027 |
setHorizontalAlignment(CENTER); |
1028 |
setVerticalAlignment(CENTER); |
1029 |
} |
1030 |
|
1031 |
/*
|
1032 |
* This method finds the image and text corresponding
|
1033 |
* to the selected value and returns the label, set up
|
1034 |
* to display the text and image.
|
1035 |
*/
|
1036 |
public Component getListCellRendererComponent(JList list, Object value, |
1037 |
int index, boolean isSelected, boolean cellHasFocus) { |
1038 |
//Get the selected index. (The index param isn't
|
1039 |
//always valid, so just use the value.)
|
1040 |
///int selectedIndex = ((Integer)value).intValue();
|
1041 |
if (isSelected) {
|
1042 |
setBackground(list.getSelectionBackground()); |
1043 |
setForeground(list.getSelectionForeground()); |
1044 |
} else {
|
1045 |
setBackground(list.getBackground()); |
1046 |
setForeground(list.getForeground()); |
1047 |
} |
1048 |
|
1049 |
ImageIcon icon = images[Integer.parseInt((String) value)]; |
1050 |
setIcon(icon); |
1051 |
|
1052 |
return this; |
1053 |
} |
1054 |
} |
1055 |
|
1056 |
/**
|
1057 |
* This method initializes pRotation
|
1058 |
*
|
1059 |
* @return javax.swing.JPanel
|
1060 |
*/
|
1061 |
private JPRotation getPRotation() {
|
1062 |
if (pRotation == null) { |
1063 |
pRotation = new JPRotation();
|
1064 |
pRotation.setBounds(480, 10, 120, 120); |
1065 |
} |
1066 |
return pRotation;
|
1067 |
} |
1068 |
} // @jve:decl-index=0:visual-constraint="17,10"
|
1069 |
// @jve:visual-info decl-index=0 visual-constraint="10,10"
|