Project

General

Profile

« Previous | Next » 

Revision 0a0a634c

Added by Patrick Plitzner about 5 years ago

ref #8011 Layout improvements

  • wrap description text
  • Use SashForm for SearchComposite

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/facet/term/TermSearchResultComposite.java
11 11
import org.eclipse.jface.layout.GridDataFactory;
12 12
import org.eclipse.jface.resource.JFaceResources;
13 13
import org.eclipse.swt.SWT;
14
import org.eclipse.swt.events.DragDetectEvent;
15
import org.eclipse.swt.events.DragDetectListener;
14
import org.eclipse.swt.events.ControlAdapter;
15
import org.eclipse.swt.events.ControlEvent;
16 16
import org.eclipse.swt.layout.GridData;
17 17
import org.eclipse.swt.layout.GridLayout;
18 18
import org.eclipse.swt.widgets.Composite;
......
38 38
    public Composite createContent(Composite parent) {
39 39
        Composite content = new Composite(this, SWT.NONE);
40 40
        content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
41
        content.setLayout(new GridLayout(1, false));
42
        label = new Label(content, SWT.NONE);
41
        GridLayout layout = new GridLayout(1, false);
42
        content.setLayout(layout);
43
        label = new Label(content, SWT.WRAP);
43 44
        label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
44 45
        label.setText(result.getContent().getRepresentation_L10n());
45 46
        label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
46 47
        GridDataFactory.fillDefaults().applyTo(label);
47
        label.addDragDetectListener(new DragDetectListener() {
48 48

  
49
        Label lblDescription = new Label(content, SWT.WRAP);
50
        GridData layoutData = new GridData();
51
        lblDescription.setLayoutData(layoutData);
52
        parent.addControlListener(new ControlAdapter() {
49 53
            @Override
50
            public void dragDetected(DragDetectEvent e) {
51
                System.out.println("dragDetected");
54
            public void controlResized(ControlEvent e) {
55
                layoutData.widthHint = parent.getClientArea().width - (6*layout.marginWidth);
56
                parent.layout(true);
52 57
            }
53 58
        });
54

  
55
        Label lblDescription = new Label(content, SWT.NONE);
56 59
        String representation_L10n_text = result.getContent().getRepresentation_L10n_text();
57 60
        if(representation_L10n_text!=null){
58 61
            lblDescription.setText(representation_L10n_text);

Also available in: Unified diff