Revision 8401

View differences:

trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/MarkerFill.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

  
42
/* CVS MESSAGES:
43
*
44
* $Id$
45
* $Log$
46
* Revision 1.1  2006-10-27 12:41:09  jaume
47
* GUI
48
*
49
*
50
*/
51
package com.iver.cit.gvsig.gvsig.gui.styling;
52

  
53
import java.awt.FlowLayout;
54
import java.awt.GridLayout;
55
import java.util.ArrayList;
56

  
57
import javax.swing.BorderFactory;
58
import javax.swing.ButtonGroup;
59
import javax.swing.JLabel;
60
import javax.swing.JPanel;
61
import javax.swing.JRadioButton;
62

  
63
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
64
import org.gvsig.gui.beans.swing.JButton;
65

  
66
import com.iver.andami.PluginServices;
67
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
68
import com.iver.utiles.XMLEntity;
69

  
70
import de.ios.framework.swing.JDecimalField;
71

  
72
public class MarkerFill extends AbstractTypeSymbolEditorPanel {
73
    private static final String NAME = PluginServices.
74
    getText(MarkerFill.class, "marker_fill");
75
    private ArrayList tabs = new ArrayList();
76
    private JDecimalField txtOffsetX;
77
    private JDecimalField txtOffsetY;
78
    private JDecimalField txtSeparationX;
79
    private JDecimalField txtSeparationY;
80
	private ColorChooserPanel markerCC;
81
	private JButton btnChooseMarker;
82
	private JButton btnOutline;
83
	private JRadioButton rdGrid;
84
	private JRadioButton rdRandom;
85

  
86
    public MarkerFill(SymbolEditor owner) {
87
        super(owner);
88
        initialize();
89
    }
90

  
91
    private void initialize() {
92
        GridLayout layout;
93
        JPanel myTab;
94
        // Marker fill tab
95

  
96
        {
97

  
98
        	myTab = new GridBagLayoutPanel();
99
        	myTab.setName(PluginServices.getText(this, "marker_fill"));
100

  
101
        	GridBagLayoutPanel p = (GridBagLayoutPanel) myTab;
102
        	JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
103
        	markerCC = new ColorChooserPanel();
104
        	aux.add(markerCC);
105
        	// TODO restore previous marker color
106

  
107
        	p.addComponent(PluginServices.getText(this, "color"), aux);
108
        	btnChooseMarker = new JButton(PluginServices.getText(this, "choose_marker"));
109
        	aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
110
        	aux.add(btnChooseMarker);
111
        	p.addComponent("", aux);
112

  
113
        	aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
114
        	btnOutline = new JButton(PluginServices.getText(this, "outline"));
115
        	aux.add(btnOutline);
116
        	btnOutline.setEnabled(false);
117
        	p.addComponent("", aux);
118

  
119
        	ButtonGroup group = new ButtonGroup();
120
        	rdGrid = new JRadioButton(PluginServices.getText(this, "grid"));
121
        	rdRandom = new JRadioButton(PluginServices.getText(this, "random"));
122
        	group.add(rdGrid);
123
        	group.add(rdRandom);
124
        	// TODO restore previous value
125

  
126
        	aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
127
        	aux.add(rdGrid);
128
        	aux.add(rdRandom);
129

  
130
        	p.addComponent("", aux);
131
        }
132
        tabs.add(myTab);
133

  
134
        // Fill properties tab
135
        {
136
        	layout = new GridLayout();
137
            layout.setColumns(1);
138
            layout.setVgap(5);
139
            myTab = new JPanel();
140
            myTab.setName(PluginServices.getText(this, "fill_properties"));
141
            JPanel offsetPnl = new JPanel();
142
            offsetPnl.setBorder(BorderFactory.
143
                        createTitledBorder(null,
144
                                PluginServices.getText(this, "offset")));
145

  
146
            // add components to the offset panel here
147
            {
148
                JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
149
                aux.add(new JLabel("X:"));
150
                aux.add(txtOffsetX = new JDecimalField(10));
151
                offsetPnl.add(aux);
152

  
153
                aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
154
                aux.add(new JLabel("Y:"));
155
                aux.add(txtOffsetY = new JDecimalField(10));
156
                offsetPnl.add(aux);
157

  
158
            }
159
            layout.setRows(offsetPnl.getComponentCount());
160
            offsetPnl.setLayout(layout);
161

  
162
            myTab.add(offsetPnl);
163

  
164
            JPanel separationPnl = new JPanel();
165
            layout = new GridLayout();
166
            layout.setColumns(1);
167
            layout.setVgap(5);
168
            separationPnl.setBorder(BorderFactory.
169
                        createTitledBorder(null,
170
                                PluginServices.getText(this, "separation")));
171

  
172
            // add components to the separation panel here
173
            {
174
                JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
175
                aux.add(new JLabel("X:"));
176
                aux.add(txtSeparationX = new JDecimalField(10));
177
                separationPnl.add(aux);
178

  
179
                aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
180
                aux.add(new JLabel("Y:"));
181
                aux.add(txtSeparationY = new JDecimalField(10));
182
                separationPnl.add(aux);
183
            }
184
            layout.setRows(separationPnl.getComponentCount());
185
            separationPnl.setLayout(layout);
186
            myTab.add(separationPnl);
187
            layout = new GridLayout();
188
            layout.setColumns(1);
189
            layout.setVgap(5);
190
            layout.setRows(myTab.getComponentCount());
191
            myTab.setLayout(layout);
192
        }
193

  
194

  
195

  
196

  
197
        tabs.add(myTab);
198

  
199
    }
200
    public XMLEntity getXMLEntity() {
201
        // TODO Auto-generated method stub
202
        return null;
203
    }
204

  
205
    public String getName() {
206
        return NAME;
207
    }
208

  
209
    public JPanel[] getTabs() {
210
        return (JPanel[]) tabs.toArray(new JPanel[0]);
211
    }
212

  
213
}
0 214

  
trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolEditor.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.1  2006-10-26 16:31:21  jaume
46
* Revision 1.2  2006-10-27 12:41:09  jaume
47 47
* GUI
48 48
*
49
* Revision 1.1  2006/10/26 16:31:21  jaume
50
* GUI
49 51
*
52
*
50 53
*/
51 54
package com.iver.cit.gvsig.gvsig.gui.styling;
52 55

  
53 56
import java.awt.BorderLayout;
54
import java.awt.Component;
55 57
import java.awt.Dimension;
56 58
import java.awt.FlowLayout;
57 59
import java.awt.event.ActionEvent;
58 60
import java.awt.event.ActionListener;
61
import java.util.Comparator;
62
import java.util.TreeSet;
59 63

  
60 64
import javax.swing.BorderFactory;
61 65
import javax.swing.JComboBox;
62 66
import javax.swing.JLabel;
63 67
import javax.swing.JPanel;
68
import javax.swing.JTabbedPane;
64 69

  
65 70
import org.gvsig.gui.beans.AcceptCancelPanel;
66 71

  
67 72
import com.iver.andami.PluginServices;
68 73
import com.iver.andami.ui.mdiManager.IWindow;
69 74
import com.iver.andami.ui.mdiManager.WindowInfo;
75
import com.iver.cit.gvsig.fmap.core.FShape;
70 76
import com.iver.cit.gvsig.fmap.core.ISymbol;
71
import com.sun.crypto.provider.JceKeyStore;
72
import javax.swing.JTabbedPane;
73 77

  
74 78
/**
75 79
 *
......
78 82
 */
