Package org.eclipse.nebula.widgets.nattable.config

Examples of org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration


    @Before
    public void setup() {
        columnHeaderLayer = new DataLayerFixture(10, 2, 100, 50);

        configRegistry = new ConfigRegistry();
        new DefaultNatTableStyleConfiguration()
                .configureRegistry(configRegistry);
        new DefaultFilterRowConfiguration().configureRegistry(configRegistry);

        filterList = new FilterList<RowDataFixture>(
                GlazedLists.eventList(RowDataListFixture.getList()));
View Full Code Here


    @Before
    public void setup() {
        columnHeaderLayer = new DataLayerFixture(10, 2, 100, 50);

        configRegistry = new ConfigRegistry();
        new DefaultNatTableStyleConfiguration()
                .configureRegistry(configRegistry);
        new DefaultFilterRowConfiguration().configureRegistry(configRegistry);

        filterList = new FilterList<RowDataFixture>(
                GlazedLists.eventList(RowDataListFixture.getList()));
View Full Code Here

                RowDataListFixture.getPropertyNames(),
                RowDataListFixture.getPropertyToLabelMap(), configRegistry);

        nattable = new NatTableFixture(gridLayerStack, false);
        nattable.setConfigRegistry(configRegistry);
        nattable.addConfiguration(new DefaultNatTableStyleConfiguration());
        nattable.addConfiguration(new DefaultSortConfiguration());
        nattable.configure();
    }
View Full Code Here

        DummyGridLayerStack gridLayer = new DummyGridLayerStack(dataProvider);
        final DataLayer n4DataLayer = (DataLayer) gridLayer.getBodyDataLayer();
        n4DataLayer.setColumnPercentageSizing(true);
        n4DataLayer.setRowPercentageSizing(true);
        final NatTable n4 = new NatTable(gridPanel, gridLayer, false);
        n4.addConfiguration(new DefaultNatTableStyleConfiguration());
        n4.addConfiguration(new HeaderMenuConfiguration(n4));
        n4.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(n4);

        // example for fixed percentage sizing in a grid
        // ensure that the sum of column sizes is not greater than 100
        gridLayer = new DummyGridLayerStack(dataProvider);
        final DataLayer n5DataLayer = (DataLayer) gridLayer.getBodyDataLayer();
        n5DataLayer.setColumnWidthByPosition(0, 25);
        n5DataLayer.setColumnWidthByPosition(1, 25);
        n5DataLayer.setColumnWidthByPosition(2, 50);
        n5DataLayer.setColumnPercentageSizing(true);
        final NatTable n5 = new NatTable(gridPanel, gridLayer, false);
        n5.addConfiguration(new DefaultNatTableStyleConfiguration());
        n5.addConfiguration(new HeaderMenuConfiguration(n5));
        n5.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(n5);

        // example for mixed percentage sizing in a grid
        // configure not every column with the exact percentage value, this way
        // the columns for which
        // no exact values are set will use the remaining space
        gridLayer = new DummyGridLayerStack(dataProvider);
        final DataLayer n6DataLayer = (DataLayer) gridLayer.getBodyDataLayer();
        n6DataLayer.setColumnWidthByPosition(0, 20);
        n6DataLayer.setColumnWidthByPosition(2, 20);
        n6DataLayer.setColumnPercentageSizing(true);
        final NatTable n6 = new NatTable(gridPanel, gridLayer, false);
        n6.addConfiguration(new DefaultNatTableStyleConfiguration());
        n6.addConfiguration(new HeaderMenuConfiguration(n6));
        n6.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(n6);

        // example for mixed fixed/percentage sizing in a grid
        // configure not every column with the exact percentage value, this way
        // the columns for which
        // no exact values are set will use the remaining space
        gridLayer = new DummyGridLayerStack(dataProvider);
        final DataLayer mixGridDataLayer = (DataLayer) gridLayer
                .getBodyDataLayer();
        mixGridDataLayer.setColumnPercentageSizing(true);
        mixGridDataLayer.setColumnPercentageSizing(0, false);
        mixGridDataLayer.setColumnPercentageSizing(1, false);
        mixGridDataLayer.setColumnWidthByPosition(0, 100);
        mixGridDataLayer.setColumnWidthByPosition(1, 100);
        final NatTable mixGrid = new NatTable(gridPanel, gridLayer, false);
        mixGrid.addConfiguration(new DefaultNatTableStyleConfiguration());
        mixGrid.addConfiguration(new HeaderMenuConfiguration(mixGrid));
        mixGrid.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(mixGrid);

        Button addColumnButton = new Button(buttonPanel, SWT.PUSH);
View Full Code Here

        bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);
        registerColumnLabels(columnLabelAccumulator);

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

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

                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);
