use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter 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.painter.cell.ICellPainter 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.painter.cell.ICellPainter 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);
}
}
use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.
the class ThemeConfiguration method configureHoverSelectionStyle.
/**
* Register the style configurations for hovering selections.
* <p>
* This means to register the style configurations against
* {@link DisplayMode#SELECT_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 configureHoverSelectionStyle(IConfigRegistry configRegistry) {
IStyle defaultHoverStyle = getDefaultHoverSelectionStyle();
if (!isStyleEmpty(defaultHoverStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, defaultHoverStyle, DisplayMode.SELECT_HOVER);
}
ICellPainter defaultHoverCellPainter = getDefaultHoverSelectionCellPainter();
if (defaultHoverCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, defaultHoverCellPainter, DisplayMode.SELECT_HOVER);
}
IStyle bodyHoverStyle = getBodyHoverSelectionStyle();
if (!isStyleEmpty(bodyHoverStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, bodyHoverStyle, DisplayMode.SELECT_HOVER, GridRegion.BODY);
}
ICellPainter bodyHoverCellPainter = getBodyHoverSelectionCellPainter();
if (bodyHoverCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, bodyHoverCellPainter, DisplayMode.SELECT_HOVER, GridRegion.BODY);
}
IStyle columnHeaderHoverStyle = getColumnHeaderHoverSelectionStyle();
if (!isStyleEmpty(columnHeaderHoverStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, columnHeaderHoverStyle, DisplayMode.SELECT_HOVER, GridRegion.COLUMN_HEADER);
}
ICellPainter columnHeaderHoverCellPainter = getColumnHeaderHoverSelectionCellPainter();
if (columnHeaderHoverCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, columnHeaderHoverCellPainter, DisplayMode.SELECT_HOVER, GridRegion.COLUMN_HEADER);
}
IStyle rowHeaderHoverStyle = getRowHeaderHoverSelectionStyle();
if (!isStyleEmpty(rowHeaderHoverStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, rowHeaderHoverStyle, DisplayMode.SELECT_HOVER, GridRegion.ROW_HEADER);
}
ICellPainter rowHeaderHoverCellPainter = getRowHeaderHoverSelectionCellPainter();
if (rowHeaderHoverCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, rowHeaderHoverCellPainter, DisplayMode.SELECT_HOVER, GridRegion.ROW_HEADER);
}
}
use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.
the class TreeLayer method getCellPainter.
@Override
public ICellPainter getCellPainter(int columnPosition, int rowPosition, ILayerCell cell, IConfigRegistry configRegistry) {
ICellPainter cellPainter = super.getCellPainter(columnPosition, rowPosition, cell, configRegistry);
if (cell.getConfigLabels().hasLabel(TREE_COLUMN_CELL)) {
ICellPainter treeCellPainter = configRegistry.getConfigAttribute(TreeConfigAttributes.TREE_STRUCTURE_PAINTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
if (treeCellPainter != null) {
IndentedTreeImagePainter treePainter = findIndentedTreeImagePainter(treeCellPainter);
if (treePainter != null) {
treePainter.setBaseCellPainter(cellPainter);
cellPainter = treeCellPainter;
} else {
// log error
LOG.warn(// $NON-NLS-1$
"There is no IndentedTreeImagePainter found for TREE_STRUCTURE_PAINTER, " + // $NON-NLS-1$
"using local configured IndentedTreeImagePainter as fallback");
// fallback
this.indentedTreeImagePainter.setBaseCellPainter(cellPainter);
cellPainter = new BackgroundPainter(this.indentedTreeImagePainter);
}
} else {
// backwards compatibility fallback
this.indentedTreeImagePainter.setBaseCellPainter(cellPainter);
cellPainter = new BackgroundPainter(this.indentedTreeImagePainter);
}
}
return cellPainter;
}
Aggregations