Statistics
| Revision:

root / branches / gvSIG_03_SLD / applications / appgvSIG / src / com / iver / cit / gvsig / gui / thememanager / legendmanager / panels / FPanelLegendDefault.java @ 2076

History | View | Annotate | Download (34.8 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.thememanager.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.util.List;
67

    
68
import javax.swing.BorderFactory;
69
import javax.swing.DefaultComboBoxModel;
70
import javax.swing.ImageIcon;
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.VectorialLegend;
97
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
98
import com.iver.cit.gvsig.gui.GUIUtil;
99
import com.iver.cit.gvsig.gui.Panels.ColorChooserPanel;
100
import com.iver.cit.gvsig.gui.Panels.TransparencyPanel;
101
import com.iver.utiles.ImageFilter;
102
import com.vividsolutions.jump.util.StringUtil;
103
/**
104
 * @author fjp
105
 *
106
 * To change the template for this generated type comment go to
107
 * Window>Preferences>Java>Code Generation>Code and Comments
108
 */
109

    
110

    
111
public class FPanelLegendDefault extends JPanel implements ILegendPanel {
112
        
113
        private FSymbol m_FSymbol = null;
114
        
115
        
116
        protected static final int SLIDER_TEXT_FIELD_COLUMNS = 3;
117
        protected static final Dimension SLIDER_DIMENSION = new Dimension(130, 49);
118
        // private Paint[] fillPatterns = new FillPatternFactory().createFillPatterns();
119
        private JPanel centerPanel = new JPanel();
120
        // private AbstractPalettePanel palettePanel;
121
        protected JCheckBox fillCheckBox = new JCheckBox();
122
        protected JCheckBox lineCheckBox = new JCheckBox();
123
        protected TransparencyPanel transparencyPanel = new TransparencyPanel();
124
        protected JLabel transparencyLabel = new JLabel();
125
        protected ColorChooserPanel lineColorChooserPanel = new ColorChooserPanel();
126
        protected ColorChooserPanel fillColorChooserPanel = new ColorChooserPanel();
127
        protected ColorChooserPanel pointColorChooserPanel = new ColorChooserPanel();
128
        protected FPreviewSymbol m_previewSymbol = new FPreviewSymbol();
129
        protected JLabel lineWidthLabel = new JLabel();
130
        protected JCheckBox synchronizeCheckBox = new JCheckBox();
131
        private JCheckBox linePatternCheckBox = new JCheckBox();
132
        private JCheckBox fillPatternCheckBox = new JCheckBox();
133
        private Paint[] fillPatterns = FSymbolFactory.createPatternFills(Color.GRAY);        
134
        private String[] linePatterns = new String[] {
135
                        "1", "3", "5", "5,1", "7", "7,12", "9", "9,2", "15,6", "20,3"
136
                };
137
        
138
        private Integer[] pointTypes = new Integer[] {
139
                        new Integer(FStyle2D.SYMBOL_STYLE_MARKER_SQUARE),
140
                        new Integer(FStyle2D.SYMBOL_STYLE_MARKER_CIRCLE),
141
                        new Integer(FStyle2D.SYMBOL_STYLE_MARKER_TRIANGLE),
142
                        new Integer(FStyle2D.SYMBOL_STYLE_MARKER_CROSS),
143
                        new Integer(FStyle2D.SYMBOL_STYLE_MARKER_IMAGEN)
144
                };
145
        
146
        protected String pointTypeToString(Integer pointType)
147
        {
148
                String resul = "No reconocido";
149
                switch (pointType.intValue())
150
                {
151
                        case FStyle2D.SYMBOL_STYLE_MARKER_SQUARE:
152
                                resul = "Cuadrado";
153
                                break;
154
                        case FStyle2D.SYMBOL_STYLE_MARKER_CIRCLE:
155
                                resul = "C?rculo";
156
                                break;
157
                        case FStyle2D.SYMBOL_STYLE_MARKER_TRIANGLE:
158
                                resul = "Tri?ngulo";
159
                                break;
160
                        case FStyle2D.SYMBOL_STYLE_MARKER_CROSS:
161
                                resul = "Cruz";
162
                                break;
163
                        case FStyle2D.SYMBOL_STYLE_MARKER_IMAGEN:
164
                                resul = "Imagen";
165
                                break;
166
                                
167
                }
168
                return resul;
169
        }
170
        protected Integer pointTypeToInt(String pointType)
171
        {
172
                if (pointType.compareTo("Cuadrado")== 0)
173
                        return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_SQUARE);
174
                if (pointType.compareTo("C?rculo")== 0)
175
                        return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_CIRCLE);
176
                if (pointType.compareTo("Tri?ngulo")== 0)
177
                        return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_TRIANGLE);
178
                if (pointType.compareTo("Cruz")== 0)
179
                        return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_CROSS);
180
                if (pointType.compareTo("Imagen")== 0)
181
                        return new Integer(FStyle2D.SYMBOL_STYLE_MARKER_IMAGEN);
182
                return new Integer(-1);
183
        }        
