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