1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2019 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.view.search.term;
|
11
|
|
12
|
import org.eclipse.swt.SWT;
|
13
|
import org.eclipse.swt.custom.ScrolledComposite;
|
14
|
import org.eclipse.swt.layout.GridData;
|
15
|
import org.eclipse.swt.layout.GridLayout;
|
16
|
import org.eclipse.swt.widgets.Composite;
|
17
|
import org.eclipse.swt.widgets.ExpandBar;
|
18
|
import org.eclipse.swt.widgets.ExpandItem;
|
19
|
import org.eclipse.swt.widgets.Label;
|
20
|
import org.eclipse.swt.widgets.Text;
|
21
|
|
22
|
/**
|
23
|
* @author pplitzner
|
24
|
* @date 22.01.2019
|
25
|
*
|
26
|
*/
|
27
|
public class TermSearchComposite extends Composite {
|
28
|
private Text txtSearch;
|
29
|
private Composite searchResultComposite;
|
30
|
|
31
|
/**
|
32
|
* Create the composite.
|
33
|
* @param parent
|
34
|
* @param style
|
35
|
*/
|
36
|
public TermSearchComposite(Composite parent, int style) {
|
37
|
super(parent, style);
|
38
|
setLayout(new GridLayout(2, false));
|
39
|
|
40
|
Composite filterComposite = new Composite(this, SWT.NONE);
|
41
|
filterComposite.setLayout(new GridLayout(1, false));
|
42
|
filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
|
43
|
filterComposite.setBounds(0, 0, 64, 64);
|
44
|
|
45
|
txtSearch = new Text(filterComposite, SWT.BORDER);
|
46
|
txtSearch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
|
47
|
|
48
|
ScrolledComposite scrolledComposite = new ScrolledComposite(filterComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
|
49
|
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
50
|
scrolledComposite.setExpandHorizontal(true);
|
51
|
scrolledComposite.setExpandVertical(true);
|
52
|
|
53
|
searchResultComposite = new Composite(this, SWT.NONE);
|
54
|
searchResultComposite.setLayout(new GridLayout(1, false));
|
55
|
searchResultComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
56
|
searchResultComposite.setBounds(0, 0, 64, 64);
|
57
|
|
58
|
ScrolledComposite resultComposite = new ScrolledComposite(searchResultComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
|
59
|
resultComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
60
|
resultComposite.setExpandHorizontal(true);
|
61
|
resultComposite.setExpandVertical(true);
|
62
|
|
63
|
ExpandBar expandBar = new ExpandBar(resultComposite, SWT.NONE);
|
64
|
|
65
|
ExpandItem xpndtmNewExpanditem = new ExpandItem(expandBar, SWT.NONE);
|
66
|
xpndtmNewExpanditem.setExpanded(true);
|
67
|
xpndtmNewExpanditem.setText("New ExpandItem");
|
68
|
|
69
|
Label lblNewLabel = new Label(expandBar, SWT.NONE);
|
70
|
xpndtmNewExpanditem.setControl(lblNewLabel);
|
71
|
lblNewLabel.setText("New Label");
|
72
|
xpndtmNewExpanditem.setHeight(xpndtmNewExpanditem.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
|
73
|
|
74
|
ExpandItem xpndtmNewExpanditem_1 = new ExpandItem(expandBar, SWT.NONE);
|
75
|
xpndtmNewExpanditem_1.setText("New ExpandItem");
|
76
|
resultComposite.setContent(expandBar);
|
77
|
resultComposite.setMinSize(expandBar.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
78
|
|
79
|
}
|
80
|
|
81
|
@Override
|
82
|
protected void checkSubclass() {
|
83
|
// Disable the check that prevents subclassing of SWT components
|
84
|
}
|
85
|
public Text getTxtSearch() {
|
86
|
return txtSearch;
|
87
|
}
|
88
|
public Composite getSearchResultComposite() {
|
89
|
return searchResultComposite;
|
90
|
}
|
91
|
}
|