184
        private JComboBox pointTypeComboBox = new JComboBox(pointTypes) {
185

    
186
                {
187
                        BasicComboBoxEditor editor = new BasicComboBoxEditor();
188
                        
189
                        setEditor(editor);
190
                        setEditable(true);
191
                        addActionListener(new ActionListener() {
192
                                        public void actionPerformed(ActionEvent e) {
193
                                                updateControls(false);
194
                                                if (getSelectedItem() instanceof Integer)
195
                                                {
196
                                                        setSelectedItem(pointTypeToString((Integer) getSelectedItem()));
197
                                                        
198
                                                        updateControls(false);
199
                                                }
200
                                        }
201
                                });
202
                        setRenderer(new ListCellRenderer() {
203
                                private Integer pointType;
204
                                private FSymbol myFSymbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT);
205
                                        private JPanel panel = new JPanel() {
206

    
207
                                                        protected void paintComponent(Graphics g) {
208
                                                                super.paintComponent(g);
209

    
210
                                                                Graphics2D g2 = (Graphics2D) g;
211
                                                                AffineTransform mT = new AffineTransform();
212
                                                                mT.setToIdentity();
213

    
214
                                                                FPoint2D shp = new FPoint2D(panel.getWidth()/2, 
215
                                                                                panel.getHeight()/2);
216
                                                                if (m_FSymbol !=null){
217
                                                                myFSymbol.setColor(m_FSymbol.getColor());
218
                                                                FGraphicUtilities.DrawShape(g2,mT, shp,myFSymbol);
219
                                                                }
220
                                                        }
221
                                                };
222
                                        
223

    
224
                                        public Component getListCellRendererComponent(
225
                                                JList list, Object value, int index,
226
                                                boolean isSelected, boolean cellHasFocus) {
227
                                                pointType = (Integer) value;
228
                                                myFSymbol.setStyle(pointType.intValue());
229
                                                // Le hacemos que se dibuje siempre con 10 pixels
230
                                                
231
                                                myFSymbol.setSizeInPixels(true);
232
                                                myFSymbol.setSize(10);
233
                                                myFSymbol.setStroke(new BasicStroke());
234
                                                panel.setForeground(UIManager.getColor(isSelected
235
                                                                ? "ComboBox.selectionForeground"
236
                                                                : "ComboBox.foreground"));
237
                                                panel.setBackground(UIManager.getColor(isSelected
238
                                                                ? "ComboBox.selectionBackground"
239
                                                                : "ComboBox.background"));
240
                                                
241
                                                return panel;
242
                                        }
243
                                });
244
                }
245
        };
246
        
247
        /**
248
         * Converts the comma-delimited string into a List of trimmed strings.
249
         *
250
         * @param linePattern a String with comma-delimited values
251
         * @param lineWidth DOCUMENT ME!
252
         *
253
         * @return a List of the Strings that were delimited by commas
254
         *
255
         * @throws IllegalArgumentException DOCUMENT ME!
256
         */
