Package org.eclipse.nebula.widgets.nattable

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


                groupByHeaderLayer, 0, 0);
        compositeGridLayer.setChildLayer("Grid", gridLayer, 0, 1);

        // turn the auto configuration off as we want to add our header menu
        // configuration
        NatTable natTable = new NatTable(parent, compositeGridLayer, false);

        // as the autoconfiguration of the NatTable is turned off, we have to
        // add the
        // DefaultNatTableStyleConfiguration and the ConfigRegistry manually
        natTable.setConfigRegistry(configRegistry);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        // add group by configuration
        natTable.addConfiguration(new GroupByHeaderMenuConfiguration(natTable,
                groupByHeaderLayer));

        natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
            @Override
            protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
                return super.createCornerMenu(natTable)
                        .withStateManagerMenuItemProvider()
                        .withMenuItemProvider(new IMenuItemProvider() {

                            @Override
                            public void addMenuItem(NatTable natTable,
                                    Menu popupMenu) {
                                MenuItem menuItem = new MenuItem(popupMenu,
                                        SWT.PUSH);
                                menuItem.setText("Toggle Group By Header"); //$NON-NLS-1$
                                menuItem.setEnabled(true);

                                menuItem.addSelectionListener(new SelectionAdapter() {
                                    @Override
                                    public void widgetSelected(
                                            SelectionEvent event) {
                                        groupByHeaderLayer
                                                .setVisible(!groupByHeaderLayer
                                                        .isVisible());
                                    }
                                });
                            }
                        }).withMenuItemProvider(new IMenuItemProvider() {

                            @Override
                            public void addMenuItem(final NatTable natTable,
                                    Menu popupMenu) {
                                MenuItem menuItem = new MenuItem(popupMenu,
                                        SWT.PUSH);
                                menuItem.setText("Collapse All"); //$NON-NLS-1$
                                menuItem.setEnabled(true);

                                menuItem.addSelectionListener(new SelectionAdapter() {
                                    @Override
                                    public void widgetSelected(
                                            SelectionEvent event) {
                                        natTable.doCommand(new TreeCollapseAllCommand());
                                    }
                                });
                            }
                        }).withMenuItemProvider(new IMenuItemProvider() {

                            @Override
                            public void addMenuItem(final NatTable natTable,
                                    Menu popupMenu) {
                                MenuItem menuItem = new MenuItem(popupMenu,
                                        SWT.PUSH);
                                menuItem.setText("Expand All"); //$NON-NLS-1$
                                menuItem.setEnabled(true);

                                menuItem.addSelectionListener(new SelectionAdapter() {
                                    @Override
                                    public void widgetSelected(
                                            SelectionEvent event) {
                                        natTable.doCommand(new TreeExpandAllCommand());
                                    }
                                });
                            }
                        });
            }
        });

        natTable.configure();

        natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(
                natTable));

        return natTable;
    }
View Full Code Here


        // Note: The enabling/disabling and showing of the scrollbars is handled
        // by the ViewportLayer.
        // Without the ViewportLayer the scrollbars will always be visible with
        // the default
        // style bits of NatTable.
        final NatTable natTable = new NatTable(parent, SWT.NO_BACKGROUND
                | SWT.NO_REDRAW_RESIZE | SWT.DOUBLE_BUFFERED, bodyDataLayer);

        return natTable;
    }
View Full Code Here

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

        natTable = new NatTable(parent, gridLayer, false);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new PainterConfiguration());
        natTable.configure();

        new NatTableContentTooltip(natTable, GridRegion.BODY);
