Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / fframes / FFrameText.java @ 28368

History | View | Annotate | Download (24.2 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;
46

    
47
import java.awt.BasicStroke;
48
import java.awt.Color;
49
import java.awt.Font;
50
import java.awt.Graphics2D;
51
import java.awt.font.FontRenderContext;
52
import java.awt.font.TextLayout;
53
import java.awt.geom.AffineTransform;
54
import java.awt.geom.Rectangle2D;
55
import java.awt.image.BufferedImage;
56
import java.util.ArrayList;
57

    
58
import javax.print.attribute.PrintRequestAttributeSet;
59

    
60
import com.iver.andami.PluginServices;
61
import com.iver.cit.gvsig.fmap.core.FShape;
62
import com.iver.cit.gvsig.project.documents.exceptions.SaveException;
63
import com.iver.cit.gvsig.project.documents.layout.FLayoutUtilities;
64
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.FFrameTextDialog;
65
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog;
66
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
67
import com.iver.utiles.StringUtilities;
68
import com.iver.utiles.XMLEntity;
69

    
70

    
71
/**
72
 * FFrame para introducir un texto en el Layout.
73
 *
74
 * @author Vicente Caballero Navarro
75
 */
76
public class FFrameText extends FFrame {
77
    /** Localizaci?n del texto. */
78
    public static final int LEFT = 0;
79
    public static final int CENTER = 1;
80
    public static final int RIGTH = 2;
81
    private ArrayList m_text = new ArrayList();
82
    private boolean m_isFixed = false;
83
    private int m_pos = LEFT;
84
    private Color textColor = Color.BLACK;
85

    
86
    //jaume
87
    private boolean surrounded = false; // The text field is surrounded by a rectangle
88
    private double cellPadding = 0; // The gap between the the text field and the surrounding rectangle
89
    private boolean fixedFontSize = false; // The text field font size is constant fixed to the folio's size
90
    private int fontSize; // Text field's font size
91
    private boolean hasTitle; // The text field has title
92
    private String title; // The text for the title
93
    private int titleSize; // The title's font size
94
    private double frameBorderSize = 0; // The surrounding rectangle's border size
95
    private Color frameColor = Color.BLACK; // The surrounding rectangle's color
96
    private Color titleColor = Color.BLACK; // The title's color
97
    private Font m_f = null;
98
    private boolean transicionPixelsMilimetros = true;
99
        private PrintRequestAttributeSet properties;
100

    
101
    /**
102
     * Crea un nuevo FFrameText.
103
     */
104
    public FFrameText() {
105
        m_f = new Font("SansSerif", Font.PLAIN, 9);
106
    }
107

    
108
    /**
109
     * Inserta la fuente del texto.
110
     *
111
     * @param f Fuente del texto.
112
     */
113
    public void setFont(Font f) {
114
        m_f = f;
115
    }
116

    
117
    /**
118
     * Devuelve el color del texto del FFrameText.
119
     *
120
     * @return Color del texto.
121
     */
122
    public Color getTextColor() {
123
        return textColor;
124
    }
125

    
126
    /**
127
     * Obtiene el fixedFontSize
128
     *
129
     * @return boolean
130
     */
131
    public boolean isFontSizeFixed() {
132
        return fixedFontSize;
133
    }
134

    
135
    /**
136
     * Establece fixedFontSize
137
     *
138
     * @param fixedFontSize
139
     */
140
    public void setFixedFontSize(boolean fixedFontSize) {
141
        this.fixedFontSize = fixedFontSize;
142
    }
143

    
144
    /**
145
     * Obtiene el fontSize
146
     *
147
     * @return int
148
     */
149
    public int getFontSize() {
150
        return fontSize;
151
    }
152

    
153
    /**
154
     * Establece fontSize
155
     *
156
     * @param fontSize
157
     */
158
    public void setFontSize(int fontSize) {
159
        this.fontSize = fontSize;
160
    }
161

    
162
    /**
163
     * Obtiene el cellPadding
164
     *
165
     * @return int
166
     */
167
    public double getCellPadding() {
168
        return cellPadding;
169
    }
170

    
171
    /**
172
     * Inserta el color del texto a escribir.
173
     *
174
     * @param color Color del texto.
175
     */
176
    public void setTextColor(Color color) {
177
        textColor = color;
178
    }
179

    
180
    /**
181
     * Devuelve la fuente del texto.
182
     *
183
     * @return Fuente del texto.
184
     */
185
    public Font getFont() {
186
        return new Font(m_f.getFontName(), m_f.getStyle(), 9);
187
    }
188

    
189
    /**
190
     * Devuelve la posici?n izquierda, centro o derecha del texto.
191
     *
192
     * @return Posici?n del texto.
193
     */
194
    public int getPos() {
195
        return m_pos;
196
    }
197

    
198
    /**
199
     * Pone la posici?n izquierda, centro o derecha del texto.
200
     *
201
     * @param p 0=LEFT,1=CENTER,2=RIGTH.
202
     */
203
    public void setPos(int p) {
204
        m_pos = p;
205
    }
206

    
207
    /**
208
     * M?todo que dibuja sobre el graphics que se le pasa como par?metro, seg?n
209
     * la transformada afin que se debe de aplicar y el rect?ngulo que se debe
210
     * de dibujar.
211
     *
212
     * @param g Graphics
213
     * @param at Transformada af?n.
214
     * @param rv rect?ngulo sobre el que hacer un clip.
215
     * @param imgBase Imagen para acelerar el dibujado.
216
     */
217
    public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv,
218
        BufferedImage imgBase) {
219
        g.setColor(Color.BLACK);
220

    
221
        Rectangle2D.Double rec = getBoundingBox(at);
222
        Rectangle2D.Double raux = (Rectangle2D.Double) rec.clone();
223
        g.rotate(Math.toRadians(getRotation()), raux.x + (raux.width / 2),
224
            raux.y + (raux.height / 2));
225

    
226
        int longmax = 1;
227

    
228
        if (intersects(rv, raux)) { // comprueba que no cae fuera de la pantalla
229

    
230
            if (m_text.isEmpty()) {
231
                drawEmpty(g);
232
            } else {
233
                for (int i = 0; i < m_text.size(); i++) {
234
                    if (m_text.get(i) == null) {
235
                        m_text.set(i, "<NULL>");
236
                    }
237
                    String text=(String)m_text.get(i);
238
                    if (text.length() > longmax) {
239
                        longmax = text.length();
240
                    }
241
                }
242

    
243
                FontRenderContext frc = g.getFontRenderContext();
244
                int scaledFontSize;
245

    
246
                // TODO myScale es la escala sobre la que se extraen todos los escalados. Esto
247
                // funciona bien tal cual est? si la ratio de aspecto (alto/ancho) del folio es constante
248
                // porque se toma como medidas el ancho del folio real y el ancho del folio en pantalla.
249
                // No se que pasar? si la ratio cambia, por ejemplo si se usan USLetter en lugar de DIN A4
250
                double myScale = at.getScaleX() * 0.0234; //FLayoutUtilities.fromSheetDistance(folio.getAncho(),at)/rv.getWidth();
251

    
252
                // Distinguish when the font has fixed size or not
253
                if (isFontSizeFixed()) {
254
                    scaledFontSize = (int) (myScale * fontSize);
255
                } else {
256
                    scaledFontSize = ((int) (raux.width)) / longmax;
257

    
258
                    if (scaledFontSize > (int) ((raux.height) / m_text.size())) {
259
                        scaledFontSize = (int) ((raux.height) / m_text.size());
260
                    }
261
                }
262

    
263
                if (m_f != null) {
264
                    // Aqu? se ajusta a partir de las caracter?sticas de la fuente, una nueva fuente con el tama?o ajustado.
265
                    m_f = new Font(m_f.getFontName(), m_f.getStyle(),
266
                            scaledFontSize);
267
                } else {
268
                    // Aqu? pasa cuando se abre el di?logo para seleccionar un tipo de fuente y se cierra sin haber seleccionado ninguna.
269
                    m_f = new Font("SansSerif", Font.PLAIN, scaledFontSize);
270
                }
271

    
272
                // Draw the text title if it exists
273
                if (hasTitle()) {
274
                    int scaledTitleFontSize = (int) (myScale * titleSize);
275
                    int gap = 3;
276

    
277
                    if (isSurrounded()) {
278
                        // Para evitar que el marco se pinte sobre el t?tulo
279
                        gap += (int) (FLayoutUtilities.fromSheetDistance(frameBorderSize,
280
                            at) * myScale);
281
                    }
282

    
283
                    g.setColor(titleColor);
284

    
285
                    Font titleFont = new Font(m_f.getFontName(),
286
                            m_f.getStyle(), scaledTitleFontSize);
287

    
288
                    if (!getTitle().equals("")) {
289
                        TextLayout titleTextLayout = new TextLayout(getTitle(),
290
                                titleFont, frc);
291
                        titleTextLayout.draw(g, (float) raux.getX(),
292
                            (float) (raux.getY() - (gap * myScale)));
293
                    }
294
                }
295

    
296
                // Draw the frame involving the text if it exists
297
                if (isSurrounded()) {
298
                    g.setColor(frameColor);
299
//                    g.drawRect((int) raux.x, (int) raux.y, (int) raux.width,
300
//                        (int) raux.height);
301

    
302
                    double scaledCellPadding = FLayoutUtilities.fromSheetDistance(cellPadding,
303
                            at);
304
                    double sizeBorder = FLayoutUtilities.fromSheetDistance(frameBorderSize,
305
                            at);
306

    
307
//                  if (sizeBorder > 1) {
308
                    int bordermm = (int)(sizeBorder*10);
309
                    int scaledCellPaddingmm = (int)(scaledCellPadding*10);
310
//                    System.out.println("borderSize = " + bordermm);
311
                        g.setStroke(new BasicStroke(bordermm));
312
//                        int scaledBorderSize = (int) (sizeBorder * myScale);
313

    
314
//                        for (int i = scaledBorderSize - 1; i > 0; i--)
315
//                            g.drawRect((int) raux.x - i, (int) raux.y - i,
316
//                                (int) raux.width + (2 * i),
317
//                                (int) raux.height + (2 * i));
318
                        g.drawRect((int) (raux.x+bordermm/2-1), (int) (raux.y+bordermm/2-1),
319
                                (int) (raux.width-bordermm+2),
320
                                (int) (raux.height-bordermm+2));
321
                        g.setStroke(new BasicStroke(0));
322
                    //}
323

    
324
                    // Recalibro el rectangulo para establecer el ?rea donde se dibujan las fuentes
325
                    // al ?rea marcada con el rat?n menos la distancia al marco especificada
326
                    raux.setRect(raux.getX() + scaledCellPaddingmm + bordermm,
327
                        raux.getY() + scaledCellPaddingmm + bordermm,
328
                        raux.getWidth() - (scaledCellPaddingmm * 2) - bordermm * 2,
329
                        raux.getHeight() - (scaledCellPaddingmm * 2) - bordermm * 2);
330

    
331
                    if (raux.getWidth()<=0 || raux.getHeight()<=0){
332
                                                //JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this,"too_large_border")+": "+bordermm+ " + "+scaledCellPaddingmm);
333
                                                g.setColor(Color.red);
334
                                                drawError(getBoundingBox(at), 15, g,PluginServices.getText(this,"too_large_border")+": "+frameBorderSize+ "cm + "+cellPadding+"cm");
335
                                                g.rotate(Math.toRadians(-getRotation()),
336
                                                    raux.x + (raux.width / 2), raux.y + (raux.height / 2));
337
                                                return;
338
                                        }
339
                }
340

    
341
                g.setColor(textColor);
342

    
343
                drawText(raux, scaledFontSize, g);
344

    
345
            }
346
        }
347
        g.rotate(Math.toRadians(-getRotation()),
348
                raux.x + (raux.width / 2), raux.y + (raux.height / 2));
349
        raux = null;
350
    }
351
    private void drawError(Rectangle2D r, int sfs, Graphics2D g,String error) {
352
            FontRenderContext frc = g.getFontRenderContext();
353
        TextLayout textLayout = null;
354
               m_f = new Font(m_f.getFontName(), m_f.getStyle(), sfs);
355
        textLayout = new TextLayout(error, m_f, frc);
356
        textLayout.draw(g, (float) r.getCenterX(),
357
                            (float) (r.getCenterY()));
358

    
359
        }
360
    /**
361
     * Dibuja el texto sobre el graphics con el tama?o adecuado.
362
     *
363
     * @param r Rect?ngulo sobre el que dibujar.
364
     * @param sfs Tama?o aproximado del texto.
365
     * @param g Graphics sobre el que dibujar el texto.
366
     */
367
    private void drawText(Rectangle2D r, int sfs, Graphics2D g) {
368
        int minSFS = Integer.MAX_VALUE;
369
        FontRenderContext frc = g.getFontRenderContext();
370
        int ht = (int) (r.getHeight() / m_text.size());
371

    
372
        if (isFontSizeFixed()) {
373
            minSFS = sfs;
374
        } else {
375
            for (int i = 0; i < m_text.size(); i++) {
376
                if (!((String) m_text.get(i)).equals("") && !((String) m_text.get(i)).equals("\n")) {
377
                    TextLayout textaux = new TextLayout((String) m_text.get(i),
378
                            m_f, frc);
379
                    Rectangle2D txtBound = textaux.getBounds();
380
                    double difW = txtBound.getWidth() / r.getWidth();
381
                    double difH = (txtBound.getHeight() * m_text.size()) / (r.getHeight());
382

    
383
                    if (difW > difH) {
384
                        if (minSFS > sfs) {
385
                            minSFS = (int) (sfs / difW);
386
                        }
387
                    } else {
388
                        if (minSFS > sfs) {
389
                            minSFS = (int) (sfs / difH);
390
                        }
391
                    }
392
                }
393
            }
394
        }
395

    
396
        TextLayout textLayout = null;
397

    
398
        for (int i = 0; i < m_text.size(); i++) {
399
            if (!((String) m_text.get(i)).equals("")) {
400
                    m_f = new Font(m_f.getFontName(), m_f.getStyle(), minSFS);
401

    
402
                textLayout = new TextLayout((String) m_text.get(i), m_f, frc);
403

    
404
                Rectangle2D txtBound = textLayout.getBounds();
405
                float difW = (float) (r.getWidth() - txtBound.getWidth());
406

    
407
                switch (m_pos) {
408
                    case (LEFT):
409
                        textLayout.draw(g, (float) r.getX(),
410
                            (float) (r.getY() + (ht * (i + 0.8))));
411

    
412
                        break;
413

    
414
                    case (CENTER):
415
                        textLayout.draw(g, (float) r.getX() + (difW / 2),
416
                            (float) (r.getY() + (ht * (i + 0.8))));
417

    
418
                        break;
419

    
420
                    case (RIGTH):
421
                        textLayout.draw(g, (float) r.getX() + difW,
422
                            (float) (r.getY() + (ht * (i + 0.8)))); //- (ht / 2))));
423

    
424
                        break;
425
                }
426
            }
427
        }
428
    }
429

    
430
    /*
431
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#print(java.awt.Graphics2D,
432
     *      java.awt.geom.AffineTransform)
433
     */
434
    public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) {
435
        this.properties=properties;
436
        draw(g, at, null, null);
437
        this.properties=null;
438

    
439
    }
