Statistics
| Revision:

gvsig-raster / org.gvsig.raster.tools / trunk / org.gvsig.raster.tools / org.gvsig.raster.tools.app / org.gvsig.raster.tools.app.basic / src / main / java / org / gvsig / raster / tools / app / basic / raster / gui / preference / RasterPreferences.java @ 1174

History | View | Annotate | Download (8.58 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.tools.app.basic.raster.gui.preference;
23

    
24
import java.awt.BorderLayout;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27

    
28
import javax.swing.ImageIcon;
29
import javax.swing.JPanel;
30
import javax.swing.JScrollPane;
31
import javax.swing.border.EmptyBorder;
32

    
33
import org.gvsig.andami.IconThemeHelper;
34
import org.gvsig.andami.preferences.AbstractPreferencePage;
35
import org.gvsig.andami.preferences.StoreException;
36
import org.gvsig.raster.tools.app.basic.raster.gui.preference.panel.PreferenceCache;
37
import org.gvsig.raster.tools.app.basic.raster.gui.preference.panel.PreferenceGeneral;
38
import org.gvsig.raster.tools.app.basic.raster.gui.preference.panel.PreferenceLoadLayer;
39
import org.gvsig.raster.tools.app.basic.raster.gui.preference.panel.PreferenceNoData;
40
import org.gvsig.raster.tools.app.basic.raster.gui.preference.panel.PreferenceOverviews;
41
import org.gvsig.raster.tools.app.basic.raster.gui.preference.panel.PreferenceTemporal;
42

    
43
/**
44
 * RasterPreferences es un panel de preferencias situado a nivel de las
45
 * preferencias de gvSIG que engloba todas las opciones configurables de Raster
46
 *
47
 * @version 11/12/2007
48
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
49
 */
50
public class RasterPreferences extends AbstractPreferencePage {
51
        private static final long serialVersionUID = -1689657253810393874L;
52

    
53
        protected static String     id        = RasterPreferences.class.getName();
54
        private ImageIcon           icon;
55

    
56
        private PreferenceNoData    noData    = null;
57
        private PreferenceOverviews overviews = null;
58
        private PreferenceCache     cache     = null;
59
        private PreferenceTemporal  temporal  = null;
60
        private PreferenceGeneral   general   = null;
61
        private PreferenceLoadLayer loadLayer = null;
62

    
63
        /**
64
         * Constructor de la clase RasterPreferences
65
         */
66
        public RasterPreferences() {
67
                super();
68
                icon = IconThemeHelper.getImageIcon("pref-raster-icon");
69
                initialize();
70
        }
71

    
72
        /**
73
         * Inicializacion del panel de preferencias.
74
         */
75
        private void initialize() {
76
                setTitle("Frame");
77

    
78
                GridBagConstraints gridBagConstraints;
79

    
80
                JScrollPane scrollPane = new JScrollPane();
81

    
82
                scrollPane.getVerticalScrollBar().setUnitIncrement(20);
83

    
84
                JPanel panel = new JPanel();
85

    
86
                panel.setLayout(new GridBagLayout());
87

    
88
                gridBagConstraints = new GridBagConstraints();
89
                gridBagConstraints.gridx = 0;
90
                gridBagConstraints.gridy = 0;
91
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
92
                panel.add(getPreferenceGeneral(), gridBagConstraints);
93

    
94
                //gridBagConstraints = new GridBagConstraints();
95
                //gridBagConstraints.gridx = 0;
96
                gridBagConstraints.gridy = 1;
97
                //gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
98
                panel.add(getPreferenceLoadLayer(), gridBagConstraints);
99

    
100
                //gridBagConstraints = new GridBagConstraints();
101
                //gridBagConstraints.gridx = 0;
102
                //gridBagConstraints.gridy = 2;
103
                //gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
104
                //panel.add(getPreferenceNoData(), gridBagConstraints);
105

    
106
                //gridBagConstraints = new GridBagConstraints();
107
                //gridBagConstraints.gridx = 0;
108
                gridBagConstraints.gridy = 2;
109
                //gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
110
                panel.add(getPreferenceTemporal(), gridBagConstraints);
111

    
112
                //gridBagConstraints = new GridBagConstraints();
113
                //gridBagConstraints.gridx = 0;
114
                gridBagConstraints.gridy = 3;
115
                //gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
116
                panel.add(getPreferenceOverviews(), gridBagConstraints);
117

    
118
                //gridBagConstraints = new GridBagConstraints();
119
                //gridBagConstraints.gridx = 0;
120
                gridBagConstraints.gridy = 4;
121
                //gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
122
                panel.add(getPreferenceCache(), gridBagConstraints);
123

    
124
                //gridBagConstraints = new GridBagConstraints();
125
                //gridBagConstraints.gridx = 0;
126
                gridBagConstraints.gridy = 5;
127
                gridBagConstraints.weightx = 1.0;
128
                gridBagConstraints.weighty = 1.0;
129
                panel.add(new JPanel(), gridBagConstraints);
130

    
131
                panel.setBorder(new EmptyBorder(5, 5, 5, 5));
132

    
133
                scrollPane.setViewportView(panel);
134

    
135
                setLayout(new BorderLayout());
136
                add(scrollPane, BorderLayout.CENTER);
137
        }
138

    
139
        /**
140
         * Devuelve el panel de configuracion para los valores NoData
141
         * @return
142
         */
143
        private PreferenceNoData getPreferenceNoData() {
144
                if (noData == null) {
145
                        noData = new PreferenceNoData();
146
                }
147
                return noData;
148
        }
149
        
150
        /**
151
         * Devuelve el panel de configuracion general de Raster. Aqui es donde se
152
         * define si se visualiza automaticamente Raster, el numero de clases, si se
153
         * pregunta la reproyeccion, etc...
154
         * @return
155
         */
156
        private PreferenceGeneral getPreferenceGeneral() {
157
                if (general == null) {
158
                        general = new PreferenceGeneral();
159
                }
160
                return general;
161
        }
162

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

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

    
187
        
188
        private PreferenceTemporal getPreferenceTemporal() {
189
                if (temporal == null) {
190
                        temporal = new PreferenceTemporal();
191
                }
192
                return temporal;
193
        }
194

    
195
        private PreferenceLoadLayer getPreferenceLoadLayer() {
196
                if (loadLayer == null) {
197
                        loadLayer = new PreferenceLoadLayer();
198
                }
199
                return loadLayer;
200
        }
201

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

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

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

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

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

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

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

    
273
        /*
274
         * (non-Javadoc)
275
         * @see com.iver.andami.preferences.IPreference#getTitle()
276
         */
277
        public String getTitle() {
278
                return "Raster";
279
        }
280

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

    
289
        public void setChangesApplied() {}
290
}