Package org.eclipse.nebula.widgets.nattable

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


        ConfigRegistry configRegistry = new ConfigRegistry();
        GlazedListsGridLayer<RowDataFixture> glazedListsGridLayer = new GlazedListsGridLayer<RowDataFixture>(
                eventList, RowDataListFixture.getPropertyNames(),
                RowDataListFixture.getPropertyToLabelMap(), configRegistry);

        nattable = new NatTable(parent, glazedListsGridLayer, false);

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


        };

        ILayer layer = new DefaultGridLayer(listDataProvider,
                columnHeaderDataProvider);

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

        // 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

                myList, columnPropertyAccessor);

        DefaultGridLayer gridLayer = new DefaultGridLayer(bodyDataProvider,
                new DefaultColumnHeaderDataProvider(propertyNames));

        NatTable natTable = new NatTable(parent, gridLayer);

        ISelectionProvider selectionProvider = new RowSelectionProvider<Person>(
                gridLayer.getBodyLayer().getSelectionLayer(), bodyDataProvider,
                false); // Provides rows where any cell in the row is selected
View Full Code Here

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

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

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

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

        new NatTableContentTooltip(natTable, GridRegion.BODY);

        return natTable;
    }
View Full Code Here

        CopyDataCommandHandler copyHandler = new CopyDataCommandHandler(
                selectionLayer, columnHeaderDataLayer, rowHeaderDataLayer);
        copyHandler.setCopyFormattedText(true);
        gridLayer.registerCommandHandler(copyHandler);

        final NatTable natTable = new NatTable(gridPanel, gridLayer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        Button addColumnButton = new Button(buttonPanel, SWT.PUSH);
        addColumnButton.setText("Copy");
        addColumnButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.doCommand(new CopyDataToClipboardCommand(
                        "\t", System.getProperty("line.separator"), //$NON-NLS-1$ //$NON-NLS-2$
                        natTable.getConfigRegistry()));
            }
        });

        return panel;
    }
View Full Code Here

    @After
    public void tearDown() {
        Assert.assertNotNull("Layer was not set", layer);

        NatTable natTable = new NatTable(getShell(), layer);

        getShell().setVisible(true);

        // Start!
        long startTimeInMillis = System.currentTimeMillis();

        natTable.getLayerPainter().paintLayer(natTable, getGC(), 0, 0,
                new Rectangle(0, 0, natTable.getWidth(), natTable.getHeight()),
                natTable.getConfigRegistry());

        // Stop!
        long stopTimeInMillis = System.currentTimeMillis();
        long actualTimeInMillis = stopTimeInMillis - startTimeInMillis;
View Full Code Here

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

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

        Button addRowButton = new Button(buttonPanel, SWT.PUSH);
        addRowButton.setText("add row");
        addRowButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                valuesToShow.add(createNumberValues());
                natTable.refresh();
            }
        });

        Button resetButton = new Button(buttonPanel, SWT.PUSH);
        resetButton.setText("reset");
        resetButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                valuesToShow.clear();
                valuesToShow.add(createNumberValues());
                valuesToShow.add(createNumberValues());
                natTable.refresh();
            }
        });

        return panel;
    }
View Full Code Here

        // build the grid layer
        final GridLayer gridLayer = new GridLayer(viewportLayer,
                columnHeaderLayer, rowHeaderLayer, cornerLayer);

        final NatTable natTable = new NatTable(container, gridLayer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        // adding a full border
        natTable.addOverlayPainter(new NatTableBorderOverlayPainter(natTable
                .getConfigRegistry()));

        Composite buttonPanel = new Composite(container, SWT.NONE);
        buttonPanel.setLayout(new GridLayout(3, true));
        GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonPanel);

        final ThemeConfiguration defaultTheme = new DefaultNatTableThemeConfiguration();
        final ThemeConfiguration modernTheme = new ModernNatTableThemeConfiguration();
        final ThemeConfiguration darkTheme = new DarkNatTableThemeConfiguration();

        final ThemeConfiguration conditionalDefaultTheme = new DefaultNatTableThemeConfiguration();
        conditionalDefaultTheme
                .addThemeExtension(new ConditionalStylingThemeExtension());
        final ThemeConfiguration conditionalModernTheme = new ModernNatTableThemeConfiguration();
        conditionalModernTheme
                .addThemeExtension(new ConditionalStylingThemeExtension());
        final ThemeConfiguration conditionalDarkTheme = new DarkNatTableThemeConfiguration();
        conditionalDarkTheme
                .addThemeExtension(new ConditionalStylingThemeExtension());

        final ThemeConfiguration hoverTheme = new HoverThemeConfiguration();
        final ThemeConfiguration fontTheme = new FontStylingThemeConfiguration();

        Button defaultThemeButton = new Button(buttonPanel, SWT.PUSH);
        defaultThemeButton.setText("NatTable Default Theme");
        defaultThemeButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.setTheme(defaultTheme);

                // reset to default state
                cleanupNonThemeSettings(gridLayer, bodyDataLayer,
                        columnHeaderDataLayer);
            }
        });

        Button modernThemeButton = new Button(buttonPanel, SWT.PUSH);
        modernThemeButton.setText("NatTable Modern Theme");
        modernThemeButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.setTheme(modernTheme);

                // reset to default state
                cleanupNonThemeSettings(gridLayer, bodyDataLayer,
                        columnHeaderDataLayer);
            }
        });

        Button darkThemeButton = new Button(buttonPanel, SWT.PUSH);
        darkThemeButton.setText("NatTable Dark Theme");
        darkThemeButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.setTheme(darkTheme);

                // reset to default state
                cleanupNonThemeSettings(gridLayer, bodyDataLayer,
                        columnHeaderDataLayer);
            }
        });

        Button conditionalThemeButton = new Button(buttonPanel, SWT.PUSH);
        conditionalThemeButton.setText("Conditional Default Theme");
        conditionalThemeButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.setTheme(conditionalDefaultTheme);

                // reset to default state
                cleanupNonThemeSettings(gridLayer, bodyDataLayer,
                        columnHeaderDataLayer);
            }
        });

        Button conditionalModernThemeButton = new Button(buttonPanel, SWT.PUSH);
        conditionalModernThemeButton.setText("Conditional Modern Theme");
        conditionalModernThemeButton
                .addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        natTable.setTheme(conditionalModernTheme);

                        // reset to default state
                        cleanupNonThemeSettings(gridLayer, bodyDataLayer,
                                columnHeaderDataLayer);
                    }
                });

        Button conditionalDarkThemeButton = new Button(buttonPanel, SWT.PUSH);
        conditionalDarkThemeButton.setText("Conditional Dark Theme");
        conditionalDarkThemeButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.setTheme(conditionalDarkTheme);

                // reset to default state
                cleanupNonThemeSettings(gridLayer, bodyDataLayer,
                        columnHeaderDataLayer);
            }
        });

        Button hoverThemeButton = new Button(buttonPanel, SWT.PUSH);
        hoverThemeButton.setText("Hover Theme");
        hoverThemeButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.setTheme(hoverTheme);

                // reset to default state
                cleanupNonThemeSettings(gridLayer, bodyDataLayer,
                        columnHeaderDataLayer);
            }
        });

        Button fontThemeButton = new Button(buttonPanel, SWT.PUSH);
        fontThemeButton.setText("Increased Font Theme");
        fontThemeButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                natTable.setTheme(fontTheme);

                // reset to default state
                cleanupNonThemeSettings(gridLayer, bodyDataLayer,
                        columnHeaderDataLayer);
            }
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.