Search in sources :

Example 81 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.

the class DefaultNatTableThemeConfiguration method getTreeStyle.

@Override
protected IStyle getTreeStyle() {
    IStyle cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, this.treeBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, this.treeFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_BACKGROUND_COLOR, this.treeGradientBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_FOREGROUND_COLOR, this.treeGradientFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, this.treeHAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, this.treeVAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, this.treeFont);
    cellStyle.setAttributeValue(CellStyleAttributes.IMAGE, this.treeImage);
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, this.treeBorderStyle);
    cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR, this.treePWEchoChar);
    cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION, this.treeTextDecoration);
    return cellStyle;
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) Style(org.eclipse.nebula.widgets.nattable.style.Style) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle)

Example 82 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.

the class DefaultNatTableThemeConfiguration method getRowHeaderHoverStyle.

@Override
protected IStyle getRowHeaderHoverStyle() {
    IStyle cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, this.rHeaderHoverBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, this.rHeaderHoverFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_BACKGROUND_COLOR, this.rHeaderHoverGradientBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_FOREGROUND_COLOR, this.rHeaderHoverGradientFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, this.rHeaderHoverHAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, this.rHeaderHoverVAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, this.rHeaderHoverFont);
    cellStyle.setAttributeValue(CellStyleAttributes.IMAGE, this.rHeaderHoverImage);
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, this.rHeaderHoverBorderStyle);
    cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR, this.rHeaderHoverPWEchoChar);
    cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION, this.rHeaderHoverTextDecoration);
    return cellStyle;
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) Style(org.eclipse.nebula.widgets.nattable.style.Style) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle)

Example 83 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.

the class DefaultNatTableThemeConfiguration method getSelectionAnchorSelectionStyle.

@Override
protected IStyle getSelectionAnchorSelectionStyle() {
    IStyle cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, this.selectionAnchorSelectionBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, this.selectionAnchorSelectionFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_BACKGROUND_COLOR, this.selectionAnchorSelectionGradientBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_FOREGROUND_COLOR, this.selectionAnchorSelectionGradientFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, this.selectionAnchorSelectionHAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, this.selectionAnchorSelectionVAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, this.selectionAnchorSelectionFont);
    cellStyle.setAttributeValue(CellStyleAttributes.IMAGE, this.selectionAnchorSelectionImage);
    // if there is not explicitly another border style configured use the
    // same as in getSelectionAnchorStyle()
    BorderStyle border = this.selectionAnchorSelectionBorderStyle != null ? this.selectionAnchorSelectionBorderStyle : this.selectionAnchorBorderStyle;
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, border);
    cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR, this.selectionAnchorSelectionPWEchoChar);
    cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION, this.selectionAnchorSelectionTextDecoration);
    return cellStyle;
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle) IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) Style(org.eclipse.nebula.widgets.nattable.style.Style) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle)

Example 84 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.

the class ThemeConfiguration method configureRowHeaderSelectionStyle.

/**
 * Register the style configurations for rendering the selection in a row
 * header in a NatTable.
 * <p>
 * By default this means to register the style configurations against
 * {@link DisplayMode#SELECT} and config/region label
 * {@link GridRegion#ROW_HEADER}. The styling for rendering full row
 * selection is configured against the label
 * {@link SelectionStyleLabels#ROW_FULLY_SELECTED_STYLE}.
 * </p>
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureRowHeaderSelectionStyle(IConfigRegistry configRegistry) {
    IStyle rowHeaderStyle = getRowHeaderSelectionStyle();
    if (!isStyleEmpty(rowHeaderStyle)) {
        // register column header cell style in select mode
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, rowHeaderStyle, DisplayMode.SELECT, GridRegion.ROW_HEADER);
    }
    ICellPainter rowHeaderCellPainter = getRowHeaderSelectionCellPainter();
    if (rowHeaderCellPainter != null) {
        // register column header cell painter in select mode
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, rowHeaderCellPainter, DisplayMode.SELECT, GridRegion.ROW_HEADER);
    }
    IStyle fullSelectionRowHeaderStyle = getRowHeaderFullSelectionStyle();
    if (!isStyleEmpty(fullSelectionRowHeaderStyle)) {
        // register row header cell style in select mode when all cells in
        // the row are selected
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, fullSelectionRowHeaderStyle, DisplayMode.SELECT, SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE);
    }
    ICellPainter fullSelectionRowHeaderCellPainter = getRowHeaderFullSelectionCellPainter();
    if (fullSelectionRowHeaderCellPainter != null) {
        // register row header cell painter in select mode when all cells in
        // the row are selected
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, fullSelectionRowHeaderCellPainter, DisplayMode.SELECT, SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 85 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.

the class ThemeConfiguration method configureColumnGroupHeaderStyle.

/**
 * This method is used to register style configurations for the column group
 * header in a NatTable.
 * <p>
 * When adding the ColumnGroupHeaderLayer to a layer stack, there will be a
 * new region with region label {@link GridRegion#COLUMN_GROUP_HEADER}.
 * Typically it will share the same styling as the column header and have an
 * internally configured {@link ICellPainter} to render dependent on the
 * state of the ColumnGroupModel.
 * </p>
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureColumnGroupHeaderStyle(IConfigRegistry configRegistry) {
    IStyle columnGroupHeaderStyle = getColumnGroupHeaderStyle();
    if (!isStyleEmpty(columnGroupHeaderStyle)) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, columnGroupHeaderStyle, DisplayMode.NORMAL, GridRegion.COLUMN_GROUP_HEADER);
    }
    ICellPainter columnGroupHeaderCellPainter = getColumnGroupHeaderCellPainter();
    if (columnGroupHeaderCellPainter != null) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, columnGroupHeaderCellPainter, DisplayMode.NORMAL, GridRegion.COLUMN_GROUP_HEADER);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Aggregations

IStyle (org.eclipse.nebula.widgets.nattable.style.IStyle)97 BorderStyle (org.eclipse.nebula.widgets.nattable.style.BorderStyle)50 Style (org.eclipse.nebula.widgets.nattable.style.Style)49 ICellPainter (org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)24 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)8 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)7 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)6 HashMap (java.util.HashMap)5 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)5 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)5 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)5 ExtendedPersonWithAddress (org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress)5 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)5 VisualRefreshCommand (org.eclipse.nebula.widgets.nattable.command.VisualRefreshCommand)4 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)4 ExtendedReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ExtendedReflectiveColumnPropertyAccessor)4 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)4 DefaultDoubleDisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter)4 GroupByDataLayer (org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDataLayer)4 GroupByHeaderLayer (org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByHeaderLayer)4