Project

General

Profile

Download (2.96 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2013 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
package eu.etaxonomy.taxeditor.ui.campanula.basicFields;
11

    
12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.widgets.Button;
14
import org.eclipse.swt.widgets.Composite;
15
import org.eclipse.swt.widgets.Display;
16
import org.eclipse.swt.widgets.Label;
17
import org.eclipse.ui.forms.widgets.FormToolkit;
18
import org.eclipse.ui.forms.widgets.TableWrapData;
19
import org.eclipse.ui.forms.widgets.TableWrapLayout;
20
import org.eclipse.wb.swt.ResourceManager;
21

    
22
/**
23
 * @author pplitzner
24
 * @date 13.08.2013
25
 *
26
 */
27
public class EntitySelectionField extends Composite {
28
    private FormToolkit formToolkit = new FormToolkit(Display.getDefault());
29
    private Label text;
30
    private Button button_selection;
31
    private Button button_edit;
32
    private Button button_remove;
33

    
34
    /**
35
     * Create the composite.
36
     * @param parent
37
     * @param style
38
     */
39
    public EntitySelectionField(Composite parent, int style) {
40
        super(parent, style);
41
        {
42
            TableWrapLayout tableWrapLayout = new TableWrapLayout();
43
            tableWrapLayout.verticalSpacing = 0;
44
            tableWrapLayout.topMargin = 0;
45
            tableWrapLayout.rightMargin = 0;
46
            tableWrapLayout.numColumns = 4;
47
            tableWrapLayout.leftMargin = 0;
48
            tableWrapLayout.horizontalSpacing = 0;
49
            tableWrapLayout.bottomMargin = 0;
50
            setLayout(tableWrapLayout);
51
        }
52

    
53
        text = formToolkit.createLabel(this, "", SWT.WRAP);
54
        TableWrapData twd_text = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1);
55
        twd_text.align = TableWrapData.LEFT;
56
        text.setLayoutData(twd_text);
57

    
58
        button_selection = formToolkit.createButton(this, "", SWT.NONE);
59
        button_selection.setToolTipText("Browse existing");
60
        button_selection.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/prj_obj.gif"));
61

    
62
        button_edit = formToolkit.createButton(this, "", SWT.NONE);
63
        button_edit.setToolTipText("Edit");
64
        button_edit.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/text.gif"));
65

    
66
        button_remove = formToolkit.createButton(this, "", SWT.NONE);
67
        button_remove.setToolTipText("Remove");
68
        button_remove.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
69
    }
70

    
71
    @Override
72
    protected void checkSubclass() {
73
        // Disable the check that prevents subclassing of SWT components
74
    }
75
    public Label getText() {
76
        return text;
77
    }
78
    public Button getButton_selection() {
79
        return button_selection;
80
    }
81
    public Button getButton_edit() {
82
        return button_edit;
83
    }
84
    public Button getButton_remove() {
85
        return button_remove;
86
    }
87
}
(1-1/10)