Revision 1551 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/FFrameText.java
FFrameText.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
import com.iver.cit.gvsig.gui.layout.Layout; |
50 | 50 |
|
51 |
import com.iver.utiles.StringUtilities; |
|
51 | 52 |
import com.iver.utiles.XMLEntity; |
52 | 53 |
|
53 | 54 |
import java.awt.Color; |
... | ... | |
76 | 77 |
private boolean m_isFixed = true; |
77 | 78 |
private double m_rotation = 0; |
78 | 79 |
private int m_pos = LEFT; |
80 |
private Color textColor = Color.BLACK; |
|
79 | 81 |
|
80 | 82 |
//private int m_space=0; |
81 | 83 |
private Font m_f = null; |
... | ... | |
97 | 99 |
} |
98 | 100 |
|
99 | 101 |
/** |
102 |
* Devuelve el color del texto del FFrameText. |
|
103 |
* |
|
104 |
* @return Color del texto. |
|
105 |
*/ |
|
106 |
public Color getTextColor() { |
|
107 |
return textColor; |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* Inserta el color del texto a escribir. |
|
112 |
* |
|
113 |
* @param color Color del texto. |
|
114 |
*/ |
|
115 |
public void setTextColor(Color color) { |
|
116 |
textColor = color; |
|
117 |
} |
|
118 |
|
|
119 |
/** |
|
100 | 120 |
* Devuelve la fuente del texto. |
101 | 121 |
* |
102 | 122 |
* @return Fuente del texto. |
... | ... | |
144 | 164 |
BufferedImage imgBase) { |
145 | 165 |
Rectangle2D.Double re = getBoundingBox(at); |
146 | 166 |
int longmax = 1; |
147 |
|
|
167 |
|
|
148 | 168 |
if (intersects(rv, re)) { |
149 | 169 |
if (m_text.isEmpty()) { |
150 | 170 |
drawEmpty(g); |
... | ... | |
174 | 194 |
if (!((String) m_text.get(i)).equals("")) { |
175 | 195 |
TextLayout layout = new TextLayout((String) m_text.get( |
176 | 196 |
i), m_f, frc); |
177 |
g.setColor(Color.black);
|
|
197 |
g.setColor(textColor);
|
|
178 | 198 |
g.rotate(Math.toRadians(m_rotation), |
179 | 199 |
re.x + (re.width / 2), re.y + (re.height / 2)); |
180 | 200 |
|
... | ... | |
281 | 301 |
*/ |
282 | 302 |
public XMLEntity getXMLEntity() { |
283 | 303 |
XMLEntity xml = new XMLEntity(); |
284 |
xml.putProperty("className",this.getClass().getName()); |
|
304 |
xml.putProperty("className", this.getClass().getName());
|
|
285 | 305 |
xml.putProperty("m_name", m_name); |
286 | 306 |
xml.putProperty("x", getBoundBox().x); |
287 | 307 |
xml.putProperty("y", getBoundBox().y); |
... | ... | |
299 | 319 |
xml.putProperty("fontName", m_f.getFontName()); |
300 | 320 |
xml.putProperty("fontStyle", m_f.getStyle()); |
301 | 321 |
xml.putProperty("tag", getTag()); |
322 |
xml.putProperty("textColor",StringUtilities.color2String(textColor)); |
|
302 | 323 |
|
303 | 324 |
return xml; |
304 | 325 |
} |
305 |
|
|
306 |
/** |
|
307 |
* Crea un Objeto de esta clase a partir de la informaci?n del XMLEntity. |
|
308 |
* |
|
309 |
* @param xml XMLEntity |
|
310 |
* @param l DOCUMENT ME! |
|
311 |
*/ |
|
312 |
|
|
313 |
/* public static FFrameText createFFrameText(XMLEntity xml) { |
|
314 |
FFrameText fframe = new FFrameText(); |
|
315 | 326 |
|
316 |
if (xml.getIntProperty("m_Selected") != 0) { |
|
317 |
fframe.setSelected(true); |
|
318 |
} else { |
|
319 |
fframe.setSelected(false); |
|
320 |
} |
|
321 |
String[] s = xml.getStringArrayProperty("s"); |
|
322 |
for (int i = 0; i < s.length; i++) { |
|
323 |
fframe.m_text.add(s[i]); |
|
324 |
} |
|
325 |
fframe.m_isFixed = xml.getBooleanProperty("m_isFixed"); |
|
326 |
fframe.m_pos = xml.getIntProperty("m_pos"); |
|
327 |
fframe.m_rotation = xml.getDoubleProperty("m_rotation"); |
|
328 |
fframe.m_f = new Font(xml.getStringProperty("fontName"), |
|
329 |
xml.getIntProperty("fontStyle"), 9); |
|
330 |
return fframe; |
|
331 |
} |
|
332 |
*/ |
|
333 |
|
|
334 | 327 |
/** |
335 | 328 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity, |
336 | 329 |
* com.iver.cit.gvsig.project.Project) |
... | ... | |
353 | 346 |
this.m_rotation = xml.getDoubleProperty("m_rotation"); |
354 | 347 |
this.m_f = new Font(xml.getStringProperty("fontName"), |
355 | 348 |
xml.getIntProperty("fontStyle"), 9); |
349 |
if (xml.contains("textColor")){//TODO Incluido en la versi?n 0.3 en posteriores versiones no hace falta esta comprobaci?n. |
|
350 |
this.textColor = StringUtilities.string2Color(xml.getStringProperty("textColor")); |
|
351 |
} |
|
356 | 352 |
} |
357 | 353 |
|
358 | 354 |
/** |
Also available in: Unified diff