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

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


                .run(new ViewportSelectionHideShowDataLayerExample());
    }

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


        assertEquals(315, columnReorderLayer.getStartXOfColumnPosition(4));
    }

    @Test
    public void getConfigLabelsByPosition() throws Exception {
        DataLayer underlyingLayer = new DataLayerFixture();
        columnReorderLayer = new ColumnReorderLayer(underlyingLayer);
        ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
                underlyingLayer);
        registerCellStyleAccumulators(underlyingLayer, columnLabelAccumulator);
View Full Code Here

                .run(new ViewportSelectionReorderDataLayerExample());
    }

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

        propertyToLabelMap.put("columnSevenNumber", "C 7");
        propertyToLabelMap.put("columnEightNumber", "C 8");

        DefaultGridLayer gridLayer = new DefaultGridLayer(
                createNumberValuesList(), propertyNames, propertyToLabelMap);
        DataLayer bodyDataLayer = (DataLayer) gridLayer.getBodyDataLayer();
        bodyDataLayer.setDefaultRowHeight(40);
        bodyDataLayer.setDefaultColumnWidth(40);

        final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
                bodyDataLayer);
        bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);
        registerColumnLabels(columnLabelAccumulator);

        NatTable natTable = new NatTable(parent, gridLayer, false);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new TableDecorationConfiguration(
View Full Code Here

        ILayer rowHeaderLayer = new RowHeaderLayer(
                new DefaultRowHeaderDataLayer(rowHeaderDataProvider),
                bodyLayer, selectionLayer);

        // Corner
        ILayer cornerLayer = new CornerLayer(new DataLayer(
                new DefaultCornerDataProvider(columnHeaderDataProvider,
                        rowHeaderDataProvider)), rowHeaderLayer,
                columnHeaderLayer);

        setBodyLayer(bodyLayer);
View Full Code Here

    public Control createExampleControl(Composite parent) {
        DummyBodyDataProvider bodyDataProvider = new DummyBodyDataProvider(200,
                1000000);
        SelectionLayer selectionLayer = new SelectionLayer(
                new ColumnReorderLayer(new DataLayer(bodyDataProvider)));
        ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);

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

        CompositeLayer compositeLayer = new CompositeLayer(1, 2);
        compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
View Full Code Here

                + "scrolling over a 1,000,000 column by 1,000,000 row data layer.";
    }

    public Control createExampleControl(Composite parent) {
        ViewportLayer layer = new ViewportLayer(new SelectionLayer(
                new DataLayer(new DummyBodyDataProvider(1000000, 1000000))));
        layer.setRegionName(GridRegion.BODY);
        return new NatTable(parent, layer);
    }
