use of org.eclipse.nebula.widgets.nattable.style.Style in project nebula.widgets.nattable by eclipse.
the class Applying_style_to_a_cell method addColumnHighlight.
private void addColumnHighlight(IConfigRegistry configRegistry) {
Style style = new Style();
style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_RED);
configRegistry.registerConfigAttribute(// attribute to apply
CellConfigAttributes.CELL_STYLE, // value of the attribute
style, // during selection or edit
DisplayMode.NORMAL, // apply the above for all cells with this label
CELL_LABEL);
// Override the selection style on the highlighted cells.
// Note: This is achieved by specifying the display mode.
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.SELECT, CELL_LABEL);
}
use of org.eclipse.nebula.widgets.nattable.style.Style in project nebula.widgets.nattable by eclipse.
the class AlternateRowStyleConfiguration method configureEvenRowStyle.
protected void configureEvenRowStyle(IConfigRegistry configRegistry) {
Style cellStyle = new Style();
cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, evenRowBgColor);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE);
}
use of org.eclipse.nebula.widgets.nattable.style.Style in project nebula.widgets.nattable by eclipse.
the class SelectionStyleConfiguration method configureHeaderFullySelectedStyle.
@Override
protected void configureHeaderFullySelectedStyle(IConfigRegistry configRegistry) {
Style fullySelectedStyle = new Style();
fullySelectedStyle.setAttributeValue(BACKGROUND_COLOR, tableStyle.fullySelectedHeaderBgColor);
fullySelectedStyle.setAttributeValue(FOREGROUND_COLOR, tableStyle.fullySelectedHeaderFgColor);
fullySelectedStyle.setAttributeValue(FONT, tableStyle.fullySelectedHeaderFont);
configRegistry.registerConfigAttribute(CELL_STYLE, fullySelectedStyle, SELECT, SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE);
configRegistry.registerConfigAttribute(CELL_STYLE, fullySelectedStyle, SELECT, SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE);
configRegistry.registerConfigAttribute(CELL_STYLE, evenRowStyle, SELECT, EVEN_ROW_CONFIG_TYPE);
configRegistry.registerConfigAttribute(CELL_STYLE, oddRowStyle, SELECT, ODD_ROW_CONFIG_TYPE);
}
use of org.eclipse.nebula.widgets.nattable.style.Style in project tdq-studio-se by Talend.
the class DataSampleTable method changeColumnHeaderLabelColor.
public void changeColumnHeaderLabelColor(String columnName, Color color, String keyName) {
updateMarkedKeys(columnName, color, keyName);
Style cellStyle = new Style();
cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, color);
cellStyle.setAttributeValue(CellStyleAttributes.FONT, font);
natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, columnName);
natTable.configure();
}
use of org.eclipse.nebula.widgets.nattable.style.Style in project nebula.widgets.nattable by eclipse.
the class ConfigurableCellBorderTest method shouldReturnASelectedCellWithDottedLineStyling.
@Test
public void shouldReturnASelectedCellWithDottedLineStyling() {
Style cellStyle = new Style();
final BorderStyle defaultBorderStyle = new BorderStyle(13, GUIHelper.COLOR_YELLOW, LineStyleEnum.DOTTED);
cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, defaultBorderStyle);
// Register line styling for body cells in selection mode
this.configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_STYLE);
// Select and access cell
this.natTable.doCommand(new SelectCellCommand(this.natTable, 2, 2, false, false));
ILayerCell cell = this.natTable.getCellByPosition(2, 2);
Assert.assertEquals(DisplayMode.SELECT, cell.getDisplayMode());
// Check for line styling
Assert.assertEquals(defaultBorderStyle, this.configRegistry.getConfigAttribute(CellConfigAttributes.CELL_STYLE, cell.getDisplayMode(), cell.getConfigLabels().getLabels()).getAttributeValue(CellStyleAttributes.BORDER_STYLE));
}
Aggregations