Statistics
| Revision:

root / trunk / extensions / extRasterTools-SE / src / org / gvsig / raster / gui / preferences / RasterPreferences.java @ 30883

History | View | Annotate | Download (8.39 KB)

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
package org.gvsig.raster.gui.preferences;
20

    
21
import java.awt.BorderLayout;
22
import java.awt.GridBagConstraints;
23
import java.awt.GridBagLayout;
24

    
25
import javax.swing.ImageIcon;
26
import javax.swing.JPanel;
27
import javax.swing.JScrollPane;
28
import javax.swing.border.EmptyBorder;
29

    
30
import org.gvsig.raster.gui.preferences.panels.PreferenceCache;
31
import org.gvsig.raster.gui.preferences.panels.PreferenceGeneral;
32
import org.gvsig.raster.gui.preferences.panels.PreferenceLoadLayer;
33
import org.gvsig.raster.gui.preferences.panels.PreferenceNoData;
34
import org.gvsig.raster.gui.preferences.panels.PreferenceOverviews;
35
import org.gvsig.raster.gui.preferences.panels.PreferenceTemporal;
36

    
37
import com.iver.andami.PluginServices;
38
import com.iver.andami.preferences.AbstractPreferencePage;
39
import com.iver.andami.preferences.StoreException;
40
/**
41
 * RasterPreferences es un panel de preferencias situado a nivel de las
42
 * preferencias de gvSIG que engloba todas las opciones configurables de Raster
43
 *
44
 * @version 11/12/2007
45
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
46
 */
