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

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


                        new ClearHoverStylingAction());
            }
        });

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

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                Style style = new Style();
                style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
View Full Code Here


        // DefaultNatTableStyleConfiguration and the ConfigRegistry manually
        natTable.setConfigRegistry(configRegistry);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());

        // add some additional styling
        natTable.addConfiguration(new AbstractRegistryConfiguration() {

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.CELL_PAINTER,
                        new CheckBoxPainter(), DisplayMode.NORMAL,
                        ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4);
            }
        });

        // add sorting configuration
        natTable.addConfiguration(new SingleClickSortConfiguration());

        sumMoneySummaryProvider = new SummationGroupBySummaryProvider<ExtendedPersonWithAddress>(
                columnPropertyAccessor);
        avgMoneySummaryProvider = new AverageMoneyGroupBySummaryProvider();

        // add group by summary configuration
        natTable.addConfiguration(new AbstractRegistryConfiguration() {

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                configRegistry.registerConfigAttribute(
                        GroupByConfigAttributes.GROUP_BY_SUMMARY_PROVIDER,
View Full Code Here

        // this is to verify that spanned cells are also editable and update the
        // data model correctly
        // @see Bug 414754
        layer.addConfiguration(new DefaultEditBindings());
        layer.addConfiguration(new DefaultEditConfiguration());
        layer.addConfiguration(new AbstractRegistryConfiguration() {

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                configRegistry.registerConfigAttribute(
                        EditConfigAttributes.CELL_EDITABLE_RULE,
View Full Code Here

        ((AbstractLayer) grid.getBodyLayer())
                .setConfigLabelAccumulator(columnLabelAccumulator);
        columnLabelAccumulator.registerColumnOverrides(0, COLUMN_ONE_LABEL);
        columnLabelAccumulator.registerColumnOverrides(1, COLUMN_TWO_LABEL);

        natTable.addConfiguration(new AbstractRegistryConfiguration() {

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                Style style = new Style();
                style.setAttributeValue(
                        CellStyleAttributes.HORIZONTAL_ALIGNMENT,
                        HorizontalAlignmentEnum.LEFT);
                style.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
                        VerticalAlignmentEnum.TOP);
                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.CELL_STYLE, style,
                        DisplayMode.NORMAL, COLUMN_ONE_LABEL);

                style = new Style();
                style.setAttributeValue(
                        CellStyleAttributes.HORIZONTAL_ALIGNMENT,
                        HorizontalAlignmentEnum.RIGHT);
                style.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
                        VerticalAlignmentEnum.BOTTOM);
                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.CELL_STYLE, style,
                        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
                // you could also implement different formatter for different
View Full Code Here

        // add the
        // DefaultNatTableStyleConfiguration manually
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());

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

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                Style style = new Style();
                style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
View Full Code Here

        // add the
        // DefaultNatTableStyleConfiguration manually
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());

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

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                // style that is applied when cells are hovered
                Style style = new Style();
View Full Code Here

        // add the
        // DefaultNatTableStyleConfiguration manually
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());

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

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                Style style = new Style();
                style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
View Full Code Here

        // add the
        // DefaultNatTableStyleConfiguration and the ConfigRegistry manually
        natTable.setConfigRegistry(configRegistry);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());

        natTable.addConfiguration(new AbstractRegistryConfiguration() {

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                // register a CheckBoxPainter as CellPainter for the married
                // information
View Full Code Here

        // add the
        // DefaultNatTableStyleConfiguration and the ConfigRegistry manually
        natTable.setConfigRegistry(configRegistry);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());

        natTable.addConfiguration(new AbstractRegistryConfiguration() {

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                // register a CheckBoxPainter as CellPainter for the married
                // information
View Full Code Here

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());

        // add sorting configuration
        natTable.addConfiguration(new SingleClickSortConfiguration());

        natTable.addConfiguration(new AbstractRegistryConfiguration() {

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                configRegistry.registerConfigAttribute(
                        EditConfigAttributes.CELL_EDITABLE_RULE,
View Full Code Here

TOP

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

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.