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
;
36 private final Button btnFilterUndeterminedSpecimen
;
39 * Create the composite.
43 public DerivateSearchComposite(Composite parent
, int style
) {
45 setLayout(new GridLayout(6, false));
47 Label lblDerivateType
= new Label(this, SWT
.NULL
);
48 lblDerivateType
.setText("Derivate Filter");
50 comboDerivateType
= new Combo(this, SWT
.READ_ONLY
);
51 comboDerivateType
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
52 formToolkit
.paintBordersFor(comboDerivateType
);
54 btnFilterUndeterminedSpecimen
= new Button(this, SWT
.CHECK
);
55 btnFilterUndeterminedSpecimen
.setText("Only undetermined specimen");
56 btnFilterUndeterminedSpecimen
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
57 new Label(this, SWT
.NONE
);
58 new Label(this, SWT
.NONE
);
59 new Label(this, SWT
.NONE
);
61 searchField
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
62 searchField
.setText("");
63 searchField
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 2, 1));
65 buttonSearch
= new Button(this, SWT
.NONE
);
66 buttonSearch
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, false, false, 1, 1));
67 formToolkit
.adapt(buttonSearch
, true, true);
68 buttonSearch
.setText("Search");
69 new Label(this, SWT
.NONE
);
70 new Label(this, SWT
.NONE
);
71 new Label(this, SWT
.NONE
);
73 resultViewer
= new TableViewer(this, SWT
.BORDER
| SWT
.FULL_SELECTION
);
74 table
= resultViewer
.getTable();
75 table
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true, 6, 4));
80 protected void checkSubclass() {
81 // Disable the check that prevents subclassing of SWT components
83 public Text
getSearchField() {
86 public TableViewer
getResultViewer() {
89 public Combo
getComboDerivateType() {
90 return comboDerivateType
;
92 public Button
getButtonSearch() {
97 public void setEnabled(boolean enabled
){
98 super.setEnabled(enabled
);
99 searchField
.setEnabled(enabled
);
100 table
.setEnabled(enabled
);
101 // resultViewer.setEnabled(enabled);
102 comboDerivateType
.setEnabled(enabled
);
103 buttonSearch
.setEnabled(enabled
);
104 btnFilterUndeterminedSpecimen
.setEnabled(enabled
);
106 public Button
getBtnFilterUndeterminedSpecimen() {
107 return btnFilterUndeterminedSpecimen
;