Revision 73f6a95e
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/WorkingSetComposite.java | ||
---|---|---|
14 | 14 |
import org.eclipse.jface.viewers.StructuredSelection; |
15 | 15 |
import org.eclipse.jface.viewers.TreeViewer; |
16 | 16 |
import org.eclipse.swt.SWT; |
17 |
import org.eclipse.swt.events.SelectionAdapter; |
|
18 |
import org.eclipse.swt.events.SelectionEvent; |
|
19 |
import org.eclipse.swt.layout.FillLayout; |
|
20 | 17 |
import org.eclipse.swt.layout.GridData; |
21 | 18 |
import org.eclipse.swt.layout.GridLayout; |
22 | 19 |
import org.eclipse.swt.widgets.Button; |
... | ... | |
36 | 33 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
37 | 34 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
38 | 35 |
import eu.etaxonomy.taxeditor.ui.combo.TermUuidComboViewer; |
39 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog; |
|
40 | 36 |
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeContentProvider; |
41 | 37 |
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeLabelProvider; |
42 | 38 |
|
... | ... | |
46 | 42 |
* |
47 | 43 |
*/ |
48 | 44 |
public class WorkingSetComposite extends Composite { |
49 |
private Text txtWorkingSetLabel;
|
|
45 |
private Text txtWorkingSet; |
|
50 | 46 |
private TermUuidComboViewer comboRankMin; |
51 | 47 |
private TermUuidComboViewer comboRankMax; |
52 | 48 |
private FeatureTreeEditorComposite featureTreeEditorComposite; |
53 | 49 |
private TreeViewer taxonNodeTree; |
54 | 50 |
private NamedArea area; |
55 |
private Label lblAreaLabel; |
|
56 | 51 |
private Button btnOpenWorkingSet; |
52 |
private Label lblWorkingSet; |
|
53 |
private Text textAreaText; |
|
57 | 54 |
|
58 | 55 |
public WorkingSetComposite(Composite parent, int style) { |
59 | 56 |
super(parent, style); |
60 |
setLayout(new GridLayout(4, false)); |
|
61 | 57 |
|
62 |
Label lblNewLabel = new Label(this, SWT.NONE); |
|
63 |
lblNewLabel.setText("Working set label"); |
|
58 |
List<Classification> list = CdmStore.getService(IClassificationService.class).list(Classification.class, null, null, null, null); |
|
64 | 59 |
|
65 |
Composite composite_2 = new Composite(this, SWT.NONE); |
|
66 |
composite_2.setLayout(new GridLayout(2, false)); |
|
67 |
composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); |
|
60 |
setLayout(new GridLayout(3, false)); |
|
68 | 61 |
|
69 |
txtWorkingSetLabel = new Text(composite_2, SWT.BORDER);
|
|
70 |
txtWorkingSetLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
|
|
71 |
txtWorkingSetLabel.setEditable(false);
|
|
62 |
Composite composite = new Composite(this, SWT.BORDER);
|
|
63 |
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
|
|
64 |
composite.setLayout(new GridLayout(4, false));
|
|
72 | 65 |
|
73 |
btnOpenWorkingSet = new Button(composite_2, SWT.NONE); |
|
74 |
btnOpenWorkingSet.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON)); |
|
66 |
lblWorkingSet = new Label(composite, SWT.NONE); |
|
67 |
lblWorkingSet.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); |
|
68 |
lblWorkingSet.setText("-no working set loaded-"); |
|
75 | 69 |
|
76 |
Label lblNewLabel_1 = new Label(this, SWT.NONE); |
|
77 |
lblNewLabel_1.setText("Taxon filter"); |
|
70 |
btnOpenWorkingSet = new Button(composite, SWT.NONE); |
|
71 |
btnOpenWorkingSet.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
72 |
btnOpenWorkingSet.setText("Open..."); |
|
73 |
btnOpenWorkingSet.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON)); |
|
78 | 74 |
|
79 |
featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE); |
|
80 |
featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4)); |
|
81 |
featureTreeEditorComposite.init(null, null, null, null); |
|
75 |
Label lblNewLabel = new Label(this, SWT.NONE); |
|
76 |
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
77 |
lblNewLabel.setText("Label"); |
|
78 |
|
|
79 |
txtWorkingSet = new Text(this, SWT.BORDER); |
|
80 |
txtWorkingSet.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
|
81 |
|
|
82 |
Label lblNewLabel_1 = new Label(this, SWT.NONE); |
|
83 |
lblNewLabel_1.setText("Taxon filter"); |
|
82 | 84 |
|
83 | 85 |
Label lblNewLabel_2 = new Label(this, SWT.NONE); |
84 | 86 |
lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
... | ... | |
87 | 89 |
comboRankMin = new TermUuidComboViewer(this, SWT.NONE); |
88 | 90 |
comboRankMin.setInput(TermType.Rank); |
89 | 91 |
comboRankMin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); |
92 |
Tree tree = new Tree(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); |
|
93 |
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4)); |
|
94 |
taxonNodeTree = new TreeViewer(tree); |
|
90 | 95 |
|
91 |
Composite composite = new Composite(this, SWT.NONE); |
|
92 |
composite.setLayout(new FillLayout(SWT.HORIZONTAL)); |
|
93 |
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3)); |
|
94 |
|
|
95 |
taxonNodeTree = new TreeViewer(new Tree(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION)); |
|
96 |
|
|
97 |
taxonNodeTree.setContentProvider(new TaxonTreeNodeContentProvider()); |
|
98 |
taxonNodeTree.setLabelProvider(new TaxonTreeNodeLabelProvider()); |
|
99 |
List<Classification> list = CdmStore.getService(IClassificationService.class).list(Classification.class, null, null, null, null); |
|
100 |
taxonNodeTree.setInput(list); |
|
96 |
taxonNodeTree.setContentProvider(new TaxonTreeNodeContentProvider()); |
|
97 |
taxonNodeTree.setLabelProvider(new TaxonTreeNodeLabelProvider()); |
|
98 |
taxonNodeTree.setInput(list); |
|
101 | 99 |
|
102 | 100 |
Label lblNewLabel_3 = new Label(this, SWT.NONE); |
103 | 101 |
lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
... | ... | |
108 | 106 |
comboRankMax.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); |
109 | 107 |
|
110 | 108 |
Label lblNewLabel_4 = new Label(this, SWT.NONE); |
111 |
lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
|
|
109 |
lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
|
112 | 110 |
lblNewLabel_4.setText("Area"); |
113 | 111 |
|
114 |
Composite composite_1 = new Composite(this, SWT.NONE); |
|
115 |
composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); |
|
116 |
composite_1.setLayout(new GridLayout(2, false)); |
|
117 |
|
|
118 |
lblAreaLabel = new Label(composite_1, SWT.NONE); |
|
119 |
lblAreaLabel.setText("New Label"); |
|
112 |
textAreaText = new Text(this, SWT.BORDER); |
|
113 |
textAreaText.setEditable(false); |
|
114 |
textAreaText.setText("Choose..."); |
|
115 |
textAreaText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
|
120 | 116 |
|
117 |
featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE); |
|
118 |
featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); |
|
119 |
featureTreeEditorComposite.init(null, null, null, null); |
|
121 | 120 |
|
122 |
Button btnNewButton = new Button(composite_1, SWT.NONE); |
|
123 |
btnNewButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1)); |
|
124 |
btnNewButton.setText("Choose"); |
|
125 |
btnNewButton.addSelectionListener(new SelectionAdapter() { |
|
126 |
@Override |
|
127 |
public void widgetSelected(SelectionEvent e) { |
|
128 |
NamedArea area = NamedAreaSelectionDialog.select(parent.getShell(), null, null); |
|
129 |
setArea(area); |
|
130 |
} |
|
131 | 121 |
|
132 |
}); |
|
133 | 122 |
|
134 | 123 |
} |
135 | 124 |
|
... | ... | |
138 | 127 |
// Disable the check that prevents subclassing of SWT components |
139 | 128 |
} |
140 | 129 |
public Text getTxt_label() { |
141 |
return txtWorkingSetLabel;
|
|
130 |
return txtWorkingSet; |
|
142 | 131 |
} |
143 | 132 |
|
144 | 133 |
public TermUuidComboViewer getRankMin() { |
... | ... | |
178 | 167 |
} |
179 | 168 |
public void setArea(NamedArea area) { |
180 | 169 |
this.area = area; |
181 |
lblAreaLabel.setText(area.getLabel()); |
|
170 |
textAreaText.setText(area.getLabel()); |
|
171 |
} |
|
172 |
public Label getLblWorkingSet() { |
|
173 |
return lblWorkingSet; |
|
174 |
} |
|
175 |
public Text getTextAreaText() { |
|
176 |
return textAreaText; |
|
182 | 177 |
} |
183 | 178 |
public Button getBtnOpenWorkingSet() { |
184 | 179 |
return btnOpenWorkingSet; |
Also available in: Unified diff
ref #7086 Selection listening for dirty state changes