Revision e75532a6
Added by Katja Luther almost 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExportToFileDestinationWizardPage.java | ||
---|---|---|
61 | 61 |
public static final String SDD_EXPORT = "SDD_EXPORT"; |
62 | 62 |
|
63 | 63 |
public static final String DWCA_EXPORT = "DWCA_EXPORT"; |
64 |
public static final String OUTPUT_MODEL_EXPORT = "OUTPUT_MODEL_EXPORT";
|
|
64 |
public static final String OUTPUT_MODEL_EXPORT = "CDM_LIGHT(CSV)";
|
|
65 | 65 |
public static final String CSV_EXPORT = "CSV_EXPORT"; |
66 | 66 |
public static final String CSV_NAME_EXPORT = "CSV_NAME_EXPORT"; |
67 |
private static final String CSV_PRINT_EXPORT ="CSV_PRINT_EXPORT"; |
|
67 | 68 |
|
68 | 69 |
public static final String XML = "xml"; |
69 | 70 |
|
... | ... | |
73 | 74 |
|
74 | 75 |
public static final String ZIP = "zip"; |
75 | 76 |
|
76 |
private static boolean csvExport = false;
|
|
77 |
private boolean csvExport = false; |
|
77 | 78 |
|
78 |
private static boolean csvNameExport = false;
|
|
79 |
private boolean csvNameExport = false; |
|
79 | 80 |
|
80 |
private static String CSV_PRINT_EXPORT ="CSV_PRINT_EXPORT"; |
|
81 |
|
|
81 | 82 |
|
82 |
private static boolean csvPrintExport = false;
|
|
83 |
private boolean csvPrintExport = false; |
|
83 | 84 |
|
84 |
private static boolean outputModelExport = false;
|
|
85 |
private boolean outputModelExport = false; |
|
85 | 86 |
|
86 | 87 |
private DirectoryDialog folderDialog; |
87 | 88 |
private Text text_exportFileName; |
... | ... | |
107 | 108 |
super(pageName); |
108 | 109 |
|
109 | 110 |
this.type = type; |
111 |
switch(type) { |
|
112 |
case CSV_EXPORT : |
|
113 |
csvExport = true; |
|
114 |
break; |
|
115 |
case CSV_NAME_EXPORT: |
|
116 |
csvNameExport = true; |
|
117 |
break; |
|
118 |
case OUTPUT_MODEL_EXPORT: |
|
119 |
outputModelExport = true; |
|
120 |
break; |
|
121 |
case CSV_PRINT_EXPORT: |
|
122 |
csvPrintExport = true; |
|
123 |
break; |
|
124 |
|
|
125 |
} |
|
110 | 126 |
this.extension = extension; |
111 | 127 |
this.setTitle(title); |
112 | 128 |
this.setDescription(description); |
... | ... | |
172 | 188 |
public static ExportToFileDestinationWizardPage Dwca() { |
173 | 189 |
return new ExportToFileDestinationWizardPage( |
174 | 190 |
DWCA_EXPORT, |
175 |
"dwca",
|
|
191 |
DWCA_EXPORT,
|
|
176 | 192 |
"DwC-Archive Export", |
177 | 193 |
"Export the contents of the currently selected database into Darwin Core Archive format.", |
178 | 194 |
ZIP); |
... | ... | |
182 | 198 |
* @return |
183 | 199 |
*/ |
184 | 200 |
public static ExportToFileDestinationWizardPage OutputModel() { |
185 |
outputModelExport = true; |
|
201 |
|
|
186 | 202 |
return new ExportToFileDestinationWizardPage( |
187 | 203 |
OUTPUT_MODEL_EXPORT, |
188 |
"output model",
|
|
204 |
OUTPUT_MODEL_EXPORT,
|
|
189 | 205 |
"Output Model Export", |
190 | 206 |
"Export the contents of the currently selected database into the output model format.", |
191 | 207 |
CSV); |
... | ... | |
196 | 212 |
* @return |
197 | 213 |
*/ |
198 | 214 |
public static ExportToFileDestinationWizardPage Csv() { |
199 |
csvExport = true; |
|
215 |
|
|
200 | 216 |
return new ExportToFileDestinationWizardPage( |
201 | 217 |
CSV_EXPORT, |
202 |
"csv",
|
|
218 |
CSV_EXPORT,
|
|
203 | 219 |
"CSV Export", |
204 | 220 |
"Export the contents of the currently selected database into Comma Separated Value format.", |
205 | 221 |
CSV); |
... | ... | |
209 | 225 |
* @return |
210 | 226 |
*/ |
211 | 227 |
public static ExportToFileDestinationWizardPage CsvNames() { |
212 |
csvNameExport = true; |
|
228 |
|
|
213 | 229 |
return new ExportToFileDestinationWizardPage( |
214 | 230 |
CSV_NAME_EXPORT, |
215 |
"csvNames",
|
|
231 |
CSV_NAME_EXPORT,
|
|
216 | 232 |
"CSV Name Export", |
217 | 233 |
"Export the names of the currently selected database into Semicolon Separated Value format.", |
218 | 234 |
CSV); |
... | ... | |
222 | 238 |
* @return |
223 | 239 |
*/ |
224 | 240 |
public static ExportToFileDestinationWizardPage CsvPrint() { |
225 |
csvPrintExport = true; |
|
241 |
|
|
226 | 242 |
return new ExportToFileDestinationWizardPage( |
227 | 243 |
CSV_PRINT_EXPORT, |
228 |
"csvPrint",
|
|
244 |
CSV_NAME_EXPORT,
|
|
229 | 245 |
"CSV Print Export", |
230 | 246 |
"Export the content of the currently selected database into Semicolon Separated Value format.", |
231 | 247 |
CSV); |
... | ... | |
246 | 262 |
|
247 | 263 |
Composite composite = new Composite(parent, SWT.NONE); |
248 | 264 |
GridLayout gridLayout = new GridLayout(); |
249 |
gridLayout.numColumns = 3; |
|
265 |
|
|
266 |
gridLayout.numColumns = 2; |
|
267 |
|
|
268 |
|
|
250 | 269 |
composite.setLayout(gridLayout); |
251 | 270 |
if(classifications == null){ |
252 | 271 |
classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null); |
... | ... | |
269 | 288 |
} |
270 | 289 |
|
271 | 290 |
|
272 |
if(csvExport || csvPrintExport || outputModelExport){ |
|
273 |
Label comboBoxLabel = new Label(composite, SWT.NONE); |
|
274 |
comboBoxLabel.setText("Classification"); |
|
291 |
if(csvExport || csvPrintExport || outputModelExport|| csvNameExport){
|
|
292 |
// Label comboBoxLabel = new Label(composite, SWT.NONE);
|
|
293 |
// comboBoxLabel.setText("Classification");
|
|
275 | 294 |
|
276 | 295 |
createClassificationSelectionCombo(composite); |
277 | 296 |
classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, |
... | ... | |
283 | 302 |
text_exportFileName = new Text(composite, SWT.BORDER); |
284 | 303 |
text_exportFileName.setText(generateFilename()); |
285 | 304 |
text_exportFileName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, |
286 |
true, false, 2, 1));
|
|
305 |
true, false)); |
|
287 | 306 |
} |
288 | 307 |
|
289 | 308 |
Label folderLabel = new Label(composite, SWT.NONE); |
290 |
folderLabel.setText("Folder"); |
|
291 |
|
|
309 |
folderLabel.setText("Select Folder for exported files"); |
|
310 |
folderLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, |
|
311 |
true, false, 2, 1)); |
|
292 | 312 |
folderDialog = new DirectoryDialog(parent.getShell()); |
293 | 313 |
|
294 | 314 |
text_folder = new Text(composite, SWT.BORDER); |
... | ... | |
366 | 386 |
return text_folder.getText(); |
367 | 387 |
} |
368 | 388 |
|
369 |
private Control createClassificationSelectionCombo(Composite parent){
|
|
389 |
private void createClassificationSelectionCombo(Composite parent){
|
|
370 | 390 |
// classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null); |
371 | 391 |
|
372 |
Composite classificationSelection = new Composite(parent, SWT.NULL); |
|
373 |
classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
|
|
392 |
// Composite classificationSelection = new Composite(parent, SWT.NULL);
|
|
393 |
// classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
|
|
374 | 394 |
|
375 |
GridLayout layout = new GridLayout(); |
|
376 |
classificationSelection.setLayout(layout); |
|
395 |
// GridLayout layout = new GridLayout();
|
|
396 |
// classificationSelection.setLayout(layout);
|
|
377 | 397 |
|
378 |
Label label = new Label(classificationSelection, SWT.NULL);
|
|
398 |
Label label = new Label(parent, SWT.NULL);
|
|
379 | 399 |
// TODO not working is not really true but leave it here to remind everyone that this is under construction |
380 | 400 |
label.setText("Select Classification"); |
381 |
classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY); |
|
382 |
classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true)); |
|
401 |
|
|
402 |
classificationSelectionCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY); |
|
403 |
classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 2,1)); |
|
383 | 404 |
|
384 | 405 |
for(Classification tree : classifications){ |
385 | 406 |
classificationSelectionCombo.add(tree.getName().getText(), classifications.indexOf(tree)); |
... | ... | |
393 | 414 |
|
394 | 415 |
|
395 | 416 |
|
396 |
return classificationSelection; |
|
417 |
//return classificationSelection;
|
|
397 | 418 |
} |
398 | 419 |
|
399 | 420 |
public Combo getCombo(){ |
Also available in: Unified diff
smaller changes in wizard for file export