257
        private static float[] toArray(String linePattern, float lineWidth) {
258
                List strings = StringUtil.fromCommaDelimitedString(linePattern);
259
                float[] array = new float[strings.size()];
260

    
261
                for (int i = 0; i < strings.size(); i++) {
262
                        String string = (String) strings.get(i);
263
                        array[i] = Float.parseFloat(string) * lineWidth;
264

    
265
                        if (array[i] <= 0) {
266
                                throw new IllegalArgumentException("Negative dash length");
267
                        }
268
                }
269

    
270
                return array;
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
                                                                                        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
                
332
        private JComboBox fillPatternComboBox = new JComboBox(fillPatterns) {
333

    
334
                        {
335
                                // setMaximumRowCount(fillPatterns.length);
336
                                setEditable(false);
337
                                addActionListener(new ActionListener() {
338
                                                public void actionPerformed(ActionEvent e) {
339
                                                        updateControls(true);
340
                                                }
341
                                        });
342
                                setRenderer(new ListCellRenderer() {
343
                                                private Paint fillPattern;
344
                                                private JLabel label = new JLabel(" ");
345
                                                private JPanel panel = new JPanel(new BorderLayout()) {
346

    
347
                                                                {
348
                                                                        label.setPreferredSize(new Dimension(150,
349
                                                                                        (int) label.getPreferredSize()
350
                                                                                                           .getHeight()));
351
                                                                        add(label, BorderLayout.CENTER);
352
                                                                }
353

    
354
                                                                protected void paintComponent(Graphics g) {
355
                                                                        super.paintComponent(g);
356
                                                                        ((Graphics2D) g).setPaint(fillPattern);
357
                                                                        ((Graphics2D) g).fill(new Rectangle2D.Double(
358
                                                                                        0, 0, getWidth(), getHeight()));
359
                                                                }
360
                                                        };
361

    
362
                                                public Component getListCellRendererComponent(
363
                                                        JList list, Object value, int index,
364
                                                        boolean isSelected, boolean cellHasFocus) {
365
                                                        fillPattern = (Paint) value;
366
                                                        // label.setText("" +(1 +
367
                                                        //         CollectionUtil.indexOf(fillPattern, fillPatterns))); 
368
                                                        label.setForeground(UIManager.getColor(isSelected
369
                                                                        ? "ComboBox.selectionForeground"
370
                                                                        : "ComboBox.foreground"));
371
                                                        panel.setBackground(UIManager.getColor(isSelected
372
                                                                        ? "ComboBox.selectionBackground"
373
                                                                        : "ComboBox.background"));
374

    
375
                                                        return panel;
376
                                                }
377
                                        });
378
                        }
379
                };
380
                
381

    
382
        private javax.swing.JPanel jPanelPoint = null;  //
383
        private javax.swing.JLabel jLabel = null;
384
        private javax.swing.JLabel jLabel1 = null;
385
        private javax.swing.JCheckBox jCheckBox = null;
386
        private javax.swing.JTextField jTextField_Size = null;
387
        private javax.swing.JComboBox jComboBox_Symbol_Type = null;
388
        private javax.swing.JLabel jLabel2 = null;
389
        private JLabel jLblImagen = null;
390
        private JTextField jTxtImagen = null;
391
        private JButton jBtnImagen = null;
392
        /**
393
         * 
394
         */
395
        public FPanelLegendDefault() {
396
                super();
397
                try {
398
                        jbInit();
399
                        linePatternCheckBox.setSelected(false);
400
                } catch (Exception e) {
401
                        e.printStackTrace();
402
                }
403

    
404
                transparencyPanel.getSlider().getModel().addChangeListener(new ChangeListener() {
405
                                public void stateChanged(ChangeEvent e) {
406
                                        updateControls(true);
407
                                }
408
                        });
409
                /* palettePanel.add(new GridPalettePanel.Listener() {
410
                                public void basicStyleChosen(BasicStyle basicStyle) {
411
                                        //Preserve some settings e.g. line and fill patterns, alpha;
412
                                        BasicStyle newBasicStyle = getBasicStyle();
413
                                        newBasicStyle.setFillColor(basicStyle.getFillColor());
414
                                        newBasicStyle.setLineColor(basicStyle.getLineColor());
415
                                        newBasicStyle.setLineWidth(basicStyle.getLineWidth());
416
                                        newBasicStyle.setRenderingFill(basicStyle.isRenderingFill());
417
                                        newBasicStyle.setRenderingLine(basicStyle.isRenderingLine());
418
                                        setBasicStyle(newBasicStyle);
419
                                }
420
                        }); */
421
                updateControls(false);
422

    
423
        }
424
        
425
        void jbInit() throws Exception {
426
                java.awt.GridBagConstraints consGridBagConstraints2 = new java.awt.GridBagConstraints();
427

    
428
                lineWidthSlider.setPreferredSize(SLIDER_DIMENSION);
429
                lineWidthSlider.setPaintLabels(true);
430
                lineWidthSlider.setValue(1);
431
                lineWidthSlider.setLabelTable(lineWidthSlider.createStandardLabels(10));
432
                lineWidthSlider.setMajorTickSpacing(5);
433
                lineWidthSlider.setMaximum(30);
434
                lineWidthSlider.setMinorTickSpacing(1);
435
                
436
                
437
                JPanel globalPanel = new JPanel();
438
                globalPanel.setLayout(new GridBagLayout());
439
                
440
                linePatternCheckBox.setText(PluginServices.getText(this,"tipo_linea"));
441
                fillPatternCheckBox.setText(PluginServices.getText(this,"tipo_relleno"));
442
                linePatternCheckBox.addActionListener(new java.awt.event.ActionListener() {
443
                                public void actionPerformed(ActionEvent e) {
444
                                        linePatternCheckBox_actionPerformed(e);
445
                                }
446
                        });
447
                fillPatternCheckBox.addActionListener(new java.awt.event.ActionListener() {
448
                                public void actionPerformed(ActionEvent e) {
449
                                        fillPatternCheckBox_actionPerformed(e);
450
                                }
451
                        });
452
                // add(getJPanelPoint());
453
                globalPanel.add(getCenterPanel(),
454
                        new GridBagConstraints(0, 0, 1, 2, 0, 0, GridBagConstraints.WEST,
455
                                GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
456
                
457
                /*globalPanel.add(new JPanel(),
458
                        new GridBagConstraints(3, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
459
                                GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); */
460
                /* globalPanel.add(new JLabel("Previsualizaci?n de s?mbolo:"),
461
                        new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
462
                                GridBagConstraints.NONE, new Insets(0, 30, 0, 0), 0, 0)); */
463
                                
464
                JPanel panelAux = new JPanel();
465
                panelAux.add(new JLabel(PluginServices.getText(this,"Previsualizacion_de_simbolo")));
466
                panelAux.add(m_previewSymbol );
467
                /* globalPanel.add(panelAux, new 
468
                                GridBagConstraints(2, 1, 1, 1, 1, 1, GridBagConstraints.WEST,
469
                                GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); */
470
                
471
                
472
                m_previewSymbol.setPreferredSize(new Dimension(80,60));
473
                m_previewSymbol.setMinimumSize(new Dimension(80,60));
474

    
475
                setLayout(null);
476
                globalPanel.setBounds(0,0,350,250);
477
                
478
                getJPanelPoint().setBounds(0,0,350,250);
479
                add(getJPanelPoint()); //, BorderLayout.WEST); //, consGridBagConstraints2);
480
                add(globalPanel); // , BorderLayout.WEST);
481
                
482
                panelAux.setBounds(350,0,150,100);
483
                
484
                add(panelAux) ; //,BorderLayout.EAST); // Contiene el preview
485
                
486
                /* globalPanel.setBackground(Color.RED);
487
                getJPanelPoint().setBackground(Color.BLUE);
488
                panelAux.setBackground(Color.GREEN); */
489
                
490
                getCenterPanel().setLayout(new GridBagLayout());
491
                setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
492
                this.setSize(419, 293);
493
                 fillColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
494
                                public void actionPerformed(ActionEvent e) {
495
                                        fillColorChooserPanel_actionPerformed(e);
496
                                }
497
                        });
498
                lineColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
499
                                public void actionPerformed(ActionEvent e) {
500
                                        lineColorChooserPanel_actionPerformed(e);
501
                                }
502
                        }); 