79 83
public class SymbolEditor extends JPanel implements IWindow {
80 84

  
81
	private WindowInfo wi;
82
	private JPanel pnlWest = null;
83
	private JPanel pnlCenter = null;
84
	private JPanel pnlPreview = null;
85
	private JPanel pnlLayers = null;
86
	private AcceptCancelPanel okCancelPanel;
87
	private ISymbol symbol;
88
	private SymbolPreview symbolPreview = null;
89
	private SymbolPreview layerViewer = null;
90
	private JPanel pncCenter = null;
91
	private JPanel pnlTypeAndUnits = null;
92
	private JComboBox cmbType;
93
	private JComboBox cmbUnits;
94
	private JTabbedPane tabbedPane = null;
95
	public SymbolEditor(ISymbol selectedSymbol, int shapeType) {
96
		// TODO Auto-generated constructor stub
97
		initialize();
98
	}
85
    private WindowInfo wi;
86
    private JPanel pnlWest = null;
87
    private JPanel pnlCenter = null;
88
    private JPanel pnlPreview = null;
89
    private JPanel pnlLayers = null;
90
    private AcceptCancelPanel okCancelPanel;
91
    private ISymbol symbol;
92
    private SymbolPreview symbolPreview = null;
93
    private SymbolPreview layerViewer = null;
94
    private JPanel pnlTypeAndUnits = null;
95
    private JComboBox cmbType;
96
    private JComboBox cmbUnits;
97
    private JTabbedPane tabbedPane = null;
98
    private int shapeType;
99 99

  
100
    private ActionListener cmbTypeActionListener = new ActionListener() {
101
		int prevIndex = -2;
102
		public void actionPerformed(ActionEvent e) {
103
			int index = getCmbType().getSelectedIndex();
104
			if (prevIndex != index) {
105
				// needs to refresh
106
				prevIndex = index;
100 107

  
101
	/**
102
	 * This method initializes this
103
	 *
104
	 */
105
	private void initialize() {
106
		this.setLayout(new BorderLayout());
107
		this.add(getPnlWest(), BorderLayout.WEST);
108
		this.add(getPnlCenter(), BorderLayout.CENTER);
109
		this.add(getOkCancelPanel(), BorderLayout.SOUTH);
110
	}
111

  
112
	private AcceptCancelPanel getOkCancelPanel() {
113
		if (okCancelPanel == null) {
114
			ActionListener action = new ActionListener() {
115
				public void actionPerformed(ActionEvent e) {
116
					if ("CANCEL".equals(e.getActionCommand())) {
117
						symbol = null;
118
					}
119
					PluginServices.getMDIManager().closeWindow(SymbolEditor.this);
108
				if (tabbedPane != null)
109
					getPnlCenter().remove(tabbedPane);
110
				JPanel[] tabs = ((AbstractTypeSymbolEditorPanel) getCmbType().getSelectedItem()).getTabs();
111
				tabbedPane = new JTabbedPane();
112
				tabbedPane.setPreferredSize(new Dimension(300, 300));
113
				for (int i = 0; i < tabs.length; i++) {
114
					tabbedPane.addTab(tabs[i].getName(), tabs[i]);
120 115
				}
121
			};
122
			okCancelPanel = new AcceptCancelPanel(action, action);
116
				getPnlCenter().add(tabbedPane, BorderLayout.CENTER);
117
				getPnlCenter().doLayout();
118
			}
123 119
		}
124
		return okCancelPanel;
125
	}
120
	};
126 121

  
127 122

  
128
	public WindowInfo getWindowInfo() {
129
		if (wi == null) {
130
			wi = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
131
			wi.setWidth(750);
132
			wi.setHeight(500);
133
			wi.setTitle(PluginServices.getText(this, "symbol_property_editor"));
134
		}
135
		return wi;
136
	}
123
    private AbstractTypeSymbolEditorPanel[] polygonOptions;
124
    {
125
    	TreeSet set = new TreeSet(new Comparator() {
126
			public int compare(Object o1, Object o2) {
127
				if (! (o1 instanceof AbstractTypeSymbolEditorPanel
128
					|| o1 instanceof AbstractTypeSymbolEditorPanel))
129
					throw new IllegalArgumentException(PluginServices.getText(this, "trying_to_add_a_non_TypeSymbolEditor_panel"));
130
				AbstractTypeSymbolEditorPanel pnl1 = (AbstractTypeSymbolEditorPanel) o1,
131
				pnl2 = (AbstractTypeSymbolEditorPanel) o2;
132
				int result = pnl1.getName().compareTo(pnl2.getName());
133
				if (result == 0)
134
					throw new IllegalArgumentException(PluginServices.getText(this, "two_panels_with_the_same_name"));
135
				return result;
136
			}
137
    	});
137 138

  
138
	public ISymbol getSymbol() {
139
		return symbol;
140
	}
141
	/**
142
	 * This method initializes pnlWest
143
	 *
144
	 * @return javax.swing.JPanel
145
	 */
146
	private JPanel getPnlWest() {
147
		if (pnlWest == null) {
148
			pnlWest = new JPanel();
149
			pnlWest.setLayout(new BorderLayout());
150
			pnlWest.add(getPnlPreview(), java.awt.BorderLayout.NORTH);
151
			pnlWest.add(getPnlLayers(), java.awt.BorderLayout.SOUTH);
152
		}
153
		return pnlWest;
154
	}
155
	/**
156
	 * This method initializes pnlCenter
157
	 *
158
	 * @return javax.swing.JPanel
159
	 */
160
	private JPanel getPnlCenter() {
161
		if (pnlCenter == null) {
162
			pnlCenter = new JPanel(new BorderLayout());
163
			pnlCenter.setBorder(BorderFactory.
164
					createTitledBorder(null,
165
							PluginServices.getText(this, "properties")));
166
			pnlCenter.add(getPnlTypeAndUnits(), java.awt.BorderLayout.NORTH);
139
    	// add here your options for polygon symbols
140
    	set.add(new SimpleFill(SymbolEditor.this));
141
    	set.add(new MarkerFill(SymbolEditor.this));
142
    	polygonOptions = (AbstractTypeSymbolEditorPanel[]) set.toArray(new AbstractTypeSymbolEditorPanel[0]);
143
    };
167 144

  
168
			pnlCenter.add(getTabbedPane(), java.awt.BorderLayout.CENTER);
169
		}
170
		return pnlCenter;
171
	}
172
	/**
173
	 * This method initializes pnlPreview
174
	 *
175
	 * @return javax.swing.JPanel
176
	 */
177
	private JPanel getPnlPreview() {
178
		if (pnlPreview == null) {
179
			pnlPreview = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
180
			pnlPreview.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "preview")));
181
			pnlPreview.add(getSymbolPreview());
182
		}
183
		return pnlPreview;
184
	}
