Package org.eclipse.nebula.widgets.nattable.layer

Examples of org.eclipse.nebula.widgets.nattable.layer.CompositeLayer


                    }
                });

        // set the region labels to make default configurations work, e.g.
        // selection
        CompositeLayer firstCompositeLayer = new CompositeLayer(1, 2);
        firstCompositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
                firstColumnHeaderLayer, 0, 0);
        firstCompositeLayer.setChildLayer(GridRegion.BODY, firstViewportLayer,
                0, 1);

        final NatTable firstNatTable = new NatTable(panel, firstCompositeLayer,
                false);

        firstNatTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        firstNatTable.addConfiguration(new ActiveTableStyleConfiguration());
        firstNatTable.configure();

        // set the modern theme
        firstNatTable.setTheme(new ModernNatTableThemeConfiguration());

        // add overlay painter for full borders
        firstNatTable.addOverlayPainter(new NatTableBorderOverlayPainter());

        // create the second table
        // create the body layer stack
        final IRowDataProvider<Person> secondBodyDataProvider = new ListDataProvider<Person>(
                getFlandersList(), columnPropertyAccessor);
        final DataLayer secondBodyDataLayer = new DataLayer(
                secondBodyDataProvider);
        final SelectionLayer secondSelectionLayer = new SelectionLayer(
                secondBodyDataLayer);
        ViewportLayer secondViewportLayer = new ViewportLayer(
                secondSelectionLayer);

        // use a RowSelectionModel that will perform row selections and is able
        // to identify a row via unique ID
        secondSelectionLayer.setSelectionModel(new RowSelectionModel<Person>(
                secondSelectionLayer, secondBodyDataProvider, rowIdAccessor));

        // create the column header layer stack
        DataLayer secondColumnHeaderDataLayer = new DataLayer(
                columnHeaderDataProvider);
        ILayer secondColumnHeaderLayer = new ColumnHeaderLayer(
                secondColumnHeaderDataLayer, secondViewportLayer,
                secondSelectionLayer);

        // register custom label styling to indicate if the table is active
        secondColumnHeaderDataLayer
                .setConfigLabelAccumulator(new IConfigLabelAccumulator() {
                    @Override
                    public void accumulateConfigLabels(LabelStack configLabels,
                            int columnPosition, int rowPosition) {
                        if (!isFirstSelectionProvider) {
                            configLabels.addLabelOnTop(ACTIVE_LABEL);
                        }
                    }
                });

        // set the region labels to make default configurations work, e.g.
        // selection
        CompositeLayer secondCompositeLayer = new CompositeLayer(1, 2);
        secondCompositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
                secondColumnHeaderLayer, 0, 0);
        secondCompositeLayer.setChildLayer(GridRegion.BODY,
                secondViewportLayer, 0, 1);

        final NatTable secondNatTable = new NatTable(panel,
                secondCompositeLayer, false);
View Full Code Here


        // the last 4 columns
        ViewportLayer viewportLayerRight = new ViewportLayer(bodyDataLayer);
        viewportLayerRight.setMinColumnPosition(5);

        // create a CompositeLayer that contains both ViewportLayers
        CompositeLayer compositeLayer = new CompositeLayer(2, 1);
        compositeLayer.setChildLayer("REGION_A", viewportLayerLeft, 0, 0);
        compositeLayer.setChildLayer("REGION_B", viewportLayerRight, 1, 0);

        // in order to make printing and exporting work correctly you need to
        // register the following
        // command handlers
        // although in this example printing and exporting is not enabled, we
        // show the registering
        compositeLayer
                .registerCommandHandler(new MultiTurnViewportOnCommandHandler(
                        viewportLayerLeft, viewportLayerRight));
        compositeLayer
                .registerCommandHandler(new MultiTurnViewportOffCommandHandler(
                        viewportLayerLeft, viewportLayerRight));

        // set the width of the left viewport to only showing 2 columns at the
        // same time
View Full Code Here

        // Plug in the SummaryRowLayer
        SummaryRowLayer summaryRowLayer = new SummaryRowLayer(dataLayer, configRegistry, false);
        // configure the SummaryRowLayer to be rendered standalone
        summaryRowLayer.setStandalone(true);

        CompositeLayer composite = new CompositeLayer(1, 2);
        composite.setChildLayer("SUMMARY", summaryRowLayer, 0, 0);
        composite.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);

        NatTable natTable = new NatTable(panel, composite, false);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        // Configure custom summary formula for a column
        natTable.addConfiguration(new ExampleSummaryRowConfiguration(dataProvider));
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.setConfigRegistry(configRegistry);
        natTable.configure();

        // Summary row fixed at the bottom
        dataLayer = new DataLayer(dataProvider);
        // IMPORTANT:
        // since the summary row layer is to the bottom of the viewport layer
        // we need to configure a GridLineCellLayerPainter that clips the top
        // cell. This means the body data layer is clipped at the bottom since
        // the painter is used globally
        dataLayer.setLayerPainter(new GridLineCellLayerPainter(false, true));

        viewportLayer = new ViewportLayer(dataLayer);

        // Plug in the SummaryRowLayer
        summaryRowLayer = new SummaryRowLayer(dataLayer, configRegistry, false);
        // configure the SummaryRowLayer to be rendered standalone
        summaryRowLayer.setStandalone(true);

        composite = new CompositeLayer(1, 2);
        composite.setChildLayer(GridRegion.BODY, viewportLayer, 0, 0);
        composite.setChildLayer("SUMMARY", summaryRowLayer, 0, 1);

        natTable = new NatTable(panel, composite, false);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        // Configure custom summary formula for a column
