Project

General

Profile

« Previous | Next » 

Revision b13380e4

Added by Patrick Plitzner over 6 years ago

ref #7086 Add feature tree to WS editor

  • add public access to fields

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/WorkingSetComposite.java
10 10

  
11 11
import java.util.List;
12 12

  
13
import org.eclipse.jface.viewers.ITreeSelection;
13 14
import org.eclipse.jface.viewers.TreeViewer;
14 15
import org.eclipse.swt.SWT;
15 16
import org.eclipse.swt.events.SelectionEvent;
......
25 26

  
26 27
import eu.etaxonomy.cdm.api.service.IClassificationService;
27 28
import eu.etaxonomy.cdm.model.common.TermType;
29
import eu.etaxonomy.cdm.model.description.FeatureTree;
28 30
import eu.etaxonomy.cdm.model.location.NamedArea;
29 31
import eu.etaxonomy.cdm.model.taxon.Classification;
32
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
33
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
30 34
import eu.etaxonomy.taxeditor.store.CdmStore;
31 35
import eu.etaxonomy.taxeditor.ui.combo.TermUuidComboViewer;
32 36
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
......
39 43
 *
40 44
 */
41 45
public class WorkingSetComposite extends Composite {
42
    private Text txt_label;
46
    private Text txtWorkingSetLabel;
47
    private TermUuidComboViewer comboRankMin;
48
    private TermUuidComboViewer comboRankMax;
49
    private FeatureTreeEditorComposite featureTreeEditorComposite;
50
    private TreeViewer taxonNodeTree;
51
    private NamedArea area;
43 52

  
44 53
    public WorkingSetComposite(Composite parent, int style) {
45 54
        super(parent, style);
46
        setLayout(new GridLayout(3, false));
55
        setLayout(new GridLayout(4, false));
47 56

  
48 57
        Label lblNewLabel = new Label(this, SWT.NONE);
49 58
        lblNewLabel.setText("Working set label");
50 59

  
51
        txt_label = new Text(this, SWT.BORDER);
52
        txt_label.setEditable(false);
53
        txt_label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
60
        txtWorkingSetLabel = new Text(this, SWT.BORDER);
61
        txtWorkingSetLabel.setEditable(false);
62
        txtWorkingSetLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
54 63

  
55 64
        Label lblNewLabel_1 = new Label(this, SWT.NONE);
56 65
        lblNewLabel_1.setText("Taxon filter");
57 66

  
67
        featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE);
68
        featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
69
        featureTreeEditorComposite.init(null, null, null, null);
70

  
58 71
        Label lblNewLabel_2 = new Label(this, SWT.NONE);
59 72
        lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
60 73
        lblNewLabel_2.setText("Rank min");
61 74

  
62
        TermUuidComboViewer combo = new TermUuidComboViewer(this, SWT.NONE);
63
        combo.setInput(TermType.Rank);
64
        combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
75
        comboRankMin = new TermUuidComboViewer(this, SWT.NONE);
76
        comboRankMin.setInput(TermType.Rank);
77
        comboRankMin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
65 78

  
66 79
        Composite composite = new Composite(this, SWT.NONE);
67 80
        composite.setLayout(new FillLayout(SWT.HORIZONTAL));
68 81
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
69 82

  
70
        TreeViewer viewer = new TreeViewer(new Tree(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
83
        taxonNodeTree = new TreeViewer(new Tree(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
71 84

  
72
        viewer.setContentProvider(new TaxonTreeNodeContentProvider());
73
        viewer.setLabelProvider(new TaxonTreeNodeLabelProvider());
85
        taxonNodeTree.setContentProvider(new TaxonTreeNodeContentProvider());
86
        taxonNodeTree.setLabelProvider(new TaxonTreeNodeLabelProvider());
74 87
        List<Classification> list = CdmStore.getService(IClassificationService.class).list(Classification.class, null, null, null, null);
75
        viewer.setInput(list);
88
        taxonNodeTree.setInput(list);
76 89

  
77 90
        Label lblNewLabel_3 = new Label(this, SWT.NONE);
78 91
        lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
79 92
        lblNewLabel_3.setText("Rank max");
80 93

  
81
        TermUuidComboViewer combo_1 = new TermUuidComboViewer(this, SWT.NONE);
82
        combo_1.setInput(TermType.Rank);
83
        combo_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
94
        comboRankMax = new TermUuidComboViewer(this, SWT.NONE);
95
        comboRankMax.setInput(TermType.Rank);
96
        comboRankMax.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
84 97

  
85 98
        Label lblNewLabel_4 = new Label(this, SWT.NONE);
86 99
        lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
......
101 114

  
102 115
            @Override
103 116
            public void widgetSelected(SelectionEvent e) {
104
                NamedArea area = NamedAreaSelectionDialog.select(parent.getShell(), null, null, null);
117
                area = NamedAreaSelectionDialog.select(parent.getShell(), null, null);
105 118
                lblNewLabel_5.setText(area.getLabel());
106 119
            }
107 120

  
......
118 131
        // Disable the check that prevents subclassing of SWT components
119 132
    }
120 133
    public Text getTxt_label() {
121
        return txt_label;
134
        return txtWorkingSetLabel;
135
    }
136
    public TermUuidComboViewer getComboRankMin() {
137
        return comboRankMin;
138
    }
139
    public TermUuidComboViewer getComboRankMax() {
140
        return comboRankMax;
141
    }
142
    public FeatureTree getCharacters(){
143
        return featureTreeEditorComposite.getFeatureTree();
144
    }
145
    public TaxonNode getTaxonNode(){
146
        ITreeSelection selection = (ITreeSelection) taxonNodeTree.getSelection();
147
        if(selection!=null){
148
            return (TaxonNode) selection.getFirstElement();
149
        }
150
        return null;
151
    }
152
    public NamedArea getArea(){
153
        return area;
122 154
    }
123 155
}

Also available in: Unified diff