Revision 27546
branches/v2_0_0_prep/extensions/extRasterTools-SE/src/org/gvsig/raster/gui/preferences/panels/PreferenceCache.java | ||
---|---|---|
40 | 40 |
/** |
41 | 41 |
* PreferenceCache es la clase que se encarga de configurar en RasterPreferences |
42 | 42 |
* las opciones de cacheamiento de capas en Raster. |
43 |
*
|
|
43 |
* |
|
44 | 44 |
* @version 14/12/2007 |
45 | 45 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
46 | 46 |
*/ |
... | ... | |
55 | 55 |
private JFormattedTextField textFieldPagsPerGroup = null; |
56 | 56 |
private JLabel labelPageSize = null; |
57 | 57 |
private JFormattedTextField textFieldPageSize = null; |
58 |
|
|
58 |
|
|
59 | 59 |
/** |
60 | 60 |
*Inicializa componentes gr?ficos y traduce |
61 | 61 |
*/ |
... | ... | |
63 | 63 |
init(); |
64 | 64 |
translate(); |
65 | 65 |
} |
66 |
|
|
66 |
|
|
67 | 67 |
/** |
68 | 68 |
* Define todas las traducciones de PreferenceCache |
69 | 69 |
*/ |
... | ... | |
196 | 196 |
} |
197 | 197 |
|
198 | 198 |
private JLabel getLabelCacheSize() { |
199 |
if (labelCacheSize == null) {
|
|
199 |
if (labelCacheSize == null) |
|
200 | 200 |
labelCacheSize = new JLabel(); |
201 |
} |
|
202 | 201 |
return labelCacheSize; |
203 | 202 |
} |
204 | 203 |
|
205 | 204 |
private JLabel getLabelPagsPerGroup() { |
206 |
if (labelPagsPerGroup == null) {
|
|
205 |
if (labelPagsPerGroup == null) |
|
207 | 206 |
labelPagsPerGroup = new JLabel(); |
208 |
} |
|
209 | 207 |
return labelPagsPerGroup; |
210 | 208 |
} |
211 | 209 |
|
212 | 210 |
private JLabel getLabelPageSize() { |
213 |
if (labelPageSize == null) {
|
|
211 |
if (labelPageSize == null) |
|
214 | 212 |
labelPageSize = new JLabel(); |
215 |
} |
|
216 | 213 |
return labelPageSize; |
217 | 214 |
} |
218 | 215 |
|
219 | 216 |
private JLabel getLabelBlockHeight() { |
220 |
if (labelBlockHeight == null) {
|
|
217 |
if (labelBlockHeight == null) |
|
221 | 218 |
labelBlockHeight = new JLabel(); |
222 |
} |
|
223 | 219 |
return labelBlockHeight; |
224 | 220 |
} |
225 | 221 |
|
... | ... | |
235 | 231 |
* Establece los valores por defecto de la Cache |
236 | 232 |
*/ |
237 | 233 |
public void initializeDefaults() { |
238 |
getTextFieldCacheSize().setValue((Long) Configuration.getDefaultValue("cache_size"));
|
|
239 |
getTextFieldPageSize().setValue((Double) Configuration.getDefaultValue("cache_pagesize"));
|
|
240 |
getTextFieldPagsPerGroup().setValue((Integer) Configuration.getDefaultValue("cache_pagspergroup"));
|
|
234 |
getTextFieldCacheSize().setValue(Configuration.getDefaultValue("cache_size")); |
|
235 |
getTextFieldPageSize().setValue(Configuration.getDefaultValue("cache_pagesize")); |
|
236 |
getTextFieldPagsPerGroup().setValue(Configuration.getDefaultValue("cache_pagspergroup")); |
|
241 | 237 |
|
242 | 238 |
Integer blockHeight = (Integer) Configuration.getDefaultValue("cache_blockheight"); |
243 |
for (int i = 0; i < getComboBoxBlockHeight().getItemCount(); i++) {
|
|
239 |
for (int i = 0; i < getComboBoxBlockHeight().getItemCount(); i++) |
|
244 | 240 |
if (getComboBoxBlockHeight().getItemAt(i).toString().equals(blockHeight.toString())) { |
245 | 241 |
getComboBoxBlockHeight().setSelectedIndex(i); |
246 | 242 |
break; |
247 | 243 |
} |
248 |
} |
|
249 | 244 |
} |
250 | 245 |
|
251 | 246 |
/** |
... | ... | |
257 | 252 |
getTextFieldPagsPerGroup().setValue(Configuration.getValue("cache_pagspergroup", Integer.valueOf(RasterLibrary.pagsPerGroup))); |
258 | 253 |
|
259 | 254 |
Integer blockHeight = Configuration.getValue("cache_blockheight", Integer.valueOf(RasterLibrary.blockHeight)); |
260 |
for (int i = 0; i < getComboBoxBlockHeight().getItemCount(); i++) {
|
|
255 |
for (int i = 0; i < getComboBoxBlockHeight().getItemCount(); i++) |
|
261 | 256 |
if (getComboBoxBlockHeight().getItemAt(i).toString().equals(blockHeight.toString())) { |
262 | 257 |
getComboBoxBlockHeight().setSelectedIndex(i); |
263 | 258 |
break; |
264 | 259 |
} |
265 |
} |
|
266 | 260 |
} |
267 | 261 |
|
268 | 262 |
/** |
... | ... | |
270 | 264 |
*/ |
271 | 265 |
public void storeValues() { |
272 | 266 |
Configuration.setValue("cache_size", getTextFieldCacheSize().getText()); |
273 |
Configuration.setValue("cache_pagesize", Double.valueOf(getTextFieldPageSize().getText())); |
|
267 |
Configuration.setValue("cache_pagesize", getTextFieldPageSize() |
|
268 |
.getText()); |
|
274 | 269 |
Configuration.setValue("cache_pagspergroup", getTextFieldPagsPerGroup().getText()); |
275 | 270 |
Configuration.setValue("cache_blockheight", getComboBoxBlockHeight().getSelectedItem().toString()); |
276 | 271 |
} |
branches/v2_0_0_prep/extensions/extRasterTools-SE/src/org/gvsig/rastertools/RasterModule.java | ||
---|---|---|
508 | 508 |
|
509 | 509 |
if (e.getKey().equals("general_defaultNumberOfClasses")) { |
510 | 510 |
if(e.getValue() instanceof String) |
511 |
RasterLibrary.defaultNumberOfClasses = new Integer((String) e.getValue()).intValue(); |
|
511 |
try { |
|
512 |
RasterLibrary.defaultNumberOfClasses = new Integer( |
|
513 |
(String) e.getValue()).intValue(); |
|
514 |
} catch (NumberFormatException exc) { |
|
515 |
// FIXME |
|
516 |
exc.printStackTrace(); |
|
517 |
} |
|
518 |
|
|
512 | 519 |
if(e.getValue() instanceof Integer) |
513 | 520 |
RasterLibrary.defaultNumberOfClasses = ((Integer) e.getValue()).intValue(); |
514 | 521 |
return; |
... | ... | |
516 | 523 |
|
517 | 524 |
if (e.getKey().equals("cache_size")) { |
518 | 525 |
if(e.getValue() instanceof String) |
519 |
RasterLibrary.cacheSize = new Long((String) e.getValue()).longValue(); |
|
526 |
try { |
|
527 |
RasterLibrary.cacheSize = new Long((String) e.getValue()).longValue(); |
|
528 |
} catch (NumberFormatException exc) { |
|
529 |
// FIXME |
|
530 |
exc.printStackTrace(); |
|
531 |
} |
|
520 | 532 |
if(e.getValue() instanceof Long) |
521 | 533 |
RasterLibrary.cacheSize = ((Long) e.getValue()).longValue(); |
522 | 534 |
return; |
... | ... | |
524 | 536 |
|
525 | 537 |
if (e.getKey().equals("cache_pagesize")) { |
526 | 538 |
if(e.getValue() instanceof String) |
527 |
RasterLibrary.pageSize = new Double((String) e.getValue()).doubleValue(); |
|
539 |
try { |
|
540 |
RasterLibrary.pageSize = new Double((String) e.getValue()) |
|
541 |
.doubleValue(); |
|
542 |
} catch (NumberFormatException exc) { |
|
543 |
// FIXME |
|
544 |
exc.printStackTrace(); |
|
545 |
} |
|
546 |
|
|
528 | 547 |
if(e.getValue() instanceof Double) |
529 | 548 |
RasterLibrary.pageSize = ((Double) e.getValue()).doubleValue(); |
530 | 549 |
return; |
... | ... | |
532 | 551 |
|
533 | 552 |
if (e.getKey().equals("cache_pagspergroup")) { |
534 | 553 |
if(e.getValue() instanceof String) |
535 |
RasterLibrary.pagsPerGroup = new Integer((String) e.getValue()).intValue(); |
|
554 |
try { |
|
555 |
RasterLibrary.pagsPerGroup = new Integer((String) e |
|
556 |
.getValue()).intValue(); |
|
557 |
} catch (NumberFormatException exc) { |
|
558 |
// FIXME |
|
559 |
exc.printStackTrace(); |
|
560 |
} |
|
561 |
|
|
536 | 562 |
if(e.getValue() instanceof Integer) |
537 | 563 |
RasterLibrary.pagsPerGroup = ((Integer) e.getValue()).intValue(); |
538 | 564 |
return; |
... | ... | |
540 | 566 |
|
541 | 567 |
if (e.getKey().equals("cache_blockheight")) { |
542 | 568 |
if(e.getValue() instanceof String) |
543 |
RasterLibrary.blockHeight = new Integer((String) e.getValue()).intValue(); |
|
569 |
try { |
|
570 |
RasterLibrary.blockHeight = new Integer((String) e |
|
571 |
.getValue()).intValue(); |
|
572 |
} catch (NumberFormatException exc) { |
|
573 |
// FIXME |
|
574 |
exc.printStackTrace(); |
|
575 |
} |
|
544 | 576 |
if(e.getValue() instanceof Integer) |
545 | 577 |
RasterLibrary.blockHeight = ((Integer) e.getValue()).intValue(); |
546 | 578 |
return; |
... | ... | |
548 | 580 |
|
549 | 581 |
if (e.getKey().equals("nodata_value")) { |
550 | 582 |
if(e.getValue() instanceof String) |
551 |
RasterLibrary.defaultNoDataValue = new Double((String) e.getValue()).doubleValue(); |
|
583 |
try { |
|
584 |
RasterLibrary.defaultNoDataValue = new Double((String) e |
|
585 |
.getValue()).doubleValue(); |
|
586 |
} catch (NumberFormatException exc) { |
|
587 |
// FIXME |
|
588 |
exc.printStackTrace(); |
|
589 |
} |
|
590 |
|
|
552 | 591 |
if(e.getValue() instanceof Double) |
553 | 592 |
RasterLibrary.defaultNoDataValue = ((Double) e.getValue()).doubleValue(); |
554 | 593 |
return; |
Also available in: Unified diff