503
                
504
                synchronizeCheckBox.setText(PluginServices.getText(this,"sincronizar_color_borde_relleno"));
505
                synchronizeCheckBox.addActionListener(new java.awt.event.ActionListener() {
506
                                public void actionPerformed(ActionEvent e) {
507
                                        synchronizeCheckBox_actionPerformed(e);
508
                                }
509
                        });
510
                fillCheckBox.setText(PluginServices.getText(this,"relleno"));
511
                fillCheckBox.addActionListener(new java.awt.event.ActionListener() {
512
                                public void actionPerformed(ActionEvent e) {
513
                                        fillCheckBox_actionPerformed(e);
514
                                }
515
                        });
516
                lineCheckBox.setText(PluginServices.getText(this,"linea"));
517
                lineCheckBox.addActionListener(new java.awt.event.ActionListener() {
518
                                public void actionPerformed(ActionEvent e) {
519
                                        lineCheckBox_actionPerformed(e);
520
                                }
521
                        });
522
                getCenterPanel().add(GUIUtil.createSyncdTextField(
523
                                transparencyPanel.getSlider(), SLIDER_TEXT_FIELD_COLUMNS),
524
                        new GridBagConstraints(2, 21, 1, 1, 0.0, 0.0,
525
                                GridBagConstraints.CENTER, GridBagConstraints.NONE,
526
                                new Insets(2, 2, 2, 2), 0, 0));
527
                getCenterPanel().add(lineWidthSlider,
528
                        new GridBagConstraints(1, 19, 1, 1, 0.0, 0.0,
529
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
530
                                new Insets(2, 2, 2, 2), 0, 0));
531
                getCenterPanel().add(GUIUtil.createSyncdTextField(lineWidthSlider,
532
                                SLIDER_TEXT_FIELD_COLUMNS),
533
                        new GridBagConstraints(2, 19, 1, 1, 0.0, 0.0,
534
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
535
                                new Insets(2, 2, 2, 2), 0, 0));
536
                fillColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
537
                                public void actionPerformed(ActionEvent e) {
538
                                        fillColorChooserPanel_actionPerformed(e);
539
                                }
540
                        }); 
541
                lineWidthLabel.setText(PluginServices.getText(this,"grosor_linea"));
542
                transparencyLabel.setText(PluginServices.getText(this,"transparencia"));
543
                consGridBagConstraints2.gridx = 0;
544
                consGridBagConstraints2.gridy = 0;
545
                consGridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST;
546
                consGridBagConstraints2.fill = java.awt.GridBagConstraints.NONE;
547
                getCenterPanel().add(synchronizeCheckBox,
548
                        new GridBagConstraints(0, 18, 3, 1, 0.0, 0.0,
549
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
550
                                new Insets(2, 2, 2, 2), 0, 0));
551
                getCenterPanel().add(transparencyLabel,
552
                        new GridBagConstraints(0, 21, 1, 1, 0.0, 0.0,
553
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
554
                                new Insets(2, 2, 2, 2), 0, 0));
555
                getCenterPanel().add(fillColorChooserPanel,
556
                        new GridBagConstraints(1, 5, 2, 1, 0.0, 0.0,
557
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
558
                                new Insets(2, 2, 2, 2), 0, 0));
559
                
560
                
561
                getCenterPanel().add(lineColorChooserPanel, 
562
                        new GridBagConstraints(1, 11, 2, 1, 0.0, 0.0,
563
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
564
                                new Insets(2, 2, 2, 2), 0, 0)); 
565
                getCenterPanel().add(transparencyPanel,
566
                        new GridBagConstraints(1, 21, 1, 1, 0.0, 0.0,
567
                                GridBagConstraints.CENTER, GridBagConstraints.NONE,
568
                                new Insets(2, 2, 2, 2), 0, 0));
569
                getCenterPanel().add(fillCheckBox,
570
                        new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
571
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
572
                                new Insets(2, 2, 2, 2), 0, 0));
573
                getCenterPanel().add(lineCheckBox,
574
                        new GridBagConstraints(0, 11, 1, 1, 0.0, 0.0,
575
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
576
                                new Insets(2, 2, 2, 2), 0, 0));
577
                getCenterPanel().add(lineWidthLabel,
578
                        new GridBagConstraints(0, 19, 1, 1, 0.0, 0.0,
579
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
580
                                new Insets(2, 2, 2, 2), 0, 0));
581
                getCenterPanel().add(linePatternCheckBox,
582
                        new GridBagConstraints(0, 16, 1, 1, 0.0, 0.0,
583
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
584
                                new Insets(2, 2, 2, 2), 0, 0));
585
                getCenterPanel().add(fillPatternCheckBox,
586
                        new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0,
587
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
588
                                new Insets(2, 2, 2, 2), 0, 0));
589
                getCenterPanel().add(linePatternComboBox,
590
                        new GridBagConstraints(1, 16, 2, 1, 0.0, 0.0,
591
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
592
                                new Insets(2, 2, 2, 2), 0, 0));
593
                getCenterPanel().add(fillPatternComboBox,
594
                        new GridBagConstraints(1, 7, 2, 1, 0.0, 0.0,
595
                                GridBagConstraints.WEST, GridBagConstraints.NONE,
596
                                new Insets(2, 2, 0, 2), 0, 0));
