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

Examples of org.eclipse.nebula.widgets.nattable.layer.stack.ColumnGroupBodyLayerStack


        String[] propertyNames = RowDataListFixture.getPropertyNames();
        Map<String, String> propertyToLabelMap = RowDataListFixture
                .getPropertyToLabelMap();
        DefaultBodyDataProvider<RowDataFixture> bodyDataProvider = new DefaultBodyDataProvider<RowDataFixture>(
                RowDataListFixture.getList(2000), propertyNames);
        ColumnGroupBodyLayerStack bodyLayer = new ColumnGroupBodyLayerStack(
                new DataLayer(bodyDataProvider), sndColumnGroupModel,
                columnGroupModel);

        // Column header

        DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
        DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                defaultColumnHeaderDataProvider);
        columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                bodyLayer, bodyLayer.getSelectionLayer());
        ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
                columnHeaderLayer, bodyLayer.getSelectionLayer(),
                columnGroupModel);

        columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 1", 1, 2);
        columnGroupHeaderLayer.addColumnsIndexesToGroup("UnBreakable group 2",
                4, 5, 6, 7);
        columnGroupHeaderLayer.addColumnsIndexesToGroup("UnBreakable group 3",
                8, 9, 10);
        columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 4", 11, 12, 13);
        columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 5", 14, 15, 16,
                17);
        columnGroupHeaderLayer.setGroupUnbreakable(4);
        columnGroupHeaderLayer.setGroupUnbreakable(8);
        columnGroupHeaderLayer.setGroupAsCollapsed(11);

        ColumnGroupGroupHeaderLayer sndGroup = new ColumnGroupGroupHeaderLayer(
                columnGroupHeaderLayer, bodyLayer.getSelectionLayer(),
                sndColumnGroupModel);

        sndGroup.addColumnsIndexesToGroup("GroupGroup 1", 1, 2, 3, 4, 5, 6, 7);
        sndGroup.addColumnsIndexesToGroup("GroupGroup 2", 11, 12, 13, 14, 15,
                16, 17);

        sndGroup.setStaticColumnIndexesByGroup("GroupGroup 1", 1, 2);

        // Row header

        final DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                bodyLayer, bodyLayer.getSelectionLayer());

        // Corner

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

        // Grid
        GridLayer gridLayer = new GridLayer(bodyLayer, sndGroup,
                rowHeaderLayer, cornerLayer);

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

        // Register create column group command handler

        // Register column chooser
        DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler(
                bodyLayer.getSelectionLayer(),
                bodyLayer.getColumnHideShowLayer(), columnHeaderLayer,
                columnHeaderDataLayer, columnGroupHeaderLayer, columnGroupModel);
        bodyLayer.registerCommandHandler(columnChooserCommandHandler);

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
            @Override
            protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
View Full Code Here


        String[] propertyNames = RowDataListFixture.getPropertyNames();
        Map<String, String> propertyToLabelMap = RowDataListFixture
                .getPropertyToLabelMap();
        DefaultBodyDataProvider<RowDataFixture> bodyDataProvider = new DefaultBodyDataProvider<RowDataFixture>(
                RowDataListFixture.getList(200), propertyNames);
        ColumnGroupBodyLayerStack bodyLayer = new ColumnGroupBodyLayerStack(
                new DataLayer(bodyDataProvider), columnGroupModel);

        // Column header

        DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
        DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                defaultColumnHeaderDataProvider);
        columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                bodyLayer, bodyLayer.getSelectionLayer());
        ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
                columnHeaderLayer, bodyLayer.getSelectionLayer(),
                columnGroupModel);

        columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 1", 1, 2);
        columnGroupHeaderLayer.addColumnsIndexesToGroup("UnBreakable group 2",
                4, 5, 6, 7);
        columnGroupHeaderLayer.addColumnsIndexesToGroup("UnBreakable group 3",
                8, 9, 10);
        columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 4", 11, 12, 13);
        columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 5", 14, 15, 16,
                17);
        columnGroupHeaderLayer.setStaticColumnIndexesByGroup("Group 5", 15, 17);
        columnGroupHeaderLayer.setGroupUnbreakable(4);
        columnGroupHeaderLayer.setGroupUnbreakable(8);
        columnGroupHeaderLayer.setGroupAsCollapsed(11);

        // Row header

        final DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                bodyLayer, bodyLayer.getSelectionLayer());

        // Corner

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

        // Grid
        GridLayer gridLayer = new GridLayer(bodyLayer, columnGroupHeaderLayer,
                rowHeaderLayer, cornerLayer);

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

        // Register create column group command handler

        // Register column chooser
        DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler(
                bodyLayer.getSelectionLayer(),
                bodyLayer.getColumnHideShowLayer(), columnHeaderLayer,
                columnHeaderDataLayer, columnGroupHeaderLayer, columnGroupModel);
        bodyLayer.registerCommandHandler(columnChooserCommandHandler);

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
            @Override
            protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
