Revision 648

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/write/WFSTransactionHandler.java
1
/*
2
 * Created on 23-dic-2004
3
 *
4
 * TODO To change the template for this generated file go to
5
 * Window - Preferences - Java - Code Generation - Code and Comments
6
 */
7
package com.iver.cit.gvsig.fmap.write;
8

  
9
/**
10
 * @author FJP
11
 *
12
 * TODO To change the template for this generated type comment go to
13
 * Window - Preferences - Java - Code Generation - Code and Comments
14
 */
15
public class WFSTransactionHandler {
16

  
17
}
0 18

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/write/EditionSourceAdapter.java
125 125
	public Rectangle2D getFullExtent() throws DriverIOException {
126 126
		return null;
127 127
	}
128

  
129
	/* (non-Javadoc)
130
	 * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeType()
131
	 */
132
	public int getShapeType() throws DriverIOException {
133
		// TODO Auto-generated method stub
134
		return 0;
135
	}
128 136
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/write/WFSEditionSourceAdapter.java
2 2

  
3 3
package com.iver.cit.gvsig.fmap.write;
4 4

  
5
import com.iver.cit.gvsig.fmap.core.IGeometry;
6 5
public class WFSEditionSourceAdapter extends EditionSourceAdapter {
7 6
    /**
8 7
     * Establece el handler que recibir? los eventos en la llamada a  toWFSTransaction 
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/legendmanager/panels/CopyOfFPanelLegendDefault.java
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
package com.iver.cit.gvsig.gui.legendmanager.panels;
8

  
9
import java.awt.BasicStroke;
10
import java.awt.BorderLayout;
11
import java.awt.Color;
12
import java.awt.Component;
13
import java.awt.Dimension;
14
import java.awt.Graphics;
15
import java.awt.Graphics2D;
16
import java.awt.GridBagConstraints;
17
import java.awt.GridBagLayout;
18
import java.awt.Insets;
19
import java.awt.Paint;
20
import java.awt.event.ActionEvent;
21
import java.awt.event.ActionListener;
22
import java.awt.geom.AffineTransform;
23
import java.awt.geom.Line2D;
24
import java.awt.geom.Rectangle2D;
25
import java.io.File;
26
import java.util.List;
27

  
28
import javax.swing.BorderFactory;
29
import javax.swing.DefaultComboBoxModel;
30
import javax.swing.ImageIcon;
31
import javax.swing.JButton;
32
import javax.swing.JCheckBox;
33
import javax.swing.JComboBox;
34
import javax.swing.JFileChooser;
35
import javax.swing.JLabel;
36
import javax.swing.JList;
37
import javax.swing.JPanel;
38
import javax.swing.JSlider;
39
import javax.swing.JTextField;
40
import javax.swing.ListCellRenderer;
41
import javax.swing.UIManager;
42
import javax.swing.event.ChangeEvent;
43
import javax.swing.event.ChangeListener;
44
import javax.swing.plaf.basic.BasicComboBoxEditor;
45

  
46
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
47
import com.iver.cit.gvsig.gui.GUIUtil;
48
import com.iver.cit.gvsig.gui.Panels.ColorChooserPanel;
49
import com.iver.cit.gvsig.gui.Panels.TransparencyPanel;
50
import com.iver.mdiApp.Utilities;
51
import com.iver.utiles.ImageFilter;
52
import com.vividsolutions.jump.util.StringUtil;
53
/**
54
 * @author fjp
55
 *
56
 * To change the template for this generated type comment go to
57
 * Window>Preferences>Java>Code Generation>Code and Comments
58
 */
59

  
60

  
61
public class CopyOfFPanelLegendDefault extends JPanel {
62
	
63
	private FStyle2D m_FSymbol = null;
64
	
65
	
66
	protected static final int SLIDER_TEXT_FIELD_COLUMNS = 3;
67
	protected static final Dimension SLIDER_DIMENSION = new Dimension(130, 49);
68
	// private Paint[] fillPatterns = new FillPatternFactory().createFillPatterns();
69
	private JPanel centerPanel = new JPanel();
70
	// private AbstractPalettePanel palettePanel;
71
	protected JCheckBox fillCheckBox = new JCheckBox();
72
	protected JCheckBox lineCheckBox = new JCheckBox();
73
	protected TransparencyPanel transparencyPanel = new TransparencyPanel();
74
	protected JLabel transparencyLabel = new JLabel();
75
	protected ColorChooserPanel lineColorChooserPanel = new ColorChooserPanel();
76
	protected ColorChooserPanel fillColorChooserPanel = new ColorChooserPanel();
77
	protected ColorChooserPanel pointColorChooserPanel = new ColorChooserPanel();
78
	protected FPreviewSymbol m_previewSymbol = new FPreviewSymbol();
79
	protected JLabel lineWidthLabel = new JLabel();
80
	protected JCheckBox synchronizeCheckBox = new JCheckBox();
81
	private JCheckBox linePatternCheckBox = new JCheckBox();
82
	private JCheckBox fillPatternCheckBox = new JCheckBox();
83
	private Paint[] fillPatterns = FSymbolFactory.createPatternFills(Color.GRAY);	
84
	private String[] linePatterns = new String[] {
85
			"1", "3", "5", "5,1", "7", "7,12", "9", "9,2", "15,6", "20,3"
86
		};
87
	
88
	private Integer[] pointTypes = new Integer[] {
89
			new Integer(FConstant.SYMBOL_STYLE_MARKER_SQUARE),
90
			new Integer(FConstant.SYMBOL_STYLE_MARKER_CIRCLE),
91
			new Integer(FConstant.SYMBOL_STYLE_MARKER_TRIANGLE),
92
			new Integer(FConstant.SYMBOL_STYLE_MARKER_CROSS),
93
			new Integer(FConstant.SYMBOL_STYLE_MARKER_IMAGEN)
94
		};
95
	
96
	protected String pointTypeToString(Integer pointType)
97
	{
98
		String resul = "No reconocido";
99
		switch (pointType.intValue())
100
		{
101
			case FConstant.SYMBOL_STYLE_MARKER_SQUARE:
102
				resul = "Cuadrado";
103
				break;
104
			case FConstant.SYMBOL_STYLE_MARKER_CIRCLE:
105
				resul = "C?rculo";
106
				break;
107
			case FConstant.SYMBOL_STYLE_MARKER_TRIANGLE:
108
				resul = "Tri?ngulo";
109
				break;
110
			case FConstant.SYMBOL_STYLE_MARKER_CROSS:
111
				resul = "Cruz";
112
				break;
113
			case FConstant.SYMBOL_STYLE_MARKER_IMAGEN:
114
				resul = "Imagen";
115
				break;
116
				
117
		}
118
		return resul;
119
	}
120
	protected Integer pointTypeToInt(String pointType)
121
	{
122
		if (pointType.compareTo("Cuadrado")== 0)
123
			return new Integer(FConstant.SYMBOL_STYLE_MARKER_SQUARE);
124
		if (pointType.compareTo("C?rculo")== 0)
125
			return new Integer(FConstant.SYMBOL_STYLE_MARKER_CIRCLE);
126
		if (pointType.compareTo("Tri?ngulo")== 0)
127
			return new Integer(FConstant.SYMBOL_STYLE_MARKER_TRIANGLE);
128
		if (pointType.compareTo("Cruz")== 0)
129
			return new Integer(FConstant.SYMBOL_STYLE_MARKER_CROSS);
130
		if (pointType.compareTo("Imagen")== 0)
131
			return new Integer(FConstant.SYMBOL_STYLE_MARKER_IMAGEN);
132
		return new Integer(-1);
133
	}	
134
	private JComboBox pointTypeComboBox = new JComboBox(pointTypes) {
135

  
136
		{
137
			BasicComboBoxEditor editor = new BasicComboBoxEditor();
138
			
139
			setEditor(editor);
140
			setEditable(true);
141
			addActionListener(new ActionListener() {
142
					public void actionPerformed(ActionEvent e) {
143
						updateControls();
144
						if (getSelectedItem() instanceof Integer)
145
						{
146
							setSelectedItem(pointTypeToString((Integer) getSelectedItem()));
147
							
148
							updateControls();
149
						}
150
					}
151
				});
152
			setRenderer(new ListCellRenderer() {
153
				private Integer pointType;
154
				private FSymbol myFSymbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT);
155
					private JPanel panel = new JPanel() {
156

  
157
							protected void paintComponent(Graphics g) {
158
								super.paintComponent(g);
159

  
160
								Graphics2D g2 = (Graphics2D) g;
161
								AffineTransform mT = new AffineTransform();
162
								mT.setToIdentity();
163

  
164
								FShape shp = new FShape(new FPoint(panel.getWidth()/2, 
165
										panel.getHeight()/2),FConstant.SHAPE_TYPE_POINT);
166
								myFSymbol.m_Color = m_FSymbol.m_Color;
167
								FGraphicUtilities.DrawShape(g2,mT, shp,myFSymbol);
168
							}
169
						};
170
					
171

  
172
					public Component getListCellRendererComponent(
173
						JList list, Object value, int index,
174
						boolean isSelected, boolean cellHasFocus) {
175
						pointType = (Integer) value;
176
						myFSymbol.m_Style = pointType.intValue();
177
						// Le hacemos que se dibuje siempre con 10 pixels
178
						
179
						myFSymbol.m_bUseSize = false;
180
						myFSymbol.m_Size = 10;
181
						myFSymbol.m_Stroke = new BasicStroke();
182
						panel.setForeground(UIManager.getColor(isSelected
183
								? "ComboBox.selectionForeground"
184
								: "ComboBox.foreground"));
185
						panel.setBackground(UIManager.getColor(isSelected
186
								? "ComboBox.selectionBackground"
187
								: "ComboBox.background"));
188
						
189
						return panel;
190
					}
191
				});
192
		}
193
	};
194
	
195
	/**
196
	 * Converts the comma-delimited string into a List of trimmed strings.
197
	 *
198
	 * @param linePattern a String with comma-delimited values
199
	 * @param lineWidth DOCUMENT ME!
200
	 *
201
	 * @return a List of the Strings that were delimited by commas
202
	 *
203
	 * @throws IllegalArgumentException DOCUMENT ME!
204
	 */
205
	public static float[] toArray(String linePattern, float lineWidth) {
206
		List strings = StringUtil.fromCommaDelimitedString(linePattern);
207
		float[] array = new float[strings.size()];
208

  
209
		for (int i = 0; i < strings.size(); i++) {
210
			String string = (String) strings.get(i);
211
			array[i] = Float.parseFloat(string) * lineWidth;
212

  
213
			if (array[i] <= 0) {
214
				throw new IllegalArgumentException("Negative dash length");
215
			}
216
		}
217

  
218
		return array;
219
	}
220
		
221
	protected JSlider lineWidthSlider = new JSlider() {
222

  
223
			{
224
				addChangeListener(new ChangeListener() {
225
						public void stateChanged(ChangeEvent e) {
226
							updateControls();
227
						}
228
					});
229
			}
230
		};
231
	private JComboBox linePatternComboBox = new JComboBox(linePatterns) { 
232
	{
233
				BasicComboBoxEditor editor = new BasicComboBoxEditor();
234
				setEditor(editor);
235
				setEditable(true);
236
				addActionListener(new ActionListener() {
237
						public void actionPerformed(ActionEvent e) {
238
							updateControls();
239
						}
240
					});
241
				setRenderer(new ListCellRenderer() {
242
						private JPanel panel = new JPanel() {
243
								private int lineWidth = 2;
244

  
245
								protected void paintComponent(Graphics g) {
246
									super.paintComponent(g);
247

  
248
									Graphics2D g2 = (Graphics2D) g;
249
									g2.setStroke(new BasicStroke(lineWidth,
250
											BasicStroke.CAP_BUTT,
251
											BasicStroke.JOIN_BEVEL, 1.0f,
252
											toArray(linePattern, lineWidth), 0));
253
									g2.draw(new Line2D.Double(0,
254
											panel.getHeight() / 2.0,
255
											panel.getWidth(),
256
											panel.getHeight() / 2.0));
257
								}
258
							};
259

  
260
						private String linePattern;
261

  
262
						public Component getListCellRendererComponent(
263
							JList list, Object value, int index,
264
							boolean isSelected, boolean cellHasFocus) {
265
							linePattern = (String) value;
266
							panel.setForeground(UIManager.getColor(isSelected
267
									? "ComboBox.selectionForeground"
268
									: "ComboBox.foreground"));
269
							panel.setBackground(UIManager.getColor(isSelected
270
									? "ComboBox.selectionBackground"
271
									: "ComboBox.background"));
272

  
273
							return panel;
274
						}
275
					});
276
			}
277
		};
278

  
279
		
280
	private JComboBox fillPatternComboBox = new JComboBox(fillPatterns) {
281

  
282
			{
283
				// setMaximumRowCount(fillPatterns.length);
284
				setEditable(false);
285
				addActionListener(new ActionListener() {
286
						public void actionPerformed(ActionEvent e) {
287
							updateControls();
288
						}
289
					});
290
				setRenderer(new ListCellRenderer() {
291
						private Paint fillPattern;
292
						private JLabel label = new JLabel(" ");
293
						private JPanel panel = new JPanel(new BorderLayout()) {
294

  
295
								{
296
									label.setPreferredSize(new Dimension(150,
297
											(int) label.getPreferredSize()
298
													   .getHeight()));
299
									add(label, BorderLayout.CENTER);
300
								}
301

  
302
								protected void paintComponent(Graphics g) {
303
									super.paintComponent(g);
304
									((Graphics2D) g).setPaint(fillPattern);
305
									((Graphics2D) g).fill(new Rectangle2D.Double(
306
											0, 0, getWidth(), getHeight()));
307
								}
308
							};
309

  
310
						public Component getListCellRendererComponent(
311
							JList list, Object value, int index,
312
							boolean isSelected, boolean cellHasFocus) {
313
							fillPattern = (Paint) value;
314
							// label.setText("" +(1 +
315
							// 	CollectionUtil.indexOf(fillPattern, fillPatterns))); 
316
							label.setForeground(UIManager.getColor(isSelected
317
									? "ComboBox.selectionForeground"
318
									: "ComboBox.foreground"));
319
							panel.setBackground(UIManager.getColor(isSelected
320
									? "ComboBox.selectionBackground"
321
									: "ComboBox.background"));
322

  
323
							return panel;
324
						}
325
					});
326
			}
327
		};
328
		
329

  
330
	private javax.swing.JPanel jPanelPoint = null;  //
331
	private javax.swing.JLabel jLabel = null;
332
	private javax.swing.JLabel jLabel1 = null;
333
	private javax.swing.JCheckBox jCheckBox = null;
334
	private javax.swing.JTextField jTextField_Size = null;
335
	private javax.swing.JComboBox jComboBox_Symbol_Type = null;
336
	private javax.swing.JLabel jLabel2 = null;
337
	private JLabel jLblImagen = null;
338
	private JTextField jTxtImagen = null;
339
	private JButton jBtnImagen = null;
340
	/**
341
	 * 
342
	 */
343
	public CopyOfFPanelLegendDefault() {
344
		super();
345
		try {
346
			jbInit();
347
			linePatternCheckBox.setSelected(false);
348
		} catch (Exception e) {
349
			e.printStackTrace();
350
		}
351

  
352
		transparencyPanel.getSlider().getModel().addChangeListener(new ChangeListener() {
353
				public void stateChanged(ChangeEvent e) {
354
					updateControls();
355
				}
356
			});
357
		/* palettePanel.add(new GridPalettePanel.Listener() {
358
				public void basicStyleChosen(BasicStyle basicStyle) {
359
					//Preserve some settings e.g. line and fill patterns, alpha;
360
					BasicStyle newBasicStyle = getBasicStyle();
361
					newBasicStyle.setFillColor(basicStyle.getFillColor());
362
					newBasicStyle.setLineColor(basicStyle.getLineColor());
363
					newBasicStyle.setLineWidth(basicStyle.getLineWidth());
364
					newBasicStyle.setRenderingFill(basicStyle.isRenderingFill());
365
					newBasicStyle.setRenderingLine(basicStyle.isRenderingLine());
366
					setBasicStyle(newBasicStyle);
367
				}
368
			}); */
369
		updateControls();
370

  
371
	}
372
	
373
	void jbInit() throws Exception {
374
		java.awt.GridBagConstraints consGridBagConstraints2 = new java.awt.GridBagConstraints();
375

  
376
		lineWidthSlider.setPreferredSize(SLIDER_DIMENSION);
377
		lineWidthSlider.setPaintLabels(true);
378
		lineWidthSlider.setValue(1);
379
		lineWidthSlider.setLabelTable(lineWidthSlider.createStandardLabels(10));
380
		lineWidthSlider.setMajorTickSpacing(5);
381
		lineWidthSlider.setMaximum(30);
382
		lineWidthSlider.setMinorTickSpacing(1);
383
		
384
		
385
		JPanel globalPanel = new JPanel();
386
		globalPanel.setLayout(new GridBagLayout());
387
		
388
		linePatternCheckBox.setText(Utilities.getMessage(this,"tipo_linea"));
389
		fillPatternCheckBox.setText(Utilities.getMessage(this,"tipo_relleno"));
390
		linePatternCheckBox.addActionListener(new java.awt.event.ActionListener() {
391
				public void actionPerformed(ActionEvent e) {
392
					linePatternCheckBox_actionPerformed(e);
393
				}
394
			});
395
		fillPatternCheckBox.addActionListener(new java.awt.event.ActionListener() {
396
				public void actionPerformed(ActionEvent e) {
397
					fillPatternCheckBox_actionPerformed(e);
398
				}
399
			});
400
		// add(getJPanelPoint());
401
		globalPanel.add(getCenterPanel(),
402
			new GridBagConstraints(0, 0, 1, 2, 0, 0, GridBagConstraints.WEST,
403
				GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
404
		
405
		/*globalPanel.add(new JPanel(),
406
			new GridBagConstraints(3, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
407
				GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0)); */
408
		/* globalPanel.add(new JLabel("Previsualizaci?n de s?mbolo:"),
409
			new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
410
				GridBagConstraints.NONE, new Insets(0, 30, 0, 0), 0, 0)); */
411
				
412
		JPanel panelAux = new JPanel();
413
		panelAux.add(new JLabel(Utilities.getMessage(this,"Previsualizacion_de_simbolo")));
414
		panelAux.add(m_previewSymbol );
415
		/* globalPanel.add(panelAux, new 
416
				GridBagConstraints(2, 1, 1, 1, 1, 1, GridBagConstraints.WEST,
417
				GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); */
418
		
419
		
420
		m_previewSymbol.setPreferredSize(new Dimension(80,60));
421
		m_previewSymbol.setMinimumSize(new Dimension(80,60));
422

  
423
		setLayout(null);
424
		globalPanel.setBounds(0,0,350,250);
425
		
426
		getJPanelPoint().setBounds(0,0,350,250);
427
		add(getJPanelPoint()); //, BorderLayout.WEST); //, consGridBagConstraints2);
428
		add(globalPanel); // , BorderLayout.WEST);
429
		
430
		panelAux.setBounds(350,0,150,100);
431
		
432
		add(panelAux) ; //,BorderLayout.EAST); // Contiene el preview
433
		
434
		/* globalPanel.setBackground(Color.RED);
435
		getJPanelPoint().setBackground(Color.BLUE);
436
		panelAux.setBackground(Color.GREEN); */
437
		
438
		getCenterPanel().setLayout(new GridBagLayout());
439
		setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
440
		this.setSize(419, 293);
441
 		fillColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
442
				public void actionPerformed(ActionEvent e) {
443
					fillColorChooserPanel_actionPerformed(e);
444
				}
445
			});
446
		lineColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
447
				public void actionPerformed(ActionEvent e) {
448
					lineColorChooserPanel_actionPerformed(e);
449
				}
450
			}); 
