Search in sources :

Example 66 with Style

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);
}
Also used : Style(org.eclipse.nebula.widgets.nattable.style.Style)

Example 67 with Style

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);
}
Also used : Style(org.eclipse.nebula.widgets.nattable.style.Style)

Example 68 with Style

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);
}
Also used : TableStyle(org.eclipse.nebula.widgets.nattable.extension.builder.model.TableStyle) Style(org.eclipse.nebula.widgets.nattable.style.Style)

Example 69 with Style

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();
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) Style(org.eclipse.nebula.widgets.nattable.style.Style)

Example 70 with Style

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));
}
Also used : BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle) SelectCellCommand(org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand) Style(org.eclipse.nebula.widgets.nattable.style.Style) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle) ILayerCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell) Test(org.junit.Test)

Aggregations

Style (org.eclipse.nebula.widgets.nattable.style.Style)115 BorderStyle (org.eclipse.nebula.widgets.nattable.style.BorderStyle)60 IStyle (org.eclipse.nebula.widgets.nattable.style.IStyle)52 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)18 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)17 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)16 HashMap (java.util.HashMap)15 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)15 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)13 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)13 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)12 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)12 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)12 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)12 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)11 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)11 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)10 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)10 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)10 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)10