Revision 1137 org.gvsig.raster.tilecache/trunk/org.gvsig.raster.tilecache/org.gvsig.raster.tilecache.app/src/main/java/org/gvsig/raster/tilecache/app/TileCachePreferencesPanel.java

View differences:

TileCachePreferencesPanel.java
55 55
 */
56 56
public class TileCachePreferencesPanel extends BasePanel implements ActionListener {
57 57
	protected static final long serialVersionUID      = 1L;
58
	private static int          TILE_SIZE_WMS         = 1024;              
58 59
	private JLabel              labelWarning          = null;
59 60
	private JLabel              labelCacheSize        = null;
60 61
	private JLabel              labelLevels           = null;
61 62
	private JLabel              labelStruct           = null;
62 63
	private JLabel              labelTileSize         = null;
64
	private JLabel              labelWMSTileSize      = null;
63 65
	private JLabel              labelPath             = null;
64 66
	private JFormattedTextField textFieldCacheSize    = null;
65 67
	private JFormattedTextField textFieldLevels       = null;
66 68
	private JFormattedTextField textFieldTileSize     = null;
69
	private JFormattedTextField textFieldWMSTileSize  = null;
67 70
	private JTextField          textFieldPath         = null;
68 71
	private JComboBox           comboBoxStruct        = null;
69 72
	private JButton             buttonRemove          = null;
......
85 88
		getLabelCacheSize().setText(getText(this, "tamanyo_max_tilecache") + ":");
86 89
		getLabelLevels().setText(getText(this, "res_levels") + ":");
87 90
		getLabelTileSize().setText(getText(this, "tilesize") + ":");
91
		getLabelWMSTileSize().setText("WMS/WCS " + getText(this, "tilesize") + ":");
88 92
		getLabelStruct().setText(getText(this, "tilecache_struct") + ":");
89 93
		getButtonRemove().setText(getText(this, "remove_cache"));
90 94
		getLabelPath().setText(getText(this, "path_tilecache"));
......
128 132
		gridBagConstraints.gridy = 4;
129 133
		gridBagConstraints.anchor = GridBagConstraints.EAST;
130 134
		gridBagConstraints.insets = new Insets(2, 5, 2, 2);
135
		add(getLabelWMSTileSize(), gridBagConstraints);
136
		
137
		gridBagConstraints = new GridBagConstraints();
138
		gridBagConstraints.gridx = 0;
139
		gridBagConstraints.gridy = 5;
140
		gridBagConstraints.anchor = GridBagConstraints.EAST;
141
		gridBagConstraints.insets = new Insets(2, 5, 2, 2);
131 142
		add(getLabelStruct(), gridBagConstraints);
132 143
		
133 144
		gridBagConstraints = new GridBagConstraints();
134 145
		gridBagConstraints.gridx = 0;
135
		gridBagConstraints.gridy = 5;
146
		gridBagConstraints.gridy = 6;
136 147
		gridBagConstraints.gridwidth = 2;
137 148
		gridBagConstraints.anchor = GridBagConstraints.WEST;
138 149
		gridBagConstraints.insets = new Insets(2, 5, 2, 2);
......
140 151
		
141 152
		gridBagConstraints = new GridBagConstraints();
142 153
		gridBagConstraints.gridx = 0;
143
		gridBagConstraints.gridy = 6;
154
		gridBagConstraints.gridy = 7;
144 155
		gridBagConstraints.anchor = GridBagConstraints.EAST;
145 156
		gridBagConstraints.insets = new Insets(2, 5, 2, 2);
146 157
		add(getLabelPath(), gridBagConstraints);
......
175 186
		gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
176 187
		gridBagConstraints.anchor = GridBagConstraints.WEST;
177 188
		gridBagConstraints.insets = new Insets(2, 2, 2, 5);
189
		add(getTextFieldWMSTileSize(), gridBagConstraints);
190
		
191
		gridBagConstraints = new GridBagConstraints();
192
		gridBagConstraints.gridx = 1;
193
		gridBagConstraints.gridy = 5;
194
		gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
195
		gridBagConstraints.anchor = GridBagConstraints.WEST;
196
		gridBagConstraints.insets = new Insets(2, 2, 2, 5);
178 197
		add(getComboBoxStruct(), gridBagConstraints);
179 198
		
180 199
		gridBagConstraints = new GridBagConstraints();
181 200
		gridBagConstraints.gridx = 1;
182
		gridBagConstraints.gridy = 6;
201
		gridBagConstraints.gridy = 7;
183 202
		gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
184 203
		gridBagConstraints.anchor = GridBagConstraints.WEST;
185 204
		gridBagConstraints.insets = new Insets(2, 2, 2, 5);
......
244 263
		return textFieldTileSize;
245 264
	}
