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

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


    public Control createExampleControl(Composite parent) {
        SelectionExampleGridLayer gridLayer = new SelectionExampleGridLayer();
        NatTable natTable = new NatTable(parent, gridLayer, false);

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

        // Label accumulator - adds labels to all cells with the given data
        // value
        CellOverrideLabelAccumulator<RowDataFixture> cellLabelAccumulator = new CellOverrideLabelAccumulator<RowDataFixture>(
                gridLayer.getBodyDataProvider());
        cellLabelAccumulator.registerOverride("AAA", 2, CELL_LABEL);

        // Register your cell style, against the label applied to the cell
        // Other configuration which can be added (apart from style) include
        // CellConfigAttributes, EditConfigAttributes, SortConfigAttributes etc.
        IConfigRegistry configRegistry = new ConfigRegistry();
        addColumnHighlight(configRegistry);

        // Register label accumulator
        bodyDataLayer.setConfigLabelAccumulator(cellLabelAccumulator);
        gridLayer.getSelectionLayer().addConfiguration(
                new DefaultSelectionLayerConfiguration());

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


        loadMessages();

        ListDataProvider<LogRecord> dataProvider = new ListDataProvider<LogRecord>(
                logMessages, new ReflectiveColumnPropertyAccessor<LogRecord>(
                        new String[] { "message" })); //$NON-NLS-1$
        DataLayer dataLayer = new DataLayer(dataProvider);
        dataLayer.setColumnPercentageSizing(true);
        dataLayer.setColumnWidthPercentageByPosition(0, 100);
        dataLayer
                .setConfigLabelAccumulator(new ValidatorMessageLabelAccumulator());

        ViewportLayer layer = new ViewportLayer(dataLayer);
        layer.setRegionName(GridRegion.BODY);
View Full Code Here

        // Corner
        final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderLayer.getColumnHeaderDataProvider(),
                rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                columnHeaderLayer);

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

    public Control createExampleControl(Composite parent) {
        IConfigRegistry configRegistry = new ConfigRegistry();
        StaticFilterExampleGridLayer underlyingLayer = new StaticFilterExampleGridLayer(
                configRegistry);

        DataLayer bodyDataLayer = underlyingLayer.getBodyDataLayer();
        IDataProvider dataProvider = underlyingLayer.getBodyDataProvider();

        // NOTE: Register the accumulator on the body data layer.
        // This ensures that the labels are bound to the column index and are
        // unaffected by column order.
        final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
                bodyDataLayer);
        bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);

        NatTable natTable = new NatTable(parent, underlyingLayer, false);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
        // natTable.addConfiguration(new DebugMenuConfiguration(natTable));
View Full Code Here

        ObservableElementList<Tuple> observableTupleList = new ObservableElementList<Tuple>(
                baseTupleList, GlazedLists.beanConnector(Tuple.class));
        TupleColumnPropertyAccessor columnPropertyAccessor = new TupleColumnPropertyAccessor();
        ListDataProvider<Tuple> bodyDataProvider = new ListDataProvider<Tuple>(
                observableTupleList, columnPropertyAccessor);
        DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);

        // Enable capturing glazed list update events
        GlazedListsEventLayer<Tuple> glazedListEventsLayer = new GlazedListsEventLayer<Tuple>(
                bodyDataLayer, baseTupleList);

        // Enable blinking
        final BlinkLayer<Tuple> blinkingLayer = new BlinkLayer<Tuple>(
                glazedListEventsLayer, bodyDataProvider, getRowIdAccessor(),
                columnPropertyAccessor, configRegistry);

        registerBlinkingConfigCells(configRegistry);

        // Add Listener to existing elements
        try {
            baseTupleList.getReadWriteLock().readLock().lock();
            for (Tuple tuple : baseTupleList) {
                tuple.addPropertyChangeListener(glazedListEventsLayer);
            }
        } finally {
            baseTupleList.getReadWriteLock().readLock().unlock();
        }

        // Setup row/column and corner layers
        ColumnHeaderDataProvider defaultColumnHeaderDataProvider = new ColumnHeaderDataProvider();
        DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DefaultCornerDataProvider defaultCornerDataProvider = new DefaultCornerDataProvider(
                defaultColumnHeaderDataProvider, rowHeaderDataProvider);

        // Build composite for all regions
        DefaultGridLayer gridLayer = new DefaultGridLayer(blinkingLayer,
                new DefaultColumnHeaderDataLayer(
                        defaultColumnHeaderDataProvider),
                new DefaultRowHeaderDataLayer(rowHeaderDataProvider),
                new DataLayer(defaultCornerDataProvider));

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

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

                // Do nothing
            }

        };

        ILayer layer = new DataLayer(myDataProvider);

        return new NatTable(parent, layer);
    }
View Full Code Here

        DefaultGridLayer gridLayer = new DefaultGridLayer(
                RowDataListFixture.getList(),
                RowDataListFixture.getPropertyNames(),
                RowDataListFixture.getPropertyToLabelMap());

        DataLayer columnHeaderDataLayer = (DataLayer) gridLayer
                .getColumnHeaderDataLayer();
        columnHeaderDataLayer
        .setConfigLabelAccumulator(new ColumnLabelAccumulator());

        final DataLayer bodyDataLayer = (DataLayer) gridLayer
                .getBodyDataLayer();
        IDataProvider dataProvider = bodyDataLayer.getDataProvider();

        // NOTE: Register the accumulator on the body data layer.
        // This ensures that the labels are bound to the column index and are
        // unaffected by column order.
        final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
                bodyDataLayer);
        bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);

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

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

    public Control createExampleControl(Composite parent) {
        DummyGridLayerStack layer = new DummyGridLayerStack(500, 1000000);

        // Widen row header so that all the row numbers are visible
        DataLayer rowHeaderDataLayer = (DataLayer) layer
                .getRowHeaderDataLayer();
        rowHeaderDataLayer.setColumnWidthByPosition(0, 80);

        return new NatTable(parent, layer);
    }
View Full Code Here

        IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<Person>(
                propertyNames);
        IDataProvider listDataProvider = new ListDataProvider<Person>(myList,
                columnPropertyAccessor);
        ILayer layer = new DataLayer(listDataProvider);

        return new NatTable(parent, layer);
    }
View Full Code Here

public class ElementalViewportLayerPerformanceTest extends
        AbstractLayerPerformanceTest {

    @Test
    public void testViewportDataLayerPerformance() {
        layer = new ViewportLayer(new DataLayer(new DummyBodyDataProvider(
                1000000, 1000000)));
    }
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.