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

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


        Map<String, String> propertyToLabelMap = RowGroupDataListFixture
                .getPropertyToLabelMap();

        DefaultBodyDataProvider<RowGroupDataFixture> bodyDataProvider = new DefaultBodyDataProvider<RowGroupDataFixture>(
                RowGroupDataListFixture.getList(2000), propertyNames);
        DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);

        ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
                bodyDataLayer);
        ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
                columnReorderLayer);

        RowHideShowLayer rowHideShowLayer = new RowHideShowLayer(
                columnHideShowLayer);
        RowGroupModel<RowGroupDataFixture> rowGroupModel = new RowGroupModel<RowGroupDataFixture>();
        rowGroupModel.setDataProvider(bodyDataProvider);
        RowGroupExpandCollapseLayer<RowGroupDataFixture> rowExpandCollapseLayer = new RowGroupExpandCollapseLayer<RowGroupDataFixture>(
                rowHideShowLayer, rowGroupModel);

        SelectionLayer selectionLayer = new SelectionLayer(
                rowExpandCollapseLayer);
        ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);

        // Column header

        DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
        DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                defaultColumnHeaderDataProvider);
        ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
                columnHeaderDataLayer, viewportLayer, selectionLayer);

        // Row header

        DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);

        RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                viewportLayer, selectionLayer, false);
        rowHeaderLayer.addConfiguration(new RowHeaderConfiguration());

        RowGroupHeaderLayer<RowGroupDataFixture> rowGroupHeaderLayer = new RowGroupHeaderLayer<RowGroupDataFixture>(
                rowHeaderLayer, selectionLayer, rowGroupModel);
        rowGroupHeaderLayer.setColumnWidth(20);

        // Create a group of rows for the model.
        RowGroup<RowGroupDataFixture> rowGroup = new RowGroup<RowGroupDataFixture>(
                rowGroupModel, "Group 1", true);
        rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(1));
        rowGroup.addMemberRow(bodyDataProvider.getRowObject(2));
        rowGroupModel.addRowGroup(rowGroup);

        rowGroup = new RowGroup<RowGroupDataFixture>(rowGroupModel, "Group 2",
                true);
        rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(11));
        rowGroup.addMemberRow(bodyDataProvider.getRowObject(12));
        rowGroup.addMemberRow(bodyDataProvider.getRowObject(13));
        rowGroupModel.addRowGroup(rowGroup);

        rowGroup = new RowGroup<RowGroupDataFixture>(rowGroupModel, "Group 3",
                false);
        rowGroup.addMemberRow(bodyDataProvider.getRowObject(18));
        rowGroup.addMemberRow(bodyDataProvider.getRowObject(19));
        rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(20));
        rowGroupModel.addRowGroup(rowGroup);

        // Corner

        final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                defaultColumnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer,
                rowGroupHeaderLayer, columnHeaderLayer);

        // Grid
        GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
