2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents 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.
10 package eu
.etaxonomy
.taxeditor
.io
.wizard
;
12 import org
.eclipse
.jface
.wizard
.WizardPage
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.layout
.GridData
;
15 import org
.eclipse
.swt
.layout
.GridLayout
;
16 import org
.eclipse
.swt
.widgets
.Button
;
17 import org
.eclipse
.swt
.widgets
.Composite
;
18 import org
.eclipse
.swt
.widgets
.Event
;
19 import org
.eclipse
.swt
.widgets
.Label
;
20 import org
.eclipse
.swt
.widgets
.Listener
;
21 import org
.eclipse
.swt
.widgets
.Text
;
22 import org
.eclipse
.wb
.swt
.ResourceManager
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
25 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.selection
.SelectionDialogFactory
;
28 * <p>ImportFromFileDataSourceWizardPage class.</p>
34 public class ClassificationChooserWizardPage
extends WizardPage
implements Listener
{
36 public static final String PAGE_NAME
= "ClassificationChooserWizardPage";
39 private Text textClassification
;
40 private Classification classification
;
41 private Button btnBrowseClassification
;
43 private Button btnClear
;
45 protected ClassificationChooserWizardPage(String title
, String description
) {
50 setDescription(description
);
54 public static ClassificationChooserWizardPage
createPage(){
55 return new ClassificationChooserWizardPage("Configure import destinations", "Note: Selecting no classification will create a default one.");
62 public void createControl(Composite parent
) {
63 final Composite composite
= new Composite(parent
, SWT
.NULL
);
65 GridLayout gridLayout
= new GridLayout();
66 gridLayout
.numColumns
= 4;
67 composite
.setLayout(gridLayout
);
70 Label label
= new Label(composite
, SWT
.NONE
);
71 label
.setText("Classification");
72 textClassification
= new Text(composite
, SWT
.NONE
);
73 textClassification
.setEnabled(false);
74 textClassification
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
75 btnBrowseClassification
= new Button(composite
, SWT
.NONE
);
76 btnBrowseClassification
.setImage(ResourceManager
.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
77 btnBrowseClassification
.addListener(SWT
.Selection
, this);
78 btnClear
= new Button(composite
, SWT
.NONE
);
79 btnClear
.setImage(ResourceManager
.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
80 btnClear
.addListener(SWT
.Selection
, this);
82 setControl(composite
);
86 public void handleEvent(Event event
) {
87 if(event
.widget
==btnBrowseClassification
){
88 classification
= SelectionDialogFactory
.getSelectionFromDialog(Classification
.class, getShell(), null, null);
89 if(classification
!=null){
90 textClassification
.setText(classification
.getTitleCache());
93 else if(event
.widget
==btnClear
){
94 classification
= null;
95 textClassification
.setText("");
100 * @return the classification
102 public Classification
getClassification() {
103 return classification
;