Revision 17 org.gvsig.educa.thematicmap/trunk/org.gvsig.educa.thematicmap/org.gvsig.educa.thematicmap.swing/org.gvsig.educa.thematicmap.swing.impl/src/main/java/org/gvsig/educa/thematicmap/swing/impl/editor/DefaultThematicMapCompilationEditor.java
DefaultThematicMapCompilationEditor.java | ||
---|---|---|
22 | 22 |
package org.gvsig.educa.thematicmap.swing.impl.editor; |
23 | 23 |
|
24 | 24 |
import java.awt.BorderLayout; |
25 |
import java.awt.image.BufferedImage; |
|
25 | 26 |
import java.util.ArrayList; |
26 | 27 |
import java.util.List; |
27 | 28 |
|
... | ... | |
41 | 42 |
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
42 | 43 |
|
43 | 44 |
/** |
45 |
* <p> |
|
46 |
* Default implementation of {@link ThematicMapCompilationEditor} |
|
47 |
* </p> |
|
48 |
* <p> |
|
49 |
* This uses <i>org.gvsig.ui</i> Wizard implementation. |
|
50 |
* </p> |
|
51 |
* <p> |
|
52 |
* There are three steps: |
|
53 |
* <ol> |
|
54 |
* <li>{@link StepIdentification}: Base values for <i>Thematic Map</i> |
|
55 |
* identification</li> |
|
56 |
* <li>{@link StepLayers}: Layers definition which will compound the <i>Thematic |
|
57 |
* Map</i></li> |
|
58 |
* <li>{@link StepValidation}: validation of all data</li> |
|
59 |
* </ol> |
|
60 |
* </p> |
|
61 |
* |
|
44 | 62 |
* @author gvSIG Team |
45 | 63 |
* @version $Id$ |
46 | 64 |
* |
... | ... | |
54 | 72 |
private static final long serialVersionUID = -9153359086582532100L; |
55 | 73 |
|
56 | 74 |
private final ThematicMapSwingManager swingManager; |
57 |
|
|
58 | 75 |
private final ThematicMapCompilation compilation; |
59 | 76 |
|
77 |
/** |
|
78 |
* Wizard component |
|
79 |
*/ |
|
60 | 80 |
private WizardPanelWithLogo wizard; |
61 | 81 |
|
82 |
/** |
|
83 |
* Wizard step for input Thematic Map information values |
|
84 |
*/ |
|
62 | 85 |
private StepIdentification stepIdentification; |
86 |
|
|
87 |
/** |
|
88 |
* Wizard step to configure layer composition |
|
89 |
*/ |
|
63 | 90 |
private StepLayers stepLayers; |
91 |
|
|
92 |
/** |
|
93 |
* Wizard step to validate all data |
|
94 |
*/ |
|
64 | 95 |
private StepValidation stepValidation; |
65 | 96 |
|
97 |
/** |
|
98 |
* UI initialized flag |
|
99 |
*/ |
|
66 | 100 |
private boolean initialized = false; |
67 | 101 |
|
68 | 102 |
private ThematicMapCompilationEditorListener listener; |
... | ... | |
72 | 106 |
swingManager = ThematicMapSwingLocator.getSwingManager(); |
73 | 107 |
|
74 | 108 |
this.compilation = compilation; |
75 |
|
|
76 | 109 |
} |
77 | 110 |
|
111 |
/** |
|
112 |
* Initialize all UI component of the panel |
|
113 |
*/ |
|
78 | 114 |
private void initializeUI() { |
79 | 115 |
if (initialized) { |
80 | 116 |
return; |
81 | 117 |
} |
82 |
// TODO logo |
|
83 |
wizard = new WizardPanelWithLogo(new ImageIcon()); |
|
118 |
// TODO Add a logo |
|
119 |
BufferedImage image = |
|
120 |
new BufferedImage(250, 400, BufferedImage.TYPE_INT_ARGB); |
|
121 |
wizard = new WizardPanelWithLogo(new ImageIcon(image)); |
|
84 | 122 |
|
85 | 123 |
stepIdentification = new StepIdentification(this); |
86 | 124 |
stepLayers = new StepLayers(this); |
... | ... | |
170 | 208 |
wizard.setBackButtonEnabled(isEnabled); |
171 | 209 |
} |
172 | 210 |
|
211 |
/** |
|
212 |
* Finalizes wizard |
|
213 |
*/ |
|
173 | 214 |
public void finish() { |
215 |
// Checks all steps |
|
174 | 216 |
if (!updateFinishButton()) { |
175 | 217 |
return; |
176 | 218 |
} |
177 |
if (!isValid()) { |
|
219 |
|
|
220 |
// Checks that compilation is valid |
|
221 |
if (!isCompilationValid()) { |
|
178 | 222 |
swingManager.getWindowManager().showMessageDialog( |
179 | 223 |
this.getSwingComponent(), |
180 | 224 |
swingManager.getTranslation("thematic_map_compilation_editor"), |
... | ... | |
182 | 226 |
MESSAGE_DIALOG_TYPE.ERROR); |
183 | 227 |
return; |
184 | 228 |
} |
229 |
close(); |
|
185 | 230 |
this.listener.finished(this); |
186 |
close(); |
|
187 | 231 |
} |
188 | 232 |
|
233 |
/** |
|
234 |
* Cancels wizard |
|
235 |
*/ |
|
189 | 236 |
public void cancel() { |
237 |
close(); |
|
190 | 238 |
this.listener.canceled(this); |
191 |
close(); |
|
192 | 239 |
} |
193 | 240 |
|
241 |
/** |
|
242 |
* Close this panel |
|
243 |
*/ |
|
194 | 244 |
private void close() { |
195 | 245 |
this.setVisible(false); |
196 | 246 |
} |
197 | 247 |
|
248 |
/** {@inheridDoc} */ |
|
198 | 249 |
public void setListener(ThematicMapCompilationEditorListener listener) { |
199 | 250 |
this.listener = listener; |
200 | 251 |
} |
201 | 252 |
|
202 | 253 |
/** |
203 |
* |
|
254 |
* Checks all steps states |
|
255 |
* |
|
256 |
* @return true if all steps are ok |
|
204 | 257 |
*/ |
205 | 258 |
public boolean updateFinishButton() { |
206 | 259 |
if (!stepIdentification.isPanelDataOk()) { |
... | ... | |
219 | 272 |
return true; |
220 | 273 |
} |
221 | 274 |
|
275 |
/** {@inheridDoc} */ |
|
222 | 276 |
public void setWizardPanelActionListener( |
223 | 277 |
WizardPanelActionListener wizardActionListener) { |
224 |
// TODO Auto-generated method stub
|
|
278 |
// Nothing to do
|
|
225 | 279 |
|
226 | 280 |
} |
227 | 281 |
|
282 |
/** {@inheridDoc} */ |
|
228 | 283 |
public WizardPanelActionListener getWizardPanelActionListener() { |
229 | 284 |
return this; |
230 | 285 |
} |
231 | 286 |
|
287 |
/** {@inheridDoc} */ |
|
232 | 288 |
public void finish(WizardPanel wizardPanel) { |
233 | 289 |
finish(); |
234 | 290 |
|
235 | 291 |
} |
236 | 292 |
|
293 |
/** {@inheridDoc} */ |
|
237 | 294 |
public void cancel(WizardPanel wizardPanel) { |
238 | 295 |
cancel(); |
239 | 296 |
|
Also available in: Unified diff