597
                
598
                pointTypeComboBox.setBounds(143, 25, 120, 20);
599
                pointColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {                        
600
                        public void actionPerformed(ActionEvent e) {
601
                                updateControls(false);
602
                        }
603
                }); 
604
                
605
                // this.setSize(348, 243);
606
                
607
        }
608
        
609
        protected void setAlpha(int alpha) {
610
                transparencyPanel.getSlider().setValue(255 - alpha);
611
        }
612

    
613
        protected int getAlpha() {
614
                return 255 - transparencyPanel.getSlider().getValue();
615
        }
616
        
617
        void fillCheckBox_actionPerformed(ActionEvent e) {
618
                updateControls(false);
619
        }
620
        
621
        void lineCheckBox_actionPerformed(ActionEvent e) {
622
                updateControls(false);
623
        }
624

    
625
        private void setSynchronizingLineColor(boolean newSynchronizingLineColor) {
626
                synchronizeCheckBox.setSelected(newSynchronizingLineColor);
627
        }
628

    
629
        protected void synchronizeCheckBox_actionPerformed(ActionEvent e) {
630
                if (synchronizeCheckBox.isSelected()) {
631
                        syncLineColor();
632
                }
633

    
634
                updateControls(false);
635
        }
636

    
637
        private JCheckBox getSynchronizeCheckBox() {
638
                return synchronizeCheckBox;
639
        }
640

    
641
        void linePatternCheckBox_actionPerformed(ActionEvent e) {
642
                updateControls(false);
643
        }
644
        void lineColorChooserPanel_actionPerformed(ActionEvent e) {
645
                if (synchronizeCheckBox.isSelected()) {
646
                        fillColorChooserPanel.setColor(lineColorChooserPanel.getColor()
647
                                                                                                                                .brighter());
648
                }
649

    
650
                updateControls(false);
651
        }
652
        void fillColorChooserPanel_actionPerformed(ActionEvent e) {
653
                if (synchronizeCheckBox.isSelected()) {
654
                        syncLineColor();
655
                }
656

    
657
                updateControls(true);
658
        }
659
        private void syncLineColor() {
660
                lineColorChooserPanel.setColor(fillColorChooserPanel.getColor().darker());
661
        }
662

    
663
        void fillPatternCheckBox_actionPerformed(ActionEvent e) {
664
                updateControls(false);
665
        }
666
        private void updateFillPatternColors() {
667
                if ((m_FSymbol != null) && (m_FSymbol.getColor() != null))
668
                { 
669
                        fillPatterns = FSymbolFactory.createPatternFills(m_FSymbol.getColor());
670
                        fillPatternComboBox.setModel(new DefaultComboBoxModel(fillPatterns));
671
                        fillPatternComboBox.getModel().setSelectedItem(m_FSymbol.getFill());
672
                        // fillPatternComboBox.setSelectedItem(m_FSymbol.m_Fill);                                        
673
                }
674
                
675
        }