View Full Code Here

                        DisplayMode.NORMAL, COLUMN_TWO_LABEL);
            }
        });

        // adding this configuration adds the styles and the painters to use
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new AbstractRegistryConfiguration() {
            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                configRegistry.registerConfigAttribute(
                        ExportConfigAttributes.EXPORTER,
                        new HSSFExcelExporter());

                configRegistry.registerConfigAttribute(
                        ExportConfigAttributes.DATE_FORMAT, "dd.MM.yyyy");

                // register a custom formatter to the body of the grid
                // you could also implement different formatter for different
                // columns by using the label mechanism
                configRegistry.registerConfigAttribute(
                        ExportConfigAttributes.EXPORT_FORMATTER,
                        new ExampleExportFormatter(), DisplayMode.NORMAL,
                        GridRegion.BODY);

                configRegistry.registerConfigAttribute(
                        ExportConfigAttributes.EXPORT_FORMATTER,
                        new IExportFormatter() {
                            @Override
                            public Object formatForExport(ILayerCell cell,
                                    IConfigRegistry configRegistry) {
                                // simply return the data value which is an
                                // integer for the row header
                                // doing this avoids the default conversion to
                                // string for export
                                return cell.getDataValue();
                            }
                        }, DisplayMode.NORMAL, GridRegion.ROW_HEADER);
            }
        });

        natTable.configure();

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

        // property names of the NumberValues class
        String[] numberPropertyNames = { "columnOneNumber", "columnTwoNumber",
                "columnThreeNumber", "columnFourNumber", "columnFiveNumber" };

        // mapping from property to label, needed for column header labels
        Map<String, String> numberPropertyToLabelMap = new HashMap<String, String>();
        numberPropertyToLabelMap.put("columnOneNumber", "Value One");
        numberPropertyToLabelMap.put("columnTwoNumber", "Value Two");
        numberPropertyToLabelMap.put("columnThreeNumber", "Value Three");
        numberPropertyToLabelMap.put("columnFourNumber", "Value Four");
        numberPropertyToLabelMap.put("columnFiveNumber", "Value Five");

        List<NumberValues> valuesToShow = new ArrayList<NumberValues>();
        valuesToShow.add(createNumberValues());
        valuesToShow.add(createNumberValues());
        valuesToShow.add(createNumberValues());
        valuesToShow.add(createNumberValues());
        valuesToShow.add(createNumberValues());

        final NatTable numberNatTable = new NatTable(gridPanel, createGrid(
                numberPropertyNames, numberPropertyToLabelMap, valuesToShow),
                false);

        // adding this configuration adds the styles and the painters to use
        numberNatTable
                .addConfiguration(new DefaultNatTableStyleConfiguration());
        numberNatTable.addConfiguration(new AbstractRegistryConfiguration() {
            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {

                // register a custom formatter to the body of the grid
View Full Code Here

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

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

        // add the style configuration for hover
        natTable.addConfiguration(new AbstractRegistryConfiguration() {

            @Override
View Full Code Here

        // 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
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 n4 = new NatTable(
                gridPanel, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.DOUBLE_BUFFERED, gridLayer, false);
        n4.addConfiguration(new DefaultNatTableStyleConfiguration());
        n4.addConfiguration(new HeaderMenuConfiguration(n4));
        n4.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(n4);

        // example for fixed percentage sizing in a grid
        // ensure that the sum of column sizes is not greater than 100
        gridLayer = new SimpleGridLayer(dataProvider);
        final DataLayer n5DataLayer = (DataLayer) gridLayer.getBodyDataLayer();
        n5DataLayer.setColumnWidthByPosition(0, 25);
        n5DataLayer.setColumnWidthByPosition(1, 25);
        n5DataLayer.setColumnWidthByPosition(2, 50);
        n5DataLayer.setColumnPercentageSizing(true);
        // use different style bits to avoid rendering of inactive scrollbars
        // for small table when using percentage sizing, typically there should
        // be no scrollbars, as the table should take the available space
        // 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 n5 = new NatTable(
                gridPanel, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.DOUBLE_BUFFERED, gridLayer, false);
        n5.addConfiguration(new DefaultNatTableStyleConfiguration());
        n5.addConfiguration(new HeaderMenuConfiguration(n5));
        n5.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(n5);

        // example for mixed percentage sizing in a grid configure not every
        // column with the exact percentage value, this way the columns for
        // which no exact values are set will use the remaining space
        gridLayer = new SimpleGridLayer(dataProvider);
        final DataLayer n6DataLayer = (DataLayer) gridLayer.getBodyDataLayer();
        n6DataLayer.setColumnWidthByPosition(0, 20);
        n6DataLayer.setColumnWidthByPosition(2, 20);
        n6DataLayer.setColumnPercentageSizing(true);
        // use different style bits to avoid rendering of inactive scrollbars
        // for small table when using percentage sizing, typically there should
        // be no scrollbars, as the table should take the available space
        // 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 n6 = new NatTable(
                gridPanel, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.DOUBLE_BUFFERED, gridLayer, false);
        n6.addConfiguration(new DefaultNatTableStyleConfiguration());
        n6.addConfiguration(new HeaderMenuConfiguration(n6));
        n6.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(n6);

        // example for mixed fixed/percentage sizing in a grid configure not
        // every column with the exact percentage value, this way the columns
        // for which no exact values are set will use the remaining space
        gridLayer = new SimpleGridLayer(dataProvider);
        final DataLayer mixGridDataLayer = (DataLayer) gridLayer.getBodyDataLayer();
        mixGridDataLayer.setColumnPercentageSizing(true);
        mixGridDataLayer.setColumnPercentageSizing(0, false);
        mixGridDataLayer.setColumnPercentageSizing(1, false);
        mixGridDataLayer.setColumnWidthByPosition(0, 100);
        mixGridDataLayer.setColumnWidthByPosition(1, 100);
        // use different style bits to avoid rendering of inactive scrollbars
        // for small table when using percentage sizing, typically there should
        // be no scrollbars, as the table should take the available space
        // 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 mixGrid = new NatTable(
                gridPanel, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.DOUBLE_BUFFERED, gridLayer, false);
        mixGrid.addConfiguration(new DefaultNatTableStyleConfiguration());
        mixGrid.addConfiguration(new HeaderMenuConfiguration(mixGrid));
        mixGrid.configure();
        GridDataFactory.fillDefaults().grab(true, true).applyTo(mixGrid);

        Button addColumnButton = new Button(buttonPanel, SWT.PUSH);
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration

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.