Statistics
| Revision:

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

History | View | Annotate | Download (8.36 KB)

1 17161 bsanchez
/* 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 17199 bsanchez
import javax.swing.JScrollPane;
28 17491 bsanchez
import javax.swing.border.EmptyBorder;
29 17161 bsanchez
30 17330 bsanchez
import org.gvsig.raster.gui.preferences.panels.PreferenceCache;
31 17491 bsanchez
import org.gvsig.raster.gui.preferences.panels.PreferenceGeneral;
32
import org.gvsig.raster.gui.preferences.panels.PreferenceLoadLayer;
33 17271 bsanchez
import org.gvsig.raster.gui.preferences.panels.PreferenceNoData;
34
import org.gvsig.raster.gui.preferences.panels.PreferenceOverviews;
35 17491 bsanchez
import org.gvsig.raster.gui.preferences.panels.PreferenceTemporal;
36 17271 bsanchez
37 17161 bsanchez
import com.iver.andami.PluginServices;
38
import com.iver.andami.preferences.AbstractPreferencePage;
39
import com.iver.andami.preferences.StoreException;
40 17271 bsanchez
/**
41 20117 bsanchez
 * RasterPreferences es un panel de preferencias situado a nivel de las
42
 * preferencias de gvSIG que engloba todas las opciones configurables de Raster
43 17271 bsanchez
 *
44
 * @version 11/12/2007
45
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
46
 */