451
		
452
		synchronizeCheckBox.setText(Utilities.getMessage(this,"sincronizar_color_borde_relleno"));
453
		synchronizeCheckBox.addActionListener(new java.awt.event.ActionListener() {
454
				public void actionPerformed(ActionEvent e) {
455
					synchronizeCheckBox_actionPerformed(e);
456
				}
457
			});
458
		fillCheckBox.setText(Utilities.getMessage(this,"relleno"));
459
		fillCheckBox.addActionListener(new java.awt.event.ActionListener() {
460
				public void actionPerformed(ActionEvent e) {
461
					fillCheckBox_actionPerformed(e);
462
				}
463
			});
464
		lineCheckBox.setText(Utilities.getMessage(this,"linea"));
465
		lineCheckBox.addActionListener(new java.awt.event.ActionListener() {
466
				public void actionPerformed(ActionEvent e) {
467
					lineCheckBox_actionPerformed(e);
468
				}
469
			});
470
		getCenterPanel().add(GUIUtil.createSyncdTextField(
471
				transparencyPanel.getSlider(), SLIDER_TEXT_FIELD_COLUMNS),
472
			new GridBagConstraints(2, 21, 1, 1, 0.0, 0.0,
473
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
474
				new Insets(2, 2, 2, 2), 0, 0));
