use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.
the class ThemeConfiguration method configureColumnHeaderSelectionStyle.
/**
* Register the style configurations for rendering the selection in a column
* header in a NatTable.
* <p>
* By default this means to register the style configurations against
* {@link DisplayMode#SELECT} and config/region label
* {@link GridRegion#COLUMN_HEADER}. The styling for rendering full column
* selection is configured against the label
* {@link SelectionStyleLabels#COLUMN_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 configureColumnHeaderSelectionStyle(IConfigRegistry configRegistry) {
IStyle columnHeaderStyle = getColumnHeaderSelectionStyle();
if (!isStyleEmpty(columnHeaderStyle)) {
// register column header cell style in select mode
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, columnHeaderStyle, DisplayMode.SELECT, GridRegion.COLUMN_HEADER);
}
ICellPainter columnHeaderCellPainter = getColumnHeaderSelectionCellPainter();
if (columnHeaderCellPainter != null) {
// register column header cell painter in select mode
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, columnHeaderCellPainter, DisplayMode.SELECT, GridRegion.COLUMN_HEADER);
}
IStyle fullSelectionColumnHeaderStyle = getColumnHeaderFullSelectionStyle();
if (!isStyleEmpty(fullSelectionColumnHeaderStyle)) {
// register column header cell style in select mode when all cells
// in the column are selected
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, fullSelectionColumnHeaderStyle, DisplayMode.SELECT, SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE);
}
ICellPainter fullSelectionColumnHeaderCellPainter = getColumnHeaderFullSelectionCellPainter();
if (fullSelectionColumnHeaderCellPainter != null) {
// register column header cell painter in select mode when all cells
// in the column are selected
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, fullSelectionColumnHeaderCellPainter, DisplayMode.SELECT, SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE);
}
}
use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.
the class ThemeConfiguration method configureSortHeaderStyle.
/**
* This method is used to register styles for the sort header layer. It will
* register the {@link IStyle} and the {@link ICellPainter} for both sort
* states which cause adding the following labels to the configuration label
* stack of a cell:
* <ul>
* <li>DefaultSortConfiguration.SORT_DOWN_CONFIG_TYPE</li>
* <li>DefaultSortConfiguration.SORT_UP_CONFIG_TYPE</li>
* </ul>
* Typically the {@link ICellPainter} itself takes care about the sort
* state. If this needs to be handled differently, this method needs to be
* overridden.
*
* @param configRegistry
* The IConfigRegistry that is used by the NatTable instance to
* which the style configuration should be applied to.
*/
protected void configureSortHeaderStyle(IConfigRegistry configRegistry) {
IStyle sortStyle = getSortHeaderStyle();
if (!isStyleEmpty(sortStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, sortStyle, DisplayMode.NORMAL, DefaultSortConfiguration.SORT_DOWN_CONFIG_TYPE);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, sortStyle, DisplayMode.NORMAL, DefaultSortConfiguration.SORT_UP_CONFIG_TYPE);
}
ICellPainter cellPainter = getSortHeaderCellPainter();
if (cellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, DefaultSortConfiguration.SORT_DOWN_CONFIG_TYPE);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, DefaultSortConfiguration.SORT_UP_CONFIG_TYPE);
}
}
use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.
the class ThemeConfiguration method configureHoverStyle.
/**
* Register the style configurations for hovering.
* <p>
* This means to register the style configurations against
* {@link DisplayMode#HOVER}. Additionally the GridRegion labels are used to
* register hover styles per region.
* </p>
* <p>
* Note: This configuration is only working if the {@link HoverLayer} is
* part of the layer stack. Otherwise the configuration will not have any
* effect.
* </p>
*
* @param configRegistry
* The IConfigRegistry that is used by the NatTable instance to
* which the style configuration should be applied to.
*/
protected void configureHoverStyle(IConfigRegistry configRegistry) {
IStyle defaultHoverStyle = getDefaultHoverStyle();
if (!isStyleEmpty(defaultHoverStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, defaultHoverStyle, DisplayMode.HOVER);
}
ICellPainter defaultHoverCellPainter = getDefaultHoverCellPainter();
if (defaultHoverCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, defaultHoverCellPainter, DisplayMode.HOVER);
}
IStyle bodyHoverStyle = getBodyHoverStyle();
if (!isStyleEmpty(bodyHoverStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, bodyHoverStyle, DisplayMode.HOVER, GridRegion.BODY);
}
ICellPainter bodyHoverCellPainter = getBodyHoverCellPainter();
if (bodyHoverCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, bodyHoverCellPainter, DisplayMode.HOVER, GridRegion.BODY);
}
IStyle columnHeaderHoverStyle = getColumnHeaderHoverStyle();
if (!isStyleEmpty(columnHeaderHoverStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, columnHeaderHoverStyle, DisplayMode.HOVER, GridRegion.COLUMN_HEADER);
}
ICellPainter columnHeaderHoverCellPainter = getColumnHeaderHoverCellPainter();
if (columnHeaderHoverCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, columnHeaderHoverCellPainter, DisplayMode.HOVER, GridRegion.COLUMN_HEADER);
}
IStyle rowHeaderHoverStyle = getRowHeaderHoverStyle();
if (!isStyleEmpty(rowHeaderHoverStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, rowHeaderHoverStyle, DisplayMode.HOVER, GridRegion.ROW_HEADER);
}
ICellPainter rowHeaderHoverCellPainter = getRowHeaderHoverCellPainter();
if (rowHeaderHoverCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, rowHeaderHoverCellPainter, DisplayMode.HOVER, GridRegion.ROW_HEADER);
}
}
use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.
the class ThemeConfiguration method configureColumnHeaderStyle.
/**
* Register the style configurations for rendering the column header in a
* NatTable.
* <p>
* By default this means to register the style configurations against
* {@link DisplayMode#NORMAL} and config/region label
* {@link GridRegion#COLUMN_HEADER}.
* </p>
*
* @param configRegistry
* The IConfigRegistry that is used by the NatTable instance to
* which the style configuration should be applied to.
*/
protected void configureColumnHeaderStyle(IConfigRegistry configRegistry) {
IStyle columnHeaderStyle = getColumnHeaderStyle();
if (!isStyleEmpty(columnHeaderStyle)) {
// register column header cell style in normal mode
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, columnHeaderStyle, DisplayMode.NORMAL, GridRegion.COLUMN_HEADER);
}
ICellPainter columnHeaderCellPainter = getColumnHeaderCellPainter();
if (columnHeaderCellPainter != null) {
// register column header cell painter in normal mode
// will also be used in other modes if no other cell painter is
// registered explicitly
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, columnHeaderCellPainter, DisplayMode.NORMAL, GridRegion.COLUMN_HEADER);
}
}
use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.
the class ThemeConfiguration method configureCornerSelectionStyle.
/**
* Register the style configurations for rendering the selection in the
* corner of a NatTable.
* <p>
* By default this means to register the style configurations against
* {@link DisplayMode#SELECT} and config/region label
* {@link GridRegion#CORNER}.
* </p>
*
* @param configRegistry
* The IConfigRegistry that is used by the NatTable instance to
* which the style configuration should be applied to.
*/
protected void configureCornerSelectionStyle(IConfigRegistry configRegistry) {
IStyle cornerStyle = this.styleCornerLikeColumnHeader ? getColumnHeaderSelectionStyle() : getCornerSelectionStyle();
if (!isStyleEmpty(cornerStyle)) {
// register corner cell style in select mode
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cornerStyle, DisplayMode.SELECT, GridRegion.CORNER);
}
ICellPainter cornerCellPainter = this.styleCornerLikeColumnHeader ? getColumnHeaderSelectionCellPainter() : getCornerSelectionCellPainter();
if (cornerCellPainter != null) {
// register corner cell painter in select mode
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cornerCellPainter, DisplayMode.SELECT, GridRegion.CORNER);
}
}
Aggregations