Add initial OccurenceView to RCP plugin
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / derivateSearch / DerivateSearchComposite.java
index 67f0c1fb554b070bff348ac1ed3925fccb30e7d0..b101a2298f984495584e9f00a7dad9267fd8ea15 100644 (file)
@@ -13,6 +13,8 @@ import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
@@ -21,8 +23,6 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
 import org.eclipse.wb.swt.ResourceManager;
 
 /**
@@ -41,6 +41,7 @@ public class DerivateSearchComposite extends Composite {
     private final Button btnBrowseTaxa;
     private final Label lblTaxon;
     private final Label lblDerivateType;
+    private final Button btnClearTaxon;
 
     /**
      * Create the composite.
@@ -49,35 +50,32 @@ public class DerivateSearchComposite extends Composite {
      */
     public DerivateSearchComposite(Composite parent, int style) {
         super(parent, style);
-        {
-            TableWrapLayout tableWrapLayout = new TableWrapLayout();
-            tableWrapLayout.numColumns = 3;
-            setLayout(tableWrapLayout);
-        }
+        setLayout(new GridLayout(4, false));
 
         lblTaxon = new Label(this, SWT.NONE);
-        lblTaxon.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
         lblTaxon.setText("Taxon");
 
         textTaxonName = formToolkit.createText(this, "New Text", SWT.NONE);
-        textTaxonName.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.MIDDLE, 1, 1));
+        textTaxonName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
         textTaxonName.setEnabled(false);
         textTaxonName.setText("");
 
         btnBrowseTaxa = formToolkit.createButton(this, "", SWT.NONE);
-        btnBrowseTaxa.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
         btnBrowseTaxa.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
 
+        btnClearTaxon = formToolkit.createButton(this, "", SWT.NONE);
+        btnClearTaxon.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
+        btnClearTaxon.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
+
         lblDerivateType = new Label(this, SWT.NULL);
-        lblDerivateType.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
-        lblDerivateType.setText("Derivate Type");
+        lblDerivateType.setText("Derivative Type");
 
         comboDerivateType = new Combo(this, SWT.READ_ONLY);
-        comboDerivateType.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE, 1, 1));
+        comboDerivateType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
         formToolkit.paintBordersFor(comboDerivateType);
 
         btnFilterUndeterminedSpecimen = new Button(this, SWT.CHECK);
-        btnFilterUndeterminedSpecimen.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
+        btnFilterUndeterminedSpecimen.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
         btnFilterUndeterminedSpecimen.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -85,22 +83,19 @@ public class DerivateSearchComposite extends Composite {
         });
         btnFilterUndeterminedSpecimen.setText("Determined");
 
-        buttonSearch = new Button(this, SWT.NONE);
-        buttonSearch.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
-        formToolkit.adapt(buttonSearch, true, true);
-        buttonSearch.setText("Search");
+                buttonSearch = new Button(this, SWT.NONE);
+                formToolkit.adapt(buttonSearch, true, true);
+                buttonSearch.setText("Search");
 
-        searchField = formToolkit.createText(this, "New Text", SWT.NONE);
-        TableWrapData twd_searchField = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.MIDDLE, 1, 1);
-        twd_searchField.align = TableWrapData.CENTER;
-        searchField.setLayoutData(twd_searchField);
-        searchField.setText("");
-        new Label(this, SWT.NONE);
+                searchField = formToolkit.createText(this, "New Text", SWT.NONE);
+                searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+                searchField.setText("");
+                new Label(this, SWT.NONE);
+                new Label(this, SWT.NONE);
 
-        resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
-        table = resultViewer.getTable();
-        table.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB, 1, 2));
-        new Label(this, SWT.NONE);
+                resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
+                table = resultViewer.getTable();
+                table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
 
     }
 
@@ -143,4 +138,7 @@ public class DerivateSearchComposite extends Composite {
     public Text getTextTaxonName() {
         return textTaxonName;
     }
+    public Button getBtnClearTaxon() {
+        return btnClearTaxon;
+    }
 }