475
		getCenterPanel().add(lineWidthSlider,
476
			new GridBagConstraints(1, 19, 1, 1, 0.0, 0.0,
477
				GridBagConstraints.WEST, GridBagConstraints.NONE,
478
				new Insets(2, 2, 2, 2), 0, 0));
479
		getCenterPanel().add(GUIUtil.createSyncdTextField(lineWidthSlider,
480
				SLIDER_TEXT_FIELD_COLUMNS),
481
			new GridBagConstraints(2, 19, 1, 1, 0.0, 0.0,
482
				GridBagConstraints.WEST, GridBagConstraints.NONE,
483
				new Insets(2, 2, 2, 2), 0, 0));
484
		fillColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
485
				public void actionPerformed(ActionEvent e) {
486
					fillColorChooserPanel_actionPerformed(e);
487
				}
488
			}); 
489
		lineWidthLabel.setText(Utilities.getMessage(this,"grosor_linea"));
490
		transparencyLabel.setText(Utilities.getMessage(this,"transparencia"));
491
		consGridBagConstraints2.gridx = 0;
492
		consGridBagConstraints2.gridy = 0;
493
		consGridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST;
494
		consGridBagConstraints2.fill = java.awt.GridBagConstraints.NONE;
495
		getCenterPanel().add(synchronizeCheckBox,
496
			new GridBagConstraints(0, 18, 3, 1, 0.0, 0.0,
497
				GridBagConstraints.WEST, GridBagConstraints.NONE,
498
				new Insets(2, 2, 2, 2), 0, 0));
