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