Search in sources :

Example 6 with ColumnOverrideLabelAccumulator

use of org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator in project nebula.widgets.nattable by eclipse.

the class _5017_DataChangeLayerTempStorageExample method createExampleControl.

@Override
public Control createExampleControl(Composite parent) {
    // property names of the Person class
    String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday" };
    // mapping from property to label, needed for column header labels
    Map<String, String> propertyToLabelMap = new HashMap<>();
    propertyToLabelMap.put("firstName", "Firstname");
    propertyToLabelMap.put("lastName", "Lastname");
    propertyToLabelMap.put("gender", "Gender");
    propertyToLabelMap.put("married", "Married");
    propertyToLabelMap.put("birthday", "Birthday");
    IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<>(propertyNames);
    final List<Person> data = PersonService.getPersons(10);
    // create the body layer stack
    IDataProvider bodyDataProvider = new ListDataProvider<>(data, columnPropertyAccessor);
    DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
    final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(bodyDataLayer);
    bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);
    registerColumnLabels(columnLabelAccumulator);
    // add a DataChangeLayer that tracks data changes but directly updates
    // the underlying data model
    DataChangeLayer dataChangeLayer = new DataChangeLayer(bodyDataLayer, new PointKeyHandler(), true);
    ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(dataChangeLayer);
    ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
    SelectionLayer selectionLayer = new SelectionLayer(columnHideShowLayer);
    ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
    // create the column header layer stack
    IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
    ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(columnHeaderDataProvider), viewportLayer, selectionLayer);
    // create the row header layer stack
    IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
    ILayer rowHeaderLayer = new RowHeaderLayer(new DataLayer(rowHeaderDataProvider, 40, 20), viewportLayer, selectionLayer);
    // create the corner layer stack
    ILayer cornerLayer = new CornerLayer(new DataLayer(new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider)), rowHeaderLayer, columnHeaderLayer);
    // create the grid layer composed with the prior created layer stacks
    GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
    NatTable natTable = new NatTable(parent, gridLayer, false);
    natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
    natTable.addConfiguration(new EditorConfiguration());
    natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {

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

                @Override
                public void addMenuItem(NatTable natTable, Menu popupMenu) {
                    MenuItem export = new MenuItem(popupMenu, SWT.PUSH);
                    export.setText("Discard changes");
                    export.setEnabled(true);
                    export.addSelectionListener(new SelectionAdapter() {

                        @Override
                        public void widgetSelected(SelectionEvent e) {
                            natTable.doCommand(new DiscardDataChangesCommand());
                        }
                    });
                }
            }).withMenuItemProvider(new IMenuItemProvider() {

                @Override
                public void addMenuItem(NatTable natTable, Menu popupMenu) {
                    MenuItem export = new MenuItem(popupMenu, SWT.PUSH);
                    export.setText("Save changes");
                    export.setEnabled(true);
                    export.addSelectionListener(new SelectionAdapter() {

                        @Override
                        public void widgetSelected(SelectionEvent e) {
                            natTable.doCommand(new SaveDataChangesCommand());
                        }
                    });
                }
            });
        }
    });
    natTable.configure();
    return natTable;
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) HashMap(java.util.HashMap) ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) HeaderMenuConfiguration(org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) DefaultCornerDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) Menu(org.eclipse.swt.widgets.Menu) ColumnOverrideLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator) PointKeyHandler(org.eclipse.nebula.widgets.nattable.datachange.PointKeyHandler) DiscardDataChangesCommand(org.eclipse.nebula.widgets.nattable.datachange.command.DiscardDataChangesCommand) ILayer(org.eclipse.nebula.widgets.nattable.layer.ILayer) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SaveDataChangesCommand(org.eclipse.nebula.widgets.nattable.datachange.command.SaveDataChangesCommand) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) MenuItem(org.eclipse.swt.widgets.MenuItem) DefaultRowHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) DataChangeLayer(org.eclipse.nebula.widgets.nattable.datachange.DataChangeLayer) RowHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer) CornerLayer(org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) IMenuItemProvider(org.eclipse.nebula.widgets.nattable.ui.menu.IMenuItemProvider) GridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer) DefaultColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider) PopupMenuBuilder(org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person)

Example 7 with ColumnOverrideLabelAccumulator

