Project

General

Profile

Download (1.77 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2019 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.view.search.term;
10

    
11
import org.eclipse.jface.layout.GridDataFactory;
12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.events.SelectionAdapter;
14
import org.eclipse.swt.events.SelectionEvent;
15
import org.eclipse.swt.layout.GridLayout;
16
import org.eclipse.swt.widgets.Button;
17
import org.eclipse.swt.widgets.Composite;
18
import org.eclipse.swt.widgets.Label;
19

    
20
/**
21
 * @author pplitzner
22
 * @since Jan 23, 2019
23
 *
24
 */
25
public class FilterComposite extends Composite{
26
    private Button btnCheck;
27
    private Facet facet;
28

    
29
    public FilterComposite(Facet facet, TermSearchController controller, Composite parent, int style) {
30
        super(parent, style);
31
        this.facet = facet;
32
        GridDataFactory.fillDefaults().applyTo(this);
33
        setLayout(new GridLayout(2, false));
34

    
35
        btnCheck = new Button(this, SWT.CHECK);
36
        btnCheck.addSelectionListener(new SelectionAdapter() {
37
            @Override
38
            public void widgetSelected(SelectionEvent e) {
39
                controller.applyFilter(FilterComposite.this);
40
            }
41
        });
42

    
43
        Composite content = new Composite(this, SWT.NONE);
44
        GridDataFactory.fillDefaults().applyTo(content);
45
        content.setLayout(new GridLayout());
46

    
47
        Label label = new Label(content, SWT.NONE);
48
        label.setText(facet.getFacet());
49
        GridDataFactory.fillDefaults().applyTo(label);
50

    
51
    }
52

    
53
    public boolean isFilterActive() {
54
        return btnCheck.getSelection();
55
    }
56

    
57
    public Facet getFacet() {
58
        return facet;
59
    }
60

    
61
}
(3-3/9)