246 265
	
266
	private JFormattedTextField getTextFieldWMSTileSize() {
267
		if (textFieldWMSTileSize == null) {
268
			NumberFormat integerFormat = NumberFormat.getNumberInstance();
269
			integerFormat.setParseIntegerOnly(true);
270
			textFieldWMSTileSize = new JFormattedTextField(new DefaultFormatterFactory(
271
					new NumberFormatter(integerFormat),
272
					new NumberFormatter(integerFormat),
273
					new NumberFormatter(integerFormat)));
274
		}
275
		return textFieldWMSTileSize;
276
	}
277
	
247 278
	private JFormattedTextField getTextFieldLevels() {
248 279
		if (textFieldLevels == null) {
249 280
			NumberFormat integerFormat = NumberFormat.getNumberInstance();
......
285 316
			labelTileSize = new JLabel();
286 317
		return labelTileSize;
287 318
	}
319
	
320
	private JLabel getLabelWMSTileSize() {
321
		if (labelWMSTileSize == null)
322
			labelWMSTileSize = new JLabel();
323
		return labelWMSTileSize;
324
	}
288 325

  
289 326
	/**
290 327
	 * Establece los valores por defecto de la Cache
......
292 329
	public void initializeDefaults() {
293 330
		getTextFieldCacheSize().setValue(Configuration.getDefaultValue("tilecache_size"));
294 331
		getTextFieldTileSize().setValue(Configuration.getDefaultValue("tilesize"));
332
		getTextFieldWMSTileSize().setValue(Configuration.getDefaultValue("tilesizewms"));
295 333
		getTextFieldLevels().setValue(Configuration.getDefaultValue("tile_levels"));
296 334
		getTextFieldPath().setText(Configuration.getDefaultValue("path_tilecache").toString());
297 335
		String struct = (String) Configuration.getDefaultValue("cache_struct");
......
310 348
	public void initializeValues() {
311 349
		getTextFieldCacheSize().setValue(Configuration.getValue("tilecache_size", Integer.valueOf(TileCacheLibrary.MAX_CACHE_SIZE)));
312 350
		getTextFieldTileSize().setValue(Configuration.getValue("tilesize", Integer.valueOf(TileCacheLibrary.DEFAULT_TILEWIDTH)));
351
		getTextFieldWMSTileSize().setValue(Configuration.getValue("tilesizewms", TILE_SIZE_WMS));
313 352
		getTextFieldLevels().setValue(Configuration.getValue("tile_levels", Integer.valueOf(TileCacheLibrary.DEFAULT_LEVELS)));
314 353
		getTextFieldPath().setText(Configuration.getValue("path_tilecache", RasterLibrary.pathTileCache));
315 354
		String struct = Configuration.getValue("cache_struct", TileCacheLibrary.DEFAULT_STRUCTURE);
......
344 383
			
345 384
		}
346 385
		
386
		Integer tilesizewms = null;
387
		try {
388
			String s = getTextFieldWMSTileSize().getText().replaceAll(",", "");
389
			tilesizewms = new Integer(s);
390
			Configuration.setValue("tilesizewms", tilesizewms);
391
		} catch (NumberFormatException e)  {
392
			
393
		}
394
		
347 395
		Integer tilelevels = null;
348 396
		try {
349 397
			String s = getTextFieldLevels().getText().replaceAll(",", "");

Also available in: Unified diff