use of org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator in project nebula.widgets.nattable by eclipse.

the class _5055_SelectionTraversalExample method createExampleControl.

@Override
public Control createExampleControl(Composite parent) {
    // property names of the Person class
    String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday" };
    IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<>(propertyNames);
    IRowDataProvider<Person> bodyDataProvider = new ListDataProvider<>(PersonService.getPersons(3), columnPropertyAccessor);
    Composite panel = new Composite(parent, SWT.NONE);
    panel.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(panel);
    // 1. AXIS traversal - NatTable default
    DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
    SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
    ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
    // as the selection mouse bindings are registered for the region label
    // GridRegion.BODY we need to set that region label to the viewport so
    // the selection via mouse is working correctly
    viewportLayer.setRegionName(GridRegion.BODY);
    NatTable natTable = new NatTable(panel, viewportLayer);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
    // 2. AXIS CYCLE traversal
    bodyDataLayer = new DataLayer(bodyDataProvider);
    selectionLayer = new SelectionLayer(bodyDataLayer);
    viewportLayer = new ViewportLayer(selectionLayer);
    // as the selection mouse bindings are registered for the region label
    // GridRegion.BODY we need to set that region label to the viewport so
    // the selection via mouse is working correctly
    viewportLayer.setRegionName(GridRegion.BODY);
    // register a MoveCellSelectionCommandHandler with
    // AXIS_CYCLE_TRAVERSAL_STRATEGY
    viewportLayer.registerCommandHandler(new MoveCellSelectionCommandHandler(selectionLayer, ITraversalStrategy.AXIS_CYCLE_TRAVERSAL_STRATEGY));
    natTable = new NatTable(panel, viewportLayer);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
    // 3. TABLE traversal
    bodyDataLayer = new DataLayer(bodyDataProvider);
    selectionLayer = new SelectionLayer(bodyDataLayer);
    viewportLayer = new ViewportLayer(selectionLayer);
    // as the selection mouse bindings are registered for the region label
    // GridRegion.BODY we need to set that region label to the viewport so
    // the selection via mouse is working correctly
    viewportLayer.setRegionName(GridRegion.BODY);
    // register a MoveCellSelectionCommandHandler with
    // TABLE_TRAVERSAL_STRATEGY
    viewportLayer.registerCommandHandler(new MoveCellSelectionCommandHandler(selectionLayer, ITraversalStrategy.TABLE_TRAVERSAL_STRATEGY));
    natTable = new NatTable(panel, viewportLayer);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
    // 4. TABLE CYCLE traversal
    bodyDataLayer = new DataLayer(bodyDataProvider);
    selectionLayer = new SelectionLayer(bodyDataLayer);
    viewportLayer = new ViewportLayer(selectionLayer);
    // as the selection mouse bindings are registered for the region label
    // GridRegion.BODY we need to set that region label to the viewport so
    // the selection via mouse is working correctly
    viewportLayer.setRegionName(GridRegion.BODY);
    // register a MoveCellSelectionCommandHandler with
    // TABLE_CYCLE_TRAVERSAL_STRATEGY
    viewportLayer.registerCommandHandler(new MoveCellSelectionCommandHandler(selectionLayer, ITraversalStrategy.TABLE_CYCLE_TRAVERSAL_STRATEGY));
    natTable = new NatTable(panel, viewportLayer);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
    // 5. mixed traversal
    // on left/right we will use TABLE CYCLE
    // on up/down we will use AXIS CYCLE
    bodyDataLayer = new DataLayer(bodyDataProvider);
    selectionLayer = new SelectionLayer(bodyDataLayer);
    viewportLayer = new ViewportLayer(selectionLayer);
    // as the selection mouse bindings are registered for the region label
    // GridRegion.BODY we need to set that region label to the viewport so
    // the selection via mouse is working correctly
    viewportLayer.setRegionName(GridRegion.BODY);
    // register a MoveCellSelectionCommandHandler with
    // TABLE_CYCLE_TRAVERSAL_STRATEGY for horizontal traversal
    // and AXIS_CYCLE_TRAVERSAL_STRATEGY for vertical traversal
    // NOTE:
    // You could achieve the same by registering a command handler
    // with TABLE_CYCLE_TRAVERSAL_STRATEGY and registering
    // MoveSelectionActions with a customized ITraversalStrategy, e.g.
    // AXIS_CYCLE_TRAVERSAL_STRATEGY
    viewportLayer.registerCommandHandler(new MoveCellSelectionCommandHandler(selectionLayer, ITraversalStrategy.TABLE_CYCLE_TRAVERSAL_STRATEGY, ITraversalStrategy.AXIS_CYCLE_TRAVERSAL_STRATEGY));
    natTable = new NatTable(panel, viewportLayer);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
    // 6. edit traversal traversal
    // on left/right we will use TABLE CYCLE
    // on up/down we will use AXIS CYCLE
    bodyDataLayer = new DataLayer(bodyDataProvider);
    selectionLayer = new SelectionLayer(bodyDataLayer);
    viewportLayer = new ViewportLayer(selectionLayer);
    // as the selection mouse bindings are registered for the region label
    // GridRegion.BODY we need to set that region label to the viewport so
    // the selection via mouse is working correctly
    viewportLayer.setRegionName(GridRegion.BODY);
    final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(bodyDataLayer);
    bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);
    registerColumnLabels(columnLabelAccumulator);
    // add some edit configuration
    viewportLayer.addConfiguration(new DefaultEditBindings());
    viewportLayer.addConfiguration(new DefaultEditConfiguration());
    viewportLayer.addConfiguration(new EditorConfiguration());
    natTable = new NatTable(panel, viewportLayer);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
    // register a MoveCellSelectionCommandHandler with
    // TABLE_CYCLE_TRAVERSAL_STRATEGY for horizontal traversal
    // and AXIS_CYCLE_TRAVERSAL_STRATEGY for vertical traversal
    // NOTE:
    // You could achieve the same by registering a command handler
    // with TABLE_CYCLE_TRAVERSAL_STRATEGY and registering
    // MoveSelectionActions with a customized ITraversalStrategy, e.g.
    // AXIS_CYCLE_TRAVERSAL_STRATEGY
    viewportLayer.registerCommandHandler(new MoveCellSelectionCommandHandler(selectionLayer, new EditTraversalStrategy(ITraversalStrategy.TABLE_CYCLE_TRAVERSAL_STRATEGY, natTable), new EditTraversalStrategy(ITraversalStrategy.AXIS_CYCLE_TRAVERSAL_STRATEGY, natTable)));
    return panel;
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) EditTraversalStrategy(org.eclipse.nebula.widgets.nattable.selection.EditTraversalStrategy) Composite(org.eclipse.swt.widgets.Composite) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) DefaultEditBindings(org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) MoveCellSelectionCommandHandler(org.eclipse.nebula.widgets.nattable.selection.MoveCellSelectionCommandHandler) GridLayout(org.eclipse.swt.layout.GridLayout) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) DefaultEditConfiguration(org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditConfiguration) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) ColumnOverrideLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person)