View Full Code Here

                propertyNames);

        // Column header layer
        IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames);
        DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                columnHeaderDataProvider);

        ISortModel sortModel = new GlazedListsSortModel<Datum>(sortedList,
                columnPropertyAccessor, configRegistry, columnHeaderDataLayer);

        final TreeList<Datum> treeList = new TreeList<Datum>(sortedList,
                new DatumTreeFormat(sortModel), new DatumExpansionModel());
        GlazedListTreeData<Datum> treeData = new DatumTreeData(treeList);

        GlazedListsDataProvider<Datum> bodyDataProvider = new GlazedListsDataProvider<Datum>(
                treeList, columnPropertyAccessor);
        final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);

        // Handle update of CheckBoxField objects in column 0
        bodyDataLayer.registerCommandHandler(new UpdateDataCommandHandler(
                bodyDataLayer) {
            @Override
            protected boolean doCommand(UpdateDataCommand command) {
                int columnPosition = command.getColumnPosition();
                int rowPosition = command.getRowPosition();

                if (columnPosition == 0) {
                    Datum datum = (Datum) bodyDataLayer.getDataProvider()
                            .getDataValue(columnPosition, rowPosition);
                    datum.setOn((Boolean) command.getNewValue());

                    bodyDataLayer.fireLayerEvent(new CellVisualChangeEvent(
                            bodyDataLayer, columnPosition, rowPosition));
                    return true;
                } else {
                    return super.doCommand(command);
                }
            }
        });

        // Body layer
        ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
                bodyDataLayer);
        ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
                columnReorderLayer);
        SelectionLayer selectionLayer = new SelectionLayer(columnHideShowLayer);

        // Switch the ITreeRowModel implementation between using native grid
        // Hide/Show or GlazedList TreeList Hide/Show
        // TreeLayer treeLayer = new TreeLayer(selectionLayer, new
        // TreeRowModel<Datum>(treeData), true);
        final TreeLayer treeLayer = new TreeLayer(selectionLayer,
                new GlazedListTreeRowModel<Datum>(treeData));

        ViewportLayer viewportLayer = new ViewportLayer(treeLayer);

        ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
                columnHeaderDataLayer, viewportLayer, selectionLayer);
        // Note: The column header layer is wrapped in a filter row composite.
        // This plugs in the filter row functionality

        ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(
                columnHeaderDataLayer);
        columnHeaderDataLayer.setConfigLabelAccumulator(labelAccumulator);

        // Register labels
        SortHeaderLayer<Datum> sortHeaderLayer = new SortHeaderLayer<Datum>(
                columnHeaderLayer, sortModel, false);

        // Row header layer
        DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                viewportLayer, selectionLayer);

        // Corner layer
        DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        // CornerLayer cornerLayer = new CornerLayer(cornerDataLayer,
        // rowHeaderLayer, columnHeaderLayer);
        CornerLayer cornerLayer = new CornerLayer(cornerDataLayer,
                rowHeaderLayer, sortHeaderLayer);
View Full Code Here

        valuesToShow.addAll(createEventData());

        ConfigRegistry configRegistry = new ConfigRegistry();
        DefaultGridLayer gridLayer = new DefaultGridLayer(valuesToShow,
                propertyNames, propertyToLabelMap);
        DataLayer bodyDataLayer = (DataLayer) gridLayer.getBodyDataLayer();

        IRowDataProvider<EventData> bodyDataProvider = (IRowDataProvider<EventData>) bodyDataLayer
                .getDataProvider();
        bodyDataLayer
                .setConfigLabelAccumulator(new CrossValidationLabelAccumulator(
                        bodyDataProvider));

        final NatTable natTable = new NatTable(gridPanel, gridLayer, false);
        natTable.setConfigRegistry(configRegistry);
View Full Code Here

    public Control createExampleControl(Composite parent) {
        // Body
        final DummyBodyDataProvider bodyDataProvider = new DummyBodyDataProvider(
                20, 1000);
        final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
        final DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(
                bodyDataLayer);
        final SelectionLayer selectionLayer = bodyLayer.getSelectionLayer();
        final FreezeLayer freezeLayer = new FreezeLayer(selectionLayer);
        final CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(
                freezeLayer, bodyLayer.getViewportLayer(), selectionLayer);

        // Column header
        final IDataProvider columnHeaderDataProvider = new DummyColumnHeaderDataProvider(
                bodyDataProvider);
        final ILayer columnHeaderLayer = new ColumnHeaderLayer(
                new DefaultColumnHeaderDataLayer(columnHeaderDataProvider),
                compositeFreezeLayer, selectionLayer);

        // Row header
        final IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        final ILayer rowHeaderLayer = new RowHeaderLayer(
                new DefaultRowHeaderDataLayer(rowHeaderDataProvider),
                compositeFreezeLayer, selectionLayer);

        // Corner
        final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderDataProvider, rowHeaderDataProvider);
        final CornerLayer cornerLayer = new CornerLayer(new DataLayer(
                cornerDataProvider), rowHeaderLayer, columnHeaderLayer);

        // Grid
        final GridLayer gridLayer = new GridLayer(compositeFreezeLayer,
                columnHeaderLayer, rowHeaderLayer, cornerLayer);
View Full Code Here

TOP

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

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.