3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.view
.derivateSearch
;
12 import org
.eclipse
.jface
.viewers
.TableViewer
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.layout
.GridData
;
15 import org
.eclipse
.swt
.layout
.GridLayout
;
16 import org
.eclipse
.swt
.widgets
.Button
;
17 import org
.eclipse
.swt
.widgets
.Combo
;
18 import org
.eclipse
.swt
.widgets
.Composite
;
19 import org
.eclipse
.swt
.widgets
.Display
;
20 import org
.eclipse
.swt
.widgets
.Label
;
21 import org
.eclipse
.swt
.widgets
.Table
;
22 import org
.eclipse
.swt
.widgets
.Text
;
23 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
26 * The widgets of the {@link DerivateSearchView}<br>
29 public class DerivateSearchComposite
extends Composite
{
30 private final FormToolkit formToolkit
= new FormToolkit(Display
.getDefault());
31 private final Text searchField
;
32 private final Table table
;
33 private final TableViewer resultViewer
;
34 private final Combo comboDerivateType
;
35 private final Button buttonSearch
;
38 * Create the composite.
42 public DerivateSearchComposite(Composite parent
, int style
) {
44 setLayout(new GridLayout(2, false));
46 comboDerivateType
= new Combo(this, SWT
.READ_ONLY
);
47 comboDerivateType
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
48 formToolkit
.paintBordersFor(comboDerivateType
);
50 Label lblDerivateType
= new Label(this, SWT
.NULL
);
51 lblDerivateType
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
52 lblDerivateType
.setText("Derivate Filter");
54 searchField
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
55 searchField
.setText("");
56 searchField
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
58 buttonSearch
= new Button(this, SWT
.NONE
);
59 buttonSearch
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, false, false, 1, 1));
60 formToolkit
.adapt(buttonSearch
, true, true);
61 buttonSearch
.setText("Search");
63 resultViewer
= new TableViewer(this, SWT
.BORDER
| SWT
.FULL_SELECTION
);
64 table
= resultViewer
.getTable();
65 table
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true, 2, 1));
70 protected void checkSubclass() {
71 // Disable the check that prevents subclassing of SWT components
73 public Text
getSearchField() {
76 public TableViewer
getResultViewer() {
79 public Combo
getComboDerivateType() {
80 return comboDerivateType
;
82 public Button
getButtonSearch() {