1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The content of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.io.wizard;
|
11
|
|
12
|
import java.text.SimpleDateFormat;
|
13
|
import java.util.Calendar;
|
14
|
import java.util.Collections;
|
15
|
import java.util.Comparator;
|
16
|
import java.util.HashSet;
|
17
|
import java.util.List;
|
18
|
import java.util.Set;
|
19
|
import java.util.UUID;
|
20
|
|
21
|
import org.eclipse.jface.layout.GridLayoutFactory;
|
22
|
import org.eclipse.jface.wizard.WizardPage;
|
23
|
import org.eclipse.swt.SWT;
|
24
|
import org.eclipse.swt.events.SelectionAdapter;
|
25
|
import org.eclipse.swt.events.SelectionEvent;
|
26
|
import org.eclipse.swt.events.SelectionListener;
|
27
|
import org.eclipse.swt.layout.GridData;
|
28
|
import org.eclipse.swt.layout.GridLayout;
|
29
|
import org.eclipse.swt.widgets.Button;
|
30
|
import org.eclipse.swt.widgets.Combo;
|
31
|
import org.eclipse.swt.widgets.Composite;
|
32
|
import org.eclipse.swt.widgets.DirectoryDialog;
|
33
|
import org.eclipse.swt.widgets.Event;
|
34
|
import org.eclipse.swt.widgets.Label;
|
35
|
import org.eclipse.swt.widgets.Listener;
|
36
|
import org.eclipse.swt.widgets.Text;
|
37
|
|
38
|
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
|
39
|
import eu.etaxonomy.cdm.api.service.IClassificationService;
|
40
|
import eu.etaxonomy.cdm.filter.LogicFilter;
|
41
|
import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
|
42
|
import eu.etaxonomy.cdm.io.common.ExportConfiguratorBase;
|
43
|
import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
|
44
|
import eu.etaxonomy.cdm.io.csv.redlist.demo.CsvDemoExportConfigurator;
|
45
|
import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
|
46
|
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
|
47
|
import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
|
48
|
import eu.etaxonomy.cdm.io.tcsxml.out.TcsXmlExportConfigurator;
|
49
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
50
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
51
|
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDtoByNameComparator;
|
52
|
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDtoByRankAndNameComparator;
|
53
|
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDtoNaturalComparator;
|
54
|
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
|
55
|
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
|
56
|
import eu.etaxonomy.taxeditor.preference.NavigatorOrderEnum;
|
57
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
58
|
import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSourceException;
|
59
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
60
|
|
61
|
/**
|
62
|
* <p>
|
63
|
* ExportToFileDestinationWizardPage class.
|
64
|
* </p>
|
65
|
*
|
66
|
* @author n.hoffmann
|
67
|
* @created 15.06.2009
|
68
|
* @version 1.0
|
69
|
*/
|
70
|
public class ExportToFileDestinationWizardPage extends WizardPage implements SelectionListener {
|
71
|
|
72
|
/** Constant <code>DATE_FORMAT_NOW="yyyyMMddHHmm"</code> */
|
73
|
public static final String DATE_FORMAT_NOW = "yyyyMMddHHmm";
|
74
|
|
75
|
/** Constant <code>JAXB_EXPORT="JAXB_EXPORT"</code> */
|
76
|
public static final String JAXB_EXPORT = "JAXB_EXPORT";
|
77
|
|
78
|
/** Constant <code>TCS_EXPORT="TCS_EXPORT"</code> */
|
79
|
public static final String TCS_EXPORT = "TCS_EXPORT";
|
80
|
|
81
|
/** Constant <code>SDD_EXPORT="SDD_EXPORT"</code> */
|
82
|
public static final String SDD_EXPORT = "SDD_EXPORT";
|
83
|
|
84
|
public static final String DWCA_EXPORT = "DWCA_EXPORT";
|
85
|
public static final String OUTPUT_MODEL_EXPORT = "CDM_LIGHT(CSV)";
|
86
|
public static final String CSV_EXPORT = "CSV_EXPORT";
|
87
|
public static final String CSV_NAME_EXPORT = "CSV_NAME_EXPORT";
|
88
|
private static final String CSV_PRINT_EXPORT ="CSV_PRINT_EXPORT";
|
89
|
private static final String EXPORT_FOLDER ="EXPORT_FOLDER";
|
90
|
public static final String XML = "xml";
|
91
|
|
92
|
public static final String CSV = "csv";
|
93
|
|
94
|
public static final String ZIP = "zip";
|
95
|
|
96
|
private boolean csvExport = false;
|
97
|
|
98
|
private boolean csvNameExport = false;
|
99
|
|
100
|
private boolean csvPrintExport = false;
|
101
|
|
102
|
private boolean outputModelExport = false;
|
103
|
private boolean dwcaExport = false;
|
104
|
|
105
|
private DirectoryDialog folderDialog;
|
106
|
private Text text_exportFileName;
|
107
|
|
108
|
private Text text_folder;
|
109
|
|
110
|
private final String type;
|
111
|
|
112
|
private final String extension;
|
113
|
|
114
|
private Combo classificationSelectionCombo;
|
115
|
|
116
|
private List<Classification> classifications;
|
117
|
|
118
|
private Classification selectedClassification;
|
119
|
|
120
|
private Label classificationLabel;
|
121
|
|
122
|
private ExportConfiguratorBase configurator;
|
123
|
private Button checkUseSelectedtaxonNode;
|
124
|
|
125
|
private Button checkUseSelectedClassification;
|
126
|
private Button checkUseAllClassification;
|
127
|
|
128
|
private Button checkExportUnpublished;
|
129
|
Combo orderSelectionCombo;
|
130
|
|
131
|
|
132
|
protected ExportToFileDestinationWizardPage(String pageName, String type,
|
133
|
String title, String description, String extension, ExportConfiguratorBase configurator) {
|
134
|
super(pageName);
|
135
|
this.configurator = configurator;
|
136
|
this.type = type;
|
137
|
switch(type) {
|
138
|
case CSV_EXPORT :
|
139
|
csvExport = true;
|
140
|
break;
|
141
|
case CSV_NAME_EXPORT:
|
142
|
csvNameExport = true;
|
143
|
break;
|
144
|
case OUTPUT_MODEL_EXPORT:
|
145
|
outputModelExport = true;
|
146
|
break;
|
147
|
case CSV_PRINT_EXPORT:
|
148
|
csvPrintExport = true;
|
149
|
break;
|
150
|
case DWCA_EXPORT:
|
151
|
dwcaExport = true;
|
152
|
break;
|
153
|
|
154
|
}
|
155
|
this.extension = extension;
|
156
|
this.setTitle(title);
|
157
|
this.setDescription(description);
|
158
|
}
|
159
|
|
160
|
public static ExportToFileDestinationWizardPage Jaxb(JaxbExportConfigurator configurator) {
|
161
|
return new ExportToFileDestinationWizardPage(
|
162
|
JAXB_EXPORT,
|
163
|
"jaxb",
|
164
|
"JAXB Export",
|
165
|
"Exports the content of the currently selected database into the cdm jaxb format.",
|
166
|
XML, configurator);
|
167
|
}
|
168
|
|
169
|
public static ExportToFileDestinationWizardPage Tcs(TcsXmlExportConfigurator config) {
|
170
|
return new ExportToFileDestinationWizardPage(
|
171
|
TCS_EXPORT,
|
172
|
"tcs",
|
173
|
"Tcs Export",
|
174
|
"Export the content of the currently selected database into TCS format.",
|
175
|
XML, config);
|
176
|
}
|
177
|
|
178
|
public static ExportToFileDestinationWizardPage Sdd(SDDExportConfigurator config) {
|
179
|
return new ExportToFileDestinationWizardPage(
|
180
|
SDD_EXPORT,
|
181
|
"sdd",
|
182
|
"Sdd Export",
|
183
|
"Export the content of the currently selected database into SDD format.",
|
184
|
XML, config);
|
185
|
}
|
186
|
|
187
|
public static ExportToFileDestinationWizardPage Dwca(DwcaTaxExportConfigurator config) {
|
188
|
return new ExportToFileDestinationWizardPage(
|
189
|
DWCA_EXPORT,
|
190
|
DWCA_EXPORT,
|
191
|
"DwC-Archive Export",
|
192
|
"Export the content of the currently selected database into Darwin Core Archive format.",
|
193
|
ZIP, config);
|
194
|
}
|
195
|
|
196
|
public static ExportToFileDestinationWizardPage OutputModel(CdmLightExportConfigurator config) {
|
197
|
|
198
|
return new ExportToFileDestinationWizardPage(
|
199
|
OUTPUT_MODEL_EXPORT,
|
200
|
OUTPUT_MODEL_EXPORT,
|
201
|
"CDM Light Export (csv)",
|
202
|
"Export the content of the currently selected database into the CDM light (csv) format.",
|
203
|
CSV,config);
|
204
|
}
|
205
|
|
206
|
public static ExportToFileDestinationWizardPage Csv(CsvDemoExportConfigurator config) {
|
207
|
|
208
|
return new ExportToFileDestinationWizardPage(
|
209
|
CSV_EXPORT,
|
210
|
CSV_EXPORT,
|
211
|
"CSV Export",
|
212
|
"Export the content of the currently selected database into Comma Separated Value format.",
|
213
|
CSV, config);
|
214
|
}
|
215
|
|
216
|
public static ExportToFileDestinationWizardPage CsvNames(CsvNameExportConfigurator config) {
|
217
|
|
218
|
return new ExportToFileDestinationWizardPage(
|
219
|
CSV_NAME_EXPORT,
|
220
|
CSV_NAME_EXPORT,
|
221
|
"CSV Name Export",
|
222
|
"Export the names of the currently selected database into Semicolon Separated Value format.",
|
223
|
CSV, config);
|
224
|
}
|
225
|
|
226
|
public static ExportToFileDestinationWizardPage CsvPrint(CsvNameExportConfigurator config) {
|
227
|
|
228
|
return new ExportToFileDestinationWizardPage(
|
229
|
CSV_PRINT_EXPORT,
|
230
|
CSV_NAME_EXPORT,
|
231
|
"CSV Print Export",
|
232
|
"Export the content of the currently selected database into Semicolon Separated Value format.",
|
233
|
CSV, config);
|
234
|
}
|
235
|
|
236
|
/** {@inheritDoc} */
|
237
|
@Override
|
238
|
public void createControl(Composite parent) {
|
239
|
|
240
|
setPageComplete(false);
|
241
|
|
242
|
Composite composite = new Composite(parent, SWT.NONE);
|
243
|
GridLayout gridLayout = new GridLayout();
|
244
|
|
245
|
gridLayout.numColumns = 2;
|
246
|
TaxonNode node = null;
|
247
|
|
248
|
composite.setLayout(gridLayout);
|
249
|
if (outputModelExport || dwcaExport){
|
250
|
checkExportUnpublished = new Button(composite, SWT.CHECK);
|
251
|
checkExportUnpublished.setText("Export unpublished taxa");
|
252
|
Label label = new Label(composite, SWT.NONE);
|
253
|
|
254
|
Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
|
255
|
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
|
256
|
gridData.horizontalSpan = 2;
|
257
|
separator.setLayoutData(gridData);
|
258
|
}
|
259
|
if(classifications == null){
|
260
|
classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
|
261
|
Collections.sort(classifications, new Comparator<Classification>() {
|
262
|
|
263
|
@Override
|
264
|
public int compare(Classification o1, Classification o2) {
|
265
|
if (o1.equals(o2)){
|
266
|
return 0;
|
267
|
}
|
268
|
int result = o1.getTitleCache().compareTo(o2.getTitleCache());
|
269
|
if (result == 0){
|
270
|
return o1.getUuid().compareTo(o2.getUuid());
|
271
|
}
|
272
|
return result;
|
273
|
}
|
274
|
});
|
275
|
if (!configurator.getTaxonNodeFilter().getClassificationFilter().isEmpty()){
|
276
|
selectedClassification = CdmStore.getService(IClassificationService.class).load(configurator.getTaxonNodeFilter().getClassificationFilter().get(0).getUuid());
|
277
|
}else{
|
278
|
|
279
|
selectedClassification = classifications.iterator().next();
|
280
|
}
|
281
|
}
|
282
|
|
283
|
|
284
|
if(csvExport || csvPrintExport || outputModelExport|| csvNameExport || dwcaExport){
|
285
|
|
286
|
// Label comboBoxLabel = new Label(composite, SWT.NONE);
|
287
|
// comboBoxLabel.setText("Classification");
|
288
|
Composite selectNodeOrClassification = new Composite(composite, SWT.NONE);
|
289
|
GridLayout grid = new GridLayout();
|
290
|
grid.numColumns = 1;
|
291
|
selectNodeOrClassification.setLayout(grid);
|
292
|
if ((outputModelExport || dwcaExport)&& !configurator.getTaxonNodeFilter().getSubtreeFilter().isEmpty()){
|
293
|
checkUseSelectedtaxonNode= new Button(selectNodeOrClassification, SWT.RADIO);
|
294
|
String taxonStr = "";
|
295
|
int count = configurator.getTaxonNodeFilter().getSubtreeFilter().size();
|
296
|
for (LogicFilter<TaxonNode> filter: configurator.getTaxonNodeFilter().getSubtreeFilter()){
|
297
|
node = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(filter.getUuid());
|
298
|
count--;
|
299
|
if (node.hasTaxon()){
|
300
|
taxonStr += node.getTaxon().getName().getTitleCache();
|
301
|
if (count>0){
|
302
|
taxonStr += ", ";
|
303
|
}
|
304
|
}
|
305
|
}
|
306
|
|
307
|
checkUseSelectedtaxonNode.setText("Export selected subtree(s) ("+ taxonStr+")");
|
308
|
checkUseSelectedtaxonNode.addListener(SWT.Selection, new Listener() {
|
309
|
@Override
|
310
|
public void handleEvent(Event e) {
|
311
|
Button b = (Button) e.widget;
|
312
|
GridData data = (GridData) classificationSelectionCombo.getLayoutData();
|
313
|
data.exclude = b.getSelection();
|
314
|
classificationSelectionCombo.setEnabled(!data.exclude);
|
315
|
|
316
|
}
|
317
|
});
|
318
|
checkUseSelectedtaxonNode.setSelection(true);
|
319
|
}
|
320
|
if(outputModelExport || dwcaExport){
|
321
|
if (dwcaExport){
|
322
|
checkUseAllClassification= new Button(selectNodeOrClassification, SWT.RADIO);
|
323
|
checkUseAllClassification.setText("Export all classifications");
|
324
|
checkUseAllClassification.addListener(SWT.Selection, new Listener() {
|
325
|
@Override
|
326
|
public void handleEvent(Event e) {
|
327
|
Button b = (Button) e.widget;
|
328
|
GridData data = (GridData) classificationSelectionCombo.getLayoutData();
|
329
|
data.exclude = b.getSelection();
|
330
|
classificationSelectionCombo.setEnabled(!data.exclude);
|
331
|
|
332
|
}
|
333
|
});
|
334
|
}
|
335
|
checkUseSelectedClassification= new Button(selectNodeOrClassification, SWT.RADIO);
|
336
|
checkUseSelectedClassification.setText("Export selected classification");
|
337
|
checkUseSelectedClassification.addListener(SWT.Selection, new Listener() {
|
338
|
@Override
|
339
|
public void handleEvent(Event e) {
|
340
|
Button b = (Button) e.widget;
|
341
|
GridData data = (GridData) classificationSelectionCombo.getLayoutData();
|
342
|
data.exclude = b.getSelection();
|
343
|
classificationSelectionCombo.setEnabled(data.exclude);
|
344
|
|
345
|
}
|
346
|
});
|
347
|
}
|
348
|
|
349
|
if (node!= null){
|
350
|
selectedClassification = node.getClassification();
|
351
|
}
|
352
|
createClassificationSelectionCombo(selectNodeOrClassification);
|
353
|
if (outputModelExport){
|
354
|
Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
|
355
|
GridData gridDataSep = new GridData();
|
356
|
gridDataSep = new GridData(GridData.BEGINNING, GridData.CENTER, true, true);
|
357
|
gridDataSep.horizontalSpan = 2;
|
358
|
separator.setLayoutData(gridDataSep);
|
359
|
|
360
|
Composite comp = new Composite(composite, SWT.NONE);
|
361
|
|
362
|
GridData gridData = new GridData();
|
363
|
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
364
|
gridData.horizontalSpan = 2;
|
365
|
comp.setLayoutData(gridData);
|
366
|
|
367
|
Label label = new Label(comp, SWT.NONE);
|
368
|
label.setText("Sorting of taxa");
|
369
|
|
370
|
orderSelectionCombo = new Combo(comp, SWT.BORDER| SWT.READ_ONLY);
|
371
|
|
372
|
GridLayoutFactory.fillDefaults().applyTo(comp);
|
373
|
for(NavigatorOrderEnum display: NavigatorOrderEnum.values()){
|
374
|
orderSelectionCombo.add(display.getLabel());
|
375
|
}
|
376
|
|
377
|
int index = 0;
|
378
|
if (PreferencesUtil.getStringValue(IPreferenceKeys.SORT_NODES) != null){
|
379
|
NavigatorOrderEnum orderInNavigator = NavigatorOrderEnum.valueOf(PreferencesUtil.getStringValue(IPreferenceKeys.SORT_NODES));
|
380
|
|
381
|
for (String itemLabel : orderSelectionCombo.getItems()){
|
382
|
if (itemLabel.equalsIgnoreCase(orderInNavigator.getLabel())){
|
383
|
orderSelectionCombo.select(index);
|
384
|
setComparatorToConfig();
|
385
|
break;
|
386
|
}
|
387
|
index++;
|
388
|
}
|
389
|
}
|
390
|
|
391
|
orderSelectionCombo.addSelectionListener(new SelectionListener() {
|
392
|
|
393
|
@Override
|
394
|
public void widgetSelected(SelectionEvent e) {
|
395
|
setComparatorToConfig();
|
396
|
}
|
397
|
|
398
|
@Override
|
399
|
public void widgetDefaultSelected(SelectionEvent e) {
|
400
|
// TODO Auto-generated method stub
|
401
|
|
402
|
}
|
403
|
});
|
404
|
|
405
|
}
|
406
|
|
407
|
|
408
|
if (checkUseSelectedtaxonNode != null){
|
409
|
|
410
|
if (checkUseSelectedtaxonNode.getSelection()){
|
411
|
classificationSelectionCombo.setEnabled(false);
|
412
|
}
|
413
|
}else{
|
414
|
classificationSelectionCombo.setEnabled(true);
|
415
|
classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
|
416
|
true, false, 2, 1));
|
417
|
}
|
418
|
Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
|
419
|
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
|
420
|
gridData.horizontalSpan = 2;
|
421
|
separator.setLayoutData(gridData);
|
422
|
|
423
|
}
|
424
|
|
425
|
Label folderLabel = new Label(composite, SWT.NONE);
|
426
|
folderLabel.setText("Select Folder for exported files");
|
427
|
folderLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
|
428
|
true, false, 2, 1));
|
429
|
folderDialog = new DirectoryDialog(parent.getShell());
|
430
|
folderDialog.setFilterPath(PreferencesUtil.getStringValue(EXPORT_FOLDER));
|
431
|
|
432
|
text_folder = new Text(composite, SWT.BORDER);
|
433
|
text_folder.setEditable(false);
|
434
|
text_folder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
|
435
|
false));
|
436
|
if (PreferencesUtil.getStringValue(EXPORT_FOLDER) != null){
|
437
|
text_folder.setText(PreferencesUtil.getStringValue(EXPORT_FOLDER));
|
438
|
setPageComplete(true);
|
439
|
}
|
440
|
|
441
|
Button button = new Button(composite, SWT.PUSH);
|
442
|
button.setText("Browse...");
|
443
|
|
444
|
button.addSelectionListener(new SelectionAdapter() {
|
445
|
@Override
|
446
|
public void widgetSelected(SelectionEvent e) {
|
447
|
super.widgetSelected(e);
|
448
|
|
449
|
String path = folderDialog.open();
|
450
|
if (path != null) { // a folder was selected
|
451
|
text_folder.setText(path);
|
452
|
PreferencesUtil.setStringValue(EXPORT_FOLDER, path);
|
453
|
setPageComplete(true);
|
454
|
}
|
455
|
}
|
456
|
});
|
457
|
if (!outputModelExport){
|
458
|
|
459
|
Label fileLabel = new Label(composite, SWT.NONE);
|
460
|
fileLabel.setText("File");
|
461
|
text_exportFileName = new Text(composite, SWT.BORDER);
|
462
|
text_exportFileName.setText(generateFilename());
|
463
|
text_exportFileName.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
|
464
|
true, false));
|
465
|
}
|
466
|
|
467
|
|
468
|
// make the composite the wizard pages control
|
469
|
setControl(composite);
|
470
|
}
|
471
|
|
472
|
protected void setComparatorToConfig() {
|
473
|
if (orderSelectionCombo.getText().equals(NavigatorOrderEnum.NaturalOrder.getLabel())){
|
474
|
((CdmLightExportConfigurator)configurator).setComparator(new TaxonNodeDtoNaturalComparator());
|
475
|
} else if (orderSelectionCombo.getText().equals(NavigatorOrderEnum.AlphabeticalOrder.getLabel())){
|
476
|
((CdmLightExportConfigurator)configurator).setComparator(new TaxonNodeDtoByNameComparator());
|
477
|
}else {
|
478
|
((CdmLightExportConfigurator)configurator).setComparator(new TaxonNodeDtoByRankAndNameComparator());
|
479
|
}
|
480
|
}
|
481
|
|
482
|
protected String generateFilename() {
|
483
|
StringBuffer buffer = new StringBuffer();
|
484
|
|
485
|
Calendar cal = Calendar.getInstance();
|
486
|
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
|
487
|
buffer.append(sdf.format(cal.getTime()));
|
488
|
|
489
|
buffer.append("-");
|
490
|
|
491
|
buffer.append(type + "_export-");
|
492
|
try {
|
493
|
buffer.append(CdmDataSourceRepository.getCurrentCdmSource());
|
494
|
} catch (CdmRemoteSourceException e) {
|
495
|
buffer.append("Unknown");
|
496
|
}
|
497
|
|
498
|
buffer.append(".");
|
499
|
buffer.append(extension);
|
500
|
|
501
|
return buffer.toString();
|
502
|
}
|
503
|
|
504
|
public String getExportFileName() {
|
505
|
return text_exportFileName.getText();
|
506
|
}
|
507
|
|
508
|
public String getFolderText() {
|
509
|
return text_folder.getText();
|
510
|
}
|
511
|
|
512
|
public Text getFolderComposite() {
|
513
|
return text_folder;
|
514
|
}
|
515
|
|
516
|
public boolean isExportUnpublishedData(){
|
517
|
return checkExportUnpublished.getSelection();
|
518
|
}
|
519
|
|
520
|
private void createClassificationSelectionCombo(Composite parent){
|
521
|
|
522
|
// Composite classificationSelection = new Composite(parent, SWT.NULL);
|
523
|
// classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
|
524
|
|
525
|
// GridLayout layout = new GridLayout();
|
526
|
// classificationSelection.setLayout(layout);
|
527
|
GridData gridData = new GridData();
|
528
|
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
529
|
gridData.horizontalIndent = 5;
|
530
|
// classificationSelection.setLayoutData(gridData);
|
531
|
|
532
|
classificationSelectionCombo = new Combo(parent, SWT.BORDER| SWT.READ_ONLY);
|
533
|
classificationSelectionCombo.setLayoutData(gridData);
|
534
|
for(Classification tree : classifications){
|
535
|
classificationSelectionCombo.add(tree.getName().getText(), classifications.indexOf(tree));
|
536
|
|
537
|
}
|
538
|
|
539
|
classificationSelectionCombo.select(classifications.indexOf(selectedClassification));
|
540
|
|
541
|
// TODO remember last selection
|
542
|
classificationSelectionCombo.addSelectionListener(this);
|
543
|
|
544
|
|
545
|
|
546
|
//return classificationSelection;
|
547
|
}
|
548
|
|
549
|
public Combo getCombo(){
|
550
|
return classificationSelectionCombo;
|
551
|
}
|
552
|
|
553
|
@Override
|
554
|
public void widgetSelected(SelectionEvent e) {
|
555
|
selectedClassification = classifications.get(classificationSelectionCombo.getSelectionIndex());
|
556
|
|
557
|
}
|
558
|
|
559
|
@Override
|
560
|
public void widgetDefaultSelected(SelectionEvent e) {
|
561
|
//not needed here
|
562
|
|
563
|
}
|
564
|
|
565
|
public UUID getSelectedClassificationUUID() {
|
566
|
|
567
|
return selectedClassification.getUuid();
|
568
|
}
|
569
|
|
570
|
public boolean getCheckUseSelectedTaxonNode() {
|
571
|
if (checkUseSelectedtaxonNode== null){
|
572
|
return false;
|
573
|
}
|
574
|
return checkUseSelectedtaxonNode.getSelection();
|
575
|
}
|
576
|
public boolean getCheckUseAllClassifications() {
|
577
|
if (checkUseAllClassification== null){
|
578
|
return false;
|
579
|
}
|
580
|
return checkUseAllClassification.getSelection();
|
581
|
}
|
582
|
|
583
|
public Set<UUID> getAllClassificationUuids(){
|
584
|
Set<UUID> allClassificationUuids = new HashSet();
|
585
|
for (Classification classification: this.classifications){
|
586
|
allClassificationUuids.add(classification.getUuid());
|
587
|
}
|
588
|
return allClassificationUuids;
|
589
|
}
|
590
|
|
591
|
@Override
|
592
|
public boolean canFlipToNextPage() {
|
593
|
return getFolderText() != null;
|
594
|
}
|
595
|
|
596
|
}
|