676

    
677
        public void updateControls(boolean bInternal) {
678
                linePatternComboBox.setEnabled(linePatternCheckBox.isSelected());
679
                fillPatternComboBox.setEnabled(fillPatternCheckBox.isSelected());
680
                lineColorChooserPanel.setEnabled(lineCheckBox.isSelected());
681
                fillColorChooserPanel.setEnabled(fillCheckBox.isSelected());
682
                fillColorChooserPanel.setAlpha(getAlpha());
683
                lineColorChooserPanel.setAlpha(getAlpha());
684
                Color theColor = (lineCheckBox.isSelected() &&
685
                !fillCheckBox.isSelected()) ? lineColorChooserPanel.getColor()
686
                                                                        : fillColorChooserPanel.getColor(); 
687
                transparencyPanel.setColor(theColor);
688
                if (jTxtImagen != null)
689
                {
690
                        jTxtImagen.setVisible(false);
691
                        jLblImagen.setVisible(false);
692
                        jBtnImagen.setVisible(false);
693
                }
694
                if (m_FSymbol != null)
695
                {                
696
                        if (m_FSymbol.getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
697
                        {
698
                                m_FSymbol.setSize(Integer.parseInt(getJTextField().getText()));
699
                                 
700
                                //System.out.println("Asigno el m_Size = " + getJTextField().getText());
701
                                
702
                                if (pointTypeComboBox.getSelectedItem() instanceof Integer)
703
                                {
704
                                        Integer styleSelected = (Integer) pointTypeComboBox.getSelectedItem();
705
                                        m_FSymbol.setStyle(styleSelected.intValue());
706
                                }
707
                                else
708
                                {
709
                                        Integer styleSelected = pointTypeToInt((String) pointTypeComboBox.getSelectedItem());
710
                                        m_FSymbol.setStyle(styleSelected.intValue());
711
                                }
712
                                if (m_FSymbol.getStyle() == FConstant.SYMBOL_STYLE_MARKER_IMAGEN)
713
                                {
714
                                        jTxtImagen.setVisible(true);
715
                                        jLblImagen.setVisible(true);
716
                                        jBtnImagen.setVisible(true);
717
                                        if (jTxtImagen.getText().compareTo("") != 0)
718
                                        {
719
                                                m_FSymbol.setIcon(new ImageIcon(jTxtImagen.getText()).getImage());
720
                                        }
721
                                }
722
                                m_FSymbol.setColor(pointColorChooserPanel.getColor());
723
                                m_FSymbol.setSizeInPixels(!getJCheckBox().isSelected());
724
                                pointColorChooserPanel.repaint();
725
                                m_previewSymbol.setSymbol(m_FSymbol);                                
726
                                return;
727
                        }
728
                        m_FSymbol.setOutlined(lineCheckBox.isSelected());
729
                        m_FSymbol.setOutlineColor(lineColorChooserPanel.getColor());
730
                        if (fillCheckBox.isSelected())
731
                        {                        
732
                                m_FSymbol.setColor(new Color(theColor.getRed(),
733
                                                                                        theColor.getGreen(),
734
                                                                                          theColor.getBlue(),
735
                                                                                                  getAlpha()));
736
                        }
737
                        else
738
                        {
739
                                m_FSymbol.setColor(null);
740
                        }
741
                        if (fillPatternCheckBox.isSelected())
742
                        {        
743
                                Paint fillAux = (Paint) fillPatternComboBox.getSelectedItem();
744
                                if ((fillAux != null) && (fillPatternComboBox.getSelectedIndex() != -1))
745
                                {                                
746
                                        m_FSymbol.setFill((Paint) fillPatternComboBox.getSelectedItem());
747
                                        // Rellenamos el m_Style para que luego podamos escribir
748
                                        // el tipo de relleno que lleva.
749
                                        m_FSymbol.setStyle(fillPatternComboBox.getSelectedIndex()+3);
750
                                        System.out.println("Asigno Style=" + m_FSymbol.getStyle());
751
                                }
752
                        }        
753
                        else
754
                            if (bInternal == false)
755
                                m_FSymbol.setFill(null);
756
                                 
757
                        float lineWidth = lineWidthSlider.getValue();
758
                        if (linePatternCheckBox.isSelected())
759
                        {                        
760
                                String linePattern = (String) linePatternComboBox.getSelectedItem();
761
                                // System.out.println(m_FSymbol.m_Stroke.toString());
762
                                m_FSymbol.setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_ROUND,
763
                                                                                        BasicStroke.JOIN_BEVEL, 1.0f,
764
                                                                                                toArray(linePattern, lineWidth), 0));
765
                                                                                                
766
                                m_FSymbol.m_LinePattern = linePattern;
767
                        }
768
                        else
769
                        {        
770
                                if (lineWidth <=1)                
771
                                        m_FSymbol.setStroke(null);
772
                                else
773
                                        m_FSymbol.setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_ROUND,
774
                                                                BasicStroke.JOIN_BEVEL));
775
                        }
776
                        // System.out.println(fillPatternComboBox.getSelectedItem().toString() + " " + linePatternComboBox.getSelectedItem().toString());
777
                        // JOptionPane.showMessageDialog(this,"HOla","Colega", JOptionPane.INFORMATION_MESSAGE);
778
                        m_previewSymbol.setSymbol(m_FSymbol);  
779
                } 
780
                
781
                updateFillPatternColors();                
782
                fillPatternComboBox.repaint(); 
783
        }
784
        
785
        public void setFSymbol(FSymbol s)
