ref #8011 Use term search in feature tree context menu to add features
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / search / facet / CheckBoxSearchResultComposite.java
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.facet;
10
11 import org.eclipse.swt.SWT;
12 import org.eclipse.swt.layout.GridData;
13 import org.eclipse.swt.layout.GridLayout;
14 import org.eclipse.swt.widgets.Button;
15 import org.eclipse.swt.widgets.Composite;
16
17 /**
18 * @author pplitzner
19 * @since Feb 14, 2019
20 *
21 */
22 public abstract class CheckBoxSearchResultComposite<T, S extends SearchResult<T>> extends Composite {
23
24 protected S result;
25 private Button btnCheck;
26
27 public CheckBoxSearchResultComposite(S result, Composite parent, int style) {
28 super(parent, style);
29 this.result = result;
30 setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
31 GridLayout gridLayout = new GridLayout();
32 gridLayout.marginWidth = 0;
33 gridLayout.horizontalSpacing = 0;
34 gridLayout.numColumns = 2;
35 setLayout(gridLayout);
36
37 Composite composite = new Composite(this, SWT.NONE);
38 composite.setLayout(new GridLayout(1, false));
39 composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
40
41 btnCheck = new Button(composite, SWT.CHECK);
42 btnCheck.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
43
44 createContent(this);
45 }
46
47 public abstract Composite createContent(Composite parent);
48
49 public S getResult() {
50 return result;
51 }
52
53 public Button getBtnCheck() {
54 return btnCheck;
55 }
56
57 }