185
	/**
186
	 * This method initializes pnlLayers
187
	 *
188
	 * @return javax.swing.JPanel
189
	 */
190
	private JPanel getPnlLayers() {
191
		if (pnlLayers == null) {
192
			pnlLayers = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
193
			pnlLayers.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "layers")));
194
			pnlLayers.add(getLayerViewer(), null);
195
		}
196
		return pnlLayers;
197
	}
145
    public SymbolEditor(ISymbol symbol, int shapeType) {
146
        this.symbol = symbol;
147
        this.shapeType = shapeType;
148
        initialize();
149
    }
198 150

  
199 151

  
200
	/**
201
	 * This method initializes symbolPreview
202
	 *
203
	 * @return com.iver.cit.gvsig.gvsig.gui.styling.SymbolPreview
204
	 */
205
	private SymbolPreview getSymbolPreview() {
206
		if (symbolPreview == null) {
207
			symbolPreview = new SymbolPreview();
208
			symbolPreview.setPreferredSize(new Dimension(100, 100));
152
    /**
153
     * This method initializes this
154
     *
155
     */
156
    private void initialize() {
157
        this.setLayout(new BorderLayout());
158
        this.add(getPnlWest(), BorderLayout.WEST);
159
        this.add(getPnlCenter(), BorderLayout.CENTER);
160
        this.add(getOkCancelPanel(), BorderLayout.SOUTH);
161
        cmbTypeActionListener.actionPerformed(null);
162
    }
209 163

  
210
		}
211
		return symbolPreview;
212
	}