View Full Code Here

        ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(
                new DummyColumnHeaderDataProvider(bodyDataProvider)),
                viewportLayer, selectionLayer);

        CompositeLayer compositeLayer = new CompositeLayer(1, 2);
        compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
                columnHeaderLayer, 0, 0);
        compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);

        NatTable natTable = new NatTable(parent, compositeLayer);

        // add DnD support
        DragAndDropSupport dndSupport = new DragAndDropSupport(natTable,
View Full Code Here

        // build the grid layer
        GridLayer gridLayer = new GridLayer(bodyLayerStack, columnHeaderLayer,
                rowHeaderLayer, cornerLayer);

        // set the group by header on top of the grid
        CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);
        final GroupByHeaderLayer groupByHeaderLayer = new GroupByHeaderLayer(
                bodyLayerStack.getGroupByModel(), gridLayer,
                columnHeaderDataProvider);
        compositeGridLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION,
                groupByHeaderLayer, 0, 0);
        compositeGridLayer.setChildLayer("Grid", gridLayer, 0, 1);

        // turn the auto configuration off as we want to add our header menu
        // configuration
        NatTable natTable = new NatTable(parent, compositeGridLayer, false);
View Full Code Here

        // and resizing is working together
        columnHeaderLayer
                .addConfiguration(new ColumnHeaderHoverLayerConfiguration(
                        columnHoverLayer));

        CompositeLayer compLayer = new CompositeLayer(1, 2);
        compLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0,
                0);
        compLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);

        // turn the auto configuration off as we want to add our hover styling
        // configuration
        NatTable natTable = new NatTable(parent, compLayer, false);
View Full Code Here

        assertNull(ActiveCellEditorRegistry.getActiveCellEditor());
    }

    @Test
    public void openEditorForSpannedCellsShouldOpenInline() throws Exception {
        CompositeLayer layer = new CompositeLayer(1, 1);
        SelectionLayer selectionLayer = new SelectionLayer(
                new SpanningDataLayer(new DummySpanningBodyDataProvider(100,
                        100)));
        layer.setChildLayer(GridRegion.BODY, new ViewportLayer(selectionLayer),
                0, 0);
        natTable = new NatTableFixture(layer, 1200, 300, false);

        layer.addConfiguration(new DefaultEditBindings());
        layer.addConfiguration(new DefaultEditConfiguration());

        natTable.enableEditingOnAllCells();

        final boolean[] inlineFired = new boolean[1];
        inlineFired[0] = false;
View Full Code Here

        assertTrue("No InlineCellEditEvent fired", inlineFired[0]);
    }

    @Test
    public void updateAllUnderlyingCellsIfSpanned() throws Exception {
        CompositeLayer layer = new CompositeLayer(1, 1);
        DummySpanningBodyDataProvider dataProvider = new DummySpanningBodyDataProvider(
                100, 100);
        SelectionLayer selectionLayer = new SelectionLayer(
                new SpanningDataLayer(dataProvider));
        layer.setChildLayer(GridRegion.BODY, new ViewportLayer(selectionLayer),
                0, 0);
        natTable = new NatTableFixture(layer, 1200, 300, false);

        layer.addConfiguration(new DefaultEditBindings());
        layer.addConfiguration(new DefaultEditConfiguration());

        natTable.enableEditingOnAllCells();

        natTable.configure();
View Full Code Here

                        columnPropertyAccessor, configRegistry),
                sortHeaderLayer, columnHeaderDataProvider, configRegistry);

        // set the region labels to make default configurations work, e.g.
        // editing, selection
        CompositeLayer compositeLayer = new CompositeLayer(1, 2);
        compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
                filterRowHeaderLayer, 0, 0);
        compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);

        // add edit configurations
        compositeLayer.addConfiguration(new DefaultEditConfiguration());
        compositeLayer.addConfiguration(new DefaultEditBindings());

        // add print support
        compositeLayer.registerCommandHandler(new PrintCommandHandler(
                compositeLayer));
        compositeLayer.addConfiguration(new DefaultPrintBindings());

        // add excel export support
        compositeLayer.registerCommandHandler(new ExportCommandHandler(
                compositeLayer));
        compositeLayer.addConfiguration(new DefaultExportBindings());

        final NatTable natTable = new NatTable(gridPanel, compositeLayer, false);

        natTable.setConfigRegistry(configRegistry);
View Full Code Here

        // build the grid layer
        GridLayer gridLayer = new GridLayer(bodyLayerStack,
                filterRowHeaderLayer, rowHeaderLayer, cornerLayer);

        // set the group by header on top of the grid
        CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);
        final GroupByHeaderLayer groupByHeaderLayer = new GroupByHeaderLayer(
                bodyLayerStack.getGroupByModel(), gridLayer,
                columnHeaderDataProvider);
        compositeGridLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION,
                groupByHeaderLayer, 0, 0);
        compositeGridLayer.setChildLayer("Grid", gridLayer, 0, 1);

        // turn the auto configuration off as we want to add our header menu
        // configuration
        final NatTable natTable = new NatTable(container, compositeGridLayer,
                false);
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.layer.CompositeLayer

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.