Project

General

Profile

Revision 21e30f05

ID21e30f05ebe7bc4898323049ed3b177f96b39e3c
Parent af09c490
Child 73d25c5b

Added by Patrick Plitzner over 1 year ago

ref #7439 auto resize columns after search

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java
59 59
import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer;
60 60
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
61 61
import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack;
62
import org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeColumnsCommand;
62 63
import org.eclipse.nebula.widgets.nattable.selection.RowSelectionModel;
63 64
import org.eclipse.nebula.widgets.nattable.selection.RowSelectionProvider;
64 65
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer;
......
69 70
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
70 71
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuAction;
71 72
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder;
73
import org.eclipse.nebula.widgets.nattable.util.GCFactory;
72 74
import org.eclipse.swt.SWT;
73 75
import org.eclipse.swt.dnd.Clipboard;
74 76
import org.eclipse.swt.dnd.TextTransfer;
......
222 224
                        configRegistry,
223 225
                        columnHeaderDataLayer));
224 226
        //row
225
        RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(new DataLayer(rowHeaderDataProvider, 50, 20),
227
        DataLayer rowHeaderDataLayer = new DataLayer(rowHeaderDataProvider);
228
        RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
226 229
                bodyLayer, bodyLayer.getSelectionLayer());
230
        rowHeaderDataLayer.setDefaultRowHeight(20);
231
        rowHeaderDataLayer.setColumnWidthByPosition(0, 30);
232
        rowHeaderDataLayer.setColumnWidthByPosition(1, 200);
233
        rowHeaderDataLayer.setColumnWidthByPosition(2, 100);
234

  
227 235
        //corner
228 236
        DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
229 237
                colHeaderDataProvider, rowHeaderDataProvider);
......
233 241
        GridLayer gridLayer = new GridLayer(bodyLayer, sortHeaderLayer,
234 242
                rowHeaderLayer, cornerLayer);
235 243

  
236
        dataLayer.setColumnPercentageSizing(true);
237

  
238 244
        natTable = new NatTable(bottomComposite, gridLayer, false);
239 245
        natTable.setConfigRegistry(configRegistry);
240 246

  
......
401 407

  
402 408
    @Optional
403 409
    @Inject
404
    private void setSelectionAfterSearch(@UIEventTopic(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED)IStructuredSelection selection){
410
    private void updateAfterSearch(@UIEventTopic(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED)IStructuredSelection selection){
405 411
        if(selection!=null){
406 412
            setSelection(selection);
407 413
        }
414
        //auto resize columns
415
        InitializeAutoResizeColumnsCommand command = new InitializeAutoResizeColumnsCommand(
416
                natTable, 2, natTable.getConfigRegistry(), new GCFactory(
417
                        natTable));
418
        natTable.doCommand(command);
419
        command = new InitializeAutoResizeColumnsCommand(
420
                natTable, 1, natTable.getConfigRegistry(), new GCFactory(
421
                        natTable));
422
        natTable.doCommand(command);
408 423
    }
409 424

  
410 425
    public void refresh(){
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
190 190
                    monitor.setTaskName(String.format(Messages.AbstractBulkEditorInput_LOADED, loadedCount, totalWork, getName()));
191 191
                } while (!entities.isEmpty());
192 192
	            monitor.done();
193
	            if(selection!=null){
194
	                EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection);
195
	            }
193
	            EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection);
196 194
	        });
197 195
	        searchJob.schedule();
198 196
		}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)