Project

General

Profile

« Previous | Next » 

Revision f0973bb3

Added by Patrick Plitzner over 5 years ago

ref #8011 Enhance term search framework

  • added menu to open term search
  • filter facets now have an effect on search results

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/term/TermSearchComposite.java
14 14
import org.eclipse.swt.layout.GridData;
15 15
import org.eclipse.swt.layout.GridLayout;
16 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 17
import org.eclipse.swt.widgets.Text;
21 18

  
22 19
/**
......
26 23
 */
27 24
public class TermSearchComposite extends Composite {
28 25
    private Text txtSearch;
26
    private ScrolledComposite filterScrolledComposite;
27
    private Composite filterListComposite;
29 28
    private Composite searchResultComposite;
29
    private ScrolledComposite resultScrolledComposite;
30 30

  
31 31
    /**
32 32
     * Create the composite.
......
40 40
        Composite filterComposite = new Composite(this, SWT.NONE);
41 41
        filterComposite.setLayout(new GridLayout(1, false));
42 42
        filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
43
        filterComposite.setBounds(0, 0, 64, 64);
44 43

  
45 44
        txtSearch = new Text(filterComposite, SWT.BORDER);
46 45
        txtSearch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
47 46

  
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);
47
        filterScrolledComposite = new ScrolledComposite(filterComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
48
        filterScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
49
        filterScrolledComposite.setExpandHorizontal(true);
50
        filterScrolledComposite.setExpandVertical(true);
52 51

  
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);
52
        initFilterList();
57 53

  
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);
54
        Composite composite_1 = new Composite(this, SWT.NONE);
55
        composite_1.setLayout(new GridLayout(1, false));
56
        composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
62 57

  
63
        ExpandBar expandBar = new ExpandBar(resultComposite, SWT.NONE);
58
        resultScrolledComposite = new ScrolledComposite(composite_1, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
59
        resultScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
60
        resultScrolledComposite.setExpandHorizontal(true);
61
        resultScrolledComposite.setExpandVertical(true);
64 62

  
65
        ExpandItem xpndtmNewExpanditem = new ExpandItem(expandBar, SWT.NONE);
66
        xpndtmNewExpanditem.setExpanded(true);
67
        xpndtmNewExpanditem.setText("New ExpandItem");
63
        initSearchResultList();
68 64

  
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);
65
    }
73 66

  
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));
67
    private void initSearchResultList() {
68
        searchResultComposite = new Composite(resultScrolledComposite, SWT.NONE);
69
        searchResultComposite.setLayout(new GridLayout(1, false));
70
        resultScrolledComposite.setContent(searchResultComposite);
71
        resultScrolledComposite.setMinSize(searchResultComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
72
    }
78 73

  
74
    private void initFilterList() {
75
        filterListComposite = new Composite(filterScrolledComposite, SWT.NONE);
76
        filterListComposite.setLayout(new GridLayout(1, false));
77
        filterScrolledComposite.setContent(filterListComposite);
78
        filterScrolledComposite.setMinSize(filterListComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
79 79
    }
80 80

  
81 81
    @Override
......
85 85
    public Text getTxtSearch() {
86 86
        return txtSearch;
87 87
    }
88

  
89
    public Composite getFilterListComposite() {
90
        return filterListComposite;
91
    }
92

  
93
    public void clear(){
94
        filterListComposite.dispose();
95
        initFilterList();
96

  
97
        clearResults();
98
    }
99

  
100
    public void clearResults() {
101
        searchResultComposite.dispose();
102
        initSearchResultList();
103
    }
104

  
105
    public void refresh(){
106
        filterScrolledComposite.layout(true, true);
107
        filterScrolledComposite.setMinSize(filterListComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
108
        resultScrolledComposite.layout(true, true);
109
        resultScrolledComposite.setMinSize(searchResultComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
110
    }
88 111
    public Composite getSearchResultComposite() {
89 112
        return searchResultComposite;
90 113
    }

Also available in: Unified diff