Package org.eclipse.nebula.widgets.nattable

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


        // Grid
        GridLayer gridLayer = new GridLayer(bodyLayer, sndGroup,
                rowHeaderLayer, cornerLayer);

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

        // Register create column group command handler

        // Register column chooser
        DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler(
                bodyLayer.getSelectionLayer(),
                bodyLayer.getColumnHideShowLayer(), columnHeaderLayer,
                columnHeaderDataLayer, columnGroupHeaderLayer, columnGroupModel);
        bodyLayer.registerCommandHandler(columnChooserCommandHandler);

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
            @Override
            protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
                return super.createColumnHeaderMenu(natTable)
                        .withColumnChooserMenuItem();
            }
        });

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


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

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

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());

        // Add our custom painting configuration
        natTable.addConfiguration(new CustomPaintingConfig());

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

        final GlazedListsGridLayer<Map<String, String>> glazedListsGridLayer = new GlazedListsGridLayer<Map<String, String>>(
                values, new MyColumnPropertyAccessor(),
                new SimpleColumnHeaderDataProvider(), configRegistry, true);

        final NatTable natTable = new NatTable(gridPanel, glazedListsGridLayer,
                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() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                String newColumn = "Column_" + columns.size();
                columns.add(newColumn);

                for (Map<String, String> value : values) {
                    String prefix = value.get("Column_0");
                    prefix = prefix.substring(0, prefix.indexOf("_"));
                    value.put(newColumn, prefix + "_" + (columns.size() - 1));
                }

                glazedListsGridLayer.getBodyDataLayer().fireLayerEvent(
                        new ColumnInsertEvent(glazedListsGridLayer
                                .getBodyDataLayer(), columns.size() - 1));
            }
        });

        natTable.doCommand(new ColumnHideCommand(glazedListsGridLayer
                .getBodyLayer(), 1));

        return panel;
    }
View Full Code Here

        StandaloneNatExampleRunner.run(800, 600,
                new _010_NatTable_with_grid_painting_of_remainder_space());
    }

    public Control createExampleControl(Composite parent) {
        NatTable natTable = new NatTable(parent);
        NatGridLayerPainter layerPainter = new NatGridLayerPainter(natTable);
        natTable.setLayerPainter(layerPainter);
        return natTable;
    }
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 TableEditConfiguration());
        natTable.configure();

        return natTable;
    }
View Full Code Here

                + "  Support is provided for automatic creation and disposal for SWT colors/fonts (see GUIHelper)";
    }

    @Override
    public Control createExampleControl(Composite parent) {
        NatTable natTable = setup(parent);

        addCustomStyling(natTable);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        addColumnHighlight(natTable.getConfigRegistry());

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());

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

        // Grid
        GridLayer gridLayer = new GridLayer(bodyLayer, columnGroupHeaderLayer,
                rowHeaderLayer, cornerLayer);

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

        // Register create column group command handler

        // Register column chooser
        DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler(
                bodyLayer.getSelectionLayer(),
                bodyLayer.getColumnHideShowLayer(), columnHeaderLayer,
                columnHeaderDataLayer, columnGroupHeaderLayer, columnGroupModel);
        bodyLayer.registerCommandHandler(columnChooserCommandHandler);

        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
            @Override
            protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
                return super.createColumnHeaderMenu(natTable)
                        .withColumnChooserMenuItem();
            }
        });
        natTable.addConfiguration(new AbstractRegistryConfiguration() {
            public void configureRegistry(IConfigRegistry configRegistry) {
                configRegistry.registerConfigAttribute(
                        ExportConfigAttributes.EXPORTER,
                        new HSSFExcelExporter());
            }
        });

        // Column group header menu
        final Menu columnGroupHeaderMenu = new PopupMenuBuilder(natTable)
                .withMenuItemProvider(
                        ColumnGroupMenuItemProviders
                                .renameColumnGroupMenuItemProvider())
                .withMenuItemProvider(
                        ColumnGroupMenuItemProviders
                                .removeColumnGroupMenuItemProvider()).build();

        natTable.addConfiguration(new AbstractUiBindingConfiguration() {
            public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
                uiBindingRegistry.registerFirstMouseDownBinding(
                        new MouseEventMatcher(SWT.NONE,
                                GridRegion.COLUMN_GROUP_HEADER,
                                MouseEventMatcher.RIGHT_BUTTON),
                        new PopupMenuAction(columnGroupHeaderMenu));
            }
        });

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

        return natTable;
    }

    private NatTable setup(Composite parent) {
        DummyGridLayerStack gridLayer = new DummyGridLayerStack();
        final NatTable natTable = new NatTable(parent, gridLayer, false);
        DataLayer bodyDataLayer = (DataLayer) gridLayer.getBodyDataLayer();

        // Add an AggregrateConfigLabelAccumulator - we can add other
        // accumulators to this as required
        AggregrateConfigLabelAccumulator aggregrateConfigLabelAccumulator = new AggregrateConfigLabelAccumulator();
        bodyDataLayer
                .setConfigLabelAccumulator(aggregrateConfigLabelAccumulator);

        ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
                bodyDataLayer);
        ColumnOverrideLabelAccumulator bodyLabelAccumulator = new ColumnOverrideLabelAccumulator(
                bodyDataLayer);

        aggregrateConfigLabelAccumulator.add(columnLabelAccumulator);
        aggregrateConfigLabelAccumulator.add(bodyLabelAccumulator);

        // Add a label for the highlighted column
        // We will add a style for this label to the config registry in a bit
        bodyLabelAccumulator.registerColumnOverrides(2, BODY_LABEL_1);
        columnLabelAccumulator.registerColumnOverrides(2, COLUMN_LABEL_1);

        // Register a command handler for the StyleEditorDialog
        DisplayColumnStyleEditorCommandHandler styleChooserCommandHandler = new DisplayColumnStyleEditorCommandHandler(
                gridLayer.getBodyLayer().getSelectionLayer(),
                columnLabelAccumulator, natTable.getConfigRegistry());

        DefaultBodyLayerStack bodyLayer = gridLayer.getBodyLayer();
        bodyLayer.registerCommandHandler(styleChooserCommandHandler);

        // Register the style editor as persistable
View Full Code Here

        ConfigRegistry configRegistry = new ConfigRegistry();
        final ColumnStructureUpdatesExampleGridLayer<PricingDataBean> glazedListsGridLayer = new ColumnStructureUpdatesExampleGridLayer<PricingDataBean>(
                rowObjectsGlazedList, propertyNames, propertyToLabelMap,
                configRegistry, true);
        final NatTable natTable = new NatTable(parent, glazedListsGridLayer,
                false);
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        natTable.setConfigRegistry(configRegistry);
        natTable.getConfigRegistry().registerConfigAttribute(
                EditConfigAttributes.CELL_EDITABLE_RULE,
                IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT, "ODD_BODY");
        natTable.getConfigRegistry().registerConfigAttribute(
                EditConfigAttributes.CELL_EDITABLE_RULE,
                IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT, "EVEN_BODY");

        natTable.configure();
        glazedListsGridLayer.bodyDataProvider.setColumnCount(2);
        Composite composite = new Composite(parent, SWT.NONE);
        composite.setLayout(new GridLayout(2, false));
        Button button = new Button(composite, SWT.PUSH);
        button.setText("Clear list, add 6 items, Change column count");
View Full Code Here

                + "nothing else.";
    }

    public Control createExampleControl(Composite parent) {
        ILayer layer = new DataLayer(new DummyBodyDataProvider(20, 20));
        return new NatTable(parent, layer);
    }
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.