Package org.eclipse.nebula.widgets.nattable

Examples of org.eclipse.nebula.widgets.nattable.NatTable


        StandaloneNatExampleRunner
                .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


        StandaloneNatExampleRunner
                .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

    }

    public Control createExampleControl(Composite parent) {
        ZoomLayer zoomLayer = new ZoomLayer(new DummyGridLayerStack());
        zoomLayer.setZoomFactor(3.0f);
        return new NatTable(parent, zoomLayer);
    }
View Full Code Here

        StandaloneNatExampleRunner
                .run(new ViewportSelectionSpanningDataLayerExample());
    }

    public Control createExampleControl(Composite parent) {
        return new NatTable(parent, new ViewportLayer(new SelectionLayer(
                new SpanningDataLayer(new DummySpanningBodyDataProvider(
                        1000000, 1000000)))));
    }
View Full Code Here

        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(
                paintDecorationDependent));
        natTable.configure();

        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
    }
View Full Code Here

                + "in the NatTable constructor to false and then you must explicitly call NatTable.configure() after you have added your "
                + "configurations. Otherwise NatTable will automatically call configure() on itself during construction.";
    }

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

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable));

        natTable.configure();

        return natTable;
    }
View Full Code Here

                + "Note: The button is 'drawn' using a custom painter. This is more efficient than using a Button widget.";
    }

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

        DataLayer bodyDataLayer = gridLayer.getBodyDataLayer();

        // Step 1: Create a label accumulator - adds custom labels to all cells
        // which we
        // wish to render differently. In this case render as a button.
        ColumnOverrideLabelAccumulator cellLabelAccumulator = new ColumnOverrideLabelAccumulator(
                bodyDataLayer);
        cellLabelAccumulator.registerColumnOverrides(2, CUSTOM_CELL_LABEL);

        // Step 2: Register label accumulator
        bodyDataLayer.setConfigLabelAccumulator(cellLabelAccumulator);

        // Step 3: Register your custom cell painter, cell style, against the
        // label applied to the cell.
        addButtonToColumn(configRegistry, natTable);
        natTable.addConfiguration(new ButtonClickConfiguration<RowDataFixture>(
                buttonPainter));

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new DebugMenuConfiguration(natTable));

        natTable.setConfigRegistry(configRegistry);
        natTable.configure();

        // Layout SWT widgets. Not relevant to example code.
        parent.setLayout(new GridLayout(1, true));
        natTable.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
                true));
        setupTextArea(parent);

        return natTable;
    }
View Full Code Here

        CompositeLayer compositeLayer = new CompositeLayer(1, 2);
        compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
                columnHeaderLayer, 0, 0);
        compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);

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

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new DebugMenuConfiguration(natTable));

        natTable.configure();

        return natTable;
    }
View Full Code Here

    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

        // Grid
        GridLayer gridLayer = new GridLayer(viewportLayer,
        // columnHeaderLayer,
                sortHeaderLayer, rowHeaderLayer, cornerLayer);

        NatTable natTable = new NatTable(parent, gridLayer, false);
        natTable.setConfigRegistry(configRegistry);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
        natTable.addConfiguration(new SingleClickSortConfiguration());

        // Uncomment to see the native tree list printed to stout.
        // printTree(treeList, treeData);

        columnHeaderDataLayer
                .setConfigLabelAccumulator(new ColumnLabelAccumulator());

        final ColumnHeaderCheckBoxPainter columnHeaderCheckBoxPainter = new ColumnHeaderCheckBoxPainter(
                bodyDataLayer) {
            @Override
            protected Boolean convertDataType(ILayerCell cell,
                    IConfigRegistry configRegistry) {
                Datum dataValue = (Datum) cell.getDataValue();
                return dataValue.isOn();
            }
        };
        final ICellPainter checkBoxPainter = new TreeCheckBoxPainter() {
            @Override
            protected CheckBoxStateEnum getCheckBoxState(ILayerCell cell) {
                Datum dataValue = (Datum) cell.getDataValue();
                return dataValue.getCheckBoxState();
            }
        };
        natTable.addConfiguration(new AbstractRegistryConfiguration() {
            public void configureRegistry(IConfigRegistry configRegistry) {
                // Column header
                configRegistry
                        .registerConfigAttribute(
                                CellConfigAttributes.CELL_PAINTER,
                                new BeveledBorderDecorator(
                                        new CellPainterDecorator(
                                                new SortableHeaderTextPainter(),
                                                CellEdgeEnum.LEFT,
                                                columnHeaderCheckBoxPainter)),
                                DisplayMode.NORMAL,
                                ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0);

                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.CELL_PAINTER,
                        new BackgroundPainter(new CellPainterDecorator(
                                new TextPainter() {
                                    @Override
                                    protected String convertDataType(
                                            ILayerCell cell,
                                            IConfigRegistry configRegistry) {
                                        Datum dataValue = (Datum) cell
                                                .getDataValue();
                                        return dataValue.getName();
                                    }
                                }, CellEdgeEnum.LEFT, checkBoxPainter)),
                        DisplayMode.NORMAL, TreeLayer.TREE_COLUMN_CELL);

                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.DISPLAY_CONVERTER,
                        new DefaultBooleanDisplayConverter(),
                        DisplayMode.NORMAL, TreeLayer.TREE_COLUMN_CELL);
                configRegistry.registerConfigAttribute(
                        EditConfigAttributes.CELL_EDITABLE_RULE,
                        IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT,
                        TreeLayer.TREE_COLUMN_CELL);
                configRegistry.registerConfigAttribute(
                        EditConfigAttributes.CELL_EDITOR,
                        new CheckBoxCellEditor() {
                            @Override
                            public void setCanonicalValue(Object canonicalValue) {
                                Datum value = (Datum) canonicalValue;
                                super.setCanonicalValue(value.isOn());
                            }
                        }, DisplayMode.NORMAL, TreeLayer.TREE_COLUMN_CELL);
            }

            @Override
            public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
                uiBindingRegistry.registerFirstSingleClickBinding(
                        new CellPainterMouseEventMatcher(
                                GridRegion.COLUMN_HEADER,
                                MouseEventMatcher.LEFT_BUTTON,
                                columnHeaderCheckBoxPainter),
                        new ToggleCheckBoxColumnAction(
                                columnHeaderCheckBoxPainter, bodyDataLayer));

                uiBindingRegistry
                        .registerFirstSingleClickBinding(
                                new CellPainterMouseEventMatcher(
                                        GridRegion.BODY,
                                        MouseEventMatcher.LEFT_BUTTON,
                                        checkBoxPainter), new MouseEditAction());

                uiBindingRegistry
                        .registerFirstMouseDragMode(
                                new CellPainterMouseEventMatcher(
                                        GridRegion.BODY,
                                        MouseEventMatcher.LEFT_BUTTON,
                                        checkBoxPainter),
                                new CellEditDragMode());
            }
        });

        natTable.configure();
        return natTable;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.NatTable

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.