}
}
};
bodyLayer.setConfigLabelAccumulator(cellLabelAccumulator);
NatTable natTable = new NatTable(parent, gridLayer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration() {
{
// override the LineBorderDecorator here to show how to paint
// borders on single sides of a cell
cellPainter = new CustomLineBorderDecorator(new TextPainter());
// set a border style
borderStyle = new BorderStyle(2, GUIHelper.COLOR_BLUE,
LineStyleEnum.DASHDOT);
}
});
// Custom style for label "FOO"
natTable.addConfiguration(new AbstractRegistryConfiguration() {
public void configureRegistry(IConfigRegistry configRegistry) {
Style cellStyle = new Style();
cellStyle.setAttributeValue(
CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_GREEN);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_STYLE, cellStyle,
DisplayMode.NORMAL, FOO_LABEL);
cellStyle = new Style();
cellStyle.setAttributeValue(
CellStyleAttributes.TEXT_DECORATION,
TextDecorationEnum.UNDERLINE_STRIKETHROUGH);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_STYLE, cellStyle,
DisplayMode.NORMAL, BAR_LABEL);
}
});
natTable.configure();
return natTable;
}