Revision 976b9268
Added by Patrick Plitzner over 9 years ago
- added classification chooser to ABCD import wizard
.gitattributes | ||
---|---|---|
1257 | 1257 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractExcelImportWizard.java -text |
1258 | 1258 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractExportWizard.java -text |
1259 | 1259 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java -text |
1260 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ClassificationChooserWizardPage.java -text |
|
1260 | 1261 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvExportWizard.java -text |
1261 | 1262 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/DarwinCoreArchiveExportWizard.java -text |
1262 | 1263 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/EndnoteImportWizard.java -text |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportWizard.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
private Abcd206ImportConfigurator configurator; |
38 | 38 |
private ImportFromFileDataSourceWizardPage dataSourcePage; |
39 |
private ClassificationChooserWizardPage classificationChooserWizardPage; |
|
39 | 40 |
|
40 | 41 |
/* (non-Javadoc) |
41 | 42 |
* @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator() |
... | ... | |
61 | 62 |
} |
62 | 63 |
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE); |
63 | 64 |
|
65 |
if(classificationChooserWizardPage.getClassification()!=null){ |
|
66 |
configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid()); |
|
67 |
} |
|
68 |
|
|
64 | 69 |
CdmStore.getImportManager().run(configurator); |
65 | 70 |
return true; |
66 | 71 |
|
... | ... | |
84 | 89 |
public void addPages() { |
85 | 90 |
super.addPages(); |
86 | 91 |
|
92 |
classificationChooserWizardPage = ClassificationChooserWizardPage.createPage(); |
|
87 | 93 |
dataSourcePage = ImportFromFileDataSourceWizardPage.XML(); |
94 |
addPage(classificationChooserWizardPage); |
|
88 | 95 |
addPage(dataSourcePage); |
89 | 96 |
} |
90 | 97 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ClassificationChooserWizardPage.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2007 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
|
|
11 |
package eu.etaxonomy.taxeditor.io.wizard; |
|
12 |
|
|
13 |
import org.eclipse.jface.wizard.WizardPage; |
|
14 |
import org.eclipse.swt.SWT; |
|
15 |
import org.eclipse.swt.layout.GridData; |
|
16 |
import org.eclipse.swt.layout.GridLayout; |
|
17 |
import org.eclipse.swt.widgets.Button; |
|
18 |
import org.eclipse.swt.widgets.Composite; |
|
19 |
import org.eclipse.swt.widgets.Event; |
|
20 |
import org.eclipse.swt.widgets.Label; |
|
21 |
import org.eclipse.swt.widgets.Listener; |
|
22 |
import org.eclipse.swt.widgets.Text; |
|
23 |
import org.eclipse.wb.swt.ResourceManager; |
|
24 |
|
|
25 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
26 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory; |
|
27 |
|
|
28 |
/** |
|
29 |
* <p>ImportFromFileDataSourceWizardPage class.</p> |
|
30 |
* |
|
31 |
* @author n.hoffmann |
|
32 |
* @created 04.08.2009 |
|
33 |
* @version 1.0 |
|
34 |
*/ |
|
35 |
public class ClassificationChooserWizardPage extends WizardPage implements Listener{ |
|
36 |
|
|
37 |
public static final String PAGE_NAME = "ClassificationChooserWizardPage"; |
|
38 |
|
|
39 |
private Text textClassification; |
|
40 |
private Classification classification; |
|
41 |
private Button btnBrowseClassification; |
|
42 |
|
|
43 |
private Button btnClear; |
|
44 |
|
|
45 |
/** |
|
46 |
* <p>Constructor for ImportFromFileDataSourceWizardPage.</p> |
|
47 |
* |
|
48 |
* @param title a {@link java.lang.String} object. |
|
49 |
* @param description a {@link java.lang.String} object. |
|
50 |
* @param extensions an array of {@link java.lang.String} objects. |
|
51 |
*/ |
|
52 |
protected ClassificationChooserWizardPage(String title, String description) { |
|
53 |
super(PAGE_NAME); |
|
54 |
|
|
55 |
setTitle(title); |
|
56 |
|
|
57 |
setDescription(description); |
|
58 |
|
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* <p>XML</p> |
|
63 |
* |
|
64 |
* @return a {@link eu.etaxonomy.taxeditor.io.wizard.ClassificationChooserWizardPage} object. |
|
65 |
*/ |
|
66 |
protected static ClassificationChooserWizardPage createPage(){ |
|
67 |
return new ClassificationChooserWizardPage("Choose Classification", "Selecting no classification will create a default one."); |
|
68 |
} |
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
/* (non-Javadoc) |
|
73 |
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) |
|
74 |
*/ |
|
75 |
/** {@inheritDoc} */ |
|
76 |
@Override |
|
77 |
public void createControl(Composite parent) { |
|
78 |
final Composite composite = new Composite(parent, SWT.NULL); |
|
79 |
|
|
80 |
setPageComplete(false); |
|
81 |
|
|
82 |
GridLayout gridLayout = new GridLayout(); |
|
83 |
gridLayout.numColumns = 4; |
|
84 |
composite.setLayout(gridLayout); |
|
85 |
|
|
86 |
Label label = new Label(composite, SWT.NONE); |
|
87 |
label.setText("Classification"); |
|
88 |
textClassification = new Text(composite, SWT.NONE); |
|
89 |
textClassification.setEnabled(false); |
|
90 |
textClassification.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
|
91 |
btnBrowseClassification = new Button(composite, SWT.NONE); |
|
92 |
btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif")); |
|
93 |
btnBrowseClassification.addListener(SWT.Selection, this); |
|
94 |
btnClear = new Button(composite, SWT.NONE); |
|
95 |
btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif")); |
|
96 |
btnClear.addListener(SWT.Selection, this); |
|
97 |
|
|
98 |
setControl(composite); |
|
99 |
} |
|
100 |
|
|
101 |
/* (non-Javadoc) |
|
102 |
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) |
|
103 |
*/ |
|
104 |
@Override |
|
105 |
public void handleEvent(Event event) { |
|
106 |
if(event.widget==btnBrowseClassification){ |
|
107 |
classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class, getShell(), null, null); |
|
108 |
if(classification!=null){ |
|
109 |
textClassification.setText(classification.getTitleCache()); |
|
110 |
} |
|
111 |
} |
|
112 |
else if(event.widget==btnClear){ |
|
113 |
classification = null; |
|
114 |
textClassification.setText(""); |
|
115 |
} |
|
116 |
} |
|
117 |
|
|
118 |
|
|
119 |
/** |
|
120 |
* @return the classification |
|
121 |
*/ |
|
122 |
public Classification getClassification() { |
|
123 |
return classification; |
|
124 |
} |
|
125 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/NomenclaturalCodeWizardPage.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
34 | 34 |
* @version 1.0 |
35 | 35 |
*/ |
36 | 36 |
public class NomenclaturalCodeWizardPage extends WizardPage { |
37 |
|
|
38 |
private IImportConfigurator configurator; |
|
37 |
|
|
38 |
private static final Logger logger = Logger.getLogger(NomenclaturalCodeWizardPage.class); |
|
39 |
|
|
40 |
private IImportConfigurator configurator; |
|
39 | 41 |
|
40 | 42 |
/** |
41 | 43 |
* <p>Constructor for NomenclaturalCodeWizardPage.</p> |
42 | 44 |
*/ |
43 | 45 |
public NomenclaturalCodeWizardPage() { |
44 | 46 |
super("Choose nomenclatural code"); |
45 |
|
|
47 |
|
|
46 | 48 |
this.setTitle("Choose nomenclatural code"); |
47 |
|
|
49 |
|
|
48 | 50 |
this.setDescription("Choose which code to use for imported names."); |
49 | 51 |
} |
50 | 52 |
|
... | ... | |
58 | 60 |
this.configurator = configurator; |
59 | 61 |
} |
60 | 62 |
|
61 |
private static final Logger logger = Logger |
|
62 |
.getLogger(NomenclaturalCodeWizardPage.class); |
|
63 | 63 |
|
64 | 64 |
/* (non-Javadoc) |
65 | 65 |
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) |
66 | 66 |
*/ |
67 | 67 |
/** {@inheritDoc} */ |
68 |
public void createControl(Composite parent) { |
|
68 |
@Override |
|
69 |
public void createControl(Composite parent) { |
|
69 | 70 |
Composite container = new Composite(parent, SWT.NULL); |
70 | 71 |
container.setLayout(new FillLayout()); |
71 |
|
|
72 |
|
|
72 | 73 |
final Group group = new Group(container, SWT.NONE); |
73 | 74 |
group.setLayout(new GridLayout()); |
74 |
|
|
75 |
|
|
75 | 76 |
NomenclaturalCode preferredCode = PreferencesUtil.getPreferredNomenclaturalCode(); |
76 |
|
|
77 |
|
|
77 | 78 |
// set preferred code as default |
78 | 79 |
configurator.setNomenclaturalCode(preferredCode); |
79 |
|
|
80 |
|
|
80 | 81 |
for (final NomenclaturalCode code : NomenclaturalCodeHelper.getSupportedCodes()) { |
81 | 82 |
Button button = new Button(group, SWT.RADIO); |
82 | 83 |
button.setText(NomenclaturalCodeHelper.getDescription(code)); |
83 | 84 |
button.setData(code); |
84 | 85 |
button.setSelection(preferredCode.equals(code)); |
85 | 86 |
button.addSelectionListener(new SelectionAdapter() { |
86 |
public void widgetSelected(SelectionEvent e) { |
|
87 |
@Override |
|
88 |
public void widgetSelected(SelectionEvent e) { |
|
87 | 89 |
configurator.setNomenclaturalCode((NomenclaturalCode) e.widget.getData()); |
88 | 90 |
} |
89 | 91 |
}); |
90 |
} |
|
91 |
|
|
92 |
} |
|
93 |
|
|
94 |
|
|
92 | 95 |
setControl(container); |
93 | 96 |
} |
97 |
|
|
98 |
|
|
94 | 99 |
} |
Also available in: Unified diff