499
		getCenterPanel().add(transparencyLabel,
500
			new GridBagConstraints(0, 21, 1, 1, 0.0, 0.0,
501
				GridBagConstraints.WEST, GridBagConstraints.NONE,
502
				new Insets(2, 2, 2, 2), 0, 0));
503
		getCenterPanel().add(fillColorChooserPanel,
504
			new GridBagConstraints(1, 5, 2, 1, 0.0, 0.0,
505
				GridBagConstraints.WEST, GridBagConstraints.NONE,
506
				new Insets(2, 2, 2, 2), 0, 0));
507
		
508
		
509
		getCenterPanel().add(lineColorChooserPanel, 
510
			new GridBagConstraints(1, 11, 2, 1, 0.0, 0.0,
511
				GridBagConstraints.WEST, GridBagConstraints.NONE,
512
				new Insets(2, 2, 2, 2), 0, 0)); 
513
		getCenterPanel().add(transparencyPanel,
514
			new GridBagConstraints(1, 21, 1, 1, 0.0, 0.0,
515
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
516
				new Insets(2, 2, 2, 2), 0, 0));
517
		getCenterPanel().add(fillCheckBox,
518
			new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
519
				GridBagConstraints.WEST, GridBagConstraints.NONE,
520
				new Insets(2, 2, 2, 2), 0, 0));