440

    
441
    /**
442
     * Rellenar el texto que se quiere a?adir al Layout.
443
     *
444
     * @param s String a a?adir.
445
     */
446
    public void addText(String s) {
447
        m_text.add(s);
448
    }
449

    
450
    /**
451
     * Devuelve el ArrayList que contiene las l?neas de texto.
452
     *
453
     * @return ArrayList.
454
     */
455
    public ArrayList getText() {
456
        return m_text;
457
    }
458

    
459
    /**
460
     * Seleccionar si se quiere un tama?o fijo o adecuado a la escala.
461
     *
462
     * @param b true si se quiere tama?o fijo.
463
     */
464
    public void setSizeFixed(boolean b) {
465
        m_isFixed = b;
466
    }
467

    
468
    /**
469
     * Devuelve si est? fijado el tama?o.
470
     *
471
     * @return True si est? fijado el tama?o.
472
     */
473
    public boolean isSizeFixed() {
474
        return m_isFixed;
475
    }
476

    
477
    /**
478
     * DOCUMENT ME!
479
     *
480
     * @return DOCUMENT ME!
481
     *
482
     * @throws SaveException
483
     *
484
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#getXMLEntity()
485
     */
486
    public XMLEntity getXMLEntity() throws SaveException {
487
        XMLEntity xml = super.getXMLEntity();
488

    
489
        try {
490
//            xml.putProperty("type", Layout.RECTANGLETEXT);
491

    
492
            String[] s = (String[]) m_text.toArray(new String[0]);
493
            xml.putProperty("s", s);
494
            xml.putProperty("m_isFixed", m_isFixed);
495

    
496
            if (m_isFixed) {
497
                xml.putProperty("fontSize", m_f.getSize());
498
            }
499

    
500
            xml.putProperty("m_pos", m_pos);
501

    
502
            xml.putProperty("fontName", m_f.getName());
503
            xml.putProperty("fontStyle", m_f.getStyle());
504
            xml.putProperty("textColor", StringUtilities.color2String(textColor));
505

    
506
            xml.putProperty("transicionPixelsMilimetros",
507
                transicionPixelsMilimetros);
508

    
509
            // jaume
510
            xml.putProperty("cellPadding", cellPadding);
511
            xml.putProperty("fontSize", fontSize);
512
            xml.putProperty("fixedFontSize", fixedFontSize);
513
            xml.putProperty("surrounded", surrounded);
514
            xml.putProperty("hasTitle", hasTitle);
515
            xml.putProperty("title", title);
516
            xml.putProperty("titleSize", titleSize);
517
            xml.putProperty("frameBorderSize", frameBorderSize);
518
            xml.putProperty("frameColor",
519
                StringUtilities.color2String(frameColor));
520
            xml.putProperty("titleColor",
521
                StringUtilities.color2String(titleColor));
522
        } catch (Exception e) {
523
            throw new SaveException(e, this.getClass().getName());
524
        }
525

    
526
        return xml;
527
    }
