package eu.etaxonomy.taxeditor.view.search.facet;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
* @date 22.01.2019
*
*/
-public class SearchComposite extends Composite {
+public class SearchComposite extends SashForm {
private Text txtSearch;
private ScrolledComposite filterScrolledComposite;
private Composite filterListComposite;
private Composite searchResultComposite;
private ScrolledComposite resultScrolledComposite;
- private Composite composite;
private Button btnSearchButton;
/**
Composite filterComposite = new Composite(this, SWT.NONE);
filterComposite.setLayout(new GridLayout(1, false));
GridData gd_filterComposite = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
- gd_filterComposite.widthHint = 170;
filterComposite.setLayoutData(gd_filterComposite);
- composite = new Composite(filterComposite, SWT.NONE);
+ Composite composite = new Composite(filterComposite, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
composite.setLayout(new GridLayout(2, false));
resultScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
resultScrolledComposite.setExpandHorizontal(true);
resultScrolledComposite.setExpandVertical(true);
+ setWeights(new int[] {40, 60});
initSearchResultList();
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DragDetectEvent;
-import org.eclipse.swt.events.DragDetectListener;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
public Composite createContent(Composite parent) {
Composite content = new Composite(this, SWT.NONE);
content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
- content.setLayout(new GridLayout(1, false));
- label = new Label(content, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ content.setLayout(layout);
+ label = new Label(content, SWT.WRAP);
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
label.setText(result.getContent().getRepresentation_L10n());
label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
GridDataFactory.fillDefaults().applyTo(label);
- label.addDragDetectListener(new DragDetectListener() {
+ Label lblDescription = new Label(content, SWT.WRAP);
+ GridData layoutData = new GridData();
+ lblDescription.setLayoutData(layoutData);
+ parent.addControlListener(new ControlAdapter() {
@Override
- public void dragDetected(DragDetectEvent e) {
- System.out.println("dragDetected");
+ public void controlResized(ControlEvent e) {
+ layoutData.widthHint = parent.getClientArea().width - (6*layout.marginWidth);
+ parent.layout(true);
}
});
-
- Label lblDescription = new Label(content, SWT.NONE);
String representation_L10n_text = result.getContent().getRepresentation_L10n_text();
if(representation_L10n_text!=null){
lblDescription.setText(representation_L10n_text);