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