View Full Code Here

    @Before
    public void setup() {
        model = new ColumnGroupModelFixture();
        model.addColumnsIndexesToGroup("G4", 8, 9);

        bodyStack = new ColumnGroupBodyLayerStack(new DataLayerFixture(20, 10,
                10, 20), model);

        new NatTableFixture(bodyStack); // Inits client area
    }
View Full Code Here

        IColumnPropertyAccessor<RowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<RowDataFixture>(
                propertyNames);
        ListDataProvider<RowDataFixture> bodyDataProvider = new ListDataProvider<RowDataFixture>(
                filterList, columnPropertyAccessor);
        DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
        ColumnGroupBodyLayerStack bodyLayer = new ColumnGroupBodyLayerStack(
                bodyDataLayer, columnGroupModel);

        ColumnOverrideLabelAccumulator bodyLabelAccumulator = new ColumnOverrideLabelAccumulator(
                bodyDataLayer);
        bodyDataLayer.setConfigLabelAccumulator(bodyLabelAccumulator);

        bodyLabelAccumulator
                .registerColumnOverrides(
                        RowDataListFixture
                                .getColumnIndexOfProperty(RowDataListFixture.PRICING_TYPE_PROP_NAME),
                        "PRICING_TYPE_PROP_NAME");

        // Column header
        IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
                propertyNames, propertyToLabelMap);
        DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                columnHeaderDataProvider);
        columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                bodyLayer, bodyLayer.getSelectionLayer());
        ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
                columnHeaderLayer, bodyLayer.getSelectionLayer(),
                columnGroupModel);

        columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 1", 1, 2);

        // calculate the height of the column header area dependent if column
        // groups exist or not
        columnGroupHeaderLayer.setCalculateHeight(true);

        // Note: The column header layer is wrapped in a filter row composite.
        // This plugs in the filter row functionality
        final FilterRowHeaderComposite<RowDataFixture> filterRowHeaderLayer = new FilterRowHeaderComposite<RowDataFixture>(
                new DefaultGlazedListsFilterStrategy<RowDataFixture>(
                        filterList, columnPropertyAccessor, configRegistry),
                columnGroupHeaderLayer, columnHeaderDataProvider,
                configRegistry);

        filterRowHeaderLayer.setFilterRowVisible(false);

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

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

        // Row header

        final DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                bodyLayer, bodyLayer.getSelectionLayer());

        // Corner

        final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                filterRowHeaderLayer);

        // Grid
        GridLayer gridLayer = new GridLayer(bodyLayer, filterRowHeaderLayer,
                rowHeaderLayer, cornerLayer);

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

        // Register create column group command handler

        // Register column chooser
        DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler(
                bodyLayer.getSelectionLayer(),
                bodyLayer.getColumnHideShowLayer(), columnHeaderLayer,
                columnHeaderDataLayer, columnGroupHeaderLayer, columnGroupModel);
        bodyLayer.registerCommandHandler(columnChooserCommandHandler);

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
            @Override
            protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.layer.stack.ColumnGroupBodyLayerStack

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.