786
        {
787
                if (s==null)
788
                {
789
                        m_FSymbol = new FSymbol(FShape.MULTI);
790
                }
791
                m_FSymbol = s.fastCloneSymbol();
792
                m_previewSymbol.setSymbol(m_FSymbol);
793
                if ((m_FSymbol.getSymbolType() == FConstant.SYMBOL_TYPE_FILL) || (m_FSymbol.getSymbolType() == FShape.MULTI))
794
                {                
795
                        // Deber?amos habilitar la pesta?a de pol?gonos
796
                        getJPanelPoint().setVisible(false);
797
                        getCenterPanel().setVisible(true);
798
                        fillCheckBox.setText(PluginServices.getText(this,"relleno"));
799
                        synchronizeCheckBox.setVisible(true);
800
                        fillPatternCheckBox.setVisible(true);
801
                        fillPatternComboBox.setVisible(true);
802
                        lineCheckBox.setVisible(true);
803
                        lineColorChooserPanel.setVisible(true);
804
                        
805
                        lineCheckBox.setSelected(m_FSymbol.isOutlined());
806
                        lineColorChooserPanel.setColor(m_FSymbol.getOutlineColor());
807
                        if (m_FSymbol.getColor() != null)
808
                        {
809
                                fillCheckBox.setSelected(true);                
810
                                fillColorChooserPanel.setColor(m_FSymbol.getColor());
811
                                setAlpha(m_FSymbol.getColor().getAlpha());
812
                                fillColorChooserPanel.setAlpha(getAlpha());
813
                                lineColorChooserPanel.setAlpha(getAlpha());                        
814
                        }
815
                        else
816
                        {
817
                                fillCheckBox.setSelected(false);
818
                        }
819
                        
820
                        linePatternCheckBox.setSelected(false);
821
                        if (m_FSymbol.getStroke() != null)
822
                        {
823
                                BasicStroke aux = (BasicStroke) m_FSymbol.getStroke();
824
                                if (aux.getDashArray() != null)
825
                                {                        
826
                                        linePatternCheckBox.setSelected(true);                
827
                                        linePatternComboBox.setSelectedItem(m_FSymbol.m_LinePattern);
828
                                }
829
                        }
830
                        if (m_FSymbol.getFill() != null)
831
                        {
832
                            fillPatternCheckBox.setSelected(true);
833
                            fillPatternComboBox.setSelectedItem(new Integer(m_FSymbol.getStyle()));
834
                        }
835
                        
836
                }
837
                if (m_FSymbol.getSymbolType() == FConstant.SYMBOL_TYPE_LINE)
838
                {
839
                        getJPanelPoint().setVisible(false);
840
                        getCenterPanel().setVisible(true);                        
841
                        fillCheckBox.setText(PluginServices.getText(this,"linea"));        // Lo vamos a usar como color de l?nea        
842
                        fillCheckBox.setSelected(true); 
843
                        synchronizeCheckBox.setVisible(false);
844
                        fillPatternCheckBox.setVisible(false);
845
                        fillPatternComboBox.setVisible(false);
846
                        lineCheckBox.setSelected(true);
847
                        lineCheckBox.setVisible(false);
848
                        fillColorChooserPanel.setColor(m_FSymbol.getColor());
849
                        lineColorChooserPanel.setVisible(false);
850
                        if (m_FSymbol.getColor() != null)
851
                        {
852
                                lineColorChooserPanel.setColor(m_FSymbol.getColor());
853
                                setAlpha(m_FSymbol.getColor().getAlpha());
854
                                lineColorChooserPanel.setAlpha(getAlpha());                        
855
                        }
856
                        linePatternCheckBox.setSelected(false);
857
                        if (m_FSymbol.getStroke() != null)
858
                        {
859
                                BasicStroke aux = (BasicStroke) m_FSymbol.getStroke();
860
                                if (aux.getDashArray() != null)
861
                                {                        
862
                                        linePatternCheckBox.setSelected(true);                
863
                                        linePatternComboBox.setSelectedItem(m_FSymbol.m_LinePattern);
864
                                }
865
                        }
866
                }
867
                if (m_FSymbol.getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
868
                {
869
                        getCenterPanel().setVisible(false);
870
                        getJPanelPoint().setVisible(true);
871
                        if (m_FSymbol.getColor()!=null){
872
                        pointColorChooserPanel.setColor(m_FSymbol.getColor());
873
                        }
874
                        getJTextField().setText("" + m_FSymbol.getSize());
875
                        getJCheckBox().setSelected(!m_FSymbol.isSizeInPixels());
876
                        getJComboBox_pointType().setSelectedItem(new Integer(m_FSymbol.getStyle()));
877
                        
878
                }
879
                
880
                // setAlpha(255 - m_FSymbol.m_Transparency);
881
                
882
        }
883

    
884
        /**
885
         * @return
886
         */
887
        public FSymbol getFSymbol() {
888
                updateControls(false);
889
                return m_FSymbol;
890
        }
891

    
892
        protected void setCenterPanel(JPanel centerPanel) {
893
                this.centerPanel = centerPanel;
894
        }
895

    
896
        protected JPanel getCenterPanel() {
897
                return centerPanel;
898
        }
899

    
900
        /**
901

902
         * This method initializes jPanel        
903

904
         *         
905

906
         * @return javax.swing.JPanel        
907

908
         */    
909
        protected javax.swing.JPanel getJPanelPoint() {
910
                if (jPanelPoint == null) {
911
                        jLblImagen = new JLabel();
912
                        jPanelPoint = new javax.swing.JPanel();
913
                        jPanelPoint.setLayout(null);
914
                        jPanelPoint.setPreferredSize(new Dimension(300,200));
915
                        jPanelPoint.setBounds(0, 2, 336, 217);
916
                        jLblImagen.setBounds(25, 139, 71, 18);
917
                        jLblImagen.setText(PluginServices.getText(this,"imagen"));
918
                        jPanelPoint.add(getJLabel2(), null);
919
                        jPanelPoint.add(getJLabel(), null);
920
                        jPanelPoint.add(getJLabel1(), null);
921
                        jPanelPoint.add(getJCheckBox(), null);
922
                        jPanelPoint.add(getJTextField(), null);
923
                        jPanelPoint.add(getJComboBox_pointType(), null);
924
                        pointColorChooserPanel.setBounds(143, 54, 98, 22);
925
                        pointColorChooserPanel.setAlpha(255);
926
                        jPanelPoint.add(pointColorChooserPanel);
927
                        jPanelPoint.add(jLblImagen, null);
928
                        jPanelPoint.add(getJTextField2(), null);
929
                        jPanelPoint.add(getJBtnImagen(), null);
930
                }
931
                return jPanelPoint;
932
        }
933

    
934
        /**
935

936
         * This method initializes jLabel        
937

938
         *         
939

940
         * @return javax.swing.JLabel        
941

942
         */    
943
        private javax.swing.JLabel getJLabel() {
944
                if (jLabel == null) {
945
                        jLabel = new javax.swing.JLabel();
946
                        jLabel.setText(PluginServices.getText(this,"tipo_simbolo"));
947
                        jLabel.setBounds(25, 23, 113, 22);
948
                }
949
                return jLabel;
950
        }
951

    
952
        /**
953

954
         * This method initializes jLabel1        
955

956
         *         
957

958
         * @return javax.swing.JLabel        
959

960
         */    
961
        private javax.swing.JLabel getJLabel1() {
962
                if (jLabel1 == null) {
963
                        jLabel1 = new javax.swing.JLabel();
964
                        jLabel1.setBounds(25, 84, 77, 22);
965
                        jLabel1.setText(PluginServices.getText(this,"tamano"));
966
                }
967
                return jLabel1;
968
        }
969

    
970
        /**
971

972
         * This method initializes jCheckBox        
973

974
         *         
975

976
         * @return javax.swing.JCheckBox        
977

978
         */    
979
        private javax.swing.JCheckBox getJCheckBox() {
980
                if (jCheckBox == null) {
981
                        jCheckBox = new javax.swing.JCheckBox();
982
                        jCheckBox.setBounds(143, 115, 145, 19);
983
                        jCheckBox.setText(PluginServices.getText(this,"tamano_metros"));
984
                }
985
                return jCheckBox;
986
        }
987

    
988
        /**
989

990
         * This method initializes jTextField        
991

992
         *         
993

994
         * @return javax.swing.JTextField        
995

996
         */    
997
        private javax.swing.JTextField getJTextField() {
998
                if (jTextField_Size == null) {
999
                        jTextField_Size = new javax.swing.JTextField();
1000
                        jTextField_Size.setBounds(143, 86, 76, 20);
1001
                        jTextField_Size.setText("12");
1002
                        jTextField_Size.addActionListener(new java.awt.event.ActionListener() {
1003
                                public void actionPerformed(ActionEvent arg0) {
1004
                                        updateControls(false);
1005
                                }
1006
                        });
1007
                }
1008
                return jTextField_Size;
1009
        }
1010

    
1011
        /**
1012

1013
         * This method initializes jComboBox        
1014

1015
         *         
1016

1017
         * @return javax.swing.JComboBox        
1018

1019
         */    
1020
        private javax.swing.JComboBox getJComboBox_pointType() {
1021
                if (jComboBox_Symbol_Type == null) {
1022
                        jComboBox_Symbol_Type = new javax.swing.JComboBox();
1023
                        jComboBox_Symbol_Type.setBounds(143, 25, 120, 20);
1024
                }
1025
                // return jComboBox_Symbol_Type;
1026
                return pointTypeComboBox;
1027
        }
1028

    
1029
        /**
1030

1031
         * This method initializes jLabel2        
1032

1033
         *         
1034

1035
         * @return javax.swing.JLabel        
1036

1037
         */    
1038
        private javax.swing.JLabel getJLabel2() {
1039
                if (jLabel2 == null) {
1040
                        jLabel2 = new javax.swing.JLabel();
1041
                        jLabel2.setBounds(25, 54, 68, 22);
1042
                        jLabel2.setText(PluginServices.getText(this,"color"));
1043
                }
1044
                return jLabel2;
1045
        }
1046

    
1047
        /**
1048
         * This method initializes jTextField        
1049
         *         
1050
         * @return javax.swing.JTextField        
1051
         */    
1052
        private JTextField getJTextField2() {
1053
                if (jTxtImagen == null) {
1054
                        jTxtImagen = new JTextField();
1055
                        jTxtImagen.setBounds(103, 139, 168, 18);
1056
                }
1057
                return jTxtImagen;
1058
        }
1059
        /**
1060
         * This method initializes jButton        
1061
         *         
1062
         * @return javax.swing.JButton        
1063
         */    
1064
        private JButton getJBtnImagen() {
1065
                if (jBtnImagen == null) {
1066
                        jBtnImagen = new JButton();
1067
                        jBtnImagen.setBounds(279, 139, 33, 18);
1068
                        jBtnImagen.setText("...");
1069
                        jBtnImagen.setToolTipText(PluginServices.getText(this,"browse"));
1070
                        jBtnImagen.addActionListener(new java.awt.event.ActionListener() { 
1071
                                public void actionPerformed(java.awt.event.ActionEvent e) {  
1072
                                        JFileChooser tempChooser = new JFileChooser();
1073
                                        ImageFilter filter = new ImageFilter();
1074
                                    tempChooser.setFileFilter(filter);
1075

    
1076
                    int result = tempChooser.showOpenDialog((Component) e.getSource());
1077
                    tempChooser.setMultiSelectionEnabled(false);
1078
                    if (result == JFileChooser.APPROVE_OPTION) {
1079
                                File newFile = tempChooser.getSelectedFile();
1080
                                jTxtImagen.setText(newFile.getAbsolutePath());
1081
                        }
1082
                                }
1083
                        });
1084
                }
1085
                return jBtnImagen;
1086
        }
1087
        /* (non-Javadoc)
1088
         * @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#setLayer(com.iver.cit.gvsig.fmap.layers.FLayer, com.iver.cit.gvsig.fmap.rendering.Legend)
1089
         */
1090
        public void setLayer(FLayer lyr, Legend legend) {
1091
                FSymbol aux;
1092
                if (legend.getDefaultSymbol() == null)
1093
                        aux = new FSymbol(((VectorialLegend)legend).getShapeType());
1094
                else
1095

    
1096
                setFSymbol(legend.getDefaultSymbol());
1097
                
1098
        }
1099
        /* (non-Javadoc)
1100
         * @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#getLegend()
1101
         */
1102
        public Legend getLegend() {
1103
                return new SingleSymbolLegend(getFSymbol());
1104
        }
1105
        /**
1106
         * @return Returns the m_previewSymbol.
1107
         */
1108
        public FPreviewSymbol getM_previewSymbol() {
1109
                return m_previewSymbol;
1110
        }
1111
   }  //  @jve:visual-info  decl-index=0 visual-constraint="10,10"