164
    private AcceptCancelPanel getOkCancelPanel() {
165
        if (okCancelPanel == null) {
166
            ActionListener action = new ActionListener() {
167
                public void actionPerformed(ActionEvent e) {
168
                    if ("CANCEL".equals(e.getActionCommand())) {
169
                        symbol = null;
170
                    }
171
                    PluginServices.getMDIManager().closeWindow(SymbolEditor.this);
172
                }
173
            };
174
            okCancelPanel = new AcceptCancelPanel(action, action);
175
        }
176
        return okCancelPanel;
177
    }
213 178

  
214 179

  
215
	/**
216
	 * This method initializes symbolPreview1
217
	 *
218
	 * @return com.iver.cit.gvsig.gvsig.gui.styling.SymbolPreview
219
	 */
220
	private SymbolPreview getLayerViewer() {
221
		if (layerViewer == null) {
222
			layerViewer = new SymbolPreview();
223
			layerViewer.setPreferredSize(new Dimension(100, 100));
224
		}
225
		return layerViewer;
226
	}
180
    public WindowInfo getWindowInfo() {
181
        if (wi == null) {
182
            wi = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
183
            wi.setWidth(600);
184
            wi.setHeight(400);
185
            wi.setTitle(PluginServices.getText(this, "symbol_property_editor"));
186
        }
187
        return wi;
188
    }
227 189

  
190
    public ISymbol getSymbol() {
191
        return symbol;
192
    }
193
    /**
194
     * This method initializes pnlWest
195
     *
196
     * @return javax.swing.JPanel
197
     */
198
    private JPanel getPnlWest() {
199
        if (pnlWest == null) {
200
            pnlWest = new JPanel();
201
            pnlWest.setLayout(new BorderLayout());
202
            pnlWest.add(getPnlPreview(), java.awt.BorderLayout.NORTH);
203
            pnlWest.add(getPnlLayers(), java.awt.BorderLayout.SOUTH);
204
        }
205
        return pnlWest;
206
    }