View Full Code Here

        // create the grid layer composed with the prior created layer stacks
        GridLayer gridLayer = new GridLayer(bodyLayerStack, columnHeaderLayer,
                rowHeaderLayer, cornerLayer);

        final NatTable natTable = new NatTable(gridPanel, gridLayer, false);
        natTable.setConfigRegistry(configRegistry);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
        natTable.addConfiguration(new SingleClickSortConfiguration());
        natTable.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        Button addColumnButton = new Button(buttonPanel, SWT.PUSH);
        addColumnButton.setText("Add Column");
        addColumnButton.addSelectionListener(new SelectionAdapter() {
View Full Code Here

    private final LabelStack regionLabels;
    int columnPosition;
    int rowPosition;

    public static NatEventData createInstanceFromEvent(MouseEvent event) {
        NatTable natTable = (NatTable) event.widget;

        int columnPosition = natTable.getColumnPositionByX(event.x);
        int rowPosition = natTable.getRowPositionByY(event.y);

        return new NatEventData(natTable, natTable.getRegionLabelsByXY(event.x,
                event.y), columnPosition, rowPosition, event);
    }
View Full Code Here

        GridLayer gridLayer = new GridLayer(bodyLayerStack,
                filterRowHeaderLayer, rowHeaderLayer, cornerLayer);

        // turn the auto configuration off as we want to add our header menu
        // configuration
        NatTable natTable = new NatTable(parent, gridLayer, false);

        // as the autoconfiguration of the NatTable is turned off, we have to
        // add the
        // DefaultNatTableStyleConfiguration and the ConfigRegistry manually
        natTable.setConfigRegistry(configRegistry);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        // add filter row configuration
        natTable.addConfiguration(new FilterRowConfiguration());

        natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
            @Override
            protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
                return super.createCornerMenu(natTable)
                        .withStateManagerMenuItemProvider();
            }
        });

        natTable.configure();

        natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(
                natTable));

        return natTable;
    }
View Full Code Here

                .getDataProvider();
        bodyDataLayer
                .setConfigLabelAccumulator(new CrossValidationLabelAccumulator(
                        bodyDataProvider));

        final NatTable natTable = new NatTable(gridPanel, gridLayer, false);
        natTable.setConfigRegistry(configRegistry);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new CrossValidationEditConfiguration(
                bodyDataProvider));
        natTable.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        return panel;
    }
View Full Code Here

        GridLayer gridLayer = new GridLayer(compositeFreezeLayer,
                columnHeaderLayer, rowHeaderLayer, cornerLayer);

        // turn the auto configuration off as we want to add our header menu
        // configuration
        final NatTable natTable = new NatTable(panel, gridLayer, false);

        // as the autoconfiguration of the NatTable is turned off, we have to
        // add the
        // DefaultNatTableStyleConfiguration manually
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new DefaultFreezeGridBindings());

        // add the corner menu configuration for adding the view management
        // action
        natTable.addConfiguration(new AbstractHeaderMenuConfiguration(natTable) {
            @Override
            protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
                return super.createColumnHeaderMenu(natTable)
                        .withHideColumnMenuItem().withShowAllColumnsMenuItem()
                        .withColumnChooserMenuItem();
            }

            @Override
            protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
                return super.createCornerMenu(natTable)
                        .withShowAllColumnsMenuItem()
                        .withStateManagerMenuItemProvider();
            }
        });
        natTable.configure();

        panel.setLayout(new GridLayout());
        GridDataFactory.fillDefaults().grab(true, true).applyTo(panel);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
View Full Code Here

        // add the ExportCommandHandler to the ViewportLayer in order to make
        // exporting work
        viewportLayer.registerCommandHandler(new ExportCommandHandler(
                viewportLayer));

        final NatTable natTable = new NatTable(gridPanel, viewportLayer, false);

        // adding this configuration adds the styles and the painters to use
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new DefaultExportBindings());

        natTable.addOverlayPainter(new NatTableBorderOverlayPainter());

        natTable.configure();

        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        Button addColumnButton = new Button(buttonPanel, SWT.PUSH);
        addColumnButton.setText("Export");
        addColumnButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.doCommand(new ExportCommand(natTable
                        .getConfigRegistry(), natTable.getShell()));
            }
        });

        return panel;
    }
View Full Code Here

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

        return new NatTable(parent, compositeLayer);
    }
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.