3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.io
.wizard
;
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
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
26 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
.SelectionDialogFactory
;
29 * <p>ImportFromFileDataSourceWizardPage class.</p>
35 public class ClassificationChooserWizardPage
extends WizardPage
implements Listener
{
37 public static final String PAGE_NAME
= "ClassificationChooserWizardPage";
40 private Text textClassification
;
41 private Classification classification
;
42 private Button btnBrowseClassification
;
44 private Button btnClear
;
46 protected ClassificationChooserWizardPage(String title
, String description
) {
51 setDescription(description
);
55 public static ClassificationChooserWizardPage
createPage(){
56 return new ClassificationChooserWizardPage("Configure import destinations", "Note: Selecting no classification will create a default one.");
63 public void createControl(Composite parent
) {
64 final Composite composite
= new Composite(parent
, SWT
.NULL
);
66 GridLayout gridLayout
= new GridLayout();
67 gridLayout
.numColumns
= 4;
68 composite
.setLayout(gridLayout
);
71 Label label
= new Label(composite
, SWT
.NONE
);
72 label
.setText("Classification");
73 textClassification
= new Text(composite
, SWT
.NONE
);
74 textClassification
.setEnabled(false);
75 textClassification
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
76 btnBrowseClassification
= new Button(composite
, SWT
.NONE
);
77 btnBrowseClassification
.setImage(ResourceManager
.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
78 btnBrowseClassification
.addListener(SWT
.Selection
, this);
79 btnClear
= new Button(composite
, SWT
.NONE
);
80 btnClear
.setImage(ResourceManager
.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
81 btnClear
.addListener(SWT
.Selection
, this);
83 setControl(composite
);
87 public void handleEvent(Event event
) {
88 if(event
.widget
==btnBrowseClassification
){
89 classification
= SelectionDialogFactory
.getSelectionFromDialog(Classification
.class, getShell(), null, null);
90 if(classification
!=null){
91 textClassification
.setText(classification
.getTitleCache());
94 else if(event
.widget
==btnClear
){
95 classification
= null;
96 textClassification
.setText("");
101 * @return the classification
103 public Classification
getClassification() {
104 return classification
;