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