Project

General

Profile

« Previous | Next » 

Revision d8baa72e

Added by Patrick Plitzner over 6 years ago

ref #7086 Add taxon tree to working set editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/WorkingSetComposite.java
8 8
 */
9 9
package eu.etaxonomy.taxeditor.editor.workingSet;
10 10

  
11
import org.eclipse.jface.viewers.ComboViewer;
11
import java.util.List;
12

  
12 13
import org.eclipse.jface.viewers.TreeViewer;
13 14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.events.SelectionEvent;
16
import org.eclipse.swt.events.SelectionListener;
14 17
import org.eclipse.swt.layout.FillLayout;
15 18
import org.eclipse.swt.layout.GridData;
16 19
import org.eclipse.swt.layout.GridLayout;
17
import org.eclipse.swt.widgets.Combo;
20
import org.eclipse.swt.widgets.Button;
18 21
import org.eclipse.swt.widgets.Composite;
19 22
import org.eclipse.swt.widgets.Label;
20 23
import org.eclipse.swt.widgets.Text;
21 24
import org.eclipse.swt.widgets.Tree;
22 25

  
26
import eu.etaxonomy.cdm.api.service.IClassificationService;
23 27
import eu.etaxonomy.cdm.model.common.TermType;
28
import eu.etaxonomy.cdm.model.location.NamedArea;
29
import eu.etaxonomy.cdm.model.taxon.Classification;
30
import eu.etaxonomy.taxeditor.store.CdmStore;
24 31
import eu.etaxonomy.taxeditor.ui.combo.TermUuidComboViewer;
32
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
33
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeContentProvider;
34
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeLabelProvider;
25 35

  
26 36
/**
27 37
 * @author pplitzner
......
50 60

  
51 61
        TermUuidComboViewer combo = new TermUuidComboViewer(this, SWT.NONE);
52 62
        combo.setInput(TermType.Rank);
53
        //        Combo combo = new Combo(this, SWT.NONE);
54
        //        combo.setItems(new String[] {"Genus", "Species", "Subspecies"});
55 63
        combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
56 64

  
57 65
        Composite composite = new Composite(this, SWT.NONE);
58 66
        composite.setLayout(new FillLayout(SWT.HORIZONTAL));
59 67
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
60 68

  
61
        TreeViewer treeViewer = new TreeViewer(composite, SWT.BORDER);
62
        Tree tree = treeViewer.getTree();
69
        TreeViewer viewer = new TreeViewer(new Tree(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
70

  
71
        viewer.setContentProvider(new TaxonTreeNodeContentProvider());
72
        viewer.setLabelProvider(new TaxonTreeNodeLabelProvider());
73
        List<Classification> list = CdmStore.getService(IClassificationService.class).list(Classification.class, null, null, null, null);
74
        viewer.setInput(list);
63 75

  
64 76
        Label lblNewLabel_3 = new Label(this, SWT.NONE);
65 77
        lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
66 78
        lblNewLabel_3.setText("Rank max");
67 79

  
68
//        Combo combo_1 = new Combo(this, SWT.NONE);
69 80
        TermUuidComboViewer combo_1 = new TermUuidComboViewer(this, SWT.NONE);
70
//        combo_1.setItems(new String[] {"Genus", "Species", "Subspecies"});
81
        combo_1.setInput(TermType.Rank);
71 82
        combo_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
72 83

  
73 84
        Label lblNewLabel_4 = new Label(this, SWT.NONE);
74 85
        lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
75 86
        lblNewLabel_4.setText("Area");
76 87

  
77
        ComboViewer comboViewer = new ComboViewer(this, SWT.NONE);
78
        Combo combo_2 = comboViewer.getCombo();
79
        combo_2.setItems(new String[] {"Europe", "Northern Europe", "Southern Europe", "Germany"});
80
        combo_2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
88
        Composite composite_1 = new Composite(this, SWT.NONE);
89
        composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
90
        composite_1.setLayout(new GridLayout(2, false));
91

  
92
        Label lblNewLabel_5 = new Label(composite_1, SWT.NONE);
93
        lblNewLabel_5.setText("New Label");
94

  
95

  
96
        Button btnNewButton = new Button(composite_1, SWT.NONE);
97
        btnNewButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
98
        btnNewButton.setText("Choose");
99
        btnNewButton.addSelectionListener(new SelectionListener() {
100

  
101
            @Override
102
            public void widgetSelected(SelectionEvent e) {
103
                NamedArea area = NamedAreaSelectionDialog.select(parent.getShell(), null, null, null);
104
                lblNewLabel_5.setText(area.getLabel());
105
            }
106

  
107
            @Override
108
            public void widgetDefaultSelected(SelectionEvent e) {
109
            }
110
        });
111

  
81 112

  
82 113
    }
83 114

  

Also available in: Unified diff