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