root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / fframes / FFrameText.java @ 2468
History | View | Annotate | Download (17.5 KB)
1 |
/*
|
---|---|
2 |
* Created on 22-jun-2004
|
3 |
*
|
4 |
*/
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 |
*
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
8 |
*
|
9 |
* This program is free software; you can redistribute it and/or
|
10 |
* modify it under the terms of the GNU General Public License
|
11 |
* as published by the Free Software Foundation; either version 2
|
12 |
* of the License, or (at your option) any later version.
|
13 |
*
|
14 |
* This program is distributed in the hope that it will be useful,
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
* GNU General Public License for more details.
|
18 |
*
|
19 |
* You should have received a copy of the GNU General Public License
|
20 |
* along with this program; if not, write to the Free Software
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
22 |
*
|
23 |
* For more information, contact:
|
24 |
*
|
25 |
* Generalitat Valenciana
|
26 |
* Conselleria d'Infraestructures i Transport
|
27 |
* Av. Blasco Ib??ez, 50
|
28 |
* 46010 VALENCIA
|
29 |
* SPAIN
|
30 |
*
|
31 |
* +34 963862235
|
32 |
* gvsig@gva.es
|
33 |
* www.gvsig.gva.es
|
34 |
*
|
35 |
* or
|
36 |
*
|
37 |
* IVER T.I. S.A
|
38 |
* Salamanca 50
|
39 |
* 46005 Valencia
|
40 |
* Spain
|
41 |
*
|
42 |
* +34 963163400
|
43 |
* dac@iver.es
|
44 |
*/
|
45 |
package com.iver.cit.gvsig.gui.layout.fframes; |
46 |
|
47 |
import java.awt.Color; |
48 |
import java.awt.Font; |
49 |
import java.awt.Graphics2D; |
50 |
import java.awt.font.FontRenderContext; |
51 |
import java.awt.font.TextLayout; |
52 |
import java.awt.geom.AffineTransform; |
53 |
import java.awt.geom.Rectangle2D; |
54 |
import java.awt.image.BufferedImage; |
55 |
import java.util.ArrayList; |
56 |
|
57 |
import com.iver.andami.PluginServices; |
58 |
import com.iver.cit.gvsig.gui.layout.Layout; |
59 |
import com.iver.utiles.StringUtilities; |
60 |
import com.iver.utiles.XMLEntity; |
61 |
|
62 |
|
63 |
/**
|
64 |
* FFrame para introducir un texto en el Layout.
|
65 |
*
|
66 |
* @author Vicente Caballero Navarro
|
67 |
*/
|
68 |
public class FFrameText extends FFrame { |
69 |
/** Localizaci?n del texto. */
|
70 |
public static final int LEFT = 0; |
71 |
public static final int CENTER = 1; |
72 |
public static final int RIGTH = 2; |
73 |
private ArrayList m_text = new ArrayList(); |
74 |
private boolean m_isFixed = false; |
75 |
//private double m_rotation = 0;
|
76 |
private int m_pos = LEFT; |
77 |
private Color textColor = Color.BLACK; |
78 |
|
79 |
//jaume
|
80 |
private boolean surrounded = false; // The text field is surrounded by a rectangle |
81 |
private int cellPadding = 0; // The gap between the the text field and the surrounding rectangle |
82 |
private boolean fixedFontSize = false; // The text field font size is constant fixed to the folio's size |
83 |
private int fontSize; // Text field's font size |
84 |
private boolean hasTitle; // The text field has title |
85 |
private String title; // The text for the title |
86 |
private int titleSize; // The title's font size |
87 |
private int frameBorderSize; // The surrounding rectangle's border size |
88 |
private Color frameColor = Color.BLACK; // The surrounding rectangle's color |
89 |
private Color titleColor = Color.BLACK; // The title's color |
90 |
|
91 |
//private int m_space=0;
|
92 |
private Font m_f = null; |
93 |
|
94 |
/**
|
95 |
* Crea un nuevo FFrameText.
|
96 |
*/
|
97 |
|
98 |
// public FFrameText(Layout l) {
|
99 |
// layout=l;
|
100 |
// m_f = new Font("SansSerif", Font.PLAIN, 9);
|
101 |
// }
|
102 |
public FFrameText() {
|
103 |
m_f = new Font("SansSerif", Font.PLAIN, 9); |
104 |
} |
105 |
|
106 |
/**
|
107 |
* Inserta la fuente del texto.
|
108 |
*
|
109 |
* @param f Fuente del texto.
|
110 |
*/
|
111 |
public void setFont(Font f) { |
112 |
m_f = f; |
113 |
} |
114 |
|
115 |
/**
|
116 |
* Devuelve el color del texto del FFrameText.
|
117 |
*
|
118 |
* @return Color del texto.
|
119 |
*/
|
120 |
public Color getTextColor() { |
121 |
return textColor;
|
122 |
} |
123 |
|
124 |
/**
|
125 |
* Obtiene el fixedFontSize
|
126 |
*
|
127 |
* @return boolean
|
128 |
*/
|
129 |
public boolean isFontSizeFixed() { |
130 |
return fixedFontSize;
|
131 |
} |
132 |
|
133 |
/**
|
134 |
* Establece fixedFontSize
|
135 |
*
|
136 |
* @param fixedFontSize
|
137 |
*/
|
138 |
public void setFixedFontSize(boolean fixedFontSize) { |
139 |
this.fixedFontSize = fixedFontSize;
|
140 |
} |
141 |
|
142 |
/**
|
143 |
* Obtiene el fontSize
|
144 |
*
|
145 |
* @return int
|
146 |
*/
|
147 |
public int getFontSize() { |
148 |
return fontSize;
|
149 |
} |
150 |
|
151 |
/**
|
152 |
* Establece fontSize
|
153 |
*
|
154 |
* @param fontSize
|
155 |
*/
|
156 |
public void setFontSize(int fontSize) { |
157 |
this.fontSize = fontSize;
|
158 |
} |
159 |
|
160 |
/**
|
161 |
* Obtiene el cellPadding
|
162 |
*
|
163 |
* @return int
|
164 |
*/
|
165 |
public int getCellPadding() { |
166 |
return cellPadding;
|
167 |
} |
168 |
|
169 |
/**
|
170 |
* Inserta el color del texto a escribir.
|
171 |
*
|
172 |
* @param color Color del texto.
|
173 |
*/
|
174 |
public void setTextColor(Color color) { |
175 |
textColor = color; |
176 |
} |
177 |
|
178 |
/**
|
179 |
* Devuelve la fuente del texto.
|
180 |
*
|
181 |
* @return Fuente del texto.
|
182 |
*/
|
183 |
public Font getFont() { |
184 |
return new Font(m_f.getFontName(), m_f.getStyle(), 9); |
185 |
} |
186 |
|
187 |
/*public void setSpace(int s){
|
188 |
m_space=s;
|
189 |
}
|
190 |
public int getSpace(){
|
191 |
return m_space;
|
192 |
}*/
|
193 |
|
194 |
/**
|
195 |
* Devuelve la posici?n izquierda, centro o derecha del texto.
|
196 |
*
|
197 |
* @return Posici?n del texto.
|
198 |
*/
|
199 |
public int getPos() { |
200 |
return m_pos;
|
201 |
} |
202 |
|
203 |
/**
|
204 |
* Pone la posici?n izquierda, centro o derecha del texto.
|
205 |
*
|
206 |
* @param p 0=LEFT,1=CENTER,2=RIGTH.
|
207 |
*/
|
208 |
public void setPos(int p) { |
209 |
m_pos = p; |
210 |
} |
211 |
|
212 |
/**
|
213 |
* M?todo que dibuja sobre el graphics que se le pasa como par?metro, seg?n
|
214 |
* la transformada afin que se debe de aplicar y el rect?ngulo que se debe
|
215 |
* de dibujar.
|
216 |
*
|
217 |
* @param g Graphics
|
218 |
* @param at Transformada af?n.
|
219 |
* @param rv rect?ngulo sobre el que hacer un clip.
|
220 |
* @param imgBase Imagen para acelerar el dibujado.
|
221 |
*/
|
222 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv, |
223 |
BufferedImage imgBase) {
|
224 |
g.setColor(Color.BLACK);
|
225 |
Rectangle2D.Double rec = getBoundingBox(at);
|
226 |
Rectangle2D.Double raux = (Rectangle2D.Double) rec.clone(); |
227 |
g.rotate(Math.toRadians(getRotation()), raux.x + (raux.width / 2), |
228 |
raux.y + (raux.height / 2));
|
229 |
int longmax = 1; |
230 |
|
231 |
if (intersects(rv, raux)) { // comprueba que no cae fuera de la pantalla |
232 |
|
233 |
if (m_text.isEmpty()) {
|
234 |
drawEmpty(g); |
235 |
} else {
|
236 |
for (int i = 0; i < m_text.size(); i++) { |
237 |
if (((String) m_text.get(i)).length() > longmax) { |
238 |
longmax = ((String) m_text.get(i)).length();
|
239 |
} |
240 |
} |
241 |
|
242 |
FontRenderContext frc = g.getFontRenderContext();
|
243 |
int scaledFontSize;
|
244 |
|
245 |
// TODO myScale es la escala sobre la que se extraen todos los escalados. Esto
|
246 |
// funciona bien tal cual est? si la ratio de aspecto (alto/ancho) del folio es constante
|
247 |
// porque se toma como medidas el ancho del folio real y el ancho del folio en pantalla.
|
248 |
// No se que pasar? si la ratio cambia, por ejemplo si se usan USLetter en lugar de DIN A4
|
249 |
double myScale = at.getScaleX() * 0.0234; //FLayoutUtilities.fromSheetDistance(folio.getAncho(),at)/rv.getWidth(); |
250 |
|
251 |
// Distinguish when the font has fixed size or not
|
252 |
if (isFontSizeFixed()) {
|
253 |
scaledFontSize = (int) (myScale * fontSize);
|
254 |
} else {
|
255 |
scaledFontSize = ((int) (raux.width)) / longmax;
|
256 |
|
257 |
if (scaledFontSize > (int) ((raux.height) / m_text.size())) { |
258 |
scaledFontSize = (int) ((raux.height) / m_text.size());
|
259 |
} |
260 |
} |
261 |
|
262 |
if (m_f != null) { |
263 |
// Aqu? se ajusta a partir de las caracter?sticas de la fuente, una nueva fuente con el tama?o ajustado.
|
264 |
m_f = new Font(m_f.getFontName(), m_f.getStyle(), |
265 |
scaledFontSize); |
266 |
} else {
|
267 |
// Aqu? pasa cuando se abre el di?logo para seleccionar un tipo de fuente y se cierra sin haber seleccionado ninguna.
|
268 |
m_f = new Font("SansSerif", Font.PLAIN, scaledFontSize); |
269 |
} |
270 |
|
271 |
// Draw the text title if it exists
|
272 |
if (hasTitle()) {
|
273 |
int scaledTitleFontSize = (int) (myScale * titleSize); |
274 |
int gap = 3; |
275 |
|
276 |
if (isSurrounded()) {
|
277 |
// Para evitar que el marco se pinte sobre el t?tulo
|
278 |
gap += (int) (frameBorderSize * myScale);
|
279 |
} |
280 |
|
281 |
g.setColor(titleColor); |
282 |
|
283 |
Font titleFont = new Font(m_f.getFontName(), |
284 |
m_f.getStyle(), scaledTitleFontSize); |
285 |
TextLayout titleTextLayout = new TextLayout(getTitle(), |
286 |
titleFont, frc); |
287 |
titleTextLayout.draw(g, (float) raux.getX(),
|
288 |
(float) (raux.getY() - (gap * myScale)));
|
289 |
} |
290 |
|
291 |
// Draw the frame involving the text if it exists
|
292 |
if (isSurrounded()) {
|
293 |
g.setColor(frameColor); |
294 |
g.drawRect((int) raux.x, (int) raux.y, (int) raux.width, |
295 |
(int) raux.height);
|
296 |
|
297 |
double scaledCellPadding = cellPadding * myScale;
|
298 |
|
299 |
if (frameBorderSize > 1) { |
300 |
System.out.println("borderSize = " + frameBorderSize); |
301 |
|
302 |
int scaledBorderSize = (int) (frameBorderSize * myScale); |
303 |
|
304 |
for (int i = scaledBorderSize - 1; i > 0; i--) |
305 |
g.drawRect((int) raux.x - i, (int) raux.y - i, |
306 |
(int) raux.width + (2 * i), |
307 |
(int) raux.height + (2 * i)); |
308 |
} |
309 |
|
310 |
// Recalibro el rectangulo para establecer el ?rea donde se dibujan las fuentes
|
311 |
// al ?rea marcada con el rat?n menos la distancia al marco especificada
|
312 |
raux.setRect(raux.getX() + scaledCellPadding, |
313 |
raux.getY() + scaledCellPadding, |
314 |
raux.getWidth() - (scaledCellPadding * 2),
|
315 |
raux.getHeight() - (scaledCellPadding * 2));
|
316 |
} |
317 |
|
318 |
g.setColor(textColor); |
319 |
|
320 |
|
321 |
drawText(raux, scaledFontSize, g); |
322 |
g.rotate(Math.toRadians(-getRotation()),
|
323 |
raux.x + (raux.width / 2), raux.y + (raux.height / 2)); |
324 |
} |
325 |
} |
326 |
|
327 |
raux = null;
|
328 |
} |
329 |
|
330 |
/**
|
331 |
* Dibuja el texto sobre el graphics con el tama?o adecuado.
|
332 |
*
|
333 |
* @param r Rect?ngulo sobre el que dibujar.
|
334 |
* @param sfs Tama?o aproximado del texto.
|
335 |
* @param g Graphics sobre el que dibujar el texto.
|
336 |
*/
|
337 |
private void drawText(Rectangle2D r, int sfs, Graphics2D g) { |
338 |
int minSFS = Integer.MAX_VALUE; |
339 |
FontRenderContext frc = g.getFontRenderContext();
|
340 |
int ht = (int) (r.getHeight() / m_text.size()); |
341 |
if (isFontSizeFixed()){
|
342 |
minSFS=sfs; |
343 |
}else{
|
344 |
for (int i = 0; i < m_text.size(); i++) { |
345 |
if (!((String) m_text.get(i)).equals("")) { |
346 |
TextLayout textaux = new TextLayout((String) m_text.get(i), |
347 |
m_f, frc); |
348 |
Rectangle2D txtBound = textaux.getBounds();
|
349 |
double difW = txtBound.getWidth() / r.getWidth();
|
350 |
double difH = (txtBound.getHeight() * m_text.size()) / (r.getHeight());
|
351 |
|
352 |
if (difW > difH) {
|
353 |
if (minSFS > sfs) {
|
354 |
minSFS = (int) (sfs / difW);
|
355 |
} |
356 |
} else {
|
357 |
if (minSFS > sfs) {
|
358 |
minSFS = (int) (sfs / difH);
|
359 |
} |
360 |
} |
361 |
} |
362 |
} |
363 |
} |
364 |
|
365 |
TextLayout textLayout = null; |
366 |
|
367 |
for (int i = 0; i < m_text.size(); i++) { |
368 |
if (!((String) m_text.get(i)).equals("")) { |
369 |
m_f = new Font(m_f.getFontName(), m_f.getStyle(), minSFS); |
370 |
|
371 |
textLayout = new TextLayout((String) m_text.get(i), m_f, frc); |
372 |
|
373 |
Rectangle2D txtBound = textLayout.getBounds();
|
374 |
float difW = (float) (r.getWidth() - txtBound.getWidth()); |
375 |
|
376 |
switch (m_pos) {
|
377 |
case (LEFT):
|
378 |
textLayout.draw(g, (float) r.getX(),
|
379 |
(float) (r.getY() + (ht * (i + 1)))); |
380 |
|
381 |
break;
|
382 |
|
383 |
case (CENTER):
|
384 |
textLayout.draw(g, (float) r.getX() + (difW / 2), |
385 |
(float) (r.getY() + (ht * (i + 1)))); |
386 |
|
387 |
break;
|
388 |
|
389 |
case (RIGTH):
|
390 |
textLayout.draw(g, (float) r.getX() + difW,
|
391 |
(float) (r.getY() + (ht * (i + 1)))); //- (ht / 2)))); |
392 |
|
393 |
break;
|
394 |
} |
395 |
} |
396 |
} |
397 |
} |
398 |
|
399 |
/**
|
400 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#print(java.awt.Graphics2D,
|
401 |
* java.awt.geom.AffineTransform)
|
402 |
*/
|
403 |
public void print(Graphics2D g, AffineTransform at) { |
404 |
draw(g, at, null, null); |
405 |
} |
406 |
|
407 |
/**
|
408 |
* Rellenar el texto que se quiere a?adir al Layout.
|
409 |
*
|
410 |
* @param s String a a?adir.
|
411 |
*/
|
412 |
public void addText(String s) { |
413 |
m_text.add(s); |
414 |
} |
415 |
|
416 |
/**
|
417 |
* Devuelve el ArrayList que contiene las l?neas de texto.
|
418 |
*
|
419 |
* @return ArrayList.
|
420 |
*/
|
421 |
public ArrayList getText() { |
422 |
return m_text;
|
423 |
} |
424 |
|
425 |
/**
|
426 |
* Seleccionar si se quiere un tama?o fijo o adecuado a la escala.
|
427 |
*
|
428 |
* @param b true si se quiere tama?o fijo.
|
429 |
*/
|
430 |
public void setSizeFixed(boolean b) { |
431 |
m_isFixed = b; |
432 |
} |
433 |
|
434 |
/**
|
435 |
* Devuelve si est? fijado el tama?o.
|
436 |
*
|
437 |
* @return True si est? fijado el tama?o.
|
438 |
*/
|
439 |
public boolean isSizeFixed() { |
440 |
return m_isFixed;
|
441 |
} |
442 |
|
443 |
|
444 |
|
445 |
/**
|
446 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#getXMLEntity()
|
447 |
*/
|
448 |
public XMLEntity getXMLEntity() {
|
449 |
XMLEntity xml = new XMLEntity();
|
450 |
xml.putProperty("className", this.getClass().getName()); |
451 |
xml.putProperty("m_name", m_name);
|
452 |
xml.putProperty("x", getBoundBox().x);
|
453 |
xml.putProperty("y", getBoundBox().y);
|
454 |
xml.putProperty("w", getBoundBox().width);
|
455 |
xml.putProperty("h", getBoundBox().height);
|
456 |
xml.putProperty("m_Selected", m_Selected);
|
457 |
xml.putProperty("type", Layout.RECTANGLETEXT);
|
458 |
|
459 |
String[] s = (String[]) m_text.toArray(new String[0]); |
460 |
xml.putProperty("s", s);
|
461 |
xml.putProperty("m_isFixed", m_isFixed);
|
462 |
xml.putProperty("m_rotation",getRotation());
|
463 |
xml.putProperty("m_pos", m_pos);
|
464 |
|
465 |
xml.putProperty("fontName", m_f.getFontName());
|
466 |
xml.putProperty("fontStyle", m_f.getStyle());
|
467 |
xml.putProperty("tag", getTag());
|
468 |
xml.putProperty("textColor", StringUtilities.color2String(textColor));
|
469 |
|
470 |
// jaume
|
471 |
xml.putProperty("cellPadding", cellPadding);
|
472 |
xml.putProperty("fontSize", fontSize);
|
473 |
xml.putProperty("fixedFontSize", fixedFontSize);
|
474 |
xml.putProperty("surrounded", surrounded);
|
475 |
xml.putProperty("hasTitle", hasTitle);
|
476 |
xml.putProperty("title", title);
|
477 |
xml.putProperty("titleSize", titleSize);
|
478 |
xml.putProperty("frameBorderSize", frameBorderSize);
|
479 |
xml.putProperty("frameColor", StringUtilities.color2String(frameColor));
|
480 |
xml.putProperty("titleColor", StringUtilities.color2String(titleColor));
|
481 |
|
482 |
return xml;
|
483 |
} |
484 |
|
485 |
/**
|
486 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity,
|
487 |
* com.iver.cit.gvsig.project.Project)
|
488 |
*/
|
489 |
public void setXMLEntity03(XMLEntity xml, Layout l) { |
490 |
if (xml.getIntProperty("m_Selected") != 0) { |
491 |
this.setSelected(true); |
492 |
} else {
|
493 |
this.setSelected(false); |
494 |
} |
495 |
|
496 |
String[] s = xml.getStringArrayProperty("s"); |
497 |
|
498 |
for (int i = 0; i < s.length; i++) { |
499 |
this.m_text.add(s[i]);
|
500 |
} |
501 |
|
502 |
this.m_isFixed = xml.getBooleanProperty("m_isFixed"); |
503 |
this.m_pos = xml.getIntProperty("m_pos"); |
504 |
setRotation(xml.getDoubleProperty("m_rotation"));
|
505 |
|
506 |
this.m_f = new Font(xml.getStringProperty("fontName"), |
507 |
xml.getIntProperty("fontStyle"), 9); |
508 |
|
509 |
if (xml.contains("textColor")) { |
510 |
this.textColor = StringUtilities.string2Color(xml.getStringProperty(
|
511 |
"textColor"));
|
512 |
} |
513 |
} |
514 |
|
515 |
/**
|
516 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity,
|
517 |
* com.iver.cit.gvsig.project.Project)
|
518 |
*/
|
519 |
public void setXMLEntity(XMLEntity xml, Layout l) { |
520 |
if (xml.getIntProperty("m_Selected") != 0) { |
521 |
this.setSelected(true); |
522 |
} else {
|
523 |
this.setSelected(false); |
524 |
} |
525 |
|
526 |
String[] s = xml.getStringArrayProperty("s"); |
527 |
|
528 |
for (int i = 0; i < s.length; i++) { |
529 |
this.m_text.add(s[i]);
|
530 |
} |
531 |
|
532 |
this.m_isFixed = xml.getBooleanProperty("m_isFixed"); |
533 |
this.m_pos = xml.getIntProperty("m_pos"); |
534 |
setRotation(xml.getDoubleProperty("m_rotation"));
|
535 |
this.m_f = new Font(xml.getStringProperty("fontName"), |
536 |
xml.getIntProperty("fontStyle"), 9); |
537 |
|
538 |
if (xml.contains("textColor")) { |
539 |
this.textColor = StringUtilities.string2Color(xml.getStringProperty(
|
540 |
"textColor"));
|
541 |
} |
542 |
|
543 |
// jaume
|
544 |
if (xml.contains("cellPadding")) { |
545 |
this.cellPadding = xml.getIntProperty("cellPadding"); |
546 |
} |
547 |
|
548 |
if (xml.contains("fontSize")) { |
549 |
this.fontSize = xml.getIntProperty("fontSize"); |
550 |
} |
551 |
|
552 |
if (xml.contains("fixedFontSize")) { |
553 |
this.fixedFontSize = xml.getBooleanProperty("fixedFontSize"); |
554 |
} |
555 |
|
556 |
if (xml.contains("surrounded")) { |
557 |
this.surrounded = xml.getBooleanProperty("surrounded"); |
558 |
} |
559 |
|
560 |
if (xml.contains("hasTitle")) { |
561 |
this.hasTitle = xml.getBooleanProperty("hasTitle"); |
562 |
} |
563 |
|
564 |
if (xml.contains("title")) { |
565 |
this.title = xml.getStringProperty("title"); |
566 |
} |
567 |
|
568 |
if (xml.contains("titleSize")) { |
569 |
this.titleSize = xml.getIntProperty("titleSize"); |
570 |
} |
571 |
|
572 |
if (xml.contains("frameBorderSize")) { |
573 |
this.frameBorderSize = xml.getIntProperty("frameBorderSize"); |
574 |
} |
575 |
|
576 |
if (xml.contains("frameColor")) { |
577 |
this.frameColor = StringUtilities.string2Color(xml.getStringProperty(
|
578 |
"frameColor"));
|
579 |
} |
580 |
|
581 |
if (xml.contains("titleColor")) { |
582 |
this.titleColor = StringUtilities.string2Color(xml.getStringProperty(
|
583 |
"titleColor"));
|
584 |
} |
585 |
} |
586 |
|
587 |
/**
|
588 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#getNameFFrame()
|
589 |
*/
|
590 |
public String getNameFFrame() { |
591 |
return PluginServices.getText(this, "texto") + num; |
592 |
} |
593 |
|
594 |
/**
|
595 |
* Sets FFrameText to draw an involving rectangle
|
596 |
*
|
597 |
* @param b
|
598 |
*/
|
599 |
public void setSurrounded(boolean b) { |
600 |
surrounded = b; |
601 |
} |
602 |
|
603 |
/**
|
604 |
* True if the FFrameText is set to draw an involving rectangle, or false
|
605 |
* if not.
|
606 |
*
|
607 |
* @return boolean
|
608 |
*/
|
609 |
public boolean isSurrounded() { |
610 |
return surrounded;
|
611 |
} |
612 |
|
613 |
/**
|
614 |
* Sets the gap between the involving rectangle and the text
|
615 |
*
|
616 |
* @param i
|
617 |
*/
|
618 |
public void setCellPadding(int i) { |
619 |
cellPadding = i; |
620 |
} |
621 |
|
622 |
/**
|
623 |
* DOCUMENT ME!
|
624 |
*
|
625 |
* @return
|
626 |
*/
|
627 |
public boolean hasTitle() { |
628 |
return hasTitle;
|
629 |
} |
630 |
|
631 |
/**
|
632 |
* DOCUMENT ME!
|
633 |
*
|
634 |
* @return
|
635 |
*/
|
636 |
public String getTitle() { |
637 |
return title;
|
638 |
} |
639 |
|
640 |
/**
|
641 |
* DOCUMENT ME!
|
642 |
*
|
643 |
* @param b
|
644 |
*/
|
645 |
public void setHasTitle(boolean b) { |
646 |
hasTitle = b; |
647 |
} |
648 |
|
649 |
/**
|
650 |
* DOCUMENT ME!
|
651 |
*
|
652 |
* @param text
|
653 |
*/
|
654 |
public void setTitle(String text) { |
655 |
title = text; |
656 |
} |
657 |
|
658 |
/**
|
659 |
* DOCUMENT ME!
|
660 |
*
|
661 |
* @return
|
662 |
*/
|
663 |
public int getTitleSize() { |
664 |
return titleSize;
|
665 |
} |
666 |
|
667 |
/**
|
668 |
* DOCUMENT ME!
|
669 |
*
|
670 |
* @param size DOCUMENT ME!
|
671 |
*/
|
672 |
public void setTitleSize(int size) { |
673 |
titleSize = size; |
674 |
} |
675 |
|
676 |
/**
|
677 |
* DOCUMENT ME!
|
678 |
*
|
679 |
* @param size
|
680 |
*/
|
681 |
public void setFrameBorderSize(int size) { |
682 |
frameBorderSize = size; |
683 |
} |
684 |
|
685 |
/**
|
686 |
* DOCUMENT ME!
|
687 |
*
|
688 |
* @return
|
689 |
*/
|
690 |
public int getFrameBorderSize() { |
691 |
return frameBorderSize;
|
692 |
} |
693 |
|
694 |
/**
|
695 |
* DOCUMENT ME!
|
696 |
*
|
697 |
* @param frameColor
|
698 |
*/
|
699 |
public void setFrameColor(Color frameColor) { |
700 |
this.frameColor = frameColor;
|
701 |
} |
702 |
|
703 |
/**
|
704 |
* DOCUMENT ME!
|
705 |
*
|
706 |
* @param titleColor DOCUMENT ME!
|
707 |
*/
|
708 |
public void setTitleColor(Color titleColor) { |
709 |
this.titleColor = titleColor;
|
710 |
} |
711 |
|
712 |
/**
|
713 |
* DOCUMENT ME!
|
714 |
*
|
715 |
* @return DOCUMENT ME!
|
716 |
*/
|
717 |
public Color getFrameColor() { |
718 |
return frameColor;
|
719 |
} |
720 |
|
721 |
/**
|
722 |
* DOCUMENT ME!
|
723 |
*
|
724 |
* @return DOCUMENT ME!
|
725 |
*/
|
726 |
public Color getTitleColor() { |
727 |
return titleColor;
|
728 |
} |
729 |
|
730 |
/**
|
731 |
* Use this method if you want the text in the FFrameText to be removed.
|
732 |
*/
|
733 |
public void clearText() { |
734 |
m_text.clear(); |
735 |
} |
736 |
} |