From: Patric Plitzner Date: Fri, 16 Jan 2015 10:04:13 +0000 (+0000) Subject: - added classification chooser to ABCD import wizard X-Git-Tag: 3.6.0~256 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/976b9268b2d656e0465030ca52a0f1109da18c39 - added classification chooser to ABCD import wizard --- diff --git a/.gitattributes b/.gitattributes index 2a80b2c02..9380ea51f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1257,6 +1257,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/Abst eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractExcelImportWizard.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractExportWizard.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java -text +eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ClassificationChooserWizardPage.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvExportWizard.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/DarwinCoreArchiveExportWizard.java -text eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/EndnoteImportWizard.java -text diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportWizard.java index c2975144f..275c39d3d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportWizard.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportWizard.java @@ -36,6 +36,7 @@ public class AbcdImportWizard extends AbstractImportWizardImportFromFileDataSourceWizardPage class.

+ * + * @author n.hoffmann + * @created 04.08.2009 + * @version 1.0 + */ +public class ClassificationChooserWizardPage extends WizardPage implements Listener{ + + public static final String PAGE_NAME = "ClassificationChooserWizardPage"; + + private Text textClassification; + private Classification classification; + private Button btnBrowseClassification; + + private Button btnClear; + + /** + *

Constructor for ImportFromFileDataSourceWizardPage.

+ * + * @param title a {@link java.lang.String} object. + * @param description a {@link java.lang.String} object. + * @param extensions an array of {@link java.lang.String} objects. + */ + protected ClassificationChooserWizardPage(String title, String description) { + super(PAGE_NAME); + + setTitle(title); + + setDescription(description); + + } + + /** + *

XML

+ * + * @return a {@link eu.etaxonomy.taxeditor.io.wizard.ClassificationChooserWizardPage} object. + */ + protected static ClassificationChooserWizardPage createPage(){ + return new ClassificationChooserWizardPage("Choose Classification", "Selecting no classification will create a default one."); + } + + + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) + */ + /** {@inheritDoc} */ + @Override + public void createControl(Composite parent) { + final Composite composite = new Composite(parent, SWT.NULL); + + setPageComplete(false); + + GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 4; + composite.setLayout(gridLayout); + + Label label = new Label(composite, SWT.NONE); + label.setText("Classification"); + textClassification = new Text(composite, SWT.NONE); + textClassification.setEnabled(false); + textClassification.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + btnBrowseClassification = new Button(composite, SWT.NONE); + btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif")); + btnBrowseClassification.addListener(SWT.Selection, this); + btnClear = new Button(composite, SWT.NONE); + btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif")); + btnClear.addListener(SWT.Selection, this); + + setControl(composite); + } + + /* (non-Javadoc) + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) + */ + @Override + public void handleEvent(Event event) { + if(event.widget==btnBrowseClassification){ + classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class, getShell(), null, null); + if(classification!=null){ + textClassification.setText(classification.getTitleCache()); + } + } + else if(event.widget==btnClear){ + classification = null; + textClassification.setText(""); + } + } + + + /** + * @return the classification + */ + public Classification getClassification() { + return classification; + } +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/NomenclaturalCodeWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/NomenclaturalCodeWizardPage.java index 361fcaf63..af287cab1 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/NomenclaturalCodeWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/NomenclaturalCodeWizardPage.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -34,17 +34,19 @@ import eu.etaxonomy.taxeditor.preference.PreferencesUtil; * @version 1.0 */ public class NomenclaturalCodeWizardPage extends WizardPage { - - private IImportConfigurator configurator; + + private static final Logger logger = Logger.getLogger(NomenclaturalCodeWizardPage.class); + + private IImportConfigurator configurator; /** *

Constructor for NomenclaturalCodeWizardPage.

*/ public NomenclaturalCodeWizardPage() { super("Choose nomenclatural code"); - + this.setTitle("Choose nomenclatural code"); - + this.setDescription("Choose which code to use for imported names."); } @@ -58,37 +60,40 @@ public class NomenclaturalCodeWizardPage extends WizardPage { this.configurator = configurator; } - private static final Logger logger = Logger - .getLogger(NomenclaturalCodeWizardPage.class); /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ /** {@inheritDoc} */ - public void createControl(Composite parent) { + @Override + public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new FillLayout()); - + final Group group = new Group(container, SWT.NONE); group.setLayout(new GridLayout()); - + NomenclaturalCode preferredCode = PreferencesUtil.getPreferredNomenclaturalCode(); - + // set preferred code as default configurator.setNomenclaturalCode(preferredCode); - + for (final NomenclaturalCode code : NomenclaturalCodeHelper.getSupportedCodes()) { Button button = new Button(group, SWT.RADIO); button.setText(NomenclaturalCodeHelper.getDescription(code)); button.setData(code); button.setSelection(preferredCode.equals(code)); button.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { configurator.setNomenclaturalCode((NomenclaturalCode) e.widget.getData()); } }); - } - + } + + setControl(container); } + + }