correcting import
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / derivateSearch / 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.view.derivateSearch;
11
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;
24
25 /**
26 * The widgets of the {@link DerivateSearchView}<br>
27 *
28 */
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
37 /**
38 * Create the composite.
39 * @param parent
40 * @param style
41 */
42 public DerivateSearchComposite(Composite parent, int style) {
43 super(parent, style);
44 setLayout(new GridLayout(2, false));
45
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);
49
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");
53
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));
57
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");
62
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));
66
67 }
68
69 @Override
70 protected void checkSubclass() {
71 // Disable the check that prevents subclassing of SWT components
72 }
73 public Text getSearchField() {
74 return searchField;
75 }
76 public TableViewer getResultViewer() {
77 return resultViewer;
78 }
79 public Combo getComboDerivateType() {
80 return comboDerivateType;
81 }
82 public Button getButtonSearch() {
83 return buttonSearch;
84 }
85 }