Revision 5474 org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/raster/gui/preference/panel/PreferenceGeneral.java

View differences:

PreferenceGeneral.java
44 44
public class PreferenceGeneral extends BasePanel {
45 45
	private static final long   serialVersionUID    = 1L;
46 46
	private JCheckBox           checkBoxPreview     = null;
47
	private JCheckBox           checkBoxCoordinates = null;
48 47
	private JLabel              labelNumClases      = null;
49 48
	private JComboBox           comboBoxNumClases   = null;
50
	private JCheckBox           checkBoxProjection  = null;
51 49
	
52 50
	/**
53 51
	 *Inicializa componentes gr?ficos y traduce
......
65 63
		getCheckBoxPreview().setText(getText(this, "previsualizar_automaticamente_raster"));
66 64
		getCheckBoxPreview().setToolTipText(getCheckBoxPreview().getText());
67 65
		getLabelNumClases().setText(getText(this, "num_clases") + ":");
68
		getCheckBoxCoordinates().setText(getText(this, "pedir_coordenadas_georreferenciacion"));
69
		getCheckBoxProjection().setText(getText(this, "ask_for_projection"));
70 66
	}
71 67

  
72 68
	protected void init() {
......
98 94
		gridBagConstraints.weightx = 1.0;
99 95
		gridBagConstraints.insets = new Insets(2, 2, 2, 5);
100 96
		add(getComboBoxNumClases(), gridBagConstraints);
101

  
102
		gridBagConstraints = new GridBagConstraints();
103
		gridBagConstraints.gridx = 0;
104
		gridBagConstraints.gridy = 2;
105
		gridBagConstraints.gridwidth = 2;
106
		gridBagConstraints.fill = GridBagConstraints.BOTH;
107
		gridBagConstraints.anchor = GridBagConstraints.WEST;
108
		gridBagConstraints.weighty = 1.0;
109
		gridBagConstraints.insets = new Insets(2, 5, 5, 5);
110
		add(getCheckBoxCoordinates(), gridBagConstraints);
111
		
112
		gridBagConstraints = new GridBagConstraints();
113
		gridBagConstraints.gridx = 0;
114
		gridBagConstraints.gridy = 3;
115
		gridBagConstraints.gridwidth = 2;
116
		gridBagConstraints.fill = GridBagConstraints.BOTH;
117
		gridBagConstraints.anchor = GridBagConstraints.WEST;
118
		gridBagConstraints.insets = new Insets(2, 5, 5, 5);
119
		add(getCheckBoxProjection(), gridBagConstraints);
120 97
	}
121 98

  
122 99
	private JCheckBox getCheckBoxPreview() {
......
142 119
		return comboBoxNumClases;
143 120
	}
144 121

  
145
	private JCheckBox getCheckBoxCoordinates() {
146
		if (checkBoxCoordinates == null) {
147
			checkBoxCoordinates = new JCheckBox();
148
			checkBoxCoordinates.setMargin(new Insets(0, 0, 0, 0));
149
		}
150
		return checkBoxCoordinates;
151
	}
152
	
153 122
	/**
154
	 * Obtiene el checkbox que indica si se se muestran las opciones de proyecci?n
155
	 * en la carga de un raster o no. Si se marca no, se aplicar?n siempre las opciones
156
	 * por defecto.
157
	 * @return JCheckBox
158
	 */
159
	private JCheckBox getCheckBoxProjection() {
160
		if (checkBoxProjection == null) {
161
			checkBoxProjection = new JCheckBox();
162
			checkBoxProjection.setMargin(new Insets(0, 0, 0, 0));
163
		}
164
		return checkBoxProjection;
165
	}
166

  
167
	/**
168 123
	 * Establece los valodres por defecto
169 124
	 */
170 125
	public void initializeDefaults() {
171
		getCheckBoxCoordinates().setSelected(((Boolean) Configuration.getDefaultValue("general_ask_coordinates")).booleanValue());
172
		getCheckBoxProjection().setSelected(((Boolean) Configuration.getDefaultValue("general_ask_projection")).booleanValue());
173 126
		getCheckBoxPreview().setSelected(((Boolean)Configuration.getDefaultValue("general_auto_preview")).booleanValue());
174 127
		Integer defaultNumberOfClasses = (Integer) Configuration.getDefaultValue("general_defaultNumberOfClasses");
175 128
		for (int i = 0; i < getComboBoxNumClases().getItemCount(); i++) {
......
184 137
	 * Establece los valores que han sido definidas por el usuario
185 138
	 */
186 139
	public void initializeValues() {
187
		getCheckBoxCoordinates().setSelected(Configuration.getValue("general_ask_coordinates", Boolean.valueOf(false)).booleanValue());
188
		getCheckBoxProjection().setSelected(Configuration.getValue("general_ask_projection", Boolean.valueOf(true)).booleanValue());
189 140
		getCheckBoxPreview().setSelected(Configuration.getValue("general_auto_preview", Boolean.valueOf(true)).booleanValue());
190 141
		Integer defaultNumberOfClasses = Configuration.getValue("general_defaultNumberOfClasses", Integer.valueOf(RasterLibrary.defaultNumberOfClasses));
191 142
		for (int i = 0; i < getComboBoxNumClases().getItemCount(); i++) {
......
200 151
	 * Guarda los valores que han sido definidas por el usuario
201 152
	 */
202 153
	public void storeValues() {
203
		Configuration.setValue("general_ask_coordinates", Boolean.valueOf(getCheckBoxCoordinates().isSelected()));
204 154
		Configuration.setValue("general_auto_preview", Boolean.valueOf(getCheckBoxPreview().isSelected()));
205 155
		int nClasses = Integer.valueOf(getComboBoxNumClases().getSelectedItem().toString());
206 156
		Configuration.setValue("general_defaultNumberOfClasses", nClasses);
207 157
		RasterLibrary.defaultNumberOfClasses = nClasses;
208
		Configuration.setValue("general_ask_projection", Boolean.valueOf(getCheckBoxProjection().isSelected()));
209 158
	}
210 159
}

Also available in: Unified diff