521
		getCenterPanel().add(lineCheckBox,
522
			new GridBagConstraints(0, 11, 1, 1, 0.0, 0.0,
523
				GridBagConstraints.WEST, GridBagConstraints.NONE,
524
				new Insets(2, 2, 2, 2), 0, 0));
525
		getCenterPanel().add(lineWidthLabel,
526
			new GridBagConstraints(0, 19, 1, 1, 0.0, 0.0,
527
				GridBagConstraints.WEST, GridBagConstraints.NONE,
528
				new Insets(2, 2, 2, 2), 0, 0));
529
		getCenterPanel().add(linePatternCheckBox,
530
			new GridBagConstraints(0, 16, 1, 1, 0.0, 0.0,
531
				GridBagConstraints.WEST, GridBagConstraints.NONE,
532
				new Insets(2, 2, 2, 2), 0, 0));
533
		getCenterPanel().add(fillPatternCheckBox,
534
			new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0,
535
				GridBagConstraints.WEST, GridBagConstraints.NONE,
536
				new Insets(2, 2, 2, 2), 0, 0));
537
		getCenterPanel().add(linePatternComboBox,
538
			new GridBagConstraints(1, 16, 2, 1, 0.0, 0.0,
539
				GridBagConstraints.WEST, GridBagConstraints.NONE,
540
				new Insets(2, 2, 2, 2), 0, 0));
541
		getCenterPanel().add(fillPatternComboBox,
542
			new GridBagConstraints(1, 7, 2, 1, 0.0, 0.0,
543
				GridBagConstraints.WEST, GridBagConstraints.NONE,
544
				new Insets(2, 2, 0, 2), 0, 0));
545
		
546
		pointTypeComboBox.setBounds(143, 25, 120, 20);
547
		pointColorChooserPanel.addActionListener(new java.awt.event.ActionListener() {
548
			public void actionPerformed(ActionEvent e) {
549
				updateControls();
550
			}
551
		}); 
552
		
553
	}
554
	
555
	protected void setAlpha(int alpha) {
556
		transparencyPanel.getSlider().setValue(255 - alpha);
557
	}
558

  
559
	protected int getAlpha() {
560
		return 255 - transparencyPanel.getSlider().getValue();
561
	}
562
	
563
	void fillCheckBox_actionPerformed(ActionEvent e) {
564
		updateControls();
565
	}
566
	
567
	void lineCheckBox_actionPerformed(ActionEvent e) {
568
		updateControls();
569
	}
570

  
571
	public void setSynchronizingLineColor(boolean newSynchronizingLineColor) {
572
		synchronizeCheckBox.setSelected(newSynchronizingLineColor);
573
	}
574

  
575
	protected void synchronizeCheckBox_actionPerformed(ActionEvent e) {
576
		if (synchronizeCheckBox.isSelected()) {
577
			syncLineColor();
578
		}
579

  
580
		updateControls();
581
	}
582

  
583
	public JCheckBox getSynchronizeCheckBox() {
584
		return synchronizeCheckBox;
585
	}
586

  
587
	void linePatternCheckBox_actionPerformed(ActionEvent e) {
588
		updateControls();
589
	}
590
	void lineColorChooserPanel_actionPerformed(ActionEvent e) {
591
		if (synchronizeCheckBox.isSelected()) {
592
			fillColorChooserPanel.setColor(lineColorChooserPanel.getColor()
593
																.brighter());
594
		}
595

  
596
		updateControls();
597
	}
598
	void fillColorChooserPanel_actionPerformed(ActionEvent e) {
599
		if (synchronizeCheckBox.isSelected()) {
600
			syncLineColor();
601
		}
602

  
603
		updateControls();
604
	}
605
	private void syncLineColor() {
606
		lineColorChooserPanel.setColor(fillColorChooserPanel.getColor().darker());
607
	}
608

  
609
	void fillPatternCheckBox_actionPerformed(ActionEvent e) {
610
		updateControls();
611
	}
