Package org.eclipse.nebula.widgets.nattable.selection

Examples of org.eclipse.nebula.widgets.nattable.selection.SelectionLayer


        propertyToLabelMap.put("birthday", "Birthday");

        IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
                PersonService.getPersons(100), propertyNames);
        DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
        SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
        ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);

        // add the PrintCommandHandler to the ViewportLayer in order to make
        // printing work
        viewportLayer.registerCommandHandler(new PrintCommandHandler(
View Full Code Here


        // create the body layer stack
        IDataProvider bodyDataProvider = new ListDataProvider<Person>(data,
                columnPropertyAccessor);
        final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
        final SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
        ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);

        // create the column header layer stack
        IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
View Full Code Here

    public Control createExampleControl(Composite parent) {
        // To make the default edit and selection configurations work correctly,
        // the region label
        // GridRegion.BODY is necessary, which is directly set to the
        // ViewportLayer instance here.
        ViewportLayer layer = new ViewportLayer(new SelectionLayer(
                new SpanningDataLayer(new DummySpanningBodyDataProvider(100,
                        100))));
        layer.setRegionName(GridRegion.BODY);

        NatTable natTable = new NatTable(parent, layer, false);
View Full Code Here

    /**
     * Set up selection behavior. Select cells vs select rows.
     */
    protected void configureSelectionStyle() {
        SelectionLayer selectionLayer = bodyLayer.getSelectionLayer();
        if (tableModel.enableFullRowSelection) {
            selectionLayer
                    .addConfiguration(new RowOnlySelectionConfiguration<T>());
            natTable.addConfiguration(new RowSelectionUIBindings());
            selectionLayer
                    .setSelectionModel(new RowSelectionModel<T>(selectionLayer,
                            bodyLayer.getDataProvider(), rowIdAccessor));
        } else {
            selectionLayer
                    .addConfiguration(new DefaultSelectionLayerConfiguration());
        }
        natTable.addConfiguration(new SelectionStyleConfiguration(tableStyle));
    }
View Full Code Here

        // all columns will be same size while the NatTable itself will have
        // 100%
        final DataLayer n1DataLayer = new DataLayer(dataProvider);
        n1DataLayer.setColumnPercentageSizing(true);
        n1DataLayer.setRowPercentageSizing(true);
        ViewportLayer layer = new ViewportLayer(new SelectionLayer(n1DataLayer));
        layer.setRegionName(GridRegion.BODY);
        final NatTable n1 = new NatTable(simplePanel, layer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(n1);

        // example for fixed percentage sizing
        // ensure that the sum of column sizes is not greater than 100
        final DataLayer n2DataLayer = new DataLayer(dataProvider);
        n2DataLayer.setColumnWidthPercentageByPosition(0, 25);
        n2DataLayer.setColumnWidthPercentageByPosition(1, 25);
        n2DataLayer.setColumnWidthPercentageByPosition(2, 50);
        layer = new ViewportLayer(new SelectionLayer(n2DataLayer));
        layer.setRegionName(GridRegion.BODY);
        final NatTable n2 = new NatTable(simplePanel, layer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(n2);

        // example for mixed percentage sizing
        // configure not every column with the exact percentage value, this way
        // the columns for which
        // no exact values are set will use the remaining space
        final DataLayer n3DataLayer = new DataLayer(dataProvider);
        n3DataLayer.setColumnPercentageSizing(true);
        n3DataLayer.setColumnWidthPercentageByPosition(0, 40);
        n3DataLayer.setColumnWidthPercentageByPosition(2, 40);
        layer = new ViewportLayer(new SelectionLayer(n3DataLayer));
        layer.setRegionName(GridRegion.BODY);
        final NatTable n3 = new NatTable(simplePanel, layer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(n3);

        // example for mixed fixed/percentage sizing
        // configure not every column with the exact percentage value, this way
        // the columns for which
        // no exact values are set will use the remaining space
        final DataLayer mixDataLayer = new DataLayer(dataProvider);
        mixDataLayer.setColumnPercentageSizing(true);
        mixDataLayer.setColumnPercentageSizing(0, false);
        mixDataLayer.setColumnPercentageSizing(1, false);
        mixDataLayer.setColumnWidthByPosition(0, 100);
        mixDataLayer.setColumnWidthByPosition(1, 100);
        layer = new ViewportLayer(new SelectionLayer(mixDataLayer));
        layer.setRegionName(GridRegion.BODY);
        final NatTable mix = new NatTable(simplePanel, layer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(mix);

        // example for percentage calculation with default sizing in a grid
View Full Code Here

    }

    public Control createExampleControl(Composite parent) {
        CompositeLayer layer = new CompositeLayer(1, 1);
        layer.setChildLayer(GridRegion.BODY, new ViewportLayer(
                new SelectionLayer(new SpanningDataLayer(
                        new DummySpanningBodyDataProvider(1000000, 1000000)))),
                0, 0);
        return new NatTable(parent, layer);
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
        StandaloneNatExampleRunner.run(new SelectionDataLayerExample());
    }

    public Control createExampleControl(Composite parent) {
        return new NatTable(parent, new SelectionLayer(new DataLayer(
                new DummyBodyDataProvider(1000000, 1000000))));
    }
View Full Code Here

        // Body
        this.bodyDataLayer = bodyDataLayer;
        DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(
                bodyDataLayer);

        SelectionLayer selectionLayer = bodyLayer.getSelectionLayer();

        // Column header
        this.columnHeaderDataLayer = columnHeaderDataLayer;
        ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                bodyLayer, selectionLayer);
View Full Code Here

    private final ViewportLayer viewportLayer;

    public DefaultBodyLayerStack(IUniqueIndexLayer underlyingLayer) {
        columnReorderLayer = new ColumnReorderLayer(underlyingLayer);
        columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
        selectionLayer = new SelectionLayer(columnHideShowLayer);
        viewportLayer = new ViewportLayer(selectionLayer);
        setUnderlyingLayer(viewportLayer);

        registerCommandHandler(new CopyDataCommandHandler(selectionLayer));
    }
View Full Code Here

                columnReorderLayer,
                columnGroupModel[columnGroupModel.length - 1]);
        columnHideShowLayer = new ColumnHideShowLayer(columnGroupReorderLayer);
        columnGroupExpandCollapseLayer = new ColumnGroupExpandCollapseLayer(
                columnHideShowLayer, columnGroupModel);
        selectionLayer = new SelectionLayer(columnGroupExpandCollapseLayer);
        viewportLayer = new ViewportLayer(selectionLayer);
        setUnderlyingLayer(viewportLayer);

        registerCommandHandler(new CopyDataCommandHandler(selectionLayer));
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.selection.SelectionLayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.