Example 8 with ColumnOverrideLabelAccumulator

use of org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator in project nebula.widgets.nattable by eclipse.

the class _4471_EditorTraversalExample method createExampleControl.

@Override
public Control createExampleControl(Composite parent) {
    // property names of the Person class
    String[] propertyNames = { "firstName", "lastName", "birthday", "married", "gender" };
    // mapping from property to label, needed for column header labels
    Map<String, String> propertyToLabelMap = new HashMap<>();
    propertyToLabelMap.put("firstName", "Firstname");
    propertyToLabelMap.put("lastName", "Lastname");
    propertyToLabelMap.put("married", "Married");
    propertyToLabelMap.put("gender", "Gender");
    propertyToLabelMap.put("birthday", "Birthday");
    IRowDataProvider<Person> bodyDataProvider = new ListDataProvider<>(PersonService.getPersons(10), new ExtendedReflectiveColumnPropertyAccessor<Person>(propertyNames));
    DefaultGridLayer gridLayer = new DefaultGridLayer(bodyDataProvider, new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap));
    final DataLayer bodyDataLayer = (DataLayer) gridLayer.getBodyDataLayer();
    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();
    return natTable;
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) HashMap(java.util.HashMap) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) DefaultColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider) ColumnOverrideLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)

Example 9 with ColumnOverrideLabelAccumulator

use of org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator in project nebula.widgets.nattable by eclipse.

the class _447_EditorExample method createExampleControl.

@Override
public Control createExampleControl(Composite parent) {
    // property names of the Person class
    String[] propertyNames = { "firstName", "lastName", "password", "description", "age", "money", "married", "gender", "birthday", "address.street", "address.city", "favouriteFood", "favouriteDrinks", "filename" };
    // mapping from property to label, needed for column header labels
    Map<String, String> propertyToLabelMap = new HashMap<>();
    propertyToLabelMap.put("firstName", "Firstname");
    propertyToLabelMap.put("lastName", "Lastname");
    propertyToLabelMap.put("password", "Password");
    propertyToLabelMap.put("description", "Description");
    propertyToLabelMap.put("age", "Age");
    propertyToLabelMap.put("money", "Money");
    propertyToLabelMap.put("married", "Married");
    propertyToLabelMap.put("gender", "Gender");
    propertyToLabelMap.put("birthday", "Birthday");
    propertyToLabelMap.put("address.street", "Street");
    propertyToLabelMap.put("address.city", "City");
    propertyToLabelMap.put("favouriteFood", "Food");
    propertyToLabelMap.put("favouriteDrinks", "Drinks");
    propertyToLabelMap.put("filename", "Filename");
    IDataProvider bodyDataProvider = new ListDataProvider<>(PersonService.getExtendedPersonsWithAddress(10), new ExtendedReflectiveColumnPropertyAccessor<ExtendedPersonWithAddress>(propertyNames));
    DefaultGridLayer gridLayer = new DefaultGridLayer(bodyDataProvider, new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap));
    final DataLayer bodyDataLayer = (DataLayer) gridLayer.getBodyDataLayer();
    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;
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) ExtendedPersonWithAddress(org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress) HashMap(java.util.HashMap) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) NatTableContentTooltip(org.eclipse.nebula.widgets.nattable.tooltip.NatTableContentTooltip) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) DefaultColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider) ColumnOverrideLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)

Example 10 with ColumnOverrideLabelAccumulator

use of org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator in project nebula.widgets.nattable by eclipse.

the class _448_CDateTimeEditorExample method createExampleControl.

@Override
public Control createExampleControl(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);
    panel.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(panel);
    Composite gridPanel = new Composite(panel, SWT.NONE);
    gridPanel.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(gridPanel);
    Composite buttonPanel = new Composite(panel, SWT.NONE);
    buttonPanel.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonPanel);
    // property names of the DateValues class
    String[] propertyNames = { "columnOneDate", "columnTwoDate", "columnThreeDate", "columnFourDate", "columnFiveDate", "columnSixCalendar" };
    // mapping from property to label, needed for column header labels
    Map<String, String> propertyToLabelMap = new HashMap<>();
    propertyToLabelMap.put("columnOneDate", "Date/Time");
    propertyToLabelMap.put("columnTwoDate", "Date");
    propertyToLabelMap.put("columnThreeDate", "Time");
    propertyToLabelMap.put("columnFourDate", "Time Discrete");
    propertyToLabelMap.put("columnFiveDate", "Date/Time text only");
    propertyToLabelMap.put("columnSixCalendar", "Calendar");
    this.valuesToShow.add(createDateValues());
    this.valuesToShow.add(createDateValues());
    ConfigRegistry configRegistry = new ConfigRegistry();
    DateGridLayer gridLayer = new DateGridLayer(this.valuesToShow, configRegistry, propertyNames, propertyToLabelMap);
    DataLayer bodyDataLayer = gridLayer.getBodyDataLayer();
    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 DateEditConfiguration());
    natTable.configure();
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
    return panel;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) HashMap(java.util.HashMap) ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) IConfigRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) GridLayout(org.eclipse.swt.layout.GridLayout) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) DefaultRowHeaderDataLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer) DefaultColumnHeaderDataLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) ColumnOverrideLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator)

Aggregations

ColumnOverrideLabelAccumulator (org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator)38 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)28 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)28 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)26 HashMap (java.util.HashMap)18 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)16 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)14 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)12 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)12 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)11 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)11 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)11 GridLayout (org.eclipse.swt.layout.GridLayout)11 DefaultGridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)9 HeaderMenuConfiguration (org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)9 Composite (org.eclipse.swt.widgets.Composite)9 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)8 Button (org.eclipse.swt.widgets.Button)8