612
	private void updateFillPatternColors() {
613
		if ((m_FSymbol != null) && (m_FSymbol.m_Color != null))
614
		{ 
615
			fillPatterns = FSymbolFactory.createPatternFills(m_FSymbol.m_Color);
616
			fillPatternComboBox.setModel(new DefaultComboBoxModel(fillPatterns));
617
			fillPatternComboBox.getModel().setSelectedItem(m_FSymbol.m_Fill);
618
			// fillPatternComboBox.setSelectedItem(m_FSymbol.m_Fill);					
619
		}
620
		
621
	}
622

  
623
	public void updateControls() {
624
		linePatternComboBox.setEnabled(linePatternCheckBox.isSelected());
625
		fillPatternComboBox.setEnabled(fillPatternCheckBox.isSelected());
626
		lineColorChooserPanel.setEnabled(lineCheckBox.isSelected());
627
		fillColorChooserPanel.setEnabled(fillCheckBox.isSelected());
628
		fillColorChooserPanel.setAlpha(getAlpha());
629
		lineColorChooserPanel.setAlpha(getAlpha());
630
		Color theColor = (lineCheckBox.isSelected() &&
631
		!fillCheckBox.isSelected()) ? lineColorChooserPanel.getColor()
632
									: fillColorChooserPanel.getColor(); 
633
		transparencyPanel.setColor(theColor);
634
		if (jTxtImagen != null)
635
		{
636
			jTxtImagen.setVisible(false);
637
			jLblImagen.setVisible(false);
638
			jBtnImagen.setVisible(false);
639
		}
640
		if (m_FSymbol != null)
641
		{		
642
			if (m_FSymbol.m_symbolType == FConstant.SYMBOL_TYPE_POINT)
643
			{
644
				m_FSymbol.m_Size = Integer.parseInt(getJTextField().getText());
645
				 
646
				//System.out.println("Asigno el m_Size = " + getJTextField().getText());
647
				
648
				if (pointTypeComboBox.getSelectedItem() instanceof Integer)
649
				{
650
					Integer styleSelected = (Integer) pointTypeComboBox.getSelectedItem();
651
					m_FSymbol.m_Style = styleSelected.intValue();
652
				}
653
				else
654
				{
655
					Integer styleSelected = pointTypeToInt((String) pointTypeComboBox.getSelectedItem());
656
					m_FSymbol.m_Style = styleSelected.intValue();
657
				}
658
				if (m_FSymbol.m_Style == FConstant.SYMBOL_STYLE_MARKER_IMAGEN)
659
				{
660
					jTxtImagen.setVisible(true);
661
					jLblImagen.setVisible(true);
662
					jBtnImagen.setVisible(true);
663
					if (jTxtImagen.getText().compareTo("") != 0)
664
					{
665
						m_FSymbol.m_Icon = new ImageIcon(jTxtImagen.getText()).getImage();
666
					}
667
				}
668
				m_FSymbol.m_Color = pointColorChooserPanel.getColor();
669
				m_FSymbol.m_bUseSize = getJCheckBox().isSelected();
670
				pointColorChooserPanel.repaint();
671
				m_previewSymbol.setSymbol(m_FSymbol);				
672
				return;
673
			}
674
			m_FSymbol.m_useOutline = lineCheckBox.isSelected();
675
			m_FSymbol.m_outlineColor = lineColorChooserPanel.getColor();
676
			if (fillCheckBox.isSelected())
677
			{			
678
				m_FSymbol.m_Color = new Color(theColor.getRed(),
679
											theColor.getGreen(),
680
											  theColor.getBlue(),
681
											  	getAlpha());
682
			}
683
			else
684
			{
685
				m_FSymbol.m_Color = null;
686
			}
687
			if (fillPatternCheckBox.isSelected())
688
			{	
689
				Paint fillAux = (Paint) fillPatternComboBox.getSelectedItem();
690
				if (fillAux != null)
691
				{				
692
					m_FSymbol.m_Fill = (Paint) fillPatternComboBox.getSelectedItem();
693
					// Rellenamos el m_Style para que luego podamos escribir
694
					// el tipo de relleno que lleva.
695
					m_FSymbol.m_Style = fillPatternComboBox.getSelectedIndex()+3;
696
					//System.out.println("Asigno m_Fill=" + m_FSymbol.m_Fill.toString());
697
				}
698
			}	
699
			else
700
				m_FSymbol.m_Fill = null;
701
				 
702
			float lineWidth = lineWidthSlider.getValue();
703
			if (linePatternCheckBox.isSelected())
704
			{			
705
				String linePattern = (String) linePatternComboBox.getSelectedItem();
706
				// System.out.println(m_FSymbol.m_Stroke.toString());
707
				m_FSymbol.m_Stroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND,
708
											BasicStroke.JOIN_BEVEL, 1.0f,
709
												toArray(linePattern, lineWidth), 0);
710
												
711
				m_FSymbol.m_LinePattern = linePattern;
712
			}
713
			else
714
			{	
715
				if (lineWidth <=1)		
716
					m_FSymbol.m_Stroke = null;
717
				else
718
					m_FSymbol.m_Stroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND,
719
								BasicStroke.JOIN_BEVEL);
720
			}
721
			// System.out.println(fillPatternComboBox.getSelectedItem().toString() + " " + linePatternComboBox.getSelectedItem().toString());
722
			// JOptionPane.showMessageDialog(this,"HOla","Colega", JOptionPane.INFORMATION_MESSAGE);
723
			m_previewSymbol.setSymbol(m_FSymbol);
724
		}
725
		
726
		updateFillPatternColors();		
727
		fillPatternComboBox.repaint(); 
728
	}
729
	
730
	public void setFSymbol(FSymbol s)
