5163886627d9394efb3eef8c459f4fb8dfc1bc93
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / derivate / searchFilter / DerivateSearchComposite.java
1 // $Id$
2 /**
3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10 package eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter;
11
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.GridData;
16 import org.eclipse.swt.layout.GridLayout;
17 import org.eclipse.swt.widgets.Button;
18 import org.eclipse.swt.widgets.Combo;
19 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.swt.widgets.Display;
21 import org.eclipse.swt.widgets.Label;
22 import org.eclipse.swt.widgets.Text;
23 import org.eclipse.ui.forms.widgets.FormToolkit;
24 import org.eclipse.wb.swt.ResourceManager;
25
26 /**
27 * The widgets of the {@link DerivateSearchView}<br>
28 *
29 */
30 public class DerivateSearchComposite extends Composite {
31 private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
32 private final Text searchField;
33 private final Combo comboDerivateType;
34 private final Button buttonSearch;
35 private final Button btnFilterUndeterminedSpecimen;
36 private final Text textTaxonName;
37 private final Button btnBrowseTaxa;
38 private final Label lblTaxon;
39 private final Label lblDerivateType;
40 private final Button btnClearTaxon;
41
42 /**
43 * Create the composite.
44 * @param parent
45 * @param style
46 */
47 public DerivateSearchComposite(Composite parent, int style) {
48 super(parent, style);
49 setLayout(new GridLayout(4, false));
50
51 lblTaxon = new Label(this, SWT.NONE);
52 lblTaxon.setText("Taxon");
53
54 textTaxonName = formToolkit.createText(this, "New Text", SWT.NONE);
55 textTaxonName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
56 textTaxonName.setEnabled(false);
57 textTaxonName.setText("");
58
59 btnBrowseTaxa = formToolkit.createButton(this, "", SWT.NONE);
60 btnBrowseTaxa.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
61
62 btnClearTaxon = formToolkit.createButton(this, "", SWT.NONE);
63 btnClearTaxon.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
64 btnClearTaxon.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
65
66 lblDerivateType = new Label(this, SWT.NULL);
67 lblDerivateType.setText("Derivative Type");
68
69 comboDerivateType = new Combo(this, SWT.READ_ONLY);
70 comboDerivateType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
71 formToolkit.paintBordersFor(comboDerivateType);
72
73 btnFilterUndeterminedSpecimen = new Button(this, SWT.CHECK);
74 btnFilterUndeterminedSpecimen.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
75 btnFilterUndeterminedSpecimen.addSelectionListener(new SelectionAdapter() {
76 @Override
77 public void widgetSelected(SelectionEvent e) {
78 }
79 });
80 btnFilterUndeterminedSpecimen.setText("Determined");
81
82 buttonSearch = new Button(this, SWT.NONE);
83 formToolkit.adapt(buttonSearch, true, true);
84 buttonSearch.setText("Search");
85
86 searchField = formToolkit.createText(this, "New Text", SWT.NONE);
87 searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
88 searchField.setText("");
89 new Label(this, SWT.NONE);
90 new Label(this, SWT.NONE);
91
92 }
93
94 @Override
95 protected void checkSubclass() {
96 // Disable the check that prevents subclassing of SWT components
97 }
98 public Text getSearchField() {
99 return searchField;
100 }
101 public Combo getComboDerivateType() {
102 return comboDerivateType;
103 }
104 public Button getButtonSearch() {
105 return buttonSearch;
106 }
107
108 @Override
109 public void setEnabled(boolean enabled){
110 super.setEnabled(enabled);
111 searchField.setEnabled(enabled);
112 comboDerivateType.setEnabled(enabled);
113 buttonSearch.setEnabled(enabled);
114 btnFilterUndeterminedSpecimen.setEnabled(enabled);
115 btnBrowseTaxa.setEnabled(enabled);
116 lblTaxon.setEnabled(enabled);
117 lblDerivateType.setEnabled(enabled);
118 }
119 public Button getBtnFilterUndeterminedSpecimen() {
120 return btnFilterUndeterminedSpecimen;
121 }
122 public Button getBtnBrowseTaxa() {
123 return btnBrowseTaxa;
124 }
125 public Text getTextTaxonName() {
126 return textTaxonName;
127 }
128 public Button getBtnClearTaxon() {
129 return btnClearTaxon;
130 }
131 }