528

    
529
    /**
530
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity,
531
     *      com.iver.cit.gvsig.project.Project)
532
     */
533
    public void setXMLEntity03(XMLEntity xml, Layout l) {
534
        if (xml.getIntProperty("m_Selected") != 0) {
535
            this.setSelected(true);
536
        } else {
537
            this.setSelected(false);
538
        }
539

    
540
        String[] s = xml.getStringArrayProperty("s");
541

    
542
        for (int i = 0; i < s.length; i++) {
543
            this.m_text.add(s[i]);
544
        }
545

    
546
        this.m_isFixed = xml.getBooleanProperty("m_isFixed");
547
        this.m_pos = xml.getIntProperty("m_pos");
548
        setRotation(xml.getDoubleProperty("m_rotation"));
549

    
550
        this.m_f = new Font(xml.getStringProperty("fontName"),
551
                xml.getIntProperty("fontStyle"), 9);
552

    
553
        if (xml.contains("textColor")) {
554
            this.textColor = StringUtilities.string2Color(xml.getStringProperty(
555
                        "textColor"));
556
        }
557
    }
558

    
559
    /**
560
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity,
561
     *      com.iver.cit.gvsig.project.Project)
562
     */
563
    public void setXMLEntity(XMLEntity xml) {
564
        if (xml.getIntProperty("m_Selected") != 0) {
565
            this.setSelected(true);
566
        } else {
567
            this.setSelected(false);
568
        }
569

    
570
        String[] s = xml.getStringArrayProperty("s");
571

    
572
        for (int i = 0; i < s.length; i++) {
573
            this.m_text.add(s[i]);
574
        }
575

    
576
        this.m_isFixed = xml.getBooleanProperty("m_isFixed");
577

    
578
        int size = 9;
579

    
580
        if (m_isFixed && xml.contains("fontSize")) {
581
            size = xml.getIntProperty("fontSize");
582
        }
583

    
584
        this.m_pos = xml.getIntProperty("m_pos");
585
        setRotation(xml.getDoubleProperty("m_rotation"));
586
        this.m_f = new Font(xml.getStringProperty("fontName"),
587
                xml.getIntProperty("fontStyle"), size);
588

    
589
        if (xml.contains("textColor")) {
590
            this.textColor = StringUtilities.string2Color(xml.getStringProperty(
591
                        "textColor"));
592
        }
593

    
594
        // jaume
595
        if (xml.contains("cellPadding")) {
596
            this.cellPadding = xml.getDoubleProperty("cellPadding");
597
        }
598

    
599
        if (xml.contains("fontSize")) {
600
            this.fontSize = xml.getIntProperty("fontSize");
601
        }
602

    
603
        if (xml.contains("fixedFontSize")) {
604
            this.fixedFontSize = xml.getBooleanProperty("fixedFontSize");
605
        }
606

    
607
        if (xml.contains("surrounded")) {
608
            this.surrounded = xml.getBooleanProperty("surrounded");
609
        }
610

    
611
        if (xml.contains("hasTitle")) {
612
            this.hasTitle = xml.getBooleanProperty("hasTitle");
613
        }
614

    
615
        if (xml.contains("title")) {
616
            this.title = xml.getStringProperty("title");
617
        }
618

    
619
        if (xml.contains("titleSize")) {
620
            this.titleSize = xml.getIntProperty("titleSize");
621
        }
622

    
623
        if (xml.contains("frameBorderSize")) {
624
            this.frameBorderSize = xml.getDoubleProperty("frameBorderSize");
625
        }
626

    
627
        if (xml.contains("frameColor")) {
628
            this.frameColor = StringUtilities.string2Color(xml.getStringProperty(
629
                        "frameColor"));
630
        }
631

    
632
        if (xml.contains("titleColor")) {
633
            this.titleColor = StringUtilities.string2Color(xml.getStringProperty(
634
                        "titleColor"));
635
        }
636

    
637
        if (!xml.contains("transicionPixelsMilimetros")) {
638
            cellPadding = 0.05;
639
            frameBorderSize = 0.01;
640
        }
641
    }
