Revision 17491 trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/gui/preferences/panels/PreferenceNoData.java

View differences:

PreferenceNoData.java
43 43
public class PreferenceNoData extends PanelBase implements ActionListener {
44 44
	private static final long serialVersionUID = -8964531984609056094L;
45 45
	private JCheckBox           jCheckBoxNoDataEnabled = null;
46
	private JCheckBox           jCheckBoxTransparent   = null;
47 46
	private JLabel              jLabelGeneralValue     = null;
48 47
	private JFormattedTextField textFieldGeneralValue  = null;
49 48

  
......
56 55
		getPanel().setBorder(BorderFactory.createTitledBorder(getText(this, "nodata")));
57 56
		getCheckBoxNoDataEnabled().setText(getText(this, "activar_uso_nodata"));
58 57
		getCheckBoxNoDataEnabled().setToolTipText(getText(this, "activar_uso_nodata"));
59
		getCheckBoxTransparent().setText(getText(this, "transparente"));
60 58
		getLabelGeneralValue().setText(getText(this, "valor_general") + ":");
61 59
	}
62 60

  
......
88 86
		gridBagConstraints.weightx = 1.0;
89 87
		gridBagConstraints.insets = new Insets(2, 2, 2, 5);
90 88
		getPanel().add(getTextFieldGeneralValue(), gridBagConstraints);
91

  
92
		posy++;
93
		gridBagConstraints = new GridBagConstraints();
94
		gridBagConstraints.gridx = 0;
95
		gridBagConstraints.gridy = posy;
96
		gridBagConstraints.gridwidth = 2;
97
		gridBagConstraints.anchor = GridBagConstraints.WEST;
98
		gridBagConstraints.insets = new Insets(2, 5, 5, 5);
99
		getPanel().add(getCheckBoxTransparent(), gridBagConstraints);
100 89
	}
101 90

  
102 91
	private JFormattedTextField getTextFieldGeneralValue() {
......
123 112
		return jCheckBoxNoDataEnabled;
124 113
	}
125 114

  
126
	private JCheckBox getCheckBoxTransparent() {
127
		if (jCheckBoxTransparent == null) {
128
			jCheckBoxTransparent = new JCheckBox();
129
			jCheckBoxTransparent.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
130
			jCheckBoxTransparent.setMargin(new Insets(0, 0, 0, 0));
131
		}
132
		return jCheckBoxTransparent;
133
	}
134

  
135 115
	private JLabel getLabelGeneralValue() {
136 116
		if (jLabelGeneralValue == null) {
137 117
			jLabelGeneralValue = new JLabel();
......
141 121

  
142 122
	private void setNoDataEnabled(boolean enabled) {
143 123
		getLabelGeneralValue().setEnabled(enabled);
144
		getCheckBoxTransparent().setEnabled(enabled);
145 124
		getTextFieldGeneralValue().setEnabled(enabled);
146 125
	}
147 126

  
148 127
	public void initializeDefaults() {
149
		Boolean enabled = Boolean.valueOf(RasterLibrary.noDataEnabled);
128
		Boolean enabled = (Boolean) Configuration.getDefaultValue("nodata_enabled");
150 129
		getCheckBoxNoDataEnabled().setSelected(enabled.booleanValue());
151 130
		setNoDataEnabled(enabled.booleanValue());
152
		getTextFieldGeneralValue().setValue(Double.valueOf(RasterLibrary.noDataValue));
153

  
154
		enabled = Boolean.valueOf(RasterLibrary.noDataTransparent);
155
		getCheckBoxTransparent().setSelected(enabled.booleanValue());
131
		getTextFieldGeneralValue().setValue((Double) Configuration.getDefaultValue("nodata_value"));
156 132
	}
157 133

  
158 134
	public void initializeValues() {
......
160 136
		getCheckBoxNoDataEnabled().setSelected(enabled.booleanValue());
161 137
		setNoDataEnabled(enabled.booleanValue());
162 138
		getTextFieldGeneralValue().setValue(Configuration.getValue("nodata_value", Double.valueOf(RasterLibrary.noDataValue)));
163

  
164
		enabled = Configuration.getValue("nodata_transparent", Boolean.valueOf(RasterLibrary.noDataTransparent));
165
		getCheckBoxTransparent().setSelected(enabled.booleanValue());
166 139
	}
167 140

  
168 141
	public void storeValues() {
......
171 144
			Configuration.setValue("nodata_value", Double.valueOf(getTextFieldGeneralValue().getText()));
172 145
		} catch (NumberFormatException e) {
173 146
		}
174
		Configuration.setValue("nodata_transparent", Boolean.valueOf(getCheckBoxTransparent().isSelected()));
175 147
	}
176 148

  
177 149
	public void actionPerformed(ActionEvent e) {

Also available in: Unified diff