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