642

    
643
    /**
644
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#getNameFFrame()
645
     */
646
    public String getNameFFrame() {
647
        return PluginServices.getText(this, "texto")+ num;
648
    }
649

    
650
    /**
651
     * Sets FFrameText to draw an involving rectangle
652
     *
653
     * @param b
654
     */
655
    public void setSurrounded(boolean b) {
656
        surrounded = b;
657
    }
658

    
659
    /**
660
     * True if the FFrameText is set to draw an involving rectangle, or false
661
     * if not.
662
     *
663
     * @return boolean
664
     */
665
    public boolean isSurrounded() {
666
        return surrounded;
667
    }
668

    
669
    /**
670
     * Sets the gap between the involving rectangle and the text
671
     *
672
     * @param i
673
     */
674
    public void setCellPadding(double i) {
675
        cellPadding = i;
676
    }
677

    
678
    /**
679
     * Devuelve true si tiene un t?tulo.
680
     *
681
     * @return
682
     */
683
    public boolean hasTitle() {
684
        return hasTitle;
685
    }
686

    
687
    /**
688
     * Devuelve un string con el t?tulo.
689
     *
690
     * @return
691
     */
692
    public String getTitle() {
693
        return title;
694
    }
695

    
696
    /**
697
     * Inserta true si tiene t?tulo
698
     *
699
     * @param b
700
     */