47 17161 bsanchez
public class RasterPreferences extends AbstractPreferencePage {
48
        private static final long serialVersionUID = -1689657253810393874L;
49
50 20117 bsanchez
        protected static String     id        = RasterPreferences.class.getName();
51
        private ImageIcon           icon;
52 17161 bsanchez
53 20117 bsanchez
        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 17271 bsanchez
60 20117 bsanchez
        /**
61
         * Constructor de la clase RasterPreferences
62
         */
63 17161 bsanchez
        public RasterPreferences() {
64
                super();
65 17199 bsanchez
                icon = PluginServices.getIconTheme().get("pref-raster-icon");
66 17161 bsanchez
                initialize();
67
        }
68
69 20117 bsanchez
        /**
70
         * Inicializacion del panel de preferencias.
71
         */
72 17161 bsanchez
        private void initialize() {
73 17491 bsanchez
                setTitle("Frame");
74
75 17161 bsanchez
                GridBagConstraints gridBagConstraints;
76
77 17491 bsanchez
                JScrollPane scrollPane = new JScrollPane();
78 17330 bsanchez
79 17491 bsanchez
                scrollPane.getVerticalScrollBar().setUnitIncrement(20);
80 17330 bsanchez
81 17491 bsanchez
                JPanel panel = new JPanel();
82 17161 bsanchez
83 17491 bsanchez
                panel.setLayout(new GridBagLayout());
84 17161 bsanchez
85
                gridBagConstraints = new GridBagConstraints();
86
                gridBagConstraints.gridx = 0;
87 17491 bsanchez
                gridBagConstraints.gridy = 0;
88 17161 bsanchez
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
89 22364 nbrodin
                panel.add(getPreferenceGeneral(), gridBagConstraints);
90 17161 bsanchez
91
                gridBagConstraints = new GridBagConstraints();
92
                gridBagConstraints.gridx = 0;
93 17491 bsanchez
                gridBagConstraints.gridy = 1;
94 17161 bsanchez
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
95 22364 nbrodin
                panel.add(getPreferenceLoadLayer(), gridBagConstraints);
96 17161 bsanchez
97
                gridBagConstraints = new GridBagConstraints();
98
                gridBagConstraints.gridx = 0;
99
                gridBagConstraints.gridy = 2;
100
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
101 22364 nbrodin
                panel.add(getPreferenceNoData(), gridBagConstraints);
102 17161 bsanchez
103
                gridBagConstraints = new GridBagConstraints();
104
                gridBagConstraints.gridx = 0;
105 17271 bsanchez
                gridBagConstraints.gridy = 3;
106 17161 bsanchez
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
107 22364 nbrodin
                panel.add(getPreferenceTemporal(), gridBagConstraints);
108 17161 bsanchez
109
                gridBagConstraints = new GridBagConstraints();
110
                gridBagConstraints.gridx = 0;
111 17491 bsanchez
                gridBagConstraints.gridy = 4;
112 17161 bsanchez
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
113 22364 nbrodin
                panel.add(getPreferenceOverviews(), gridBagConstraints);
114 17161 bsanchez
115
                gridBagConstraints = new GridBagConstraints();
116
                gridBagConstraints.gridx = 0;
117 17491 bsanchez
                gridBagConstraints.gridy = 5;
118 17161 bsanchez
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
119 22364 nbrodin
                panel.add(getPreferenceCache(), gridBagConstraints);
120 17161 bsanchez
121
                gridBagConstraints = new GridBagConstraints();
122
                gridBagConstraints.gridx = 0;
123 17491 bsanchez
                gridBagConstraints.gridy = 6;
124 17161 bsanchez
                gridBagConstraints.weightx = 1.0;
125 17491 bsanchez
                gridBagConstraints.weighty = 1.0;
126
                panel.add(new JPanel(), gridBagConstraints);
127 17161 bsanchez
128 17491 bsanchez
                panel.setBorder(new EmptyBorder(5, 5, 5, 5));
129 17161 bsanchez
130 17491 bsanchez
                scrollPane.setViewportView(panel);
131 17271 bsanchez
132 17491 bsanchez
                setLayout(new BorderLayout());
133
                add(scrollPane, BorderLayout.CENTER);
134 17161 bsanchez
        }
135
136 20117 bsanchez
        /**
137
         * Devuelve el panel de configuracion para los valores NoData
138
         * @return
139
         */
140 17330 bsanchez
        private PreferenceNoData getPreferenceNoData() {
141
                if (noData == null) {
142
                        noData = new PreferenceNoData();
143 17271 bsanchez
                }
144 17330 bsanchez
                return noData;
145 17271 bsanchez
        }
146
147 20117 bsanchez
        /**
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 17491 bsanchez
        private PreferenceGeneral getPreferenceGeneral() {
154
                if (general == null) {
155
                        general = new PreferenceGeneral();
156
                }
157
                return general;
158
        }
159
160 20117 bsanchez
        /**
161
         * Devuelve un panel de configuracion para las overviews de Raster.
162
         * @return
163
         */
164 17271 bsanchez
        private PreferenceOverviews getPreferenceOverviews() {
165
                if (overviews == null) {
166
                        overviews = new PreferenceOverviews();
167
                }
168
                return overviews;
169
        }
170
171 20117 bsanchez
        /**
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 17330 bsanchez
        private PreferenceCache getPreferenceCache() {
178
                if (cache == null) {
179
                        cache = new PreferenceCache();
180
                }
181
                return cache;
182
        }
183
184 20117 bsanchez
185 17491 bsanchez
        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 17161 bsanchez
        /*
200
         * (non-Javadoc)
201 17271 bsanchez
         * @see com.iver.andami.preferences.IPreference#initializeValues()
202 17161 bsanchez
         */
203 17271 bsanchez
        public void initializeValues() {
204 17330 bsanchez
                getPreferenceNoData().initializeValues();
205
                getPreferenceOverviews().initializeValues();
206
                getPreferenceCache().initializeValues();
207 17491 bsanchez
                getPreferenceTemporal().initializeValues();
208
                getPreferenceGeneral().initializeValues();
209
                getPreferenceLoadLayer().initializeValues();
210 17161 bsanchez
        }
211
212
        /*
213
         * (non-Javadoc)
214 17271 bsanchez
         * @see com.iver.andami.preferences.AbstractPreferencePage#storeValues()
215 17161 bsanchez
         */
216 17271 bsanchez
        public void storeValues() throws StoreException {
217 17330 bsanchez
                getPreferenceNoData().storeValues();
218
                getPreferenceOverviews().storeValues();
219
                getPreferenceCache().storeValues();
220 17491 bsanchez
                getPreferenceTemporal().storeValues();
221
                getPreferenceGeneral().storeValues();
222
                getPreferenceLoadLayer().storeValues();
223 17161 bsanchez
        }
224
225
        /*
226
         * (non-Javadoc)
227 17271 bsanchez
         * @see com.iver.andami.preferences.IPreference#initializeDefaults()
228 17161 bsanchez
         */
229 17271 bsanchez
        public void initializeDefaults() {
230 17330 bsanchez
                getPreferenceNoData().initializeDefaults();
231
                getPreferenceOverviews().initializeDefaults();
232
                getPreferenceCache().initializeDefaults();
233 17491 bsanchez
                getPreferenceTemporal().initializeDefaults();
234
                getPreferenceGeneral().initializeDefaults();
235
                getPreferenceLoadLayer().initializeDefaults();
236 17161 bsanchez
        }
237
238
        /*
239
         * (non-Javadoc)
240 17271 bsanchez
         * @see com.iver.andami.preferences.AbstractPreferencePage#isResizeable()
241
         */
242
        public boolean isResizeable() {
243
                return true;
244
        }
245
246
        /*
247
         * (non-Javadoc)
248 17161 bsanchez
         * @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 "Raster";
276
        }
277
278
        /*
279
         * (non-Javadoc)
280
         * @see com.iver.andami.preferences.IPreference#isValueChanged()
281
         */
282
        public boolean isValueChanged() {
283 17271 bsanchez
                return true;
284 17161 bsanchez
        }
285 17271 bsanchez
286
        public void setChangesApplied() {}
287 17161 bsanchez
}