207
    /**
208
     * This method initializes pnlCenter
209
     *
210
     * @return javax.swing.JPanel
211
     */
212
    private JPanel getPnlCenter() {
213
        if (pnlCenter == null) {
214
            pnlCenter = new JPanel(new BorderLayout());
215
            pnlCenter.setBorder(BorderFactory.
216
                    createTitledBorder(null,
217
                            PluginServices.getText(this, "properties")));
218
            pnlCenter.add(getPnlTypeAndUnits(), java.awt.BorderLayout.NORTH);
228 219

  
229
	/**
230
	 * This method initializes pnlTypeAndUnits
231
	 *
232
	 * @return javax.swing.JPanel
233
	 */
234
	private JPanel getPnlTypeAndUnits() {
235
		if (pnlTypeAndUnits == null) {
236
			pnlTypeAndUnits = new JPanel();
237
			pnlTypeAndUnits.setLayout(new BorderLayout());
238
			JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING));
239
			aux.add(new JLabel(PluginServices.getText(this, "type")));
240
			aux.add(getCmbType());
241
			pnlTypeAndUnits.add(aux, BorderLayout.WEST);
220
//            pnlCenter.add(getTabbedPane(), java.awt.BorderLayout.CENTER);
221
        }
222
        return pnlCenter;
223
    }
224
    /**
225
     * This method initializes pnlPreview
226
     *
227
     * @return javax.swing.JPanel
228
     */
229
    private JPanel getPnlPreview() {
230
        if (pnlPreview == null) {
231
            pnlPreview = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
232
            pnlPreview.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "preview")));
233
            pnlPreview.add(getSymbolPreview());
234
        }
235
        return pnlPreview;
236
    }
237
    /**
238
     * This method initializes pnlLayers
239
     *
240
     * @return javax.swing.JPanel
241
     */
242
    private JPanel getPnlLayers() {
243
        if (pnlLayers == null) {
244
            pnlLayers = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
245
            pnlLayers.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "layers")));
246
            pnlLayers.add(getLayerViewer(), null);
247
        }
248
        return pnlLayers;
249
    }
242 250

  
243
			aux =  new JPanel(new FlowLayout(FlowLayout.LEADING));
244
			aux.add(new JLabel(PluginServices.getText(this, "units")));
245
			aux.add(getCmbUnits());
246
			pnlTypeAndUnits.add(aux, BorderLayout.EAST);
247
		}
248
		return pnlTypeAndUnits;
249
	}
250 251

  
252
    /**
253
     * This method initializes symbolPreview
254
     *
255
     * @return com.iver.cit.gvsig.gvsig.gui.styling.SymbolPreview
256
     */
257
    private SymbolPreview getSymbolPreview() {
258
        if (symbolPreview == null) {
259
            symbolPreview = new SymbolPreview();
260
            symbolPreview.setPreferredSize(new Dimension(100, 100));
251 261

  
252
	private JComboBox getCmbUnits() {
253
		if (cmbUnits == null) {
254
			cmbUnits = new JComboBox(new String[] {"unidad1", "unidad2"});
255
		}
256
		return cmbUnits;
257
	}
262
        }
263
        return symbolPreview;
264
    }
258 265

  
259 266

  
260
	private JComboBox getCmbType() {
261
		if (cmbType == null) {
262
			cmbType = new JComboBox(new String[] {"hola", "adios"});
263
		}
264
		return cmbType;
265
	}
267
    /**
268
     * This method initializes symbolPreview1
269
     *
270
     * @return com.iver.cit.gvsig.gvsig.gui.styling.SymbolPreview
271
     */
272
    private SymbolPreview getLayerViewer() {
273
        if (layerViewer == null) {
274
            layerViewer = new SymbolPreview();
275
            layerViewer.setPreferredSize(new Dimension(100, 100));
276
        }
277
        return layerViewer;
278
    }
266 279

  
267 280

  
268
	/**
269
	 * This method initializes tabbedPane
270
	 *
271
	 * @return javax.swing.JTabbedPane
272
	 */
273
	private JTabbedPane getTabbedPane() {
274
		if (tabbedPane == null) {
275
			tabbedPane = new JTabbedPane();
276
		}
277
		return tabbedPane;
278
	}
281
    /**
282
     * This method initializes pnlTypeAndUnits
283
     *
284
     * @return javax.swing.JPanel
285
     */
286
    private JPanel getPnlTypeAndUnits() {
287
        if (pnlTypeAndUnits == null) {
288
            pnlTypeAndUnits = new JPanel();
289
            pnlTypeAndUnits.setLayout(new BorderLayout());
290
            JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING));