701
    public void setHasTitle(boolean b) {
702
        hasTitle = b;
703
    }
704

    
705
    /**
706
     * Inserta un string con el t?tulo.
707
     *
708
     * @param text
709
     */
710
    public void setTitle(String text) {
711
        title = text;
712
    }
713

    
714
    /**
715
     * Devuelve el tama?o del t?tulo.
716
     *
717
     * @return
718
     */
719
    public int getTitleSize() {
720
        return titleSize;
721
    }
722

    
723
    /**
724
     * Inserta el tama?o del t?tulo.
725
     *
726
     * @param size DOCUMENT ME!
727
     */
728
    public void setTitleSize(int size) {
729
        titleSize = size;
730
    }
731

    
732
    /**
733
     * Inserta el tama?o del borde.
734
     *
735
     * @param size
736
     */
737
    public void setFrameBorderSize(double size) {
738
        frameBorderSize = size;
739
    }
740

    
741
    /**
742
     * Devuelve el tama?o del borde.
743
     *
744
     * @return
745
     */
746
    public double getFrameBorderSize() {
747
        return frameBorderSize;
748
    }
749

    
750
    /**
751
     * DOCUMENT ME!
752
     *
753
     * @param frameColor
754
     */
755
    public void setFrameColor(Color frameColor) {
756
        this.frameColor = frameColor;
757
    }
758

    
759
    /**
760
     * DOCUMENT ME!
761
     *
762
     * @param titleColor DOCUMENT ME!
763
     */
764
    public void setTitleColor(Color titleColor) {
765
        this.titleColor = titleColor;
766
    }
767

    
768
    /**
769
     * DOCUMENT ME!
770
     *
771
     * @return DOCUMENT ME!
772
     */
773
    public Color getFrameColor() {
774
        return frameColor;
775
    }
776

    
777
    /**
778
     * DOCUMENT ME!
779
     *
780
     * @return DOCUMENT ME!
781
     */
782
    public Color getTitleColor() {
783
        return titleColor;
784
    }
785

    
786
    /**
787
     * Use this method if you want the text in the FFrameText to be removed.
788
     */
789
    public void clearText() {
790
        m_text.clear();
791
    }
792

    
793
        public void initialize() {
794
                // TODO Auto-generated method stub
795

    
796
        }
797

    
798
        public void cloneActions(IFFrame frame) {
799
                // TODO Auto-generated method stub
800

    
801
        }
802

    
803
        public IFFrameDialog getPropertyDialog() {
804
                return new FFrameTextDialog(getLayout(),this);
805
        }
806
}