svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / legendmanager / panels / FPanelLegendDefault.java @ 1827
History | View | Annotate | Download (35 KB)
1 |
/*
|
---|---|
2 |
* Created on 30-abr-2004
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
package com.iver.cit.gvsig.gui.legendmanager.panels; |
48 |
|
49 |
import java.awt.BasicStroke; |
50 |
import java.awt.BorderLayout; |
51 |
import java.awt.Color; |
52 |
import java.awt.Component; |
53 |
import java.awt.Dimension; |
54 |
import java.awt.Graphics; |
55 |
import java.awt.Graphics2D; |
56 |
import java.awt.GridBagConstraints; |
57 |
import java.awt.GridBagLayout; |
58 |
import java.awt.Insets; |
59 |
import java.awt.Paint; |
60 |
import java.awt.event.ActionEvent; |
61 |
import java.awt.event.ActionListener; |
62 |
import java.awt.geom.AffineTransform; |
63 |
import java.awt.geom.Line2D; |
64 |
import java.awt.geom.Rectangle2D; |
65 |
import java.io.File; |
66 |
import java.net.URI; |
67 |
import java.util.List; |
68 |
|
69 |
import javax.swing.BorderFactory; |
70 |
import javax.swing.DefaultComboBoxModel; |
71 |
import javax.swing.ImageIcon; |
72 |
import javax.swing.JButton; |
73 |
import javax.swing.JCheckBox; |
74 |
import javax.swing.JComboBox; |
75 |
import javax.swing.JFileChooser; |
76 |
import javax.swing.JLabel; |
77 |
import javax.swing.JList; |
78 |
import javax.swing.JPanel; |
79 |
import javax.swing.JSlider; |
80 |
import javax.swing.JTextField; |
81 |
import javax.swing.ListCellRenderer; |
82 |
import javax.swing.UIManager; |
83 |
import javax.swing.event.ChangeEvent; |
84 |
import javax.swing.event.ChangeListener; |
85 |
import javax.swing.plaf.basic.BasicComboBoxEditor; |
86 |
|
87 |
import com.iver.andami.PluginServices; |
88 |
import com.iver.andami.Utilities; |
89 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
90 |
import com.iver.cit.gvsig.fmap.core.FShape; |
91 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
92 |
import com.iver.cit.gvsig.fmap.core.v02.FGraphicUtilities; |
93 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
94 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbolFactory; |
95 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
96 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
97 |
import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend; |
98 |
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
99 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
100 |
import com.iver.cit.gvsig.gui.GUIUtil; |
101 |
import com.iver.cit.gvsig.gui.Panels.ColorChooserPanel; |
102 |
import com.iver.cit.gvsig.gui.Panels.TransparencyPanel; |
103 |
import com.iver.utiles.ImageFilter; |
104 |
import com.vividsolutions.jump.util.StringUtil; |
105 |
/**
|
106 |
* @author fjp
|
107 |
*
|
108 |
* To change the template for this generated type comment go to
|
109 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
110 |
*/
|
111 |
|
112 |
|
113 |
public class FPanelLegendDefault extends JPanel implements ILegendPanel { |
114 |
|
115 |
private FSymbol m_FSymbol = null; |
116 |
|
117 |
|
118 |
protected static final int SLIDER_TEXT_FIELD_COLUMNS = 3; |
119 |
protected static final Dimension SLIDER_DIMENSION = new Dimension(130, 49); |
120 |
// private Paint[] fillPatterns = new FillPatternFactory().createFillPatterns();
|
121 |
private JPanel centerPanel = new JPanel(); |
122 |
// private AbstractPalettePanel palettePanel;
|
123 |
protected JCheckBox fillCheckBox = new JCheckBox(); |
124 |
protected JCheckBox lineCheckBox = new JCheckBox(); |
125 |
protected TransparencyPanel transparencyPanel = new TransparencyPanel(); |
126 |
protected JLabel transparencyLabel = new JLabel(); |
127 |
protected ColorChooserPanel lineColorChooserPanel = new ColorChooserPanel(); |
128 |
protected ColorChooserPanel fillColorChooserPanel = new ColorChooserPanel(); |
129 |
protected ColorChooserPanel pointColorChooserPanel = new ColorChooserPanel(); |
130 |
protected FPreviewSymbol m_previewSymbol = new FPreviewSymbol(); |
131 |
protected JLabel lineWidthLabel = new JLabel(); |
132 |
protected JCheckBox synchronizeCheckBox = new JCheckBox(); |
133 |
private JCheckBox linePatternCheckBox = new JCheckBox(); |
134 |
private JCheckBox fillPatternCheckBox = new JCheckBox(); |
135 |
private Paint[] fillPatterns = FSymbolFactory.createPatternFills(Color.GRAY); |
136 |
private String[] linePatterns = new String[] { |
137 |
"1", "3", "5", "5,1", "7", "7,12", "9", "9,2", "15,6", "20,3" |
138 |
}; |
139 |
|
140 |
private Integer[] pointTypes = new Integer[] { |
141 |
new Integer(FStyle2D.SYMBOL_STYLE_MARKER_SQUARE), |
142 |
new Integer(FStyle2D.SYMBOL_STYLE_MARKER_CIRCLE), |
143 |
new Integer(FStyle2D.SYMBOL_STYLE_MARKER_TRIANGLE), |
144 |
new Integer(FStyle2D.SYMBOL_STYLE_MARKER_CROSS), |
145 |
new Integer(FStyle2D.SYMBOL_STYLE_MARKER_IMAGEN) |
146 |
}; |
147 |
|
148 |
protected String pointTypeToString(Integer pointType) |
149 |
{ |
150 |
String resul = "No reconocido"; |
151 |
switch (pointType.intValue())
|
152 |
{ |
153 |
case FStyle2D.SYMBOL_STYLE_MARKER_SQUARE:
|
154 |
resul = "Cuadrado";
|
155 |
break;
|
156 |
case FStyle2D.SYMBOL_STYLE_MARKER_CIRCLE:
|
157 |
resul = "C?rculo";
|
158 |
break;
|
159 |
case FStyle2D.SYMBOL_STYLE_MARKER_TRIANGLE:
|
160 |
resul = "Tri?ngulo";
|
161 |
break;
|
162 |
case FStyle2D.SYMBOL_STYLE_MARKER_CROSS:
|
163 |
resul = "Cruz";
|
164 |
break;
|
165 |
case FStyle2D.SYMBOL_STYLE_MARKER_IMAGEN:
|
166 |
resul = "Imagen";
|
167 |
break;
|
168 |
|
169 |
} |
170 |
return resul;
|
171 |
} |
172 |
protected Integer pointTypeToInt(String pointType) |
173 |
{ |
174 |
if (pointType.compareTo("Cuadrado")== 0) |
175 |
return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_SQUARE); |
176 |
if (pointType.compareTo("C?rculo")== 0) |
177 |
return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_CIRCLE); |
178 |
if (pointType.compareTo("Tri?ngulo")== 0) |
179 |
return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_TRIANGLE); |
180 |
if (pointType.compareTo("Cruz")== 0) |
181 |
return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_CROSS); |
182 |
if (pointType.compareTo("Imagen")== 0) |
183 |
return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_IMAGEN); |
184 |
return new Integer(-1); |
185 |
} |
186 |
private JComboBox pointTypeComboBox = new JComboBox(pointTypes) { |
187 |
|
188 |
{ |
189 |
BasicComboBoxEditor editor = new BasicComboBoxEditor(); |
190 |
|
191 |
setEditor(editor); |
192 |
setEditable(true);
|
193 |
addActionListener(new ActionListener() { |
194 |
public void actionPerformed(ActionEvent e) { |
195 |
updateControls(false);
|
196 |
if (getSelectedItem() instanceof Integer) |
197 |
{ |
198 |
setSelectedItem(pointTypeToString((Integer) getSelectedItem()));
|
199 |
|
200 |
updateControls(false);
|
201 |
} |
202 |
} |
203 |
}); |
204 |
setRenderer(new ListCellRenderer() { |
205 |
private Integer pointType; |
206 |
private FSymbol myFSymbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT); |
207 |
private JPanel panel = new JPanel() { |
208 |
|
209 |
protected void paintComponent(Graphics g) { |
210 |
super.paintComponent(g);
|
211 |
|
212 |
Graphics2D g2 = (Graphics2D) g; |
213 |
AffineTransform mT = new AffineTransform(); |
214 |
mT.setToIdentity(); |
215 |
|
216 |
FPoint2D shp = new FPoint2D(panel.getWidth()/2, |
217 |
panel.getHeight()/2);
|
218 |
if (m_FSymbol !=null){ |
219 |
myFSymbol.setColor(m_FSymbol.getColor()); |
220 |
FGraphicUtilities.DrawShape(g2,mT, shp,myFSymbol); |
221 |
} |
222 |
} |
223 |
}; |
224 |
|
225 |
|
226 |
public Component getListCellRendererComponent( |
227 |
JList list, Object value, int index, |
228 |
boolean isSelected, boolean cellHasFocus) { |
229 |
pointType = (Integer) value;
|
230 |
myFSymbol.setStyle(pointType.intValue()); |
231 |
// Le hacemos que se dibuje siempre con 10 pixels
|
232 |
|
233 |
myFSymbol.setSizeInPixels(true);
|
234 |
myFSymbol.setSize(10);
|
235 |
myFSymbol.setStroke(new BasicStroke()); |
236 |
panel.setForeground(UIManager.getColor(isSelected
|
237 |
? "ComboBox.selectionForeground"
|
238 |
: "ComboBox.foreground"));
|
239 |
panel.setBackground(UIManager.getColor(isSelected
|
240 |
? "ComboBox.selectionBackground"
|
241 |
: "ComboBox.background"));
|
242 |
|
243 |
return panel;
|
244 |
} |
245 |
}); |
246 |
} |
247 |
}; |
248 |
|
249 |
/**
|
250 |
* Converts the comma-delimited string into a List of trimmed strings.
|
251 |
*
|
252 |
* @param linePattern a String with comma-delimited values
|
253 |
* @param lineWidth DOCUMENT ME!
|
254 |
*
|
255 |
* @return a List of the Strings that were delimited by commas
|
256 |
*
|
257 |
* @throws IllegalArgumentException DOCUMENT ME!
|
258 |
*/
|
259 |
private static float[] toArray(String linePattern, float lineWidth) { |
260 |
List strings = StringUtil.fromCommaDelimitedString(linePattern);
|
261 |
float[] array = new float[strings.size()]; |
262 |
|
263 |
for (int i = 0; i < strings.size(); i++) { |
264 |
String string = (String) strings.get(i); |
265 |
array[i] = Float.parseFloat(string) * lineWidth;
|
266 |
|
267 |
if (array[i] <= 0) { |
268 |
throw new IllegalArgumentException("Negative dash length"); |
269 |
} |
270 |
} |
271 |
|
272 |
return array;
|
273 |
} |
274 |
|
275 |
protected JSlider lineWidthSlider = new JSlider() { |
276 |
|
277 |
{ |
278 |
addChangeListener(new ChangeListener() { |
279 |
public void stateChanged(ChangeEvent e) { |
280 |
updateControls(false);
|
281 |
} |
282 |
}); |
283 |
} |
284 |
}; |
285 |
private JComboBox linePatternComboBox = new JComboBox(linePatterns) { |
286 |
{ |
287 |
BasicComboBoxEditor editor = new BasicComboBoxEditor(); |
288 |
setEditor(editor); |
289 |
setEditable(true);
|
290 |
addActionListener(new ActionListener() { |
291 |
public void actionPerformed(ActionEvent e) { |
292 |
updateControls(false);
|
293 |
} |
294 |
}); |
295 |
setRenderer(new ListCellRenderer() { |
296 |
private JPanel panel = new JPanel() { |
297 |
private int lineWidth = 2; |
298 |
|
299 |
protected void paintComponent(Graphics g) { |
300 |
super.paintComponent(g);
|
301 |
|
302 |
Graphics2D g2 = (Graphics2D) g; |
303 |
g2.setStroke(new BasicStroke(lineWidth, |
304 |
BasicStroke.CAP_BUTT,
|
305 |
BasicStroke.JOIN_BEVEL, 1.0f, |
306 |
toArray(linePattern, lineWidth), 0));
|
307 |
g2.draw(new Line2D.Double(0, |
308 |
panel.getHeight() / 2.0,
|
309 |
panel.getWidth(), |
310 |
panel.getHeight() / 2.0));
|
311 |
} |
312 |
}; |
313 |
|
314 |
private String linePattern; |
315 |
|
316 |
public Component getListCellRendererComponent( |
317 |
JList list, Object value, int index, |
318 |
boolean isSelected, boolean cellHasFocus) { |
319 |
linePattern = (String) value;
|
320 |
panel.setForeground(UIManager.getColor(isSelected
|
321 |
? "ComboBox.selectionForeground"
|
322 |
: "ComboBox.foreground"));
|
323 |
panel.setBackground(UIManager.getColor(isSelected
|
324 |
? "ComboBox.selectionBackground"
|
325 |
: "ComboBox.background"));
|
326 |
|
327 |
return panel;
|
328 |
} |
329 |
}); |
330 |
} |
331 |
}; |
332 |
|
333 |
|
334 |
private JComboBox fillPatternComboBox = new JComboBox(fillPatterns) { |
335 |
|
336 |
{ |
337 |
// setMaximumRowCount(fillPatterns.length);
|
338 |
setEditable(false);
|
339 |
addActionListener(new ActionListener() { |
340 |
public void actionPerformed(ActionEvent e) { |
341 |
updateControls(true);
|
342 |
} |
343 |
}); |
344 |
setRenderer(new ListCellRenderer() { |
345 |
private Paint fillPattern; |
346 |
private JLabel label = new JLabel(" "); |
347 |
private JPanel panel = new JPanel(new BorderLayout()) { |
348 |
|
349 |
{ |
350 |
label.setPreferredSize(new Dimension(150, |
351 |
(int) label.getPreferredSize()
|
352 |
.getHeight())); |
353 |
add(label, BorderLayout.CENTER);
|
354 |
} |
355 |
|
356 |
protected void paintComponent(Graphics g) { |
357 |
super.paintComponent(g);
|
358 |
((Graphics2D) g).setPaint(fillPattern);
|
359 |
((Graphics2D) g).fill(new Rectangle2D.Double( |
360 |
0, 0, getWidth(), getHeight())); |
361 |
} |
362 |
}; |
363 |
|
364 |
public Component getListCellRendererComponent( |
365 |
JList list, Object value, int index, |
366 |
boolean isSelected, boolean cellHasFocus) { |
367 |
fillPattern = (Paint) value;
|
368 |
// label.setText("" +(1 +
|
369 |
// CollectionUtil.indexOf(fillPattern, fillPatterns)));
|
370 |
label.setForeground(UIManager.getColor(isSelected
|
371 |
? "ComboBox.selectionForeground"
|
372 |
: "ComboBox.foreground"));
|
373 |
panel.setBackground(UIManager.getColor(isSelected
|
374 |
? "ComboBox.selectionBackground"
|
375 |
: "ComboBox.background"));
|
376 |
|
377 |
return panel;
|
378 |
} |
379 |
}); |
380 |
} |
381 |
}; |
382 |
|
383 |
|
384 |
private javax.swing.JPanel jPanelPoint = null; // |
385 |
private javax.swing.JLabel jLabel = null; |
386 |
private javax.swing.JLabel jLabel1 = null; |
387 |
private javax.swing.JCheckBox jCheckBox = null; |
388 |
private javax.swing.JTextField jTextField_Size = null; |
389 |
private javax.swing.JComboBox jComboBox_Symbol_Type = null; |
390 |
private javax.swing.JLabel jLabel2 = null; |
391 |
private JLabel jLblImagen = null; |
392 |
private JTextField jTxtImagen = null; |
393 |
private JButton jBtnImagen = null; |
394 |
/**
|
395 |
*
|
396 |
*/
|
397 |
public FPanelLegendDefault() {
|
398 |
super();
|
399 |
try {
|
400 |
jbInit(); |
401 |
linePatternCheckBox.setSelected(false);
|
402 |
} catch (Exception e) { |
403 |
e.printStackTrace(); |
404 |
} |
405 |
|
406 |
transparencyPanel.getSlider().getModel().addChangeListener(new ChangeListener() { |
407 |
public void stateChanged(ChangeEvent e) { |
408 |
updateControls(true);
|
409 |
} |
410 |
}); |
411 |
/* palettePanel.add(new GridPalettePanel.Listener() {
|
412 |
public void basicStyleChosen(BasicStyle basicStyle) {
|
413 |
//Preserve some settings e.g. line and fill patterns, alpha;
|
414 |
BasicStyle newBasicStyle = getBasicStyle();
|
415 |
newBasicStyle.setFillColor(basicStyle.getFillColor());
|
416 |
newBasicStyle.setLineColor(basicStyle.getLineColor());
|
417 |
newBasicStyle.setLineWidth(basicStyle.getLineWidth());
|
418 |
newBasicStyle.setRenderingFill(basicStyle.isRenderingFill());
|
419 |
newBasicStyle.setRenderingLine(basicStyle.isRenderingLine());
|
420 |
setBasicStyle(newBasicStyle);
|
421 |
}
|
422 |
}); */
|
423 |
updateControls(false);
|
424 |
|
425 |
} |
426 |
|
427 |
void jbInit() throws Exception { |
428 |
java.awt.GridBagConstraints consGridBagConstraints2 = new java.awt.GridBagConstraints();
|
429 |
|
430 |
lineWidthSlider.setPreferredSize(SLIDER_DIMENSION); |
431 |
lineWidthSlider.setPaintLabels(true);
|
432 |
lineWidthSlider.setValue(1);
|
433 |
lineWidthSlider.setLabelTable(lineWidthSlider.createStandardLabels(10));
|
434 |
lineWidthSlider.setMajorTickSpacing(5);
|
435 |
lineWidthSlider.setMaximum(30);
|
436 |
lineWidthSlider.setMinorTickSpacing(1);
|
437 |
|
438 |
|
439 |
JPanel globalPanel = new JPanel(); |
440 |
globalPanel.setLayout(new GridBagLayout()); |
441 |
|
442 |
linePatternCheckBox.setText(PluginServices.getText(this,"tipo_linea")); |
443 |
fillPatternCheckBox.setText(PluginServices.getText(this,"tipo_relleno")); |
444 |
linePatternCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
445 |
public void actionPerformed(ActionEvent e) { |
446 |
linePatternCheckBox_actionPerformed(e); |
447 |
} |
448 |
}); |
449 |
fillPatternCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
450 |
public void actionPerformed(ActionEvent e) { |
451 |
fillPatternCheckBox_actionPerformed(e); |
452 |
} |
453 |
}); |
454 |
// add(getJPanelPoint());
|
455 |
globalPanel.add(getCenterPanel(), |
456 |
new GridBagConstraints(0, 0, 1, 2, 0, 0, GridBagConstraints.WEST, |
457 |
GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); |
458 |
|
459 |
/*globalPanel.add(new JPanel(),
|
460 |
new GridBagConstraints(3, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
|
461 |
GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); */
|
462 |
/* globalPanel.add(new JLabel("Previsualizaci?n de s?mbolo:"),
|
463 |
new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
|
464 |
GridBagConstraints.NONE, new Insets(0, 30, 0, 0), 0, 0)); */
|
465 |
|
466 |
JPanel panelAux = new JPanel(); |
467 |
panelAux.add(new JLabel(PluginServices.getText(this,"Previsualizacion_de_simbolo"))); |
468 |
panelAux.add(m_previewSymbol ); |
469 |
/* globalPanel.add(panelAux, new
|
470 |
GridBagConstraints(2, 1, 1, 1, 1, 1, GridBagConstraints.WEST,
|
471 |
GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); */
|
472 |
|
473 |
|
474 |
m_previewSymbol.setPreferredSize(new Dimension(80,60)); |
475 |
m_previewSymbol.setMinimumSize(new Dimension(80,60)); |
476 |
|
477 |
setLayout(null);
|
478 |
globalPanel.setBounds(0,0,350,250); |
479 |
|
480 |
getJPanelPoint().setBounds(0,0,350,250); |
481 |
add(getJPanelPoint()); //, BorderLayout.WEST); //, consGridBagConstraints2);
|
482 |
add(globalPanel); // , BorderLayout.WEST);
|
483 |
|
484 |
panelAux.setBounds(350,0,150,100); |
485 |
|
486 |
add(panelAux) ; //,BorderLayout.EAST); // Contiene el preview
|
487 |
|
488 |
/* globalPanel.setBackground(Color.RED);
|
489 |
getJPanelPoint().setBackground(Color.BLUE);
|
490 |
panelAux.setBackground(Color.GREEN); */
|
491 |
|
492 |
getCenterPanel().setLayout(new GridBagLayout()); |
493 |
setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
494 |
this.setSize(419, 293); |
495 |
fillColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
|
496 |
public void actionPerformed(ActionEvent e) { |
497 |
fillColorChooserPanel_actionPerformed(e); |
498 |
} |
499 |
}); |
500 |
lineColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
|
501 |
public void actionPerformed(ActionEvent e) { |
502 |
lineColorChooserPanel_actionPerformed(e); |
503 |
} |
504 |
}); |
505 |
|
506 |
synchronizeCheckBox.setText(PluginServices.getText(this,"sincronizar_color_borde_relleno")); |
507 |
synchronizeCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
508 |
public void actionPerformed(ActionEvent e) { |
509 |
synchronizeCheckBox_actionPerformed(e); |
510 |
} |
511 |
}); |
512 |
fillCheckBox.setText(PluginServices.getText(this,"relleno")); |
513 |
fillCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
514 |
public void actionPerformed(ActionEvent e) { |
515 |
fillCheckBox_actionPerformed(e); |
516 |
} |
517 |
}); |
518 |
lineCheckBox.setText(PluginServices.getText(this,"linea")); |
519 |
lineCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
520 |
public void actionPerformed(ActionEvent e) { |
521 |
lineCheckBox_actionPerformed(e); |
522 |
} |
523 |
}); |
524 |
getCenterPanel().add(GUIUtil.createSyncdTextField( |
525 |
transparencyPanel.getSlider(), SLIDER_TEXT_FIELD_COLUMNS), |
526 |
new GridBagConstraints(2, 21, 1, 1, 0.0, 0.0, |
527 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
528 |
new Insets(2, 2, 2, 2), 0, 0)); |
529 |
getCenterPanel().add(lineWidthSlider, |
530 |
new GridBagConstraints(1, 19, 1, 1, 0.0, 0.0, |
531 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
532 |
new Insets(2, 2, 2, 2), 0, 0)); |
533 |
getCenterPanel().add(GUIUtil.createSyncdTextField(lineWidthSlider, |
534 |
SLIDER_TEXT_FIELD_COLUMNS), |
535 |
new GridBagConstraints(2, 19, 1, 1, 0.0, 0.0, |
536 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
537 |
new Insets(2, 2, 2, 2), 0, 0)); |
538 |
fillColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
|
539 |
public void actionPerformed(ActionEvent e) { |
540 |
fillColorChooserPanel_actionPerformed(e); |
541 |
} |
542 |
}); |
543 |
lineWidthLabel.setText(PluginServices.getText(this,"grosor_linea")); |
544 |
transparencyLabel.setText(PluginServices.getText(this,"transparencia")); |
545 |
consGridBagConstraints2.gridx = 0;
|
546 |
consGridBagConstraints2.gridy = 0;
|
547 |
consGridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST; |
548 |
consGridBagConstraints2.fill = java.awt.GridBagConstraints.NONE; |
549 |
getCenterPanel().add(synchronizeCheckBox, |
550 |
new GridBagConstraints(0, 18, 3, 1, 0.0, 0.0, |
551 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
552 |
new Insets(2, 2, 2, 2), 0, 0)); |
553 |
getCenterPanel().add(transparencyLabel, |
554 |
new GridBagConstraints(0, 21, 1, 1, 0.0, 0.0, |
555 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
556 |
new Insets(2, 2, 2, 2), 0, 0)); |
557 |
getCenterPanel().add(fillColorChooserPanel, |
558 |
new GridBagConstraints(1, 5, 2, 1, 0.0, 0.0, |
559 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
560 |
new Insets(2, 2, 2, 2), 0, 0)); |
561 |
|
562 |
|
563 |
getCenterPanel().add(lineColorChooserPanel, |
564 |
new GridBagConstraints(1, 11, 2, 1, 0.0, 0.0, |
565 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
566 |
new Insets(2, 2, 2, 2), 0, 0)); |
567 |
getCenterPanel().add(transparencyPanel, |
568 |
new GridBagConstraints(1, 21, 1, 1, 0.0, 0.0, |
569 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
570 |
new Insets(2, 2, 2, 2), 0, 0)); |
571 |
getCenterPanel().add(fillCheckBox, |
572 |
new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, |
573 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
574 |
new Insets(2, 2, 2, 2), 0, 0)); |
575 |
getCenterPanel().add(lineCheckBox, |
576 |
new GridBagConstraints(0, 11, 1, 1, 0.0, 0.0, |
577 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
578 |
new Insets(2, 2, 2, 2), 0, 0)); |
579 |
getCenterPanel().add(lineWidthLabel, |
580 |
new GridBagConstraints(0, 19, 1, 1, 0.0, 0.0, |
581 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
582 |
new Insets(2, 2, 2, 2), 0, 0)); |
583 |
getCenterPanel().add(linePatternCheckBox, |
584 |
new GridBagConstraints(0, 16, 1, 1, 0.0, 0.0, |
585 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
586 |
new Insets(2, 2, 2, 2), 0, 0)); |
587 |
getCenterPanel().add(fillPatternCheckBox, |
588 |
new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, |
589 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
590 |
new Insets(2, 2, 2, 2), 0, 0)); |
591 |
getCenterPanel().add(linePatternComboBox, |
592 |
new GridBagConstraints(1, 16, 2, 1, 0.0, 0.0, |
593 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
594 |
new Insets(2, 2, 2, 2), 0, 0)); |
595 |
getCenterPanel().add(fillPatternComboBox, |
596 |
new GridBagConstraints(1, 7, 2, 1, 0.0, 0.0, |
597 |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
598 |
new Insets(2, 2, 0, 2), 0, 0)); |
599 |
|
600 |
pointTypeComboBox.setBounds(143, 25, 120, 20); |
601 |
pointColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
|
602 |
public void actionPerformed(ActionEvent e) { |
603 |
updateControls(false);
|
604 |
} |
605 |
}); |
606 |
|
607 |
// this.setSize(348, 243);
|
608 |
|
609 |
} |
610 |
|
611 |
protected void setAlpha(int alpha) { |
612 |
transparencyPanel.getSlider().setValue(255 - alpha);
|
613 |
} |
614 |
|
615 |
protected int getAlpha() { |
616 |
return 255 - transparencyPanel.getSlider().getValue(); |
617 |
} |
618 |
|
619 |
void fillCheckBox_actionPerformed(ActionEvent e) { |
620 |
updateControls(false);
|
621 |
} |
622 |
|
623 |
void lineCheckBox_actionPerformed(ActionEvent e) { |
624 |
updateControls(false);
|
625 |
} |
626 |
|
627 |
private void setSynchronizingLineColor(boolean newSynchronizingLineColor) { |
628 |
synchronizeCheckBox.setSelected(newSynchronizingLineColor); |
629 |
} |
630 |
|
631 |
protected void synchronizeCheckBox_actionPerformed(ActionEvent e) { |
632 |
if (synchronizeCheckBox.isSelected()) {
|
633 |
syncLineColor(); |
634 |
} |
635 |
|
636 |
updateControls(false);
|
637 |
} |
638 |
|
639 |
private JCheckBox getSynchronizeCheckBox() { |
640 |
return synchronizeCheckBox;
|
641 |
} |
642 |
|
643 |
void linePatternCheckBox_actionPerformed(ActionEvent e) { |
644 |
updateControls(false);
|
645 |
} |
646 |
void lineColorChooserPanel_actionPerformed(ActionEvent e) { |
647 |
if (synchronizeCheckBox.isSelected()) {
|
648 |
fillColorChooserPanel.setColor(lineColorChooserPanel.getColor() |
649 |
.brighter()); |
650 |
} |
651 |
|
652 |
updateControls(false);
|
653 |
} |
654 |
void fillColorChooserPanel_actionPerformed(ActionEvent e) { |
655 |
if (synchronizeCheckBox.isSelected()) {
|
656 |
syncLineColor(); |
657 |
} |
658 |
|
659 |
updateControls(true);
|
660 |
} |
661 |
private void syncLineColor() { |
662 |
lineColorChooserPanel.setColor(fillColorChooserPanel.getColor().darker()); |
663 |
} |
664 |
|
665 |
void fillPatternCheckBox_actionPerformed(ActionEvent e) { |
666 |
updateControls(false);
|
667 |
} |
668 |
private void updateFillPatternColors() { |
669 |
if ((m_FSymbol != null) && (m_FSymbol.getColor() != null)) |
670 |
{ |
671 |
fillPatterns = FSymbolFactory.createPatternFills(m_FSymbol.getColor()); |
672 |
fillPatternComboBox.setModel(new DefaultComboBoxModel(fillPatterns)); |
673 |
fillPatternComboBox.getModel().setSelectedItem(m_FSymbol.getFill()); |
674 |
// fillPatternComboBox.setSelectedItem(m_FSymbol.m_Fill);
|
675 |
} |
676 |
|
677 |
} |
678 |
|
679 |
public void updateControls(boolean bInternal) { |
680 |
linePatternComboBox.setEnabled(linePatternCheckBox.isSelected()); |
681 |
fillPatternComboBox.setEnabled(fillPatternCheckBox.isSelected()); |
682 |
lineColorChooserPanel.setEnabled(lineCheckBox.isSelected()); |
683 |
fillColorChooserPanel.setEnabled(fillCheckBox.isSelected()); |
684 |
fillColorChooserPanel.setAlpha(getAlpha()); |
685 |
lineColorChooserPanel.setAlpha(getAlpha()); |
686 |
Color theColor = (lineCheckBox.isSelected() &&
|
687 |
!fillCheckBox.isSelected()) ? lineColorChooserPanel.getColor() |
688 |
: fillColorChooserPanel.getColor(); |
689 |
transparencyPanel.setColor(theColor); |
690 |
if (jTxtImagen != null) |
691 |
{ |
692 |
jTxtImagen.setVisible(false);
|
693 |
jLblImagen.setVisible(false);
|
694 |
jBtnImagen.setVisible(false);
|
695 |
} |
696 |
if (m_FSymbol != null) |
697 |
{ |
698 |
if (m_FSymbol.getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
|
699 |
{ |
700 |
m_FSymbol.setSize(Integer.parseInt(getJTextField().getText()));
|
701 |
|
702 |
//System.out.println("Asigno el m_Size = " + getJTextField().getText());
|
703 |
|
704 |
if (pointTypeComboBox.getSelectedItem() instanceof Integer) |
705 |
{ |
706 |
Integer styleSelected = (Integer) pointTypeComboBox.getSelectedItem(); |
707 |
m_FSymbol.setStyle(styleSelected.intValue()); |
708 |
} |
709 |
else
|
710 |
{ |
711 |
Integer styleSelected = pointTypeToInt((String) pointTypeComboBox.getSelectedItem()); |
712 |
m_FSymbol.setStyle(styleSelected.intValue()); |
713 |
} |
714 |
if (m_FSymbol.getStyle() == FConstant.SYMBOL_STYLE_MARKER_IMAGEN)
|
715 |
{ |
716 |
jTxtImagen.setVisible(true);
|
717 |
jLblImagen.setVisible(true);
|
718 |
jBtnImagen.setVisible(true);
|
719 |
if (jTxtImagen.getText().compareTo("") != 0) |
720 |
{ |
721 |
File iconFile = new File(jTxtImagen.getText()); |
722 |
URI theUri= iconFile.toURI();
|
723 |
m_FSymbol.setIconURI(theUri); |
724 |
} |
725 |
} |
726 |
m_FSymbol.setColor(pointColorChooserPanel.getColor()); |
727 |
m_FSymbol.setSizeInPixels(!getJCheckBox().isSelected()); |
728 |
pointColorChooserPanel.repaint(); |
729 |
m_previewSymbol.setSymbol(m_FSymbol); |
730 |
return;
|
731 |
} |
732 |
m_FSymbol.setOutlined(lineCheckBox.isSelected()); |
733 |
m_FSymbol.setOutlineColor(lineColorChooserPanel.getColor()); |
734 |
if (fillCheckBox.isSelected())
|
735 |
{ |
736 |
m_FSymbol.setColor(new Color(theColor.getRed(), |
737 |
theColor.getGreen(), |
738 |
theColor.getBlue(), |
739 |
getAlpha())); |
740 |
} |
741 |
else
|
742 |
{ |
743 |
m_FSymbol.setColor(null);
|
744 |
} |
745 |
if (fillPatternCheckBox.isSelected())
|
746 |
{ |
747 |
Paint fillAux = (Paint) fillPatternComboBox.getSelectedItem(); |
748 |
if ((fillAux != null) && (fillPatternComboBox.getSelectedIndex() != -1)) |
749 |
{ |
750 |
m_FSymbol.setFill((Paint) fillPatternComboBox.getSelectedItem());
|
751 |
// Rellenamos el m_Style para que luego podamos escribir
|
752 |
// el tipo de relleno que lleva.
|
753 |
m_FSymbol.setStyle(fillPatternComboBox.getSelectedIndex()+3);
|
754 |
System.out.println("Asigno Style=" + m_FSymbol.getStyle()); |
755 |
} |
756 |
} |
757 |
else
|
758 |
if (bInternal == false) |
759 |
m_FSymbol.setFill(null);
|
760 |
|
761 |
float lineWidth = lineWidthSlider.getValue();
|
762 |
if (linePatternCheckBox.isSelected())
|
763 |
{ |
764 |
String linePattern = (String) linePatternComboBox.getSelectedItem(); |
765 |
// System.out.println(m_FSymbol.m_Stroke.toString());
|
766 |
m_FSymbol.setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, |
767 |
BasicStroke.JOIN_BEVEL, 1.0f, |
768 |
toArray(linePattern, lineWidth), 0));
|
769 |
|
770 |
m_FSymbol.m_LinePattern = linePattern; |
771 |
} |
772 |
else
|
773 |
{ |
774 |
if (lineWidth <=1) |
775 |
m_FSymbol.setStroke(null);
|
776 |
else
|
777 |
m_FSymbol.setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, |
778 |
BasicStroke.JOIN_BEVEL));
|
779 |
} |
780 |
// System.out.println(fillPatternComboBox.getSelectedItem().toString() + " " + linePatternComboBox.getSelectedItem().toString());
|
781 |
// JOptionPane.showMessageDialog(this,"HOla","Colega", JOptionPane.INFORMATION_MESSAGE);
|
782 |
m_previewSymbol.setSymbol(m_FSymbol); |
783 |
} |
784 |
|
785 |
updateFillPatternColors(); |
786 |
fillPatternComboBox.repaint(); |
787 |
} |
788 |
|
789 |
public void setFSymbol(FSymbol s) |
790 |
{ |
791 |
if (s==null) |
792 |
{ |
793 |
m_FSymbol = new FSymbol(FShape.MULTI);
|
794 |
} |
795 |
m_FSymbol = s.fastCloneSymbol(); |
796 |
m_previewSymbol.setSymbol(m_FSymbol); |
797 |
if ((m_FSymbol.getSymbolType() == FConstant.SYMBOL_TYPE_FILL) || (m_FSymbol.getSymbolType() == FShape.MULTI))
|
798 |
{ |
799 |
// Deber?amos habilitar la pesta?a de pol?gonos
|
800 |
getJPanelPoint().setVisible(false);
|
801 |
getCenterPanel().setVisible(true);
|
802 |
fillCheckBox.setText(PluginServices.getText(this,"relleno")); |
803 |
synchronizeCheckBox.setVisible(true);
|
804 |
fillPatternCheckBox.setVisible(true);
|
805 |
fillPatternComboBox.setVisible(true);
|
806 |
lineCheckBox.setVisible(true);
|
807 |
lineColorChooserPanel.setVisible(true);
|
808 |
|
809 |
lineCheckBox.setSelected(m_FSymbol.isOutlined()); |
810 |
lineColorChooserPanel.setColor(m_FSymbol.getOutlineColor()); |
811 |
if (m_FSymbol.getColor() != null) |
812 |
{ |
813 |
fillCheckBox.setSelected(true);
|
814 |
fillColorChooserPanel.setColor(m_FSymbol.getColor()); |
815 |
setAlpha(m_FSymbol.getColor().getAlpha()); |
816 |
fillColorChooserPanel.setAlpha(getAlpha()); |
817 |
lineColorChooserPanel.setAlpha(getAlpha()); |
818 |
} |
819 |
else
|
820 |
{ |
821 |
fillCheckBox.setSelected(false);
|
822 |
} |
823 |
|
824 |
linePatternCheckBox.setSelected(false);
|
825 |
if (m_FSymbol.getStroke() != null) |
826 |
{ |
827 |
BasicStroke aux = (BasicStroke) m_FSymbol.getStroke(); |
828 |
if (aux.getDashArray() != null) |
829 |
{ |
830 |
linePatternCheckBox.setSelected(true);
|
831 |
linePatternComboBox.setSelectedItem(m_FSymbol.m_LinePattern); |
832 |
} |
833 |
} |
834 |
if (m_FSymbol.getFill() != null) |
835 |
{ |
836 |
fillPatternCheckBox.setSelected(true);
|
837 |
fillPatternComboBox.setSelectedItem(new Integer(m_FSymbol.getStyle())); |
838 |
} |
839 |
|
840 |
} |
841 |
if (m_FSymbol.getSymbolType() == FConstant.SYMBOL_TYPE_LINE)
|
842 |
{ |
843 |
getJPanelPoint().setVisible(false);
|
844 |
getCenterPanel().setVisible(true);
|
845 |
fillCheckBox.setText(PluginServices.getText(this,"linea")); // Lo vamos a usar como color de l?nea |
846 |
fillCheckBox.setSelected(true);
|
847 |
synchronizeCheckBox.setVisible(false);
|
848 |
fillPatternCheckBox.setVisible(false);
|
849 |
fillPatternComboBox.setVisible(false);
|
850 |
lineCheckBox.setSelected(true);
|
851 |
lineCheckBox.setVisible(false);
|
852 |
fillColorChooserPanel.setColor(m_FSymbol.getColor()); |
853 |
lineColorChooserPanel.setVisible(false);
|
854 |
if (m_FSymbol.getColor() != null) |
855 |
{ |
856 |
lineColorChooserPanel.setColor(m_FSymbol.getColor()); |
857 |
setAlpha(m_FSymbol.getColor().getAlpha()); |
858 |
lineColorChooserPanel.setAlpha(getAlpha()); |
859 |
} |
860 |
linePatternCheckBox.setSelected(false);
|
861 |
if (m_FSymbol.getStroke() != null) |
862 |
{ |
863 |
BasicStroke aux = (BasicStroke) m_FSymbol.getStroke(); |
864 |
if (aux.getDashArray() != null) |
865 |
{ |
866 |
linePatternCheckBox.setSelected(true);
|
867 |
linePatternComboBox.setSelectedItem(m_FSymbol.m_LinePattern); |
868 |
} |
869 |
} |
870 |
} |
871 |
if (m_FSymbol.getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
|
872 |
{ |
873 |
getCenterPanel().setVisible(false);
|
874 |
getJPanelPoint().setVisible(true);
|
875 |
if (m_FSymbol.getColor()!=null){ |
876 |
pointColorChooserPanel.setColor(m_FSymbol.getColor()); |
877 |
} |
878 |
getJTextField().setText("" + m_FSymbol.getSize());
|
879 |
getJCheckBox().setSelected(!m_FSymbol.isSizeInPixels()); |
880 |
getJComboBox_pointType().setSelectedItem(new Integer(m_FSymbol.getStyle())); |
881 |
|
882 |
if (m_FSymbol.getStyle() == FConstant.SYMBOL_STYLE_MARKER_IMAGEN)
|
883 |
{ |
884 |
File fProv = new File(m_FSymbol.getIconURI()); |
885 |
jTxtImagen.setText(fProv.getAbsolutePath()); |
886 |
jTxtImagen.setVisible(true);
|
887 |
jLblImagen.setVisible(true);
|
888 |
jBtnImagen.setVisible(true);
|
889 |
} |
890 |
|
891 |
|
892 |
} |
893 |
|
894 |
// setAlpha(255 - m_FSymbol.m_Transparency);
|
895 |
|
896 |
} |
897 |
|
898 |
/**
|
899 |
* @return
|
900 |
*/
|
901 |
public FSymbol getFSymbol() {
|
902 |
updateControls(false);
|
903 |
return m_FSymbol;
|
904 |
} |
905 |
|
906 |
protected void setCenterPanel(JPanel centerPanel) { |
907 |
this.centerPanel = centerPanel;
|
908 |
} |
909 |
|
910 |
protected JPanel getCenterPanel() { |
911 |
return centerPanel;
|
912 |
} |
913 |
|
914 |
/**
|
915 |
|
916 |
* This method initializes jPanel
|
917 |
|
918 |
*
|
919 |
|
920 |
* @return javax.swing.JPanel
|
921 |
|
922 |
*/
|
923 |
protected javax.swing.JPanel getJPanelPoint() {
|
924 |
if (jPanelPoint == null) { |
925 |
jLblImagen = new JLabel(); |
926 |
jPanelPoint = new javax.swing.JPanel();
|
927 |
jPanelPoint.setLayout(null);
|
928 |
jPanelPoint.setPreferredSize(new Dimension(300,200)); |
929 |
jPanelPoint.setBounds(0, 2, 336, 217); |
930 |
jLblImagen.setBounds(25, 139, 71, 18); |
931 |
jLblImagen.setText(PluginServices.getText(this,"imagen")); |
932 |
jPanelPoint.add(getJLabel2(), null);
|
933 |
jPanelPoint.add(getJLabel(), null);
|
934 |
jPanelPoint.add(getJLabel1(), null);
|
935 |
jPanelPoint.add(getJCheckBox(), null);
|
936 |
jPanelPoint.add(getJTextField(), null);
|
937 |
jPanelPoint.add(getJComboBox_pointType(), null);
|
938 |
pointColorChooserPanel.setBounds(143, 54, 98, 22); |
939 |
pointColorChooserPanel.setAlpha(255);
|
940 |
jPanelPoint.add(pointColorChooserPanel); |
941 |
jPanelPoint.add(jLblImagen, null);
|
942 |
jPanelPoint.add(getJTextField2(), null);
|
943 |
jPanelPoint.add(getJBtnImagen(), null);
|
944 |
} |
945 |
return jPanelPoint;
|
946 |
} |
947 |
|
948 |
/**
|
949 |
|
950 |
* This method initializes jLabel
|
951 |
|
952 |
*
|
953 |
|
954 |
* @return javax.swing.JLabel
|
955 |
|
956 |
*/
|
957 |
private javax.swing.JLabel getJLabel() {
|
958 |
if (jLabel == null) { |
959 |
jLabel = new javax.swing.JLabel();
|
960 |
jLabel.setText(PluginServices.getText(this,"tipo_simbolo")); |
961 |
jLabel.setBounds(25, 23, 113, 22); |
962 |
} |
963 |
return jLabel;
|
964 |
} |
965 |
|
966 |
/**
|
967 |
|
968 |
* This method initializes jLabel1
|
969 |
|
970 |
*
|
971 |
|
972 |
* @return javax.swing.JLabel
|
973 |
|
974 |
*/
|
975 |
private javax.swing.JLabel getJLabel1() {
|
976 |
if (jLabel1 == null) { |
977 |
jLabel1 = new javax.swing.JLabel();
|
978 |
jLabel1.setBounds(25, 84, 77, 22); |
979 |
jLabel1.setText(PluginServices.getText(this,"tamano")); |
980 |
} |
981 |
return jLabel1;
|
982 |
} |
983 |
|
984 |
/**
|
985 |
|
986 |
* This method initializes jCheckBox
|
987 |
|
988 |
*
|
989 |
|
990 |
* @return javax.swing.JCheckBox
|
991 |
|
992 |
*/
|
993 |
private javax.swing.JCheckBox getJCheckBox() {
|
994 |
if (jCheckBox == null) { |
995 |
jCheckBox = new javax.swing.JCheckBox();
|
996 |
jCheckBox.setBounds(143, 115, 145, 19); |
997 |
jCheckBox.setText(PluginServices.getText(this,"tamano_metros")); |
998 |
} |
999 |
return jCheckBox;
|
1000 |
} |
1001 |
|
1002 |
/**
|
1003 |
|
1004 |
* This method initializes jTextField
|
1005 |
|
1006 |
*
|
1007 |
|
1008 |
* @return javax.swing.JTextField
|
1009 |
|
1010 |
*/
|
1011 |
private javax.swing.JTextField getJTextField() {
|
1012 |
if (jTextField_Size == null) { |
1013 |
jTextField_Size = new javax.swing.JTextField();
|
1014 |
jTextField_Size.setBounds(143, 86, 76, 20); |
1015 |
jTextField_Size.setText("12");
|
1016 |
jTextField_Size.addActionListener(new java.awt.event.ActionListener() {
|
1017 |
public void actionPerformed(ActionEvent arg0) { |
1018 |
updateControls(false);
|
1019 |
} |
1020 |
}); |
1021 |
} |
1022 |
return jTextField_Size;
|
1023 |
} |
1024 |
|
1025 |
/**
|
1026 |
|
1027 |
* This method initializes jComboBox
|
1028 |
|
1029 |
*
|
1030 |
|
1031 |
* @return javax.swing.JComboBox
|
1032 |
|
1033 |
*/
|
1034 |
private javax.swing.JComboBox getJComboBox_pointType() {
|
1035 |
if (jComboBox_Symbol_Type == null) { |
1036 |
jComboBox_Symbol_Type = new javax.swing.JComboBox();
|
1037 |
jComboBox_Symbol_Type.setBounds(143, 25, 120, 20); |
1038 |
} |
1039 |
// return jComboBox_Symbol_Type;
|
1040 |
return pointTypeComboBox;
|
1041 |
} |
1042 |
|
1043 |
/**
|
1044 |
|
1045 |
* This method initializes jLabel2
|
1046 |
|
1047 |
*
|
1048 |
|
1049 |
* @return javax.swing.JLabel
|
1050 |
|
1051 |
*/
|
1052 |
private javax.swing.JLabel getJLabel2() {
|
1053 |
if (jLabel2 == null) { |
1054 |
jLabel2 = new javax.swing.JLabel();
|
1055 |
jLabel2.setBounds(25, 54, 68, 22); |
1056 |
jLabel2.setText(PluginServices.getText(this,"color")); |
1057 |
} |
1058 |
return jLabel2;
|
1059 |
} |
1060 |
|
1061 |
/**
|
1062 |
* This method initializes jTextField
|
1063 |
*
|
1064 |
* @return javax.swing.JTextField
|
1065 |
*/
|
1066 |
private JTextField getJTextField2() { |
1067 |
if (jTxtImagen == null) { |
1068 |
jTxtImagen = new JTextField(); |
1069 |
jTxtImagen.setBounds(103, 139, 168, 18); |
1070 |
} |
1071 |
return jTxtImagen;
|
1072 |
} |
1073 |
/**
|
1074 |
* This method initializes jButton
|
1075 |
*
|
1076 |
* @return javax.swing.JButton
|
1077 |
*/
|
1078 |
private JButton getJBtnImagen() { |
1079 |
if (jBtnImagen == null) { |
1080 |
jBtnImagen = new JButton(); |
1081 |
jBtnImagen.setBounds(279, 139, 33, 18); |
1082 |
jBtnImagen.setText("...");
|
1083 |
jBtnImagen.setToolTipText(PluginServices.getText(this,"browse")); |
1084 |
jBtnImagen.addActionListener(new java.awt.event.ActionListener() {
|
1085 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
1086 |
JFileChooser tempChooser = new JFileChooser(); |
1087 |
ImageFilter filter = new ImageFilter(); |
1088 |
tempChooser.setFileFilter(filter); |
1089 |
|
1090 |
int result = tempChooser.showOpenDialog((Component) e.getSource()); |
1091 |
tempChooser.setMultiSelectionEnabled(false);
|
1092 |
if (result == JFileChooser.APPROVE_OPTION) { |
1093 |
File newFile = tempChooser.getSelectedFile();
|
1094 |
jTxtImagen.setText(newFile.getAbsolutePath()); |
1095 |
} |
1096 |
} |
1097 |
}); |
1098 |
} |
1099 |
return jBtnImagen;
|
1100 |
} |
1101 |
/* (non-Javadoc)
|
1102 |
* @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#setLayer(com.iver.cit.gvsig.fmap.layers.FLayer, com.iver.cit.gvsig.fmap.rendering.Legend)
|
1103 |
*/
|
1104 |
public void setLayer(FLayer lyr, Legend legend) { |
1105 |
FSymbol aux; |
1106 |
if (legend.getDefaultSymbol() == null) |
1107 |
aux = new FSymbol(((VectorialLegend)legend).getShapeType());
|
1108 |
else
|
1109 |
|
1110 |
setFSymbol(legend.getDefaultSymbol()); |
1111 |
|
1112 |
} |
1113 |
/* (non-Javadoc)
|
1114 |
* @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#getLegend()
|
1115 |
*/
|
1116 |
public Legend getLegend() {
|
1117 |
return new SingleSymbolLegend(getFSymbol()); |
1118 |
} |
1119 |
} // @jve:visual-info decl-index=0 visual-constraint="10,10"
|