291
            aux.add(new JLabel(PluginServices.getText(this, "type")));
292
            aux.add(getCmbType());
293
            pnlTypeAndUnits.add(aux, BorderLayout.WEST);
279 294

  
295
            aux =  new JPanel(new FlowLayout(FlowLayout.LEADING));
296
            aux.add(new JLabel(PluginServices.getText(this, "units")));
297
            aux.add(getCmbUnits());
298
            pnlTypeAndUnits.add(aux, BorderLayout.EAST);
299
        }
300
        return pnlTypeAndUnits;
301
    }
280 302

  
303

  
304
    private JComboBox getCmbUnits() {
305
        if (cmbUnits == null) {
306
            cmbUnits = new JComboBox(new String[] {"unidad1", "unidad2"});
307
        }
308
        return cmbUnits;
309
    }
310

  
311

  
312
    private JComboBox getCmbType() {
313
        if (cmbType == null) {
314
        	AbstractTypeSymbolEditorPanel[] tabs = null;
315
            switch (shapeType) {
316
            case FShape.POINT:
317
                break;
318
            case FShape.LINE:
319
                break;
320
            case FShape.POLYGON:
321
            	tabs = polygonOptions;
322
                break;
323
            default:
324
            }
325
            cmbType = new JComboBox(tabs);
326
            cmbType.addActionListener(cmbTypeActionListener);
327
        }
328
        return cmbType;
329
    }
330

  
331
    /**
332
     * seguramente esto no me va a valer, deber?a traemere el xmlentity i aplicarlo al simbolo actual
333
     * @param symbol
334
     */
335
    void changeSymbol(ISymbol symbol) {
336
		this.symbol = symbol;
337
		symbolPreview.setSymbol(symbol);
338
	}
281 339
}  //  @jve:decl-index=0:visual-constraint="10,10"
trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SimpleFill.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

  
42
/* CVS MESSAGES:
43
*
44
* $Id$
45
* $Log$
46
* Revision 1.1  2006-10-27 12:41:09  jaume
47
* GUI
48
*
49
*
50
*/
51
package com.iver.cit.gvsig.gvsig.gui.styling;
52

  
53
import java.awt.Dimension;
54
import java.awt.FlowLayout;
55
import java.util.ArrayList;
56

  
57
import javax.swing.JColorChooser;
58
import javax.swing.JPanel;
59

  
60
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
61

  
62
import com.iver.andami.PluginServices;
63
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
64
import com.iver.utiles.XMLEntity;
65

  
66
import de.ios.framework.swing.JDecimalField;
67

  
68
public class SimpleFill extends AbstractTypeSymbolEditorPanel {
69
	private static final String NAME = PluginServices.
70
		getText(SimpleFill.class, "simple_fill");
71
	private ColorChooserPanel jccFillColor;
72
	private ColorChooserPanel jccOutlineColor;
73
	private JDecimalField txtOutlineWidth;
74
	private ArrayList tabs = new ArrayList();
75

  
76
	public SimpleFill(SymbolEditor owner) {
77
		super(owner);
78
		initialize();
79
	}
80

  
81
	public String getName() {
82
		return NAME;
83
	}
84

  
85
	public JPanel[] getTabs() {
86
		return (JPanel[]) tabs.toArray(new JPanel[0]);
87
	}
88

  
89
	private void initialize() {
90
		JPanel myTab = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
91
		myTab.setName(PluginServices.getText(this, "simple_fill"));
92
		GridBagLayoutPanel aux = new GridBagLayoutPanel();
93
		jccFillColor = new ColorChooserPanel();
94
		// TODO restore previous color
95
		aux.addComponent(PluginServices.getText(this, "fill_color")+":",
96
			jccFillColor	);
97
		jccOutlineColor = new ColorChooserPanel();
98
		// TODO restore previous outline color
99
		aux.addComponent(PluginServices.getText(this, "outline_color")+":",
100
			jccOutlineColor	);
101
		txtOutlineWidth = new JDecimalField(25);
102
		// TODO restore previous outline width
103
		aux.addComponent(PluginServices.getText(this, "outline_width")+":",
104
			txtOutlineWidth );
105
		aux.setPreferredSize(new Dimension(300, 300));
106
		myTab.add(aux);
107

  
108
		tabs.add(myTab);
109
	}
110

  
111
	public XMLEntity getXMLEntity() {
112
		// TODO Auto-generated method stub
113
		return null;
114
	}
115

  
116
}
0 117

  
trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/AbstractTypeSymbolEditorPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

  
42
/* CVS MESSAGES:
43
*
44
* $Id$
45
* $Log$
46
* Revision 1.1  2006-10-27 12:41:09  jaume
47
* GUI
48
*
49
*
50
*/
51
package com.iver.cit.gvsig.gvsig.gui.styling;
52

  
53
import javax.swing.JPanel;
54

  
55
import com.iver.utiles.XMLEntity;
56

  
57
public abstract class AbstractTypeSymbolEditorPanel {
58

  
59
	private SymbolEditor owner;
60

  
61
	public abstract XMLEntity getXMLEntity();
62
	/**
63
	 * Creates a new instance of this type symbol editor panel associated to
64
	 * its parent SymbolEditor which will be notified of the changes in
65
	 * order to keep the symbol preview in sync with the user settings.
66
	 * @param owner, the SymbolEditor which created this.
67
	 */
68
	public AbstractTypeSymbolEditorPanel(SymbolEditor owner) {
69
		this.owner = owner;
70
	}
71
	public abstract String getName();
72
	public abstract JPanel[] getTabs();
73

  
74
	public String toString() {
75
		return getName();
76
	}
77

  
78
	protected final void fireSymbolChangedEvent() {
79
		owner.changeSymbol(null);
80
	}
81
}
0 82

  
trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/RouteControlPanel.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.2  2006-10-26 16:31:21  jaume
46
* Revision 1.3  2006-10-27 12:41:09  jaume
47 47
* GUI
48 48
*
49
* Revision 1.2  2006/10/26 16:31:21  jaume
50
* GUI
51
*
49 52
* Revision 1.1  2006/10/25 10:50:41  jaume
50 53
* movement of classes and gui stuff
51 54
*
......
71 74
import java.awt.Dimension;
72 75
import java.awt.FlowLayout;
73 76
import java.awt.Font;
77
import java.awt.GridLayout;
74 78
import java.awt.event.ActionEvent;
75 79
import java.awt.event.ActionListener;
76 80
import java.util.ArrayList;
......
122 126
            PluginServices.getText(this, "stage"),
