Revision 7253 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/preferencespage/ViewPage.java
ViewPage.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.5 2006-09-12 15:56:50 jaume |
|
46 |
* Revision 1.6 2006-09-14 06:57:18 jaume |
|
47 |
* *** empty log message *** |
|
48 |
* |
|
49 |
* Revision 1.5 2006/09/12 15:56:50 jaume |
|
47 | 50 |
* Default Projection now customizable |
48 | 51 |
* |
49 | 52 |
* Revision 1.4 2006/08/29 07:21:08 cesar |
... | ... | |
110 | 113 |
import java.util.Enumeration; |
111 | 114 |
|
112 | 115 |
import javax.swing.ImageIcon; |
116 |
import javax.swing.JCheckBox; |
|
113 | 117 |
import javax.swing.JLabel; |
114 | 118 |
import javax.swing.JPanel; |
115 | 119 |
import javax.swing.JTextField; |
... | ... | |
124 | 128 |
import com.iver.andami.preferences.AbstractPreferencePage; |
125 | 129 |
import com.iver.andami.preferences.StoreException; |
126 | 130 |
import com.iver.cit.gvsig.fmap.MapContext; |
131 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
127 | 132 |
import com.iver.cit.gvsig.gui.dialogs.CSSelectionDialog; |
128 | 133 |
import com.iver.cit.gvsig.project.Project; |
129 | 134 |
import com.iver.utiles.XMLEntity; |
... | ... | |
133 | 138 |
private static final String FACTORY_DEFAULT_PROJECTION = "EPSG:23030"; |
134 | 139 |
private static final String ZOOM_IN_FACTOR_KEY_NAME = "ZoomInFactor"; |
135 | 140 |
private static final String ZOOM_OUT_FACTOR_KEY_NAME = "ZoomOutFactor"; |
136 |
//private static Preferences prefs = Preferences.userRoot().node( "gvsig.options.view" ); |
|
141 |
private static final String ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME = "NewLayersInInvisibleMode"; |
|
142 |
private static final String KEEP_SCALE_ON_RESIZING_KEY_NAME = "KeepScaleOnResizing"; |
|
143 |
|
|
137 | 144 |
private JTextField txtZoomInFactor; |
138 | 145 |
private JTextField txtZoomOutFactor; |
139 | 146 |
protected String id; |
... | ... | |
142 | 149 |
private JLabel lblDefaultProjection; |
143 | 150 |
private JButton btnChangeProjection; |
144 | 151 |
private String fontName; |
152 |
private JCheckBox chkInvisibleNewLayers; |
|
153 |
private JCheckBox chkKeepScaleOnResizing; |
|
145 | 154 |
|
146 | 155 |
{ |
147 | 156 |
Enumeration keys = UIManager.getDefaults().keys(); |
... | ... | |
188 | 197 |
// just a separator |
189 | 198 |
addComponent(new JLabel(" ")); |
190 | 199 |
|
200 |
// Adding Invisible New Layers |
|
201 |
chkInvisibleNewLayers = new JCheckBox( |
|
202 |
PluginServices.getText(this, "options.view.invisible_new_layers")); |
|
203 |
|
|
204 |
addComponent("", chkInvisibleNewLayers); |
|
205 |
chkKeepScaleOnResizing = new JCheckBox( |
|
206 |
PluginServices.getText(this, "options.view.keep_scale_on_resizing")); |
|
207 |
chkKeepScaleOnResizing.setEnabled(false); |
|
208 |
addComponent("", chkKeepScaleOnResizing); |
|
209 |
|
|
210 |
// just a separator |
|
211 |
addComponent(new JLabel(" ")); |
|
212 |
|
|
191 | 213 |
// zoom in factor |
192 | 214 |
addComponent(PluginServices.getText(this, "zoom_in_factor") + ":", |
193 | 215 |
txtZoomInFactor = new JTextField("", 15)); |
... | ... | |
204 | 226 |
|
205 | 227 |
// Default Projection |
206 | 228 |
if (xml.contains(DEFAULT_PROJECTION_KEY_NAME)) { |
207 |
lblDefaultProjection.setText(xml.getStringProperty(DEFAULT_PROJECTION_KEY_NAME)); |
|
229 |
lblDefaultProjection.setText( |
|
230 |
xml.getStringProperty(DEFAULT_PROJECTION_KEY_NAME)); |
|
208 | 231 |
} else { |
209 | 232 |
lblDefaultProjection.setText(FACTORY_DEFAULT_PROJECTION); |
210 | 233 |
} |
211 | 234 |
Project.setDefaultProjection(ProjectionPool.get(lblDefaultProjection.getText())); |
212 | 235 |
|
236 |
// Adding invisible new layers |
|
237 |
if (xml.contains(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME)) { |
|
238 |
chkInvisibleNewLayers.setSelected( |
|
239 |
xml.getBooleanProperty(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME)); |
|
240 |
} |
|
241 |
|
|
242 |
// Keep scale on resizing |
|
243 |
if (xml.contains(KEEP_SCALE_ON_RESIZING_KEY_NAME)) { |
|
244 |
chkKeepScaleOnResizing.setSelected( |
|
245 |
xml.getBooleanProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME)); |
|
246 |
} |
|
247 |
|
|
213 | 248 |
// Zoom-in factor |
214 | 249 |
if (xml.contains(ZOOM_IN_FACTOR_KEY_NAME)) { |
215 | 250 |
double zoomInFactor = xml.getDoubleProperty(ZOOM_IN_FACTOR_KEY_NAME); |
... | ... | |
248 | 283 |
String projName = lblDefaultProjection.getText(); |
249 | 284 |
double zif; |
250 | 285 |
double zof; |
286 |
boolean invisibleNewLayers, keepScaleOnResize; |
|
251 | 287 |
try { |
252 | 288 |
zif=Double.parseDouble(txtZoomInFactor.getText()); |
253 | 289 |
zof=Double.parseDouble(txtZoomOutFactor.getText()); |
254 | 290 |
Project.setDefaultProjection(ProjectionPool.get(projName)); |
291 |
invisibleNewLayers = chkInvisibleNewLayers.isSelected(); |
|
292 |
keepScaleOnResize = chkKeepScaleOnResizing.isSelected(); |
|
255 | 293 |
} catch (Exception e) { |
256 | 294 |
throw new StoreException(PluginServices.getText(this,"factor_zoom_incorrecto")); |
257 | 295 |
} |
258 | 296 |
MapContext.ZOOMINFACTOR=zif; |
259 | 297 |
MapContext.ZOOMOUTFACTOR=zof; |
298 |
// MapControl.setScalingOnResize(!keepScaleOnResize); |
|
260 | 299 |
|
261 | 300 |
PluginServices ps = PluginServices.getPluginServices(this); |
262 | 301 |
XMLEntity xml = ps.getPersistentXML(); |
263 | 302 |
xml.putProperty(DEFAULT_PROJECTION_KEY_NAME, projName); |
264 | 303 |
xml.putProperty(ZOOM_IN_FACTOR_KEY_NAME, zif); |
265 | 304 |
xml.putProperty(ZOOM_OUT_FACTOR_KEY_NAME, zof); |
305 |
xml.putProperty(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME, invisibleNewLayers); |
|
306 |
xml.putProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME, keepScaleOnResize); |
|
307 |
|
|
266 | 308 |
} |
267 | 309 |
|
268 | 310 |
|
... | ... | |
270 | 312 |
lblDefaultProjection.setText(FACTORY_DEFAULT_PROJECTION); |
271 | 313 |
txtZoomInFactor.setText(String.valueOf(MapContext.ZOOMINFACTOR)); |
272 | 314 |
txtZoomOutFactor.setText(String.valueOf(MapContext.ZOOMOUTFACTOR)); |
315 |
chkInvisibleNewLayers.setSelected(false); |
|
316 |
chkKeepScaleOnResizing.setSelected(false); |
|
273 | 317 |
} |
274 | 318 |
|
275 | 319 |
public ImageIcon getIcon() { |
Also available in: Unified diff