View Full Code Here


    }

    public Control createExampleControl(Composite parent) {
        DummyBodyDataProvider bodyDataProvider = new DummyBodyDataProvider(5,
                10);
        DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
        bodyDataLayer.setDefaultRowHeight(100);
        SelectionLayer selectionLayer = new SelectionLayer(
                new ColumnHideShowLayer(new ColumnReorderLayer(bodyDataLayer)));
        InvertedLayer invertedLayer = new InvertedLayer(selectionLayer);
        ViewportLayer viewportLayer = new ViewportLayer(invertedLayer);

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

        DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DataLayer rowHeaderDataLayer = new DataLayer(rowHeaderDataProvider);
        rowHeaderDataLayer.setDefaultColumnWidth(40);
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                viewportLayer, selectionLayer);

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

        GridLayer compositeLayer = new GridLayer(viewportLayer,
View Full Code Here

        ConfigRegistry configRegistry = new ConfigRegistry();

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

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

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

                viewportLayer, selectionLayer);

        // Column header layer
        final IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
        final DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                columnHeaderDataProvider);
        ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
                columnHeaderDataLayer, compFreeze, 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);
        bodyDataLayer.setConfigLabelAccumulator(labelAccumulator);

        // Register labels
        labelAccumulator.registerColumnOverrides(RowDataListFixture
                .getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
                "CUSTOM_COMPARATOR_LABEL");

        // Row header layer
        DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataLayer.getDataProvider());
        DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                compFreeze, selectionLayer);

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

        // Grid
        GridLayer gridLayer = new GridLayer(compFreeze, columnHeaderLayer,
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);
        DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);

        // GlazedListsEventLayer<Datum> glazedListsEventLayer =
        // new GlazedListsEventLayer<Datum>(bodyDataLayer, treeList);
        DetailGlazedListsEventLayer<Datum> glazedListsEventLayer = new DetailGlazedListsEventLayer<Datum>(
                bodyDataLayer, treeList);

        // Body layer
        ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
                glazedListsEventLayer);
        ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
                columnReorderLayer);

        RowHideShowLayer rowHideShowLayer = new RowHideShowLayer(
                columnHideShowLayer);

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

        SelectionLayer selectionLayer = new SelectionLayer(treeLayer);

        ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);

        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, sortHeaderLayer);

        // Grid
        GridLayer gridLayer = new GridLayer(viewportLayer, sortHeaderLayer,
View Full Code Here

    public CalculatingBodyLayerStack(EventList<NumberValues> valuesToShow,
            ConfigRegistry configRegistry) {
        IDataProvider dataProvider = new GlazedListsDataProvider<NumberValues>(
                valuesToShow, new CalculatingDataProvider());
        bodyDataLayer = new DataLayer(dataProvider);
        glazedListsEventLayer = new GlazedListsEventLayer<NumberValues>(
                bodyDataLayer, valuesToShow);
        summaryRowLayer = new SummaryRowLayer(glazedListsEventLayer,
                configRegistry, false);
        summaryRowLayer
View Full Code Here

        DefaultGridLayer gridLayer = new DefaultGridLayer(bodyDataProvider,
                new DefaultColumnHeaderDataProvider(propertyNames,
                        propertyToLabelMap));

        final DataLayer bodyDataLayer = (DataLayer) gridLayer
                .getBodyDataLayer();

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

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

            public void setDataValue(int columnIndex, int rowIndex,
                    Object newValue) {}
        };

        IConfigRegistry configRegistry = new ConfigRegistry();
        IUniqueIndexLayer dataLayer = new DataLayer(myDataProvider);

        // Plug in the SummaryRowLayer
        IUniqueIndexLayer summaryRowLayer = new SummaryRowLayer(dataLayer,
                configRegistry, false);
        ViewportLayer viewportLayer = new ViewportLayer(summaryRowLayer);
View Full Code Here

        IColumnPropertyAccessor<BlinkingRowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<BlinkingRowDataFixture>(
                propertyNames);
        bodyDataProvider = new ListDataProvider<BlinkingRowDataFixture>(
                observableElementList, columnPropertyAccessor);

        final DataLayer bodyLayer = new DataLayer(bodyDataProvider);

        GlazedListsEventLayer<BlinkingRowDataFixture> glazedListsEventLayer = new GlazedListsEventLayer<BlinkingRowDataFixture>(
                bodyLayer, observableElementList);
        BlinkLayer<BlinkingRowDataFixture> blinkingLayer = new BlinkLayer<BlinkingRowDataFixture>(
                glazedListsEventLayer, bodyDataProvider,
                BlinkingRowDataFixture.rowIdAccessor, columnPropertyAccessor,
                configRegistry);
        registerBlinkingConfigCells(configRegistry);
        insertRowData(glazedListsEventLayer, bodyDataProvider);

        // Column header
        final DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);

        // Row header
        final DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);

        // Corner
        final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                defaultColumnHeaderDataProvider, rowHeaderDataProvider);

        // Grid
        GridLayer gridLayer = new DefaultGridLayer(blinkingLayer,
                new DefaultColumnHeaderDataLayer(
                        defaultColumnHeaderDataProvider),
                new DefaultRowHeaderDataLayer(rowHeaderDataProvider),
                new DataLayer(cornerDataProvider));

        NatTable natTable = new NatTable(parent, gridLayer, false);

        natTable.setConfigRegistry(configRegistry);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
View Full Code Here

    }

    public Control createExampleControl(Composite parent) {
        // Setup the layer stack
        final MyDataProvider myDataProvider = new MyDataProvider();
        SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(
                myDataProvider));
        ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(
                new DummyColumnHeaderDataProvider(myDataProvider)),
                selectionLayer, selectionLayer);

        CompositeLayer compositeLayer = new CompositeLayer(1, 2);
        compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
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.