use of org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration in project nebula.widgets.nattable by eclipse.
the class _5113_RowGroupingExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// Body
// 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");
// build the body layer stack
// Usually you would create a new layer stack by extending
// AbstractIndexLayerTransform and setting the ViewportLayer as
// underlying layer. But in this case using the ViewportLayer directly
// as body layer is also working.
IRowDataProvider<Person> bodyDataProvider = new DefaultBodyDataProvider<>(getStaticPersonList(), propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(bodyDataLayer);
ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
RowHideShowLayer rowHideShowLayer = new RowHideShowLayer(columnHideShowLayer);
RowGroupModel<Person> rowGroupModel = new RowGroupModel<>();
rowGroupModel.setDataProvider(bodyDataProvider);
RowGroupExpandCollapseLayer<Person> rowExpandCollapseLayer = new RowGroupExpandCollapseLayer<>(rowHideShowLayer, rowGroupModel);
SelectionLayer selectionLayer = new SelectionLayer(rowExpandCollapseLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// Column header
DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(defaultColumnHeaderDataProvider);
ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// Row header
DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer, false);
rowHeaderLayer.addConfiguration(new RowHeaderConfiguration());
RowGroupHeaderLayer<Person> rowGroupHeaderLayer = new RowGroupHeaderLayer<>(rowHeaderLayer, selectionLayer, rowGroupModel);
rowGroupHeaderLayer.setColumnWidth(20);
// Create a group of rows for the model.
RowGroup<Person> rowGroup = new RowGroup<>(rowGroupModel, "Simpson", false);
rowGroup.addMemberRow(bodyDataProvider.getRowObject(0));
rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(1));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(2));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(3));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(4));
rowGroupModel.addRowGroup(rowGroup);
rowGroup = new RowGroup<>(rowGroupModel, "Flanders", false);
rowGroup.addMemberRow(bodyDataProvider.getRowObject(5));
rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(6));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(7));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(8));
rowGroupModel.addRowGroup(rowGroup);
rowGroup = new RowGroup<>(rowGroupModel, "Lovejoy", true);
rowGroup.addMemberRow(bodyDataProvider.getRowObject(9));
rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(10));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(11));
rowGroupModel.addRowGroup(rowGroup);
// Corner
final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(defaultColumnHeaderDataProvider, rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowGroupHeaderLayer, columnHeaderLayer);
// Grid
GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer, rowGroupHeaderLayer, cornerLayer);
NatTable natTable = new NatTable(parent, gridLayer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
natTable.configure();
natTable.setTheme(new ModernNatTableThemeConfiguration());
return natTable;
}
use of org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration in project nebula.widgets.nattable by eclipse.
the class _6031_GlazedListsFilterExample 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(50), columnPropertyAccessor);
// build the column header layer
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());
// Note: The column header layer is wrapped in a filter row composite.
// This plugs in the filter row functionality
FilterRowHeaderComposite<PersonWithAddress> filterRowHeaderLayer = new FilterRowHeaderComposite<>(new DefaultGlazedListsFilterStrategy<>(bodyLayerStack.getFilterList(), columnPropertyAccessor, configRegistry), columnHeaderLayer, columnHeaderDataLayer.getDataProvider(), configRegistry);
// 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, filterRowHeaderLayer);
// build the grid layer
GridLayer gridLayer = new GridLayer(bodyLayerStack, filterRowHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(parent, gridLayer, 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 filter row configuration
natTable.addConfiguration(new FilterRowConfiguration());
natTable.addConfiguration(new HeaderMenuConfiguration(natTable) {
@Override
protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
return super.createCornerMenu(natTable).withStateManagerMenuItemProvider();
}
});
natTable.configure();
natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(natTable));
return natTable;
}
use of org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration in project nebula.widgets.nattable by eclipse.
the class _5016_DataChangeLayerExample 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(), false);
// we register a special command handler to perform custom changes on
// save
dataChangeLayer.registerCommandHandler(new SaveDataChangesCommandHandler(dataChangeLayer) {
@Override
public boolean doCommand(ILayer targetLayer, SaveDataChangesCommand command) {
if (MessageDialog.openQuestion(parent.getShell(), "Save data", "Do you really want to save to database?")) {
// you would implement the storage to database here
System.out.println("We save the data to the database");
return super.doCommand(targetLayer, command);
}
return 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;
}
use of org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration 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;
}
use of org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration in project nebula.widgets.nattable by eclipse.
the class _5044_HorizontalSplitViewportGridExample method createExampleControl.
@Override
public Control createExampleControl(Composite parent) {
// 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);
final BodyLayerStack<PersonWithAddress> bodyLayer = new BodyLayerStack<>(PersonService.getPersonsWithAddress(50), columnPropertyAccessor);
// build the row header layer
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyLayer.getBodyDataProvider());
DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
final ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
// build the column header layer
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
final DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
final AbstractLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
// Use this special layer painter that supports rendering of split
// viewports although the ColumnHeaderLayer is not split. Here is some
// custom calculation included that might not work correctly in case
// there are column groups or other spanning involved.
columnHeaderLayer.setLayerPainter(new CellLayerPainter() {
@Override
protected boolean isClipLeft(int position) {
// check position-1 because of the row header column count
// as the body is a composite layer, the default transformation
// for the grid is not working correctly
int index = LayerUtil.convertColumnPosition(columnHeaderLayer, position - 1, columnHeaderDataLayer);
return (index > SPLIT_COLUMN_INDEX);
}
@Override
protected void paintCell(ILayerCell cell, GC gc, IConfigRegistry configRegistry) {
ILayer layer = cell.getLayer();
int columnPosition = cell.getColumnPosition();
int rowPosition = cell.getRowPosition();
ICellPainter cellPainter = layer.getCellPainter(columnPosition, rowPosition, cell, configRegistry);
Rectangle adjustedCellBounds = layer.getLayerPainter().adjustCellBounds(columnPosition, rowPosition, cell.getBounds());
if (cellPainter != null) {
Rectangle originalClipping = gc.getClipping();
int startX = getStartXOfColumnPosition(columnPosition);
int startY = getStartYOfRowPosition(rowPosition);
int endX = getStartXOfColumnPosition(cell.getOriginColumnPosition() + cell.getColumnSpan());
int endY = getStartYOfRowPosition(cell.getOriginRowPosition() + cell.getRowSpan());
// correct position of first column in right region
// find the last visible column in left region
int viewportBorderX = bodyLayer.getViewportLayerLeft().getClientAreaWidth() + rowHeaderLayer.getWidth();
if (isClipLeft(columnPosition) && startX < viewportBorderX) {
startX = viewportBorderX;
}
if (!isClipLeft(columnPosition - 1) && startX > viewportBorderX) {
startX = viewportBorderX;
}
if (isClipLeft(cell.getOriginColumnPosition() + cell.getColumnSpan()) && endX < viewportBorderX) {
endX = viewportBorderX;
}
Rectangle cellClipBounds = originalClipping.intersection(new Rectangle(startX, startY, endX - startX, endY - startY));
gc.setClipping(cellClipBounds.intersection(adjustedCellBounds));
cellPainter.paintCell(cell, gc, adjustedCellBounds, configRegistry);
gc.setClipping(originalClipping);
}
}
});
// build the corner layer
IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
final ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
GridLayer gridLayer = new GridLayer(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
// in order to make printing and exporting work correctly you need to
// register the following command handlers
gridLayer.registerCommandHandler(new MultiTurnViewportOnCommandHandler(bodyLayer.getViewportLayerLeft(), bodyLayer.getViewportLayerRight()));
gridLayer.registerCommandHandler(new MultiTurnViewportOffCommandHandler(bodyLayer.getViewportLayerLeft(), bodyLayer.getViewportLayerRight()));
// Wrap NatTable in composite so we can slap on the external horizontal
// sliders
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.horizontalSpacing = 0;
gridLayout.verticalSpacing = 0;
composite.setLayout(gridLayout);
NatTable natTable = new NatTable(composite, gridLayer, false);
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
natTable.setLayoutData(gridData);
createSplitSliders(composite, rowHeaderLayer, bodyLayer.getViewportLayerLeft(), bodyLayer.getViewportLayerRight());
// add an IOverlayPainter to ensure the right border of the left
// viewport always
// this is necessary because the left border of layer stacks is not
// rendered by default
natTable.addOverlayPainter(new IOverlayPainter() {
@Override
public void paintOverlay(GC gc, ILayer layer) {
Color beforeColor = gc.getForeground();
gc.setForeground(GUIHelper.COLOR_GRAY);
int viewportBorderX = bodyLayer.getViewportLayerLeft().getWidth() + rowHeaderLayer.getWidth() - 1;
gc.drawLine(viewportBorderX, 0, viewportBorderX, layer.getHeight() - 1);
gc.setForeground(beforeColor);
}
});
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
natTable.configure();
return composite;
}
Aggregations