Project

General

Profile

Download (3.1 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
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.
8
*/
9

    
10
package eu.etaxonomy.taxeditor.io.e4.in.abcd;
11

    
12
import javax.inject.Inject;
13

    
14
import org.eclipse.jface.wizard.WizardPage;
15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.layout.GridData;
17
import org.eclipse.swt.layout.GridLayout;
18
import org.eclipse.swt.widgets.Button;
19
import org.eclipse.swt.widgets.Composite;
20
import org.eclipse.swt.widgets.Event;
21
import org.eclipse.swt.widgets.Label;
22
import org.eclipse.swt.widgets.Listener;
23
import org.eclipse.swt.widgets.Text;
24
import org.eclipse.wb.swt.ResourceManager;
25

    
26
import eu.etaxonomy.cdm.model.taxon.Classification;
27
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
28

    
29
/**
30
 * <p>ImportFromFileDataSourceWizardPage class.</p>
31
 *
32
 * @author n.hoffmann
33
 * @created 04.08.2009
34
 * @version 1.0
35
 */
36
public class ClassificationChooserWizardPageE4 extends WizardPage implements Listener{
37

    
38
	public static final String PAGE_NAME = "ClassificationChooserWizardPage";
39

    
40
	//classification
41
    private Text textClassification;
42
    private Classification classification;
43
    private Button btnBrowseClassification;
44

    
45
    private Button btnClear;
46

    
47
    @Inject
48
	public ClassificationChooserWizardPageE4() {
49
		super(PAGE_NAME);
50

    
51
		setTitle("Configure import destinations");
52

    
53
		setDescription("Note: Selecting no classification will create a default one.");
54

    
55
	}
56

    
57
	/** {@inheritDoc} */
58
	@Override
59
    public void createControl(Composite parent) {
60
		final Composite composite = new Composite(parent, SWT.NULL);
61

    
62
		GridLayout gridLayout = new GridLayout();
63
		gridLayout.numColumns = 4;
64
		composite.setLayout(gridLayout);
65

    
66
		//classification
67
		Label label = new Label(composite, SWT.NONE);
68
		label.setText("Classification");
69
		textClassification = new Text(composite, SWT.NONE);
70
		textClassification.setEnabled(false);
71
		textClassification.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
72
		btnBrowseClassification = new Button(composite, SWT.NONE);
73
		btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
74
		btnBrowseClassification.addListener(SWT.Selection, this);
75
		btnClear = new Button(composite, SWT.NONE);
76
		btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
77
		btnClear.addListener(SWT.Selection, this);
78

    
79
		setControl(composite);
80
	}
81

    
82
	@Override
83
	public void handleEvent(Event event) {
84
	    if(event.widget==btnBrowseClassification){
85
	        classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class, getShell(), null, null);
86
	        if(classification!=null){
87
	            textClassification.setText(classification.getTitleCache());
88
	        }
89
	    }
90
	    else if(event.widget==btnClear){
91
	        classification = null;
92
	        textClassification.setText("");
93
	    }
94
	}
95

    
96
    /**
97
     * @return the classification
98
     */
99
    public Classification getClassification() {
100
        return classification;
101
    }
102

    
103
}
(3-3/4)