731
	{
732
		m_FSymbol = s.cloneSymbol();
733
		m_previewSymbol.setSymbol(m_FSymbol);
734
		if (m_FSymbol.m_symbolType == FConstant.SYMBOL_TYPE_FILL)
735
		{		
736
			getJPanelPoint().setVisible(false);
737
			getCenterPanel().setVisible(true);
738
			fillCheckBox.setText(Utilities.getMessage(this,"relleno"));
739
			synchronizeCheckBox.setVisible(true);
740
			fillPatternCheckBox.setVisible(true);
741
			fillPatternComboBox.setVisible(true);
742
			lineCheckBox.setVisible(true);
743
			lineColorChooserPanel.setVisible(true);
744
			
745
			lineCheckBox.setSelected(m_FSymbol.m_useOutline);
746
			lineColorChooserPanel.setColor(m_FSymbol.m_outlineColor);
747
			if (m_FSymbol.m_Color != null)
748
			{
749
				fillCheckBox.setSelected(true);		
750
				fillColorChooserPanel.setColor(m_FSymbol.m_Color);
751
				setAlpha(m_FSymbol.m_Color.getAlpha());
752
				fillColorChooserPanel.setAlpha(getAlpha());
753
				lineColorChooserPanel.setAlpha(getAlpha());			
754
			}
755
			else
756
			{
757
				fillCheckBox.setSelected(false);
758
			}
759
			
760
			linePatternCheckBox.setSelected(false);
761
			if (m_FSymbol.m_Stroke != null)
762
			{
763
				BasicStroke aux = (BasicStroke) m_FSymbol.m_Stroke;
764
				if (aux.getDashArray() != null)
765
				{			
766
					linePatternCheckBox.setSelected(true);		
767
					linePatternComboBox.setSelectedItem(m_FSymbol.m_LinePattern);
768
				}
769
			}
770
		}
771
		if (m_FSymbol.m_symbolType == FConstant.SYMBOL_TYPE_LINE)
772
		{
773
			getJPanelPoint().setVisible(false);
774
			getCenterPanel().setVisible(true);			
775
			fillCheckBox.setText(Utilities.getMessage(this,"linea"));	// Lo vamos a usar como color de l?nea	
776
			fillCheckBox.setSelected(true); 
777
			synchronizeCheckBox.setVisible(false);
778
			fillPatternCheckBox.setVisible(false);
779
			fillPatternComboBox.setVisible(false);
780
			lineCheckBox.setSelected(true);
781
			lineCheckBox.setVisible(false);
782
			fillColorChooserPanel.setColor(m_FSymbol.m_Color);
783
			lineColorChooserPanel.setVisible(false);
784
			if (m_FSymbol.m_Color != null)
785
			{
786
				lineColorChooserPanel.setColor(m_FSymbol.m_Color);
787
				setAlpha(m_FSymbol.m_Color.getAlpha());
788
				lineColorChooserPanel.setAlpha(getAlpha());			
789
			}
790
			
791
			linePatternCheckBox.setSelected(false);
792
			if (m_FSymbol.m_Stroke != null)
793
			{
794
				BasicStroke aux = (BasicStroke) m_FSymbol.m_Stroke;
795
				if (aux.getDashArray() != null)
796
				{			
797
					linePatternCheckBox.setSelected(true);		
798
					linePatternComboBox.setSelectedItem(m_FSymbol.m_LinePattern);
799
				}
800
			}
801
		}
802
		if (m_FSymbol.m_symbolType == FConstant.SYMBOL_TYPE_POINT)
803
		{
804
			getCenterPanel().setVisible(false);
805
			getJPanelPoint().setVisible(true);
806
			if (m_FSymbol.m_Color!=null){
807
			pointColorChooserPanel.setColor(m_FSymbol.m_Color);
808
			}
809
			getJTextField().setText("" + m_FSymbol.m_Size);
810
			getJCheckBox().setSelected(m_FSymbol.m_bUseSize);
811
			getJComboBox_pointType().setSelectedItem(new Integer(m_FSymbol.m_Style));
812
			
813
		}
814
		
815
		// setAlpha(255 - m_FSymbol.m_Transparency);
816
		
817
	}
818

  
819
	/**
820
	 * @return
821
	 */
822
	public FSymbol getFSymbol() {
823
		updateControls();
824
		return m_FSymbol;
825
	}
826

  
827
	protected void setCenterPanel(JPanel centerPanel) {
828
		this.centerPanel = centerPanel;
829
	}
830

  
831
	protected JPanel getCenterPanel() {
832
		return centerPanel;
833
	}
834

  
835
	/**
836

  
837
	 * This method initializes jPanel	
838

  
839
	 * 	
840

  
841
	 * @return javax.swing.JPanel	
842

  
843
	 */    
844
	private javax.swing.JPanel getJPanelPoint() {
845
		if (jPanelPoint == null) {
846
			jLblImagen = new JLabel();
847
			jPanelPoint = new javax.swing.JPanel();
848
			jPanelPoint.setLayout(null);
849
			jPanelPoint.setPreferredSize(new Dimension(300,200));
850
			jPanelPoint.setBounds(0, 2, 336, 217);
851
			jLblImagen.setBounds(25, 139, 71, 18);
852
			jLblImagen.setText(Utilities.getMessage(this,"imagen"));
853
			jPanelPoint.add(getJLabel2(), null);
854
			jPanelPoint.add(getJLabel(), null);
855
			jPanelPoint.add(getJLabel1(), null);
856
			jPanelPoint.add(getJCheckBox(), null);
857
			jPanelPoint.add(getJTextField(), null);
858
			jPanelPoint.add(getJComboBox_pointType(), null);
859
			pointColorChooserPanel.setBounds(143, 54, 98, 22);
860
			pointColorChooserPanel.setAlpha(255);
861
			jPanelPoint.add(pointColorChooserPanel);
862
			jPanelPoint.add(jLblImagen, null);
863
			jPanelPoint.add(getJTextField2(), null);
864
			jPanelPoint.add(getJBtnImagen(), null);
865
		}
866
		return jPanelPoint;
867
	}