123 127
            PluginServices.getText(this, "cost"),
124 128
    };
129
	private JButton btnGenerateRoute;
130
	private JButton btnSaveRoute;
125 131
    /**
126 132
     * This method initializes
127 133
     *
......
181 187

  
182 188
    public WindowInfo getWindowInfo() {
183 189
        if (wi==null) {
184
            wi = new WindowInfo(WindowInfo.RESIZABLE);
190
            wi = new WindowInfo(WindowInfo.PALETTE);
185 191
            wi.setWidth(450);
186 192
            wi.setHeight(320);
187 193
            wi.setTitle(PluginServices.getText(this, "create_network") + "...");
......
211 217
    private JButton getBtnPullDownStage() {
212 218
		if (btnPullDownStage == null) {
213 219
			btnPullDownStage = new JButton(new ImageIcon(this.getClass().getClassLoader().getResource("images/down-arrow.png")));
214
			btnPullDownStage.setName("btnPullDownStage");
220
//			btnPullDownStage.setName("btnPullDownStage");
215 221
			btnPullDownStage.addActionListener(this);
216 222
		}
217 223
		return btnPullDownStage;
......
220 226
	private JButton getBtnPushUpStage() {
221 227
		if (btnPushUpStage == null) {
222 228
			btnPushUpStage = new JButton(new ImageIcon(this.getClass().getClassLoader().getResource("images/up-arrow.png")));
223
			btnPushUpStage.setName("btnPushUpStage");
229
//			btnPushUpStage.setName("btnPushUpStage");
224 230
			btnPushUpStage.addActionListener(this);
225 231
		}
226 232
		return btnPushUpStage;
......
229 235
	private JButton getBtnRemoveStage() {
230 236
		if (btnRemoveStage == null) {
231 237
			btnRemoveStage = new JButton(new ImageIcon(this.getClass().getClassLoader().getResource("images/delete.png")));
232
			btnRemoveStage.setName("btnRemoveStage");
238
//			btnRemoveStage.setName("btnRemoveStage");
233 239
			btnRemoveStage.addActionListener(this);
234 240
		}
235 241
		return btnRemoveStage;
......
244 250
        if (scrlStages == null) {
245 251
            scrlStages = new JScrollPane();
246 252
            scrlStages.setViewportView(getTblStages());
247
            scrlStages.setPreferredSize(new Dimension(300, 200));
253
            scrlStages.setPreferredSize(new Dimension(270, 200));
248 254
        }
249 255
        return scrlStages;
250 256
    }
......
409 415
     */