47
public class RasterPreferences extends AbstractPreferencePage {
48
        private static final long serialVersionUID = -1689657253810393874L;
49

    
50
        protected static String     id        = RasterPreferences.class.getName();
51
        private ImageIcon           icon;
52

    
53
        private PreferenceNoData    noData    = null;
54
        private PreferenceOverviews overviews = null;
55
        private PreferenceCache     cache     = null;
56
        private PreferenceTemporal  temporal  = null;
57
        private PreferenceGeneral   general   = null;
58
        private PreferenceLoadLayer loadLayer = null;
59

    
60
        /**
61
         * Constructor de la clase RasterPreferences
62
         */
63
        public RasterPreferences() {
64
                super();
65
                icon = PluginServices.getIconTheme().get("pref-raster-icon");
66
                initialize();
67
        }
68

    
69
        /**
70
         * Inicializacion del panel de preferencias.
71
         */
72
        private void initialize() {
73
                setTitle("Frame");
74

    
75
                GridBagConstraints gridBagConstraints;
76

    
77
                JScrollPane scrollPane = new JScrollPane();
78

    
79
                scrollPane.getVerticalScrollBar().setUnitIncrement(20);
80

    
81
                JPanel panel = new JPanel();
82

    
83
                panel.setLayout(new GridBagLayout());
84

    
85
                gridBagConstraints = new GridBagConstraints();
86
                gridBagConstraints.gridx = 0;
87
                gridBagConstraints.gridy = 0;
88
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
89
                panel.add(getPreferenceGeneral(), gridBagConstraints);
90

    
91
                gridBagConstraints = new GridBagConstraints();
92
                gridBagConstraints.gridx = 0;
93
                gridBagConstraints.gridy = 1;
94
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
95
                panel.add(getPreferenceLoadLayer(), gridBagConstraints);
96

    
97
                gridBagConstraints = new GridBagConstraints();
98
                gridBagConstraints.gridx = 0;
99
                gridBagConstraints.gridy = 2;
100
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
101
                panel.add(getPreferenceNoData(), gridBagConstraints);
102

    
103
                gridBagConstraints = new GridBagConstraints();
104
                gridBagConstraints.gridx = 0;
105
                gridBagConstraints.gridy = 3;
106
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
107
                panel.add(getPreferenceTemporal(), gridBagConstraints);
108

    
109
                gridBagConstraints = new GridBagConstraints();
110
                gridBagConstraints.gridx = 0;
111
                gridBagConstraints.gridy = 4;
112
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
113
                panel.add(getPreferenceOverviews(), gridBagConstraints);
114

    
115
                gridBagConstraints = new GridBagConstraints();
116
                gridBagConstraints.gridx = 0;
117
                gridBagConstraints.gridy = 5;
118
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
119
                panel.add(getPreferenceCache(), gridBagConstraints);
120

    
121
                gridBagConstraints = new GridBagConstraints();
122
                gridBagConstraints.gridx = 0;
123
                gridBagConstraints.gridy = 6;
124
                gridBagConstraints.weightx = 1.0;
125
                gridBagConstraints.weighty = 1.0;
126
                panel.add(new JPanel(), gridBagConstraints);
127

    
128
                panel.setBorder(new EmptyBorder(5, 5, 5, 5));
129

    
130
                scrollPane.setViewportView(panel);
131

    
132
                setLayout(new BorderLayout());
133
                add(scrollPane, BorderLayout.CENTER);
134
        }
135

    
136
        /**
137
         * Devuelve el panel de configuracion para los valores NoData
138
         * @return
139
         */
140
        private PreferenceNoData getPreferenceNoData() {
141
                if (noData == null) {
142
                        noData = new PreferenceNoData();
143
                }
144
                return noData;
145
        }
146

    
147
        /**
148
         * Devuelve el panel de configuracion general de Raster. Aqui es donde se
149
         * define si se visualiza automaticamente Raster, el numero de clases, si se
150
         * pregunta la reproyeccion, etc...
151
         * @return
152
         */
153
        private PreferenceGeneral getPreferenceGeneral() {
154
                if (general == null) {
155
                        general = new PreferenceGeneral();
156
                }
157
                return general;
158
        }
159

    
160
        /**
161
         * Devuelve un panel de configuracion para las overviews de Raster.
162
         * @return
163
         */
164
        private PreferenceOverviews getPreferenceOverviews() {
165
                if (overviews == null) {
166
                        overviews = new PreferenceOverviews();
167
                }
168
                return overviews;
169
        }
170

    
171
        /**
172
         * Devuelve el panel de preferencias para las opciones de cache de Raster.
173
         * Aqu? se podr?n definir todos los parametros configurables respecto a la
174
         * cache.
175
         * @return
176
         */
177
        private PreferenceCache getPreferenceCache() {
178
                if (cache == null) {
179
                        cache = new PreferenceCache();
180
                }
181
                return cache;
182
        }
183

    
184

    
185
        private PreferenceTemporal getPreferenceTemporal() {
186
                if (temporal == null) {
187
                        temporal = new PreferenceTemporal();
188
                }
189
                return temporal;
190
        }
191

    
192
        private PreferenceLoadLayer getPreferenceLoadLayer() {
193
                if (loadLayer == null) {
194
                        loadLayer = new PreferenceLoadLayer();
195
                }
196
                return loadLayer;
197
        }
198

    
199
        /*
200
         * (non-Javadoc)
201
         * @see com.iver.andami.preferences.IPreference#initializeValues()
202
         */
203
        public void initializeValues() {
204
                getPreferenceNoData().initializeValues();
205
                getPreferenceOverviews().initializeValues();
206
                getPreferenceCache().initializeValues();
207
                getPreferenceTemporal().initializeValues();
208
                getPreferenceGeneral().initializeValues();
209
                getPreferenceLoadLayer().initializeValues();
210
        }
211

    
212
        /*
213
         * (non-Javadoc)
214
         * @see com.iver.andami.preferences.AbstractPreferencePage#storeValues()
215
         */
216
        public void storeValues() throws StoreException {
217
                getPreferenceNoData().storeValues();
218
                getPreferenceOverviews().storeValues();
219
                getPreferenceCache().storeValues();
220
                getPreferenceTemporal().storeValues();
221
                getPreferenceGeneral().storeValues();
222
                getPreferenceLoadLayer().storeValues();
223
        }
224

    
225
        /*
226
         * (non-Javadoc)
227
         * @see com.iver.andami.preferences.IPreference#initializeDefaults()
228
         */
229
        public void initializeDefaults() {
230
                getPreferenceNoData().initializeDefaults();
231
                getPreferenceOverviews().initializeDefaults();
232
                getPreferenceCache().initializeDefaults();
233
                getPreferenceTemporal().initializeDefaults();
234
                getPreferenceGeneral().initializeDefaults();
235
                getPreferenceLoadLayer().initializeDefaults();
236
        }
237

    
238
        /*
239
         * (non-Javadoc)
240
         * @see com.iver.andami.preferences.AbstractPreferencePage#isResizeable()
241
         */
242
        public boolean isResizeable() {
243
                return true;
244
        }
245

    
246
        /*
247
         * (non-Javadoc)
248
         * @see com.iver.andami.preferences.IPreference#getID()
249
         */
250
        public String getID() {
251
                return id;
252
        }
253

    
254
        /*
255
         * (non-Javadoc)
256
         * @see com.iver.andami.preferences.IPreference#getIcon()
257
         */
258
        public ImageIcon getIcon() {
259
                return icon;
260
        }
261

    
262
        /*
263
         * (non-Javadoc)
264
         * @see com.iver.andami.preferences.IPreference#getPanel()
265
         */
266
        public JPanel getPanel() {
267
                return this;
268
        }
269

    
270
        /*
271
         * (non-Javadoc)
272
         * @see com.iver.andami.preferences.IPreference#getTitle()
273
         */
274
        public String getTitle() {
275
                return PluginServices.getText(this, "Raster");
276
        }
277

    
278
        /*
279
         * (non-Javadoc)
280
         * @see com.iver.andami.preferences.IPreference#isValueChanged()
281
         */
282
        public boolean isValueChanged() {
283
                return true;
284
        }
285

    
286
        public void setChangesApplied() {}
287
}