868

  
869
	/**
870

  
871
	 * This method initializes jLabel	
872

  
873
	 * 	
874

  
875
	 * @return javax.swing.JLabel	
876

  
877
	 */    
878
	private javax.swing.JLabel getJLabel() {
879
		if (jLabel == null) {
880
			jLabel = new javax.swing.JLabel();
881
			jLabel.setText(Utilities.getMessage(this,"tipo_simbolo"));
882
			jLabel.setBounds(25, 23, 113, 22);
883
		}
884
		return jLabel;
885
	}
886

  
887
	/**
888

  
889
	 * This method initializes jLabel1	
890

  
891
	 * 	
892

  
893
	 * @return javax.swing.JLabel	
894

  
895
	 */    
896
	private javax.swing.JLabel getJLabel1() {
897
		if (jLabel1 == null) {
898
			jLabel1 = new javax.swing.JLabel();
899
			jLabel1.setBounds(25, 84, 77, 22);
900
			jLabel1.setText(Utilities.getMessage(this,"tamano"));
901
		}
902
		return jLabel1;
903
	}
904

  
905
	/**
906

  
907
	 * This method initializes jCheckBox	
908

  
909
	 * 	
910

  
911
	 * @return javax.swing.JCheckBox	
912

  
913
	 */    
914
	private javax.swing.JCheckBox getJCheckBox() {
915
		if (jCheckBox == null) {
916
			jCheckBox = new javax.swing.JCheckBox();
917
			jCheckBox.setBounds(143, 115, 145, 19);
918
			jCheckBox.setText(Utilities.getMessage(this,"tamano_metros"));
919
		}
920
		return jCheckBox;
921
	}
922

  
923
	/**
924

  
925
	 * This method initializes jTextField	
926

  
927
	 * 	
928

  
929
	 * @return javax.swing.JTextField	
930

  
931
	 */    
932
	private javax.swing.JTextField getJTextField() {
933
		if (jTextField_Size == null) {
934
			jTextField_Size = new javax.swing.JTextField();
935
			jTextField_Size.setBounds(143, 86, 76, 20);
936
			jTextField_Size.setText("12");
937
			jTextField_Size.addActionListener(new java.awt.event.ActionListener() {
938
				public void actionPerformed(ActionEvent arg0) {
939
					updateControls();
940
				}
941
			});
942
		}
943
		return jTextField_Size;
944
	}
945

  
946
	/**
947

  
948
	 * This method initializes jComboBox	
949

  
950
	 * 	
951

  
952
	 * @return javax.swing.JComboBox	
953

  
954
	 */    
955
	private javax.swing.JComboBox getJComboBox_pointType() {
956
		if (jComboBox_Symbol_Type == null) {
957
			jComboBox_Symbol_Type = new javax.swing.JComboBox();
958
			jComboBox_Symbol_Type.setBounds(143, 25, 120, 20);
959
		}
960
		// return jComboBox_Symbol_Type;
961
		return pointTypeComboBox;
962
	}
963

  
964
	/**
965

  
966
	 * This method initializes jLabel2	
967

  
968
	 * 	
969

  
970
	 * @return javax.swing.JLabel	
971

  
972
	 */    
973
	private javax.swing.JLabel getJLabel2() {
974
		if (jLabel2 == null) {
975
			jLabel2 = new javax.swing.JLabel();
976
			jLabel2.setBounds(25, 54, 68, 22);
977
			jLabel2.setText(Utilities.getMessage(this,"color"));
978
		}
979
		return jLabel2;
980
	}
981

  
982
	/**
983
	 * This method initializes jTextField	
984
	 * 	
985
	 * @return javax.swing.JTextField	
986
	 */    
987
	private JTextField getJTextField2() {
988
		if (jTxtImagen == null) {
989
			jTxtImagen = new JTextField();
990
			jTxtImagen.setBounds(103, 139, 168, 18);
991
		}
992
		return jTxtImagen;
993
	}
994
	/**
995
	 * This method initializes jButton	
996
	 * 	
997
	 * @return javax.swing.JButton	
998
	 */    
999
	private JButton getJBtnImagen() {
1000
		if (jBtnImagen == null) {
1001
			jBtnImagen = new JButton();
1002
			jBtnImagen.setBounds(279, 139, 33, 18);
1003
			jBtnImagen.setText("...");
1004
			jBtnImagen.setToolTipText(Utilities.getMessage(this,"browse"));
1005
			jBtnImagen.addActionListener(new java.awt.event.ActionListener() { 
1006
				public void actionPerformed(java.awt.event.ActionEvent e) {  
1007
					JFileChooser tempChooser = new JFileChooser();
1008
					ImageFilter filter = new ImageFilter();
1009
				    tempChooser.setFileFilter(filter);
1010

  
1011
                    int result = tempChooser.showOpenDialog((Component) e.getSource());
1012
                    tempChooser.setMultiSelectionEnabled(false);
1013
                    if (result == JFileChooser.APPROVE_OPTION) {
1014
                		File newFile = tempChooser.getSelectedFile();
1015
                		jTxtImagen.setText(newFile.getAbsolutePath());
1016
                	}
1017
				}
1018
			});
1019
		}
1020
		return jBtnImagen;
1021
	}
1022
   }  //  @jve:visual-info  decl-index=0 visual-constraint="10,10"

Also available in: Unified diff