410 416
    private JPanel getEastPanel() {
411 417
        if (eastPanel == null) {
418
        	GridLayout layout = new GridLayout();
419
        	 layout.setColumns(1);
420
             layout.setVgap(5);
421
            JPanel aux = new JPanel();
422
            aux.add(getBtnLoadStage());
423
            aux.add(getBtnSaveStage());
424
            aux.add(getBtnSaveRoute());
425
            aux.add(getBtnGenerateReport());
426
            layout.setRows(aux.getComponentCount());
427
            aux.setLayout(layout);
412 428
            eastPanel = new GridBagLayoutPanel();
413
            eastPanel.addComponent(getBtnLoadStage());
414
            eastPanel.add(getBtnSaveStage());
429
            eastPanel.addComponent(aux);
415 430
        }
416 431
        return eastPanel;
417 432
    }
418 433

  
419
    /**
434
    private JButton getBtnGenerateReport() {
435
    	if (btnGenerateRoute == null) {
436
    		btnGenerateRoute = new JButton();
437
    		btnGenerateRoute.setText(PluginServices.getText(this, "generate_report"));
438
    		btnGenerateRoute.addActionListener(this);
439
    	}
440
    	return btnGenerateRoute;
441
	}
442

  
443
	private JButton getBtnSaveRoute() {
444
    	if (btnSaveRoute == null) {
445
    		btnSaveRoute = new JButton();
446
    		btnSaveRoute.setText(PluginServices.getText(this, "save_route"));
447
    		btnSaveRoute.addActionListener(this);
448
    	}
449
    	return btnSaveRoute;
450
    }
451

  
452
	/**
420 453
     * This method initializes defaultTableModel
421 454
     *
422 455
     * @return javax.swing.table.DefaultTableModel
......
500 533
    }
501 534

  
502 535
	public void actionPerformed(ActionEvent e) {
503
		String name = ((Component) e.getSource()).getName();
504
		if (name.equals(getBtnLoadStage().getName())) {
536
		Component c = (Component) e.getSource();
537
		if (c.equals(getBtnLoadStage())) {
505 538
			// load
506 539

  
507
		} else if (name.equals(getBtnSaveStage().getName())) {
540
		} else if (c.equals(getBtnSaveStage())) {
508 541
			// save
509 542

  
510
		} else if (name.equals(getBtnPushUpStage().getName())) {
543
		} else if (c.equals(getBtnPushUpStage())) {
511 544
			// push up
512 545
			int[] selected = tblStages.getSelectedRows();
513 546
			if (selected.length == 0 || selected[0] == 0)
......
523 556
				tblStages.addRowSelectionInterval(selected[i], selected[i]);
524 557
			}
525 558

  
526
		} else if (name.equals(getBtnPullDownStage().getName())) {
559
		} else if (c.equals(getBtnPullDownStage())) {
527 560
			// pull down
528 561
			int[] selected = tblStages.getSelectedRows();
529 562
			if (selected.length == 0 || selected[selected.length-1] >= _getFlags().size()-1)
......
540 573
			}
541 574

  
542 575

  
543
		} else if (name.equals(getBtnRemoveStage().getName())) {
576
		} else if (c.equals(getBtnRemoveStage())) {
544 577
			// remove
545 578
			int[] selected = tblStages.getSelectedRows();
546 579
			for (int i = selected.length-1; i >=0 ; i--) {
trunk/extensions/extGraph_predes/build.xml
28 28

  
29 29

  
30 30
  	<!--
31
  	- - >
31
  	- ->
32 32
  	<jar jarfile="${fmapLibs}/jts-1.7.jar" basedir="${build}" update="yes" includes="com/vividsolutions/**"/>
33 33

  
34
  	<! - - Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
34
  	<!- - Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
35 35
  	<jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}" includes="com/iver/**"/>
36 36

  
37 37

  
......
40 40
    <copy file="config/config.xml" todir="${dist}"/>
41 41
    <!-- <copy file="config/about.htm" todir="${dist}"/> -->
42 42
    <copy todir="${dist}">
43
    	<fileset dir="." includes="text*.properties"/>
43
    	<fileset dir="config/" includes="text*.properties"/>
44 44
    </copy>
45 45
    <copy todir="${dist}/lib">
46 46
    	<fileset dir="lib" includes="*"/>

Also available in: Unified diff