svn-gvsig-desktop / trunk / extensions / extGPE-gvSIG / src / org / gvsig / gpe / gui / preferencespage / GPEPreferencesPage.java @ 27067
History | View | Annotate | Download (9.56 KB)
1 |
package org.gvsig.gpe.gui.preferencespage; |
---|---|
2 |
|
3 |
import java.awt.Component; |
4 |
import java.awt.GridBagConstraints; |
5 |
import java.util.ArrayList; |
6 |
|
7 |
import javax.swing.ImageIcon; |
8 |
import javax.swing.JPanel; |
9 |
import javax.swing.border.Border; |
10 |
import javax.swing.border.TitledBorder; |
11 |
|
12 |
import com.iver.andami.PluginServices; |
13 |
import com.iver.andami.preferences.AbstractPreferencePage; |
14 |
import com.iver.andami.preferences.StoreException; |
15 |
|
16 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
17 |
*
|
18 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
19 |
*
|
20 |
* This program is free software; you can redistribute it and/or
|
21 |
* modify it under the terms of the GNU General Public License
|
22 |
* as published by the Free Software Foundation; either version 2
|
23 |
* of the License, or (at your option) any later version.
|
24 |
*
|
25 |
* This program is distributed in the hope that it will be useful,
|
26 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
27 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
28 |
* GNU General Public License for more details.
|
29 |
*
|
30 |
* You should have received a copy of the GNU General Public License
|
31 |
* along with this program; if not, write to the Free Software
|
32 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
33 |
*
|
34 |
* For more information, contact:
|
35 |
*
|
36 |
* Generalitat Valenciana
|
37 |
* Conselleria d'Infraestructures i Transport
|
38 |
* Av. Blasco Ib??ez, 50
|
39 |
* 46010 VALENCIA
|
40 |
* SPAIN
|
41 |
*
|
42 |
* +34 963862235
|
43 |
* gvsig@gva.es
|
44 |
* www.gvsig.gva.es
|
45 |
*
|
46 |
* or
|
47 |
*
|
48 |
* IVER T.I. S.A
|
49 |
* Salamanca 50
|
50 |
* 46005 Valencia
|
51 |
* Spain
|
52 |
*
|
53 |
* +34 963163400
|
54 |
* dac@iver.es
|
55 |
*/
|
56 |
/* CVS MESSAGES:
|
57 |
*
|
58 |
* $Id$
|
59 |
* $Log$
|
60 |
*
|
61 |
*/
|
62 |
/**
|
63 |
* Preferences page for the GPE layers
|
64 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
65 |
*/
|
66 |
public class GPEPreferencesPage extends AbstractPreferencePage { |
67 |
private static final long serialVersionUID = -4472846749161169021L; |
68 |
private ArrayList defaults = null; |
69 |
private ImageIcon icon = null; |
70 |
|
71 |
public GPEPreferencesPage() {
|
72 |
super();
|
73 |
initialize(); |
74 |
} |
75 |
|
76 |
/**
|
77 |
* Creates and initializes the panel
|
78 |
*/
|
79 |
private void initialize() { |
80 |
icon = new ImageIcon(this.getClass().getClassLoader().getResource("images/gpe.png")); |
81 |
setLayout(new java.awt.GridBagLayout());
|
82 |
//The XML panel
|
83 |
GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); |
84 |
gridBagConstraints.gridx = 0;
|
85 |
gridBagConstraints.gridy = 0;
|
86 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
87 |
gridBagConstraints.weightx = 1.0;
|
88 |
add(getXMLPanel(),gridBagConstraints); |
89 |
//The XML SCHEMA panel
|
90 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
91 |
gridBagConstraints.gridx = 0;
|
92 |
gridBagConstraints.gridy = 1;
|
93 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
94 |
gridBagConstraints.weightx = 1.0;
|
95 |
add(getXMLSchemaPanel(),gridBagConstraints); |
96 |
//The Coordinates panel
|
97 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
98 |
gridBagConstraints.gridx = 0;
|
99 |
gridBagConstraints.gridy = 2;
|
100 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
101 |
gridBagConstraints.weightx = 1.0;
|
102 |
add(getCoordinatesPanel(),gridBagConstraints); |
103 |
//Others panel
|
104 |
Component othersPanel = getOthersPanel();
|
105 |
if (othersPanel != null){ |
106 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
107 |
gridBagConstraints.gridx = 0;
|
108 |
gridBagConstraints.gridy = 3;
|
109 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
110 |
gridBagConstraints.weightx = 1.0;
|
111 |
add(getOthersPanel(),gridBagConstraints); |
112 |
} |
113 |
} |
114 |
|
115 |
/**
|
116 |
* @return the default properties that have their own panel
|
117 |
* to set them.
|
118 |
*/
|
119 |
private ArrayList getDefaults(){ |
120 |
if (defaults == null){ |
121 |
defaults = new ArrayList(); |
122 |
// defaults.add(GPEDefaults.DECIMAL);
|
123 |
// defaults.add(GPEDefaults.COORDINATES_SEPARATOR);
|
124 |
// defaults.add(GPEDefaults.TUPLES_SEPARATOR);
|
125 |
// defaults.add(GPEDefaults.NAMESPACE_PREFIX);
|
126 |
// defaults.add(GPEDefaults.NAMESPACE_URI);
|
127 |
// defaults.add(GPEDefaults.XML_VERSION);
|
128 |
// defaults.add(GPEDefaults.XML_ENCODING);
|
129 |
// defaults.add(GPEDefaults.DEFAULT_FILE_NAME);
|
130 |
// defaults.add(GPEDefaults.XSD_SCHEMA_FILE);
|
131 |
// defaults.add(GPEDefaults.DECIMAL_DIGITS);
|
132 |
// defaults.add(GPEDefaults.DEFAULT_BLANC_SPACE);
|
133 |
} |
134 |
return defaults;
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* @return a panel that contains all the properties related
|
139 |
* with the coordinates
|
140 |
*/
|
141 |
private Component getCoordinatesPanel(){ |
142 |
//PropertiesComponent component = new PropertiesComponent();
|
143 |
Component component = new JPanel(); |
144 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.DECIMAL),
|
145 |
// GPEDefaults.DECIMAL,
|
146 |
// GPEDefaults.getProperty(GPEDefaults.DECIMAL),
|
147 |
// null);
|
148 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.COORDINATES_SEPARATOR),
|
149 |
// GPEDefaults.COORDINATES_SEPARATOR,
|
150 |
// GPEDefaults.getProperty(GPEDefaults.COORDINATES_SEPARATOR),
|
151 |
// null);
|
152 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.TUPLES_SEPARATOR),
|
153 |
// GPEDefaults.TUPLES_SEPARATOR,
|
154 |
// GPEDefaults.getProperty(GPEDefaults.TUPLES_SEPARATOR),
|
155 |
// null);
|
156 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.DECIMAL_DIGITS),
|
157 |
// GPEDefaults.DECIMAL_DIGITS,
|
158 |
// GPEDefaults.getProperty(GPEDefaults.DECIMAL_DIGITS),
|
159 |
// null);
|
160 |
// component.setBorder(createBorderPanel(PluginServices.getText(this, "gpe_preferences_window_coordinates")));
|
161 |
return component;
|
162 |
} |
163 |
|
164 |
/**
|
165 |
* @return a panel that contains all the properties related
|
166 |
* with XML
|
167 |
*/
|
168 |
private Component getXMLPanel(){ |
169 |
// PropertiesComponent component = new PropertiesComponent();
|
170 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.XML_VERSION),
|
171 |
// GPEDefaults.XML_VERSION,
|
172 |
// GPEDefaults.getProperty(GPEDefaults.XML_VERSION),
|
173 |
// null);
|
174 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.XML_ENCODING),
|
175 |
// GPEDefaults.XML_ENCODING,
|
176 |
// GPEDefaults.getProperty(GPEDefaults.XML_ENCODING),
|
177 |
// null);
|
178 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.DEFAULT_BLANC_SPACE),
|
179 |
// GPEDefaults.DEFAULT_BLANC_SPACE,
|
180 |
// GPEDefaults.getProperty(GPEDefaults.DEFAULT_BLANC_SPACE),
|
181 |
// null);
|
182 |
// component.setBorder(createBorderPanel(PluginServices.getText(this, "gpe_preferences_window_xml")));
|
183 |
Component component = new JPanel(); |
184 |
return component;
|
185 |
} |
186 |
|
187 |
/**
|
188 |
* @return a panel that contains all the properties related
|
189 |
* with the XML Schema
|
190 |
*/
|
191 |
private Component getXMLSchemaPanel(){ |
192 |
// PropertiesComponent component = new PropertiesComponent();
|
193 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.NAMESPACE_PREFIX),
|
194 |
// GPEDefaults.NAMESPACE_PREFIX,
|
195 |
// GPEDefaults.getProperty(GPEDefaults.NAMESPACE_PREFIX),
|
196 |
// null);
|
197 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.NAMESPACE_URI),
|
198 |
// GPEDefaults.NAMESPACE_URI,
|
199 |
// GPEDefaults.getProperty(GPEDefaults.NAMESPACE_URI),
|
200 |
// null);
|
201 |
// component.addValue(PluginServices.getText(this, "gpe_" + GPEDefaults.XSD_SCHEMA_FILE),
|
202 |
// GPEDefaults.XSD_SCHEMA_FILE,
|
203 |
// GPEDefaults.getProperty(GPEDefaults.XSD_SCHEMA_FILE),
|
204 |
// null);
|
205 |
// component.setBorder(createBorderPanel(PluginServices.getText(this, "gpe_preferences_window_xmlschema")));
|
206 |
Component component = new JPanel(); |
207 |
return component;
|
208 |
} |
209 |
|
210 |
/**
|
211 |
* @return a panel that contains all the properties that
|
212 |
* have not been join in the other groups
|
213 |
*/
|
214 |
private Component getOthersPanel(){ |
215 |
// PropertiesComponent component = new PropertiesComponent();
|
216 |
// Iterator it = GPEDefaults.getKeys();
|
217 |
// int i=0;
|
218 |
// while (it.hasNext()){
|
219 |
// String key = (String)it.next();
|
220 |
// if (!(getDefaults().contains(key))){
|
221 |
// Object value = GPEDefaults.getProperty(key);
|
222 |
// component.addValue(PluginServices.getText(this, key), key, value, null);
|
223 |
// i++;
|
224 |
// }
|
225 |
// }
|
226 |
// component.setBorder(createBorderPanel(PluginServices.getText(this, "gpe_preferences_window_other")));
|
227 |
// if (i==0){
|
228 |
// return null;
|
229 |
// }
|
230 |
Component component = new JPanel(); |
231 |
return component;
|
232 |
} |
233 |
|
234 |
/**
|
235 |
* Cretaes a border for a JPanel
|
236 |
* @param title
|
237 |
* The title for the panel
|
238 |
*/
|
239 |
private Border createBorderPanel(String title){ |
240 |
TitledBorder border = new TitledBorder(title); |
241 |
return border;
|
242 |
} |
243 |
|
244 |
/*
|
245 |
* (non-Javadoc)
|
246 |
* @see com.iver.andami.preferences.AbstractPreferencePage#setChangesApplied()
|
247 |
*/
|
248 |
public void setChangesApplied() { |
249 |
// TODO Auto-generated method stub
|
250 |
} |
251 |
|
252 |
/*
|
253 |
* (non-Javadoc)
|
254 |
* @see com.iver.andami.preferences.AbstractPreferencePage#storeValues()
|
255 |
*/
|
256 |
public void storeValues() throws StoreException { |
257 |
// TODO Auto-generated method stub
|
258 |
} |
259 |
|
260 |
/*
|
261 |
* (non-Javadoc)
|
262 |
* @see com.iver.andami.preferences.IPreference#getID()
|
263 |
*/
|
264 |
public String getID() { |
265 |
return getClass().getName();
|
266 |
} |
267 |
|
268 |
/*
|
269 |
* (non-Javadoc)
|
270 |
* @see com.iver.andami.preferences.IPreference#getIcon()
|
271 |
*/
|
272 |
public ImageIcon getIcon() { |
273 |
return icon;
|
274 |
} |
275 |
|
276 |
/*
|
277 |
* (non-Javadoc)
|
278 |
* @see com.iver.andami.preferences.IPreference#getPanel()
|
279 |
*/
|
280 |
public JPanel getPanel() { |
281 |
return this; |
282 |
} |
283 |
|
284 |
/*
|
285 |
* (non-Javadoc)
|
286 |
* @see com.iver.andami.preferences.IPreference#getTitle()
|
287 |
*/
|
288 |
public String getTitle() { |
289 |
return PluginServices.getText(this, "gpe_preferences_window"); |
290 |
} |
291 |
|
292 |
/*
|
293 |
* (non-Javadoc)
|
294 |
* @see com.iver.andami.preferences.IPreference#initializeDefaults()
|
295 |
*/
|
296 |
public void initializeDefaults() { |
297 |
// TODO Auto-generated method stub
|
298 |
|
299 |
} |
300 |
|
301 |
/*
|
302 |
* (non-Javadoc)
|
303 |
* @see com.iver.andami.preferences.IPreference#initializeValues()
|
304 |
*/
|
305 |
public void initializeValues() { |
306 |
// TODO Auto-generated method stub
|
307 |
|
308 |
} |
309 |
|
310 |
/*
|
311 |
* (non-Javadoc)
|
312 |
* @see com.iver.andami.preferences.IPreference#isValueChanged()
|
313 |
*/
|
314 |
public boolean isValueChanged() { |
315 |
// TODO Auto-generated method stub
|
316 |
return false; |
317 |
} |
318 |
|
319 |
} |