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

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator


        DefaultGridLayer gridLayer = new DefaultGridLayer(listDataProvider,
                new DummyColumnHeaderDataProvider(listDataProvider));
        final DefaultBodyLayerStack bodyLayer = gridLayer.getBodyLayer();

        // Custom label "FOO" for cell at column, row index (1, 5)
        IConfigLabelAccumulator cellLabelAccumulator = new IConfigLabelAccumulator() {
            public void accumulateConfigLabels(LabelStack configLabels,
                    int columnPosition, int rowPosition) {
                int columnIndex = bodyLayer
                        .getColumnIndexByPosition(columnPosition);
                int rowIndex = bodyLayer.getRowIndexByPosition(rowPosition);
View Full Code Here


        HoverLayer bodyHoverLayer = new HoverLayer(bodyDataLayer);
        SelectionLayer selectionLayer = new SelectionLayer(bodyHoverLayer);
        ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);

        // add labels to provider conditional styling
        bodyDataLayer.setConfigLabelAccumulator(new IConfigLabelAccumulator() {
            @Override
            public void accumulateConfigLabels(LabelStack configLabels,
                    int columnPosition, int rowPosition) {
                Person p = bodyDataProvider.getRowObject(rowPosition);
                if (p != null) {
View Full Code Here

        int childRowPosition = compositeRowPosition - getRowPositionOffset(layoutCoordinate.y);
        LabelStack configLabels = childLayer.getConfigLabelsByPosition(
                childColumnPosition, childRowPosition);

        String regionName = this.childLayerToRegionNameMap.get(childLayer);
        IConfigLabelAccumulator configLabelAccumulator = this.regionNameToConfigLabelAccumulatorMap
                .get(regionName);
        if (configLabelAccumulator != null) {
            configLabelAccumulator.accumulateConfigLabels(
                    configLabels, childColumnPosition, childRowPosition);
        }
        configLabels.addLabel(regionName);

        return configLabels;
View Full Code Here

    /**
     * Adds the configLabelAccumulator to the existing label accumulators.
     */
    public void addConfigLabelAccumulatorForRegion(
            String regionName, IConfigLabelAccumulator configLabelAccumulator) {
        IConfigLabelAccumulator existingConfigLabelAccumulator =
                this.regionNameToConfigLabelAccumulatorMap.get(regionName);
        AggregrateConfigLabelAccumulator aggregateAccumulator;
        if (existingConfigLabelAccumulator instanceof AggregrateConfigLabelAccumulator) {
            aggregateAccumulator = (AggregrateConfigLabelAccumulator) existingConfigLabelAccumulator;
        } else {
View Full Code Here

                firstColumnHeaderDataLayer, firstViewportLayer,
                firstSelectionLayer);

        // register custom label styling to indicate if the table is active
        firstColumnHeaderDataLayer
                .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 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);
View Full Code Here

        };
    }

    private void initCellLabelAccumulator() {
        setConfigLabelAccumulator(new IConfigLabelAccumulator() {

            public void accumulateConfigLabels(LabelStack configLabels,
                    int columnPosition, int rowPosition) {
                configLabels.addLabel("DEFAULT");
            }
View Full Code Here

            int rowPosition) {
        int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition);
        int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition);
        LabelStack configLabels = underlyingLayer.getConfigLabelsByPosition(
                underlyingColumnPosition, underlyingRowPosition);
        IConfigLabelAccumulator configLabelAccumulator = getConfigLabelAccumulator();
        if (configLabelAccumulator != null) {
            configLabelAccumulator.accumulateConfigLabels(configLabels,
                    columnPosition, rowPosition);
        }
        String regionName = getRegionName();
        if (regionName != null) {
            configLabels.addLabel(regionName);
View Full Code Here

    public LabelStack getConfigLabelsByPosition(int columnPosition,
            int rowPosition) {
        LabelStack configLabels = underlyingLayer.getConfigLabelsByPosition(
                localToUnderlyingColumnPosition(columnPosition),
                localToUnderlyingRowPosition(rowPosition));
        IConfigLabelAccumulator configLabelAccumulator = getConfigLabelAccumulator();
        if (configLabelAccumulator != null) {
            configLabelAccumulator.accumulateConfigLabels(configLabels,
                    columnPosition, rowPosition);
        }
        String regionName = getRegionName();
        if (regionName != null) {
            configLabels.addLabel(regionName);
View Full Code Here

    }

    @Test
    public void layerStackShouldUpdate() throws Exception {
        // add label accumulator to DataLayer
        dataLayer.setConfigLabelAccumulator(new IConfigLabelAccumulator() {

            @Override
            public void accumulateConfigLabels(LabelStack configLabels,
                    int columnPosition, int rowPosition) {
                configLabels.addLabel(TEST_LABEL);
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator

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.