use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class _6051_GroupByExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// create a new ConfigRegistry which will be needed for GlazedLists
// handling
ConfigRegistry configRegistry = new ConfigRegistry();
// property names of the Person class
String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday", "address.street", "address.housenumber", "address.postalCode", "address.city" };
// 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");
propertyToLabelMap.put("address.street", "Street");
propertyToLabelMap.put("address.housenumber", "Housenumber");
propertyToLabelMap.put("address.postalCode", "Postal Code");
propertyToLabelMap.put("address.city", "City");
IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<>(propertyNames);
BodyLayerStack<PersonWithAddress> bodyLayerStack = new BodyLayerStack<>(PersonService.getPersonsWithAddress(100), columnPropertyAccessor);
// build the column header layer
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// build the row header layer
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// build the corner layer
IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
GridLayer gridLayer = new GridLayer(bodyLayerStack, columnHeaderLayer, rowHeaderLayer, cornerLayer);
// set the group by header on top of the grid
CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);
final GroupByHeaderLayer groupByHeaderLayer = new GroupByHeaderLayer(bodyLayerStack.getGroupByModel(), gridLayer, columnHeaderDataProvider, columnHeaderLayer);
compositeGridLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION, groupByHeaderLayer, 0, 0);
compositeGridLayer.setChildLayer("Grid", gridLayer, 0, 1);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(parent, compositeGridLayer, false);
// 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 group by configuration
natTable.addConfiguration(new GroupByHeaderMenuConfiguration(natTable, groupByHeaderLayer));
natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
@Override
protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
return super.createCornerMenu(natTable).withStateManagerMenuItemProvider().withMenuItemProvider(new IMenuItemProvider() {
@Override
public void addMenuItem(NatTable natTable, Menu popupMenu) {
MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
// $NON-NLS-1$
menuItem.setText("Toggle Group By Header");
menuItem.setEnabled(true);
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
groupByHeaderLayer.setVisible(!groupByHeaderLayer.isVisible());
}
});
}
}).withMenuItemProvider(new IMenuItemProvider() {
@Override
public void addMenuItem(final NatTable natTable, Menu popupMenu) {
MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
// $NON-NLS-1$
menuItem.setText("Collapse All");
menuItem.setEnabled(true);
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
natTable.doCommand(new TreeCollapseAllCommand());
}
});
}
}).withMenuItemProvider(new IMenuItemProvider() {
@Override
public void addMenuItem(final NatTable natTable, Menu popupMenu) {
MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
// $NON-NLS-1$
menuItem.setText("Expand All");
menuItem.setEnabled(true);
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
natTable.doCommand(new TreeExpandAllCommand());
}
});
}
}).withMenuItemProvider(new IMenuItemProvider() {
@Override
public void addMenuItem(final NatTable natTable, Menu popupMenu) {
MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
// $NON-NLS-1$
menuItem.setText("Expand to Level 2");
menuItem.setEnabled(true);
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
natTable.doCommand(new TreeExpandToLevelCommand(2));
}
});
}
});
}
});
natTable.configure();
natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(natTable));
return natTable;
}
use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class _6052_GroupByCustomTypesExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// create a new ConfigRegistry which will be needed for GlazedLists
// handling
ConfigRegistry configRegistry = new ConfigRegistry();
String[] propertyNames = { "name", "age", "money", "gender", "city" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<>();
propertyToLabelMap.put("name", "Name");
propertyToLabelMap.put("age", "Age");
propertyToLabelMap.put("money", "Money");
propertyToLabelMap.put("gender", "Gender");
propertyToLabelMap.put("city", "City");
IColumnPropertyAccessor<MyRowObject> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<>(propertyNames);
BodyLayerStack<MyRowObject> bodyLayerStack = new BodyLayerStack<>(createMyRowObjects(50), columnPropertyAccessor);
// add a label accumulator to be able to register converter
bodyLayerStack.getBodyDataLayer().setConfigLabelAccumulator(new ColumnLabelAccumulator());
// build the column header layer
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// also set the config label accumulator to the column header to make
// the ISortModel work correctly
columnHeaderDataLayer.setConfigLabelAccumulator(new ColumnLabelAccumulator());
// build the row header layer
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// build the corner layer
IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
GridLayer gridLayer = new GridLayer(bodyLayerStack, columnHeaderLayer, rowHeaderLayer, cornerLayer);
// set the group by header on top of the grid
CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);
final GroupByHeaderLayer groupByHeaderLayer = new GroupByHeaderLayer(bodyLayerStack.getGroupByModel(), gridLayer, columnHeaderDataProvider);
compositeGridLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION, groupByHeaderLayer, 0, 0);
compositeGridLayer.setChildLayer("Grid", gridLayer, 0, 1);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(parent, compositeGridLayer, false);
// 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 group by configuration
natTable.addConfiguration(new GroupByHeaderMenuConfiguration(natTable, groupByHeaderLayer));
natTable.addConfiguration(new MyRowObjectTableConfiguration());
natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
@Override
protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
return super.createCornerMenu(natTable).withStateManagerMenuItemProvider().withMenuItemProvider(new IMenuItemProvider() {
@Override
public void addMenuItem(NatTable natTable, Menu popupMenu) {
MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
// $NON-NLS-1$
menuItem.setText("Toggle Group By Header");
menuItem.setEnabled(true);
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
groupByHeaderLayer.setVisible(!groupByHeaderLayer.isVisible());
}
});
}
});
}
});
// the composition in this example does not have a SortHeaderLayer
// but in order to show the custom objects sorted by comparator, we
// need to set the appropriate ISortModel to the GroupByDataLayer
bodyLayerStack.bodyDataLayer.initializeTreeComparator(new GlazedListsSortModel<>(bodyLayerStack.sortedList, columnPropertyAccessor, configRegistry, columnHeaderDataLayer), null, false);
natTable.configure();
natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(natTable));
return natTable;
}
use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class _6053_GroupBySummaryExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout());
// create a new ConfigRegistry which will be needed for GlazedLists
// handling
final ConfigRegistry configRegistry = new ConfigRegistry();
// property names of the ExtendedPersonWithAddress class
String[] propertyNames = { "firstName", "lastName", "age", "money", "married", "gender", "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("age", "Age");
propertyToLabelMap.put("money", "Money");
propertyToLabelMap.put("married", "Married");
propertyToLabelMap.put("gender", "Gender");
propertyToLabelMap.put("birthday", "Birthday");
final IColumnPropertyAccessor<ExtendedPersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<>(propertyNames);
// to enable the group by summary feature, the GroupByDataLayer needs to
// know the ConfigRegistry
final BodyLayerStack<ExtendedPersonWithAddress> bodyLayerStack = new BodyLayerStack<>(PersonService.getExtendedPersonsWithAddress(100), columnPropertyAccessor, configRegistry);
bodyLayerStack.getBodyDataLayer().setConfigLabelAccumulator(new ColumnLabelAccumulator());
// build the column header layer
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// add sorting
SortHeaderLayer<ExtendedPersonWithAddress> sortHeaderLayer = new SortHeaderLayer<>(columnHeaderLayer, new GlazedListsSortModel<>(bodyLayerStack.getSortedList(), columnPropertyAccessor, configRegistry, columnHeaderDataLayer), false);
// connect sortModel to GroupByDataLayer to support sorting by group by
// summary values
bodyLayerStack.getBodyDataLayer().initializeTreeComparator(sortHeaderLayer.getSortModel(), bodyLayerStack.getTreeLayer(), true);
// build the row header layer
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// build the corner layer
IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, sortHeaderLayer);
// build the grid layer
GridLayer gridLayer = new GridLayer(bodyLayerStack, sortHeaderLayer, rowHeaderLayer, cornerLayer);
// set the group by header on top of the grid
CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);
final GroupByHeaderLayer groupByHeaderLayer = new GroupByHeaderLayer(bodyLayerStack.getGroupByModel(), gridLayer, columnHeaderDataProvider);
compositeGridLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION, groupByHeaderLayer, 0, 0);
compositeGridLayer.setChildLayer("Grid", gridLayer, 0, 1);
// turn the auto configuration off as we want to add our header menu
// configuration
final NatTable natTable = new NatTable(container, compositeGridLayer, false);
// 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 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);
// set a custom display converter to the money column
// that transforms the values correctly localized
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDoubleDisplayConverter(), DisplayMode.NORMAL, ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3);
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new GenderDisplayConverter(), DisplayMode.NORMAL, ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 5);
}
});
// add sorting configuration
natTable.addConfiguration(new SingleClickSortConfiguration());
this.sumMoneySummaryProvider = new SummationGroupBySummaryProvider<>(columnPropertyAccessor);
this.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, _6053_GroupBySummaryExample.this.sumMoneySummaryProvider, DisplayMode.NORMAL, GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + 3);
configRegistry.registerConfigAttribute(GroupByConfigAttributes.GROUP_BY_SUMMARY_PROVIDER, new AverageAgeGroupBySummaryProvider(), DisplayMode.NORMAL, GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + 2);
configRegistry.registerConfigAttribute(GroupByConfigAttributes.GROUP_BY_CHILD_COUNT_PATTERN, "[{0}] - ({1})");
}
});
// add group by header configuration
natTable.addConfiguration(new GroupByHeaderMenuConfiguration(natTable, groupByHeaderLayer));
natTable.addConfiguration(new AbstractHeaderMenuConfiguration(natTable) {
@Override
protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
return super.createColumnHeaderMenu(natTable).withHideColumnMenuItem().withShowAllColumnsMenuItem().withStateManagerMenuItemProvider();
}
@Override
protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
return super.createCornerMenu(natTable).withShowAllColumnsMenuItem().withStateManagerMenuItemProvider();
}
});
natTable.configure();
natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(natTable));
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
Composite buttonPanel = new Composite(container, SWT.NONE);
buttonPanel.setLayout(new RowLayout());
GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonPanel);
Button toggleHeaderButton = new Button(buttonPanel, SWT.PUSH);
toggleHeaderButton.setText("Toggle Group By Header");
toggleHeaderButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
groupByHeaderLayer.setVisible(!groupByHeaderLayer.isVisible());
}
});
Button collapseAllButton = new Button(buttonPanel, SWT.PUSH);
collapseAllButton.setText("Collapse All");
collapseAllButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new TreeCollapseAllCommand());
}
});
Button expandAllButton = new Button(buttonPanel, SWT.PUSH);
expandAllButton.setText("Expand All");
expandAllButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
natTable.doCommand(new TreeExpandAllCommand());
}
});
Button toggleMoneySummaryButton = new Button(buttonPanel, SWT.PUSH);
toggleMoneySummaryButton.setText("Toggle Money Group Summary (SUM/AVG)");
toggleMoneySummaryButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// clear the group by summary cache so the new summary
// calculation gets triggered
bodyLayerStack.getBodyDataLayer().clearCache();
_6053_GroupBySummaryExample.this.useMoneySum = !_6053_GroupBySummaryExample.this.useMoneySum;
if (_6053_GroupBySummaryExample.this.useMoneySum) {
configRegistry.registerConfigAttribute(GroupByConfigAttributes.GROUP_BY_SUMMARY_PROVIDER, _6053_GroupBySummaryExample.this.sumMoneySummaryProvider, DisplayMode.NORMAL, GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + 3);
} else {
configRegistry.registerConfigAttribute(GroupByConfigAttributes.GROUP_BY_SUMMARY_PROVIDER, _6053_GroupBySummaryExample.this.avgMoneySummaryProvider, DisplayMode.NORMAL, GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + 3);
}
natTable.doCommand(new VisualRefreshCommand());
}
});
return container;
}
use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class Rendering_cells_as_a_link_and_button method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
this.gridLayer = new SelectionExampleGridLayer();
NatTable natTable = new NatTable(parent, this.gridLayer, false);
IConfigRegistry configRegistry = new ConfigRegistry();
DataLayer bodyDataLayer = this.gridLayer.getBodyDataLayer();
// Step 1: Create a label accumulator - adds custom labels to all cells
// which we wish to render differently. In this case render as a button.
ColumnOverrideLabelAccumulator cellLabelAccumulator = new ColumnOverrideLabelAccumulator(bodyDataLayer);
cellLabelAccumulator.registerColumnOverrides(0, LINK_CELL_LABEL);
cellLabelAccumulator.registerColumnOverrides(2, BUTTON_CELL_LABEL);
// Step 2: Register label accumulator
bodyDataLayer.setConfigLabelAccumulator(cellLabelAccumulator);
// Step 3: Register your custom cell style and , against the
// label applied to the link cell.
LinkClickConfiguration<RowDataFixture> linkClickConfiguration = new LinkClickConfiguration<>();
addLinkToColumn(configRegistry, natTable.getDisplay().getSystemColor(SWT.COLOR_BLUE), linkClickConfiguration);
natTable.addConfiguration(linkClickConfiguration);
// Step 4: Register your custom cell painter, cell style, against the
// label applied to the button cell.
addButtonToColumn(configRegistry);
natTable.addConfiguration(new ButtonClickConfiguration<RowDataFixture>(this.buttonPainter));
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new DebugMenuConfiguration(natTable));
natTable.setConfigRegistry(configRegistry);
natTable.configure();
// Layout SWT widgets. Not relevant to example code.
parent.setLayout(new GridLayout(1, true));
natTable.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
setupTextArea(parent);
return natTable;
}
use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.
the class BlinkingGridExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
final String[] propertyNames = RowDataListFixture.getPropertyNames();
final Map<String, String> propertyToLabelMap = RowDataListFixture.getPropertyToLabelMap();
ConfigRegistry configRegistry = new ConfigRegistry();
// Body
LinkedList<BlinkingRowDataFixture> rowData = new LinkedList<>();
EventList<BlinkingRowDataFixture> eventList = GlazedLists.eventList(rowData);
ObservableElementList<BlinkingRowDataFixture> observableElementList = new ObservableElementList<>(eventList, GlazedLists.beanConnector(BlinkingRowDataFixture.class));
IColumnPropertyAccessor<BlinkingRowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<>(propertyNames);
this.bodyDataProvider = new ListDataProvider<>(observableElementList, columnPropertyAccessor);
final DataLayer bodyLayer = new DataLayer(this.bodyDataProvider);
GlazedListsEventLayer<BlinkingRowDataFixture> glazedListsEventLayer = new GlazedListsEventLayer<>(bodyLayer, observableElementList);
BlinkLayer<BlinkingRowDataFixture> blinkingLayer = new BlinkLayer<>(glazedListsEventLayer, this.bodyDataProvider, new IRowIdAccessor<BlinkingRowDataFixture>() {
@Override
public Serializable getRowId(BlinkingRowDataFixture rowObject) {
return rowObject.getSecurity_description();
}
}, columnPropertyAccessor, configRegistry);
registerBlinkingConfigCells(configRegistry);
insertRowData(glazedListsEventLayer, this.bodyDataProvider);
// Column header
final DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
// Row header
final DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(this.bodyDataProvider);
// Corner
final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(defaultColumnHeaderDataProvider, rowHeaderDataProvider);
// Grid
GridLayer gridLayer = new DefaultGridLayer(blinkingLayer, new DefaultColumnHeaderDataLayer(defaultColumnHeaderDataProvider), new DefaultRowHeaderDataLayer(rowHeaderDataProvider), new DataLayer(cornerDataProvider));
NatTable natTable = new NatTable(parent, gridLayer, false);
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.configure();
return natTable;
}
Aggregations