Revision 1551
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/dialogs/FFrameTextDialog.java | ||
---|---|---|
44 | 44 |
*/ |
45 | 45 |
package com.iver.cit.gvsig.gui.layout.fframes.dialogs; |
46 | 46 |
|
47 |
import java.awt.Color; |
|
47 | 48 |
import java.awt.geom.Rectangle2D; |
48 | 49 |
|
49 | 50 |
import javax.swing.ImageIcon; |
51 |
import javax.swing.JColorChooser; |
|
52 |
import javax.swing.JDialog; |
|
53 |
import javax.swing.JFrame; |
|
50 | 54 |
import javax.swing.JPanel; |
51 | 55 |
import javax.swing.JToggleButton; |
52 | 56 |
|
... | ... | |
59 | 63 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameText; |
60 | 64 |
|
61 | 65 |
|
66 |
import javax.swing.JButton; |
|
62 | 67 |
/** |
63 | 68 |
* Dialogo para a?adir texto al Layout. |
64 | 69 |
* |
... | ... | |
92 | 97 |
private FFrameText fframetext = null; //new FFrameText(); |
93 | 98 |
private boolean isAcepted = false; |
94 | 99 |
private javax.swing.JButton bFuente = null; |
95 |
|
|
100 |
private Color textcolor = null; |
|
101 |
private JButton jButton = null; |
|
96 | 102 |
/** |
97 | 103 |
* This is the default constructor |
98 | 104 |
* |
... | ... | |
103 | 109 |
super(); |
104 | 110 |
fframetext = fframe; |
105 | 111 |
m_layout = layout; |
112 |
textcolor = fframe.getTextColor(); |
|
106 | 113 |
initialize(); |
107 | 114 |
} |
108 | 115 |
|
... | ... | |
112 | 119 |
private void initialize() { |
113 | 120 |
this.setLayout(null); |
114 | 121 |
this.add(getJContentPane(), null); |
115 |
this.setSize(288, 218);
|
|
122 |
this.setSize(289, 218);
|
|
116 | 123 |
} |
117 | 124 |
|
118 | 125 |
/** |
... | ... | |
149 | 156 |
jContentPane.add(getBAceptar(), null); |
150 | 157 |
jContentPane.add(getBCancelar(), null); |
151 | 158 |
jContentPane.add(getBFuente(), null); |
152 |
jContentPane.setSize(286, 227);
|
|
159 |
jContentPane.setSize(291, 227);
|
|
153 | 160 |
jContentPane.setLocation(6, 4); |
161 |
jContentPane.add(getJButton(), null); |
|
154 | 162 |
} |
155 | 163 |
|
156 | 164 |
return jContentPane; |
... | ... | |
202 | 210 |
private javax.swing.JLabel getLAlinear() { |
203 | 211 |
if (lAlinear == null) { |
204 | 212 |
lAlinear = new javax.swing.JLabel(); |
205 |
lAlinear.setSize(74, 27);
|
|
213 |
lAlinear.setSize(52, 27);
|
|
206 | 214 |
lAlinear.setText(PluginServices.getText(this, "alinear")); //$NON-NLS-1$ |
207 | 215 |
lAlinear.setLocation(5, 98); |
208 | 216 |
} |
... | ... | |
220 | 228 |
bIzquierda = new JToggleButton(); |
221 | 229 |
bIzquierda.setSize(30, 27); |
222 | 230 |
bIzquierda.setPreferredSize(new java.awt.Dimension(28, 20)); |
223 |
bIzquierda.setLocation(87, 98);
|
|
231 |
bIzquierda.setLocation(60, 98);
|
|
224 | 232 |
|
225 | 233 |
if (fframetext.getPos() == FFrameText.LEFT) { |
226 | 234 |
bIzquierda.setSelected(true); |
... | ... | |
250 | 258 |
bCentro = new JToggleButton(); |
251 | 259 |
bCentro.setSize(30, 27); |
252 | 260 |
bCentro.setPreferredSize(new java.awt.Dimension(28, 20)); |
253 |
bCentro.setLocation(120, 98);
|
|
261 |
bCentro.setLocation(93, 98);
|
|
254 | 262 |
|
255 | 263 |
if (fframetext.getPos() == FFrameText.CENTER) { |
256 | 264 |
bCentro.setSelected(true); |
... | ... | |
280 | 288 |
bDerecha = new JToggleButton(); |
281 | 289 |
bDerecha.setSize(30, 27); |
282 | 290 |
bDerecha.setPreferredSize(new java.awt.Dimension(28, 20)); |
283 |
bDerecha.setLocation(153, 98);
|
|
291 |
bDerecha.setLocation(126, 98);
|
|
284 | 292 |
|
285 | 293 |
if (fframetext.getPos() == FFrameText.RIGTH) { |
286 | 294 |
bDerecha.setSelected(true); |
... | ... | |
454 | 462 |
} catch (Exception ex) { |
455 | 463 |
} |
456 | 464 |
} |
457 |
|
|
465 |
fframetext.setTextColor(textcolor); |
|
458 | 466 |
fframetext.setSizeFixed(!getChbEscalaVista().isSelected()); |
459 | 467 |
fframetext.setRotation(Double.parseDouble( |
460 | 468 |
getTRotacion().getText())); |
... | ... | |
516 | 524 |
private javax.swing.JButton getBFuente() { |
517 | 525 |
if (bFuente == null) { |
518 | 526 |
bFuente = new javax.swing.JButton(); |
519 |
bFuente.setBounds(184, 98, 82, 27);
|
|
527 |
bFuente.setBounds(157, 98, 73, 27);
|
|
520 | 528 |
bFuente.setText(PluginServices.getText(this, "fuente")); //$NON-NLS-1$ |
521 | 529 |
bFuente.addActionListener(new java.awt.event.ActionListener() { |
522 | 530 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
... | ... | |
534 | 542 |
*/ |
535 | 543 |
public void viewActivated() { |
536 | 544 |
} |
537 |
} |
|
545 |
/** |
|
546 |
* This method initializes jButton |
|
547 |
* |
|
548 |
* @return javax.swing.JButton |
|
549 |
*/ |
|
550 |
private JButton getJButton() { |
|
551 |
if (jButton == null) { |
|
552 |
jButton = new JButton(); |
|
553 |
jButton.setForeground(Color.white); |
|
554 |
jButton.setBackground(textcolor); |
|
555 |
jButton.setBounds(235, 98, 32, 27); |
|
556 |
jButton.addActionListener(new java.awt.event.ActionListener() { |
|
557 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
558 |
JDialog dlg; |
|
559 |
JColorChooser colorChooser; |
|
560 |
colorChooser = new JColorChooser(); |
|
561 |
dlg = JColorChooser.createDialog((JFrame) null, |
|
562 |
PluginServices.getText(this, "Elegir_Color"), |
|
563 |
true, colorChooser, null, null); |
|
564 |
dlg.show(true); |
|
565 |
|
|
566 |
textcolor = (Color) colorChooser.getColor(); |
|
567 |
|
|
568 |
//getJPanel1().setBackground(textcolor); |
|
569 |
jButton.setBackground(textcolor); |
|
570 |
|
|
571 |
} |
|
572 |
}); |
|
573 |
} |
|
574 |
return jButton; |
|
575 |
} |
|
576 |
} // @jve:decl-index=0:visual-constraint="10,10" |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/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