root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / fframes / dialogs / FFrameTextDialog.java @ 2391
History | View | Annotate | Download (26.7 KB)
1 |
/*
|
---|---|
2 |
* Created on 22-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 java.awt.Color; |
48 |
import java.awt.geom.Rectangle2D; |
49 |
|
50 |
import javax.swing.ImageIcon; |
51 |
import javax.swing.JColorChooser; |
52 |
import javax.swing.JDialog; |
53 |
import javax.swing.JFrame; |
54 |
import javax.swing.JPanel; |
55 |
import javax.swing.JToggleButton; |
56 |
|
57 |
import com.iver.andami.PluginServices; |
58 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
59 |
import com.iver.cit.gvsig.AddLayer; |
60 |
import com.iver.cit.gvsig.gui.Dialogs.FontChooser; |
61 |
import com.iver.cit.gvsig.gui.layout.FLayoutUtilities; |
62 |
import com.iver.cit.gvsig.gui.layout.Layout; |
63 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameText; |
64 |
|
65 |
|
66 |
import javax.swing.JButton; |
67 |
import javax.swing.JCheckBox; |
68 |
import javax.swing.JTextField; |
69 |
import javax.swing.JLabel; |
70 |
/**
|
71 |
* Dialogo para a?adir texto al Layout.
|
72 |
*
|
73 |
* @author Vicente Caballero Navarro
|
74 |
*/
|
75 |
public class FFrameTextDialog extends JPanel implements IFFrameDialog { |
76 |
public static final ImageIcon ileft = new ImageIcon(AddLayer.class.getClassLoader() |
77 |
.getResource("images/left.PNG")); //$NON-NLS-1$ |
78 |
public static final ImageIcon icenterV = new ImageIcon(AddLayer.class.getClassLoader() |
79 |
.getResource("images/centerV.PNG")); //$NON-NLS-1$ |
80 |
public static final ImageIcon iright = new ImageIcon(AddLayer.class.getClassLoader() |
81 |
.getResource("images/right.PNG")); //$NON-NLS-1$ |
82 |
private javax.swing.JPanel jContentPane = null; // @jve:visual-info decl-index=0 visual-constraint="593,10" |
83 |
private javax.swing.JScrollPane jScrollPane = null; |
84 |
private javax.swing.JTextArea taTexto = null; |
85 |
private javax.swing.JLabel lAlinear = null; |
86 |
private JToggleButton bIzquierda = null; |
87 |
private JToggleButton bCentro = null; |
88 |
private JToggleButton bDerecha = null; |
89 |
private javax.swing.JLabel jLabel1 = null; |
90 |
private javax.swing.JComboBox jComboBox = null; |
91 |
private javax.swing.JLabel jLabel2 = null; |
92 |
private javax.swing.JLabel lRotacion = null; |
93 |
private javax.swing.JCheckBox chkEscalaVista = null; |
94 |
private javax.swing.JButton bAceptar = null; |
95 |
private javax.swing.JButton bCancelar = null; |
96 |
private Layout m_layout = null; |
97 |
private Rectangle2D rect = new Rectangle2D.Double(); |
98 |
private FFrameText fframetext = null; //new FFrameText(); |
99 |
private boolean isAcepted = false; |
100 |
private javax.swing.JButton bFuente = null; |
101 |
private Color textcolor = null; |
102 |
private Color frameColor =null; |
103 |
private Color titleColor =null; |
104 |
private JButton jButton = null; |
105 |
private JCheckBox chkSurroundingRectangle = null; |
106 |
private JTextField txtCellPadding = null; |
107 |
private JLabel jLabel = null; |
108 |
private JCheckBox chkFontSize = null; |
109 |
private JTextField txtFontSize = null; |
110 |
private JCheckBox chkTitle = null; |
111 |
private JTextField txtTitle = null; |
112 |
private JPanel jPanel = null; |
113 |
private JTextField txtTitleSize = null; |
114 |
private JLabel jLabel3 = null; |
115 |
private JLabel jLabel4; |
116 |
private JPanel jPanel1 = null; |
117 |
private JTextField txtFrameSize = null; |
118 |
private JLabel jLabel5 = null; |
119 |
private JLabel jLabel6 = null; |
120 |
private JLabel jLabel7 = null; |
121 |
private JButton jButton1 = null; |
122 |
private JButton jButton2 = null; |
123 |
private JPRotation pRotation = null; |
124 |
/**
|
125 |
* This is the default constructor
|
126 |
*
|
127 |
* @param layout Referencia al Layout.
|
128 |
* @param fframe Referencia al fframe de texto.
|
129 |
*/
|
130 |
public FFrameTextDialog(Layout layout, FFrameText fframe) {
|
131 |
super();
|
132 |
fframetext = fframe; |
133 |
m_layout = layout; |
134 |
textcolor = fframe.getTextColor(); |
135 |
frameColor = fframe.getFrameColor(); |
136 |
titleColor = fframe.getTitleColor(); |
137 |
initialize(); |
138 |
} |
139 |
|
140 |
/**
|
141 |
* This method initializes this
|
142 |
*/
|
143 |
private void initialize() { |
144 |
this.setLayout(null); |
145 |
this.add(getJContentPane(), null); |
146 |
this.setSize(419, 429); |
147 |
getPRotation().setRotation(fframetext.getRotation()); |
148 |
} |
149 |
|
150 |
/**
|
151 |
* Inserta el rect?ngulo a ocupar por el fframe de texto.
|
152 |
*
|
153 |
* @param r Rect?ngulo.
|
154 |
*/
|
155 |
public void setRectangle(Rectangle2D r) { |
156 |
rect.setRect(r); |
157 |
} |
158 |
|
159 |
/**
|
160 |
* This method initializes jContentPane
|
161 |
*
|
162 |
* @return javax.swing.JPanel
|
163 |
*/
|
164 |
private javax.swing.JPanel getJContentPane() {
|
165 |
if (jContentPane == null) { |
166 |
jLabel = new JLabel(); |
167 |
jContentPane = new javax.swing.JPanel();
|
168 |
jContentPane.setLayout(null);
|
169 |
jContentPane.add(getJScrollPane(), null);
|
170 |
jContentPane.add(getLAlinear(), null);
|
171 |
jContentPane.add(getBIzquierda(), null);
|
172 |
jContentPane.add(getBCentro(), null);
|
173 |
jContentPane.add(getBDerecha(), null);
|
174 |
|
175 |
//jContentPane.add(getJLabel1(), null);
|
176 |
//jContentPane.add(getJComboBox(), null);
|
177 |
//jContentPane.add(getJLabel2(), null);
|
178 |
jContentPane.add(getLRotacion(), null);
|
179 |
jContentPane.add(getChkEscalaVista(), null);
|
180 |
jContentPane.add(getBAceptar(), null);
|
181 |
jContentPane.add(getBCancelar(), null);
|
182 |
jContentPane.add(getBFuente(), null);
|
183 |
jContentPane.setSize(412, 422); |
184 |
jContentPane.setLocation(3, 4); |
185 |
jContentPane.add(getJButton(), null);
|
186 |
// jaume
|
187 |
jLabel.setText(PluginServices.getText(this, "pixeles")); |
188 |
jLabel.setSize(40, 16); |
189 |
jLabel.setLocation(226, 74); |
190 |
jContentPane.add(getJPanel1(), null);
|
191 |
jContentPane.add(getJPanel(), null);
|
192 |
jContentPane.add(getChkFontSize(), null);
|
193 |
jContentPane.add(getTxtFontSize(), null);
|
194 |
jContentPane.add(getPRotation(), null);
|
195 |
} |
196 |
|
197 |
return jContentPane;
|
198 |
} |
199 |
|
200 |
/**
|
201 |
* This method initializes jScrollPane
|
202 |
*
|
203 |
* @return javax.swing.JScrollPane
|
204 |
*/
|
205 |
private javax.swing.JScrollPane getJScrollPane() {
|
206 |
if (jScrollPane == null) { |
207 |
jScrollPane = new javax.swing.JScrollPane();
|
208 |
jScrollPane.setViewportView(getTaTexto()); |
209 |
jScrollPane.setSize(261, 83); |
210 |
jScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
211 |
jScrollPane.setLocation(5, 5); |
212 |
} |
213 |
|
214 |
return jScrollPane;
|
215 |
} |
216 |
|
217 |
/**
|
218 |
* This method initializes taTexto
|
219 |
*
|
220 |
* @return javax.swing.JTextArea
|
221 |
*/
|
222 |
private javax.swing.JTextArea getTaTexto() {
|
223 |
if (taTexto == null) { |
224 |
taTexto = new javax.swing.JTextArea();
|
225 |
|
226 |
for (int i = 0; i < fframetext.getText().size(); i++) { |
227 |
if (!((String) fframetext.getText().get(i)).equals("")) { //$NON-NLS-1$ |
228 |
taTexto.append((String) fframetext.getText().get(i));
|
229 |
} |
230 |
|
231 |
taTexto.setPreferredSize(new java.awt.Dimension(220, 80)); |
232 |
} |
233 |
} |
234 |
|
235 |
return taTexto;
|
236 |
} |
237 |
|
238 |
/**
|
239 |
* This method initializes lAlinear
|
240 |
*
|
241 |
* @return javax.swing.JLabel
|
242 |
*/
|
243 |
private javax.swing.JLabel getLAlinear() {
|
244 |
if (lAlinear == null) { |
245 |
lAlinear = new javax.swing.JLabel();
|
246 |
lAlinear.setSize(52, 27); |
247 |
lAlinear.setText(PluginServices.getText(this, "alinear")); //$NON-NLS-1$ |
248 |
lAlinear.setLocation(5, 98); |
249 |
} |
250 |
|
251 |
return lAlinear;
|
252 |
} |
253 |
|
254 |
/**
|
255 |
* This method initializes bIzquierda
|
256 |
*
|
257 |
* @return javax.swing.JButton
|
258 |
*/
|
259 |
private JToggleButton getBIzquierda() { |
260 |
if (bIzquierda == null) { |
261 |
bIzquierda = new JToggleButton(); |
262 |
bIzquierda.setSize(30, 27); |
263 |
bIzquierda.setPreferredSize(new java.awt.Dimension(28, 20)); |
264 |
bIzquierda.setLocation(60, 98); |
265 |
|
266 |
if (fframetext.getPos() == FFrameText.LEFT) {
|
267 |
bIzquierda.setSelected(true);
|
268 |
} |
269 |
|
270 |
bIzquierda.setIcon(ileft); |
271 |
bIzquierda.addActionListener(new java.awt.event.ActionListener() {
|
272 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
273 |
fframetext.setPos(FFrameText.LEFT); |
274 |
getBIzquierda().setSelected(true);
|
275 |
getBCentro().setSelected(false);
|
276 |
getBDerecha().setSelected(false);
|
277 |
} |
278 |
}); |
279 |
} |
280 |
|
281 |
return bIzquierda;
|
282 |
} |
283 |
|
284 |
/**
|
285 |
* This method initializes bCentro
|
286 |
*
|
287 |
* @return javax.swing.JButton
|
288 |
*/
|
289 |
private JToggleButton getBCentro() { |
290 |
if (bCentro == null) { |
291 |
bCentro = new JToggleButton(); |
292 |
bCentro.setSize(30, 27); |
293 |
bCentro.setPreferredSize(new java.awt.Dimension(28, 20)); |
294 |
bCentro.setLocation(93, 98); |
295 |
|
296 |
if (fframetext.getPos() == FFrameText.CENTER) {
|
297 |
bCentro.setSelected(true);
|
298 |
} |
299 |
|
300 |
bCentro.setIcon(icenterV); |
301 |
bCentro.addActionListener(new java.awt.event.ActionListener() {
|
302 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
303 |
fframetext.setPos(FFrameText.CENTER); |
304 |
getBIzquierda().setSelected(false);
|
305 |
getBCentro().setSelected(true);
|
306 |
getBDerecha().setSelected(false);
|
307 |
} |
308 |
}); |
309 |
} |
310 |
|
311 |
return bCentro;
|
312 |
} |
313 |
|
314 |
/**
|
315 |
* This method initializes bDerecha
|
316 |
*
|
317 |
* @return javax.swing.JButton
|
318 |
*/
|
319 |
private JToggleButton getBDerecha() { |
320 |
if (bDerecha == null) { |
321 |
bDerecha = new JToggleButton(); |
322 |
bDerecha.setSize(30, 27); |
323 |
bDerecha.setPreferredSize(new java.awt.Dimension(28, 20)); |
324 |
bDerecha.setLocation(126, 98); |
325 |
|
326 |
if (fframetext.getPos() == FFrameText.RIGTH) {
|
327 |
bDerecha.setSelected(true);
|
328 |
} |
329 |
|
330 |
bDerecha.setIcon(iright); |
331 |
bDerecha.addActionListener(new java.awt.event.ActionListener() {
|
332 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
333 |
fframetext.setPos(FFrameText.RIGTH); |
334 |
getBIzquierda().setSelected(false);
|
335 |
getBCentro().setSelected(false);
|
336 |
getBDerecha().setSelected(true);
|
337 |
} |
338 |
}); |
339 |
} |
340 |
|
341 |
return bDerecha;
|
342 |
} |
343 |
|
344 |
/**
|
345 |
* This method initializes jComboBox
|
346 |
*
|
347 |
* @return javax.swing.JComboBox
|
348 |
*/
|
349 |
private javax.swing.JComboBox getJComboBox() {
|
350 |
if (jComboBox == null) { |
351 |
jComboBox = new javax.swing.JComboBox();
|
352 |
jComboBox.addItem("0"); //$NON-NLS-1$ |
353 |
jComboBox.addItem("1"); //$NON-NLS-1$ |
354 |
jComboBox.addItem("2"); //$NON-NLS-1$ |
355 |
|
356 |
//jComboBox.setSelectedIndex(fframetext.getSpace());
|
357 |
jComboBox.setSize(102, 20); |
358 |
jComboBox.setPreferredSize(new java.awt.Dimension(45, 20)); |
359 |
jComboBox.setLocation(130, 140); |
360 |
jComboBox.addActionListener(new java.awt.event.ActionListener() {
|
361 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
362 |
//fframetext.setSpace(jComboBox.getSelectedIndex());
|
363 |
} |
364 |
}); |
365 |
} |
366 |
|
367 |
return jComboBox;
|
368 |
} |
369 |
|
370 |
/**
|
371 |
* This method initializes jLabel2
|
372 |
*
|
373 |
* @return javax.swing.JLabel
|
374 |
*/
|
375 |
private javax.swing.JLabel getJLabel2() {
|
376 |
if (jLabel2 == null) { |
377 |
jLabel2 = new javax.swing.JLabel();
|
378 |
jLabel2.setSize(34, 16); |
379 |
jLabel2.setText(PluginServices.getText(this, "__lineas")); //$NON-NLS-1$ |
380 |
jLabel2.setLocation(238, 141); |
381 |
} |
382 |
|
383 |
return jLabel2;
|
384 |
} |
385 |
|
386 |
/**
|
387 |
* This method initializes lRotacion
|
388 |
*
|
389 |
* @return javax.swing.JLabel
|
390 |
*/
|
391 |
private javax.swing.JLabel getLRotacion() {
|
392 |
if (lRotacion == null) { |
393 |
lRotacion = new javax.swing.JLabel();
|
394 |
lRotacion.setBounds(6, 131, 109, 16); |
395 |
lRotacion.setText(PluginServices.getText(this, "angulo_rotacion")); //$NON-NLS-1$ |
396 |
} |
397 |
|
398 |
return lRotacion;
|
399 |
} |
400 |
|
401 |
/**
|
402 |
* This method initializes chbEscalaVista
|
403 |
*
|
404 |
* @return javax.swing.JCheckBox
|
405 |
*/
|
406 |
private javax.swing.JCheckBox getChkEscalaVista() {
|
407 |
if (chkEscalaVista == null) { |
408 |
chkEscalaVista = new javax.swing.JCheckBox();
|
409 |
chkEscalaVista.setSize(280, 20); |
410 |
chkEscalaVista.setText( |
411 |
PluginServices.getText(this, "__redimensionar_texto_escala")); //$NON-NLS-1$ |
412 |
chkEscalaVista.setSelected(fframetext.isSizeFixed()); |
413 |
chkEscalaVista.setLocation(6, 153); |
414 |
chkEscalaVista.setEnabled(true);
|
415 |
} |
416 |
|
417 |
return chkEscalaVista;
|
418 |
} |
419 |
|
420 |
/**
|
421 |
* This method initializes bAceptar
|
422 |
*
|
423 |
* @return javax.swing.JButton
|
424 |
*/
|
425 |
private javax.swing.JButton getBAceptar() {
|
426 |
if (bAceptar == null) { |
427 |
bAceptar = new javax.swing.JButton();
|
428 |
bAceptar.setSize(79, 26); |
429 |
bAceptar.setText(PluginServices.getText(this, "Aceptar")); //$NON-NLS-1$ |
430 |
bAceptar.setLocation(39, 388); |
431 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
432 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
433 |
fframetext.setBoundBox(FLayoutUtilities.toSheetRect( |
434 |
rect, m_layout.getAT())); |
435 |
fframetext.getText().clear(); |
436 |
|
437 |
for (int i = 0; i < getTaTexto().getLineCount(); i++) { |
438 |
try {
|
439 |
String s = getTaTexto().getText(getTaTexto()
|
440 |
.getLineStartOffset(i), |
441 |
getTaTexto().getLineEndOffset(i) - |
442 |
getTaTexto().getLineStartOffset(i)); |
443 |
|
444 |
if (!s.equals("")) { //$NON-NLS-1$ |
445 |
fframetext.addText(s); |
446 |
} |
447 |
} catch (Exception ex) { |
448 |
} |
449 |
} |
450 |
fframetext.setTextColor(textcolor); |
451 |
fframetext.setSizeFixed(!getChkEscalaVista().isSelected()); |
452 |
|
453 |
// jaume
|
454 |
boolean b = getChkSurroundingRectangle().isSelected();
|
455 |
fframetext.setSurrounded(getChkSurroundingRectangle().isSelected()); |
456 |
|
457 |
if (b){
|
458 |
// Hay rect?ngulo
|
459 |
fframetext.setCellPadding(Integer.parseInt(getTxtCellPadding().getText()));
|
460 |
int i;
|
461 |
try{
|
462 |
i = Integer.parseInt(getTxtFrameSize().getText());
|
463 |
} catch (Exception ex){ |
464 |
i = 0;
|
465 |
} |
466 |
if (i==0) i = 1; |
467 |
fframetext.setFrameBorderSize(i); |
468 |
fframetext.setFrameColor(frameColor); |
469 |
} |
470 |
b=getChkFontSize().isSelected(); |
471 |
fframetext.setFixedFontSize(b); |
472 |
|
473 |
if (b){
|
474 |
// El tama?o de la fuente es fijo
|
475 |
int i;
|
476 |
try{
|
477 |
i = Integer.parseInt(getTxtFontSize().getText());
|
478 |
} catch (Exception ex){ |
479 |
i = 12;
|
480 |
} |
481 |
fframetext.setFontSize(i); |
482 |
} |
483 |
b=getChkTitle().isSelected(); |
484 |
fframetext.setHasTitle(b); |
485 |
if (b){
|
486 |
// Hay t?tulo
|
487 |
fframetext.setTitle(getTxtTitle().getText()); |
488 |
int i;
|
489 |
try{
|
490 |
i = Integer.parseInt(getTxtTitleSize().getText());
|
491 |
} catch (Exception ex){ |
492 |
i = 12;
|
493 |
} |
494 |
fframetext.setTitleSize(i); |
495 |
|
496 |
fframetext.setTitleColor(titleColor); |
497 |
} |
498 |
|
499 |
fframetext.setRotation(getPRotation().getRotation()); |
500 |
PluginServices.getMDIManager().closeView(FFrameTextDialog.this); |
501 |
m_layout.refresh(); |
502 |
isAcepted = true;
|
503 |
} |
504 |
}); |
505 |
} |
506 |
|
507 |
return bAceptar;
|
508 |
} |
509 |
|
510 |
/**
|
511 |
* This method initializes bCancelar
|
512 |
*
|
513 |
* @return javax.swing.JButton
|
514 |
*/
|
515 |
private javax.swing.JButton getBCancelar() {
|
516 |
if (bCancelar == null) { |
517 |
bCancelar = new javax.swing.JButton();
|
518 |
bCancelar.setSize(85, 26); |
519 |
bCancelar.setText(PluginServices.getText(this, "Cancelar")); //$NON-NLS-1$ |
520 |
bCancelar.setLocation(144, 388); |
521 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
522 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
523 |
PluginServices.getMDIManager().closeView(FFrameTextDialog.this); |
524 |
} |
525 |
}); |
526 |
} |
527 |
|
528 |
return bCancelar;
|
529 |
} |
530 |
|
531 |
/* (non-Javadoc)
|
532 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
533 |
*/
|
534 |
public ViewInfo getViewInfo() {
|
535 |
ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
|
536 |
|
537 |
//vi.setResizable(false);
|
538 |
m_viewinfo.setTitle(PluginServices.getText(this, "Propiedades_texto")); //$NON-NLS-1$ |
539 |
|
540 |
return m_viewinfo;
|
541 |
} |
542 |
|
543 |
/**
|
544 |
* @see com.iver.cit.gvsig.gui.layout.fframes.dialogs.IFFrameDialog#getIsAcepted()
|
545 |
*/
|
546 |
public boolean getIsAcepted() { |
547 |
return isAcepted;
|
548 |
} |
549 |
|
550 |
/**
|
551 |
* This method initializes bFuente
|
552 |
*
|
553 |
* @return javax.swing.JButton
|
554 |
*/
|
555 |
private javax.swing.JButton getBFuente() {
|
556 |
if (bFuente == null) { |
557 |
bFuente = new javax.swing.JButton();
|
558 |
bFuente.setBounds(157, 98, 73, 27); |
559 |
bFuente.setText(PluginServices.getText(this, "fuente")); //$NON-NLS-1$ |
560 |
bFuente.addActionListener(new java.awt.event.ActionListener() {
|
561 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
562 |
fframetext.setFont(FontChooser.showDialog( |
563 |
PluginServices.getText(this, "__seleccion_de_fuente"), fframetext.getFont())); // fchoser=new FontChooser(); //$NON-NLS-1$ |
564 |
} |
565 |
}); |
566 |
} |
567 |
|
568 |
return bFuente;
|
569 |
} |
570 |
|
571 |
/**
|
572 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
573 |
*/
|
574 |
public void viewActivated() { |
575 |
} |
576 |
/**
|
577 |
* This method initializes jButton
|
578 |
*
|
579 |
* @return javax.swing.JButton
|
580 |
*/
|
581 |
private JButton getJButton() { |
582 |
if (jButton == null) { |
583 |
jButton = new JButton(); |
584 |
jButton.setForeground(Color.white);
|
585 |
jButton.setBackground(textcolor); |
586 |
jButton.setBounds(235, 98, 32, 27); |
587 |
jButton.addActionListener(new java.awt.event.ActionListener() {
|
588 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
589 |
JDialog dlg;
|
590 |
JColorChooser colorChooser;
|
591 |
colorChooser = new JColorChooser(); |
592 |
dlg = JColorChooser.createDialog((JFrame) null, |
593 |
PluginServices.getText(this, "Elegir_Color"), |
594 |
true, colorChooser, null, null); |
595 |
dlg.show(true);
|
596 |
|
597 |
textcolor = (Color) colorChooser.getColor();
|
598 |
|
599 |
//getJPanel1().setBackground(textcolor);
|
600 |
jButton.setBackground(textcolor); |
601 |
|
602 |
} |
603 |
}); |
604 |
} |
605 |
return jButton;
|
606 |
} |
607 |
/**
|
608 |
* This method initializes chbSurroundingRectangle
|
609 |
*
|
610 |
* @return javax.swing.JCheckBox
|
611 |
* @author jaume
|
612 |
*/
|
613 |
private JCheckBox getChkSurroundingRectangle() { |
614 |
if (chkSurroundingRectangle == null) { |
615 |
chkSurroundingRectangle = new JCheckBox(); |
616 |
chkSurroundingRectangle.setText(PluginServices.getText(this, "usar_marco")); |
617 |
chkSurroundingRectangle.setSelected(fframetext.isSurrounded()); |
618 |
chkSurroundingRectangle.setBounds(5, 20, 143, 19); |
619 |
chkSurroundingRectangle.addItemListener(new java.awt.event.ItemListener() {
|
620 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
621 |
getTxtCellPadding().setEnabled(getChkSurroundingRectangle().isSelected()); |
622 |
getTxtFrameSize().setEnabled(getChkSurroundingRectangle().isSelected()); |
623 |
} |
624 |
}); |
625 |
} |
626 |
return chkSurroundingRectangle;
|
627 |
} |
628 |
/**
|
629 |
* This method initializes txtCellPadding
|
630 |
*
|
631 |
* @author jaume
|
632 |
*
|
633 |
* @return javax.swing.JTextField
|
634 |
*/
|
635 |
private JTextField getTxtCellPadding() { |
636 |
if (txtCellPadding == null) { |
637 |
txtCellPadding = new JTextField(); |
638 |
txtCellPadding.setEnabled(fframetext.isSurrounded()); |
639 |
txtCellPadding.setText(fframetext.getCellPadding()+"");
|
640 |
txtCellPadding.setSize(60, 20); |
641 |
txtCellPadding.setLocation(153, 74); |
642 |
txtCellPadding.addKeyListener(new java.awt.event.KeyAdapter() {
|
643 |
public void keyReleased(java.awt.event.KeyEvent e) { |
644 |
ensureInteger(txtCellPadding); |
645 |
} |
646 |
}); |
647 |
|
648 |
} |
649 |
return txtCellPadding;
|
650 |
} |
651 |
/**
|
652 |
* This method initializes chkFontSize
|
653 |
*
|
654 |
* @return javax.swing.JCheckBox
|
655 |
*/
|
656 |
private JCheckBox getChkFontSize() { |
657 |
if (chkFontSize == null) { |
658 |
chkFontSize = new JCheckBox(); |
659 |
chkFontSize.setBounds(6, 174, 143, 19); |
660 |
chkFontSize.setText(PluginServices.getText(this, "tamanyo_fuente")); |
661 |
chkFontSize.setSelected(fframetext.isFontSizeFixed()); |
662 |
chkFontSize.addItemListener(new java.awt.event.ItemListener() {
|
663 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
664 |
getTxtFontSize().setEnabled(getChkFontSize().isSelected()); |
665 |
} |
666 |
}); |
667 |
} |
668 |
return chkFontSize;
|
669 |
} |
670 |
/**
|
671 |
* This method initializes txtFontSize
|
672 |
*
|
673 |
* @return javax.swing.JTextField
|
674 |
*/
|
675 |
private JTextField getTxtFontSize() { |
676 |
if (txtFontSize == null) { |
677 |
txtFontSize = new JTextField(); |
678 |
txtFontSize.setBounds(153, 176, 64, 17); |
679 |
txtFontSize.setEnabled(fframetext.isFontSizeFixed()); |
680 |
if (txtFontSize.isEnabled()) txtFontSize.setText(fframetext.getFontSize()+""); |
681 |
txtFontSize.addKeyListener(new java.awt.event.KeyAdapter() {
|
682 |
public void keyReleased(java.awt.event.KeyEvent e) { |
683 |
ensureInteger(txtFontSize); |
684 |
} |
685 |
}); |
686 |
} |
687 |
return txtFontSize;
|
688 |
} |
689 |
/**
|
690 |
* This method initializes chkTitle2
|
691 |
*
|
692 |
* @return javax.swing.JCheckBox
|
693 |
*/
|
694 |
private JCheckBox getChkTitle() { |
695 |
if (chkTitle == null) { |
696 |
chkTitle = new JCheckBox(); |
697 |
chkTitle.setText(PluginServices.getText(this, "usar_titulo")); |
698 |
chkTitle.setSelected(fframetext.hasTitle()); |
699 |
chkTitle.setBounds(6, 17, 85, 19); |
700 |
chkTitle.addChangeListener(new javax.swing.event.ChangeListener() {
|
701 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
702 |
getTxtTitle().setEnabled(chkTitle.isSelected()); |
703 |
getTxtTitleSize().setEnabled(chkTitle.isSelected()); |
704 |
jLabel3.setEnabled(chkTitle.isSelected()); |
705 |
} |
706 |
}); |
707 |
} |
708 |
return chkTitle;
|
709 |
} |
710 |
/**
|
711 |
* This method initializes txtTitle
|
712 |
*
|
713 |
* @return javax.swing.JTextField
|
714 |
*/
|
715 |
private JTextField getTxtTitle() { |
716 |
if (txtTitle == null) { |
717 |
txtTitle = new JTextField(); |
718 |
txtTitle.setEnabled(fframetext.hasTitle()); |
719 |
if (fframetext.hasTitle())
|
720 |
txtTitle.setText(fframetext.getTitle()); |
721 |
txtTitle.setBounds(92, 17, 175, 20); |
722 |
} |
723 |
return txtTitle;
|
724 |
} |
725 |
/**
|
726 |
* This method initializes jPanel
|
727 |
*
|
728 |
* @return javax.swing.JPanel
|
729 |
*/
|
730 |
private JPanel getJPanel() { |
731 |
if (jPanel == null) { |
732 |
jPanel = new JPanel(); |
733 |
jLabel3 = new JLabel(); |
734 |
jPanel.setLayout(null);
|
735 |
jPanel.setBounds(4, 307, 273, 76); |
736 |
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
737 |
null, PluginServices.getText(this, "titulo_fframetext"), |
738 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
739 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
740 |
jLabel3.setBounds(9, 45, 109, 22); |
741 |
jLabel3.setText(PluginServices.getText(this, "tamanyo_fuente")); |
742 |
jLabel3.setEnabled(fframetext.hasTitle()); |
743 |
jPanel.add(getTxtTitleSize(), null);
|
744 |
jPanel.add(jLabel3, null);
|
745 |
jPanel.add(getChkTitle(), null);
|
746 |
jPanel.add(getTxtTitle(), null);
|
747 |
jLabel4 = new JLabel(); |
748 |
jLabel4.setBounds(190, 45, 40, 16); |
749 |
jPanel.add(jLabel4, null);
|
750 |
jLabel4.setText(PluginServices.getText(this, "pixeles")); |
751 |
jPanel.add(getJButton2(), null);
|
752 |
|
753 |
} |
754 |
return jPanel;
|
755 |
} |
756 |
/**
|
757 |
* This method initializes txtTitleSize
|
758 |
*
|
759 |
* @return javax.swing.JTextField
|
760 |
*/
|
761 |
private JTextField getTxtTitleSize() { |
762 |
if (txtTitleSize == null) { |
763 |
txtTitleSize = new JTextField(); |
764 |
txtTitleSize.setBounds(121, 45, 64, 20); |
765 |
txtTitleSize.setEnabled(fframetext.hasTitle()); |
766 |
int i = fframetext.getTitleSize();
|
767 |
if (i == 0 && !txtTitleSize.isEnabled()) i = 5; |
768 |
txtTitleSize.setText(i+"");
|
769 |
txtTitleSize.addKeyListener(new java.awt.event.KeyAdapter() {
|
770 |
public void keyReleased(java.awt.event.KeyEvent e) { |
771 |
ensureInteger(txtTitleSize); |
772 |
} |
773 |
}); |
774 |
} |
775 |
return txtTitleSize;
|
776 |
} |
777 |
|
778 |
/**
|
779 |
* Asegura cutremente que no se meten valores que no sean.
|
780 |
* El funcionamiento consiste en si el ?ltimo car?cter escrito
|
781 |
* no vale para formar un int entonces se elimina.
|
782 |
*
|
783 |
* enteros.
|
784 |
* @param tf
|
785 |
*/
|
786 |
private void ensureInteger(JTextField tf){ |
787 |
String s = tf.getText();
|
788 |
try {
|
789 |
Integer.parseInt(s);
|
790 |
} catch (Exception e){ |
791 |
if (s.length()!=0) |
792 |
tf.setText(s.substring(0, s.length()-1)); |
793 |
else tf.setText(""); |
794 |
} |
795 |
} |
796 |
/**
|
797 |
* This method initializes jPanel1
|
798 |
*
|
799 |
* @return javax.swing.JPanel
|
800 |
*/
|
801 |
private JPanel getJPanel1() { |
802 |
if (jPanel1 == null) { |
803 |
jPanel1 = new JPanel(); |
804 |
jLabel5 = new JLabel(); |
805 |
jLabel6 = new JLabel(); |
806 |
jLabel7 = new JLabel(); |
807 |
jPanel1.setLayout(null);
|
808 |
jPanel1.setBounds(4, 199, 273, 106); |
809 |
jPanel1.add(getTxtCellPadding(), null);
|
810 |
jPanel1.add(getChkSurroundingRectangle(), null);
|
811 |
jPanel1.add(jLabel, null);
|
812 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
813 |
null, PluginServices.getText(this, "marco"), |
814 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
815 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
816 |
jLabel5.setText(PluginServices.getText(this, "pixeles")); |
817 |
jLabel5.setLocation(226, 46); |
818 |
jLabel5.setSize(40, 16); |
819 |
jLabel5.setPreferredSize(new java.awt.Dimension(40,16)); |
820 |
jLabel6.setBounds(44, 47, 100, 20); |
821 |
jLabel6.setText(PluginServices.getText(this, "tamanyo_borde")); |
822 |
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
823 |
jLabel7.setBounds(44, 73, 100, 20); |
824 |
jLabel7.setText(PluginServices.getText(this, "margenes")); |
825 |
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
826 |
jPanel1.add(getTxtFrameSize(), null);
|
827 |
jPanel1.add(jLabel6, null);
|
828 |
jPanel1.add(jLabel7, null);
|
829 |
jPanel1.add(jLabel5, null);
|
830 |
jPanel1.add(getJButton1(), null);
|
831 |
} |
832 |
return jPanel1;
|
833 |
} |
834 |
/**
|
835 |
* This method initializes txtFrameSize
|
836 |
*
|
837 |
* @return javax.swing.JTextField
|
838 |
*/
|
839 |
private JTextField getTxtFrameSize() { |
840 |
if (txtFrameSize == null) { |
841 |
txtFrameSize = new JTextField(); |
842 |
txtFrameSize.setEnabled(fframetext.isSurrounded()); |
843 |
//if (txtFrameSize.isEnabled()){
|
844 |
int i = fframetext.getFrameBorderSize();
|
845 |
if (i==0) i = 1; |
846 |
txtFrameSize.setText(i+"");
|
847 |
//}
|
848 |
txtFrameSize.setLocation(153, 47); |
849 |
txtFrameSize.setSize(60, 20); |
850 |
} |
851 |
return txtFrameSize;
|
852 |
} |
853 |
/**
|
854 |
* This method initializes jButton1
|
855 |
*
|
856 |
* @return javax.swing.JButton
|
857 |
*/
|
858 |
private JButton getJButton1() { |
859 |
if (jButton1 == null) { |
860 |
jButton1 = new JButton(); |
861 |
jButton1.setForeground(fframetext.getFrameColor()); |
862 |
jButton1.setBackground(fframetext.getFrameColor()); |
863 |
jButton1.setBounds(229, 12, 32, 27); |
864 |
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
865 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
866 |
// color del marco
|
867 |
JDialog dlg;
|
868 |
JColorChooser colorChooser;
|
869 |
colorChooser = new JColorChooser(); |
870 |
dlg = JColorChooser.createDialog((JFrame) null, |
871 |
PluginServices.getText(this, "Elegir_Color"), |
872 |
true, colorChooser, null, null); |
873 |
dlg.show(true);
|
874 |
|
875 |
frameColor = (Color) colorChooser.getColor();
|
876 |
|
877 |
//getJPanel1().setBackground(textcolor);
|
878 |
jButton1.setBackground(frameColor); |
879 |
} |
880 |
}); |
881 |
} |
882 |
return jButton1;
|
883 |
} |
884 |
/**
|
885 |
* This method initializes jButton2
|
886 |
*
|
887 |
* @return javax.swing.JButton
|
888 |
*/
|
889 |
private JButton getJButton2() { |
890 |
if (jButton2 == null) { |
891 |
jButton2 = new JButton(); |
892 |
jButton2.setForeground(fframetext.getTitleColor()); |
893 |
jButton2.setBackground(fframetext.getTitleColor()); |
894 |
jButton2.addActionListener(new java.awt.event.ActionListener() {
|
895 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
896 |
// color del t?tulo
|
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 |
titleColor = (Color) colorChooser.getColor();
|
906 |
jButton2.setBackground(titleColor); |
907 |
} |
908 |
}); |
909 |
|
910 |
jButton2.setBounds(235, 40, 32, 27); |
911 |
} |
912 |
return jButton2;
|
913 |
} |
914 |
|
915 |
/**
|
916 |
* This method initializes pRotation
|
917 |
*
|
918 |
* @return javax.swing.JPanel
|
919 |
*/
|
920 |
private JPRotation getPRotation() {
|
921 |
if (pRotation == null) { |
922 |
pRotation = new JPRotation();
|
923 |
pRotation.setBounds(281, 13, 125, 131); |
924 |
} |
925 |
return pRotation;
|
926 |
} |
927 |
} // @jve:decl-index=0:visual-constraint="10,10"
|