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;
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;
/**
private final Button btnBrowseTaxa;
private final Label lblTaxon;
private final Label lblDerivateType;
+ private final Button btnClearTaxon;
/**
* Create the 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) {
});
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));
}
public Text getTextTaxonName() {
return textTaxonName;
}
+ public Button getBtnClearTaxon() {
+ return btnClearTaxon;
+ }
}