Project

General

Profile

Revision 3c998621

ID3c99862163848b867cc56827bc8a1bf3b7f28ddf
Parent fcbac3e6
Child 1038e9fe

Added by Patrick Plitzner over 3 years ago

Make specimen selection dialog horizontally scrollable

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/SpecimenSelectionDialog.java
14 14
import java.util.stream.Collectors;
15 15

  
16 16
import org.eclipse.jface.dialogs.Dialog;
17
import org.eclipse.jface.layout.GridDataFactory;
18 17
import org.eclipse.jface.viewers.ArrayContentProvider;
19 18
import org.eclipse.jface.viewers.IStructuredSelection;
20 19
import org.eclipse.jface.viewers.ITableLabelProvider;
......
22 21
import org.eclipse.jface.viewers.TableViewer;
23 22
import org.eclipse.jface.viewers.TableViewerColumn;
24 23
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.custom.ScrolledComposite;
25 25
import org.eclipse.swt.events.FocusEvent;
26 26
import org.eclipse.swt.events.FocusListener;
27 27
import org.eclipse.swt.events.SelectionAdapter;
......
122 122
                list.setInput(matrix.getSpecimenCache());
123 123
            }
124 124
        });
125

  
126
        ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
127
        scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
128
        scrolledComposite.setExpandHorizontal(true);
129
        scrolledComposite.setExpandVertical(true);
125 130
        //table
126
        list = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
131
        list = new TableViewer(scrolledComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
127 132
        Table table = list.getTable();
128
        GridData gd_table = GridDataFactory.fillDefaults().create();
129
        gd_table.grabExcessHorizontalSpace = true;
130
        gd_table.grabExcessVerticalSpace = true;
131
        table.setLayoutData(gd_table);
133

  
132 134
        //table columns
133 135
        TableViewerColumn columnTaxon = new TableViewerColumn(list, SWT.NONE);
134 136
        columnTaxon.getColumn().setText("Taxon");
......
137 139
        columnTaxon.getColumn().setMoveable(true);
138 140
        TableViewerColumn columnSpecimen = new TableViewerColumn(list, SWT.NONE);
139 141
        columnSpecimen.getColumn().setText("Specimen");
140
        columnSpecimen.getColumn().setWidth(200);
141 142
        columnSpecimen.getColumn().setResizable(true);
142 143
        columnSpecimen.getColumn().setMoveable(true);
144
        columnSpecimen.getColumn().setWidth(400);
143 145
        table.setHeaderVisible(true);
144 146
        table.setLinesVisible(true);
147
        scrolledComposite.setContent(table);
148
        scrolledComposite.setMinSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT));
145 149
        list.setContentProvider(new ArrayContentProvider());
146 150
        list.setLabelProvider(new SpecimenListLabelProvider());
151
        list.setInput(matrix.getSpecimenCache());
147 152

  
148 153
        //gather specimens
149 154
        if(matrix.getSpecimenCache()==null){
150 155
            loadSpecimens();
151 156
        }
152
        list.setInput(matrix.getSpecimenCache());
157

  
158
        columnSpecimen.getColumn().pack();
159

  
153 160
        return composite;
154 161
    }
155 162

  
......
179 186
    protected void configureShell(Shell newShell) {
180 187
        super.configureShell(newShell);
181 188
        newShell.setText(Messages.SpecimenSelectionDialog_SELECT_SPECIMENS);
182
        newShell.setMinimumSize(500, 400);
189
        newShell.setMinimumSize(500, 600);
190
        newShell.setSize(800, 600);
183 191
    }
184 192

  
185 193
    @Override

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)