use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.
the class ThemeConfiguration method configureTreeStyle.
/**
* This method is used to register style configurations for a tree
* representation. It will only be applied in case a TreeLayer is involved,
* which adds the configuration label {@link TreeLayer#TREE_COLUMN_CELL} to
* the tree column.
*
* @param configRegistry
* The IConfigRegistry that is used by the NatTable instance to
* which the style configuration should be applied to.
*/
protected void configureTreeStyle(IConfigRegistry configRegistry) {
IStyle treeStyle = getTreeStyle();
if (!isStyleEmpty(treeStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, treeStyle, DisplayMode.NORMAL, TreeLayer.TREE_COLUMN_CELL);
}
ICellPainter cellPainter = getTreeCellPainter();
if (cellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, TreeLayer.TREE_COLUMN_CELL);
}
IStyle treeSelectionStyle = getTreeSelectionStyle();
if (!isStyleEmpty(treeSelectionStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, treeSelectionStyle, DisplayMode.SELECT, TreeLayer.TREE_COLUMN_CELL);
}
ICellPainter selectionCellPainter = getTreeSelectionCellPainter();
if (selectionCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, selectionCellPainter, DisplayMode.SELECT, TreeLayer.TREE_COLUMN_CELL);
}
ICellPainter treePainter = getTreeStructurePainter();
if (treePainter != null) {
configRegistry.registerConfigAttribute(TreeConfigAttributes.TREE_STRUCTURE_PAINTER, treePainter, DisplayMode.NORMAL);
}
ICellPainter treeSelectionPainter = getTreeStructureSelectionPainter();
if (treeSelectionPainter != null) {
configRegistry.registerConfigAttribute(TreeConfigAttributes.TREE_STRUCTURE_PAINTER, treeSelectionPainter, DisplayMode.SELECT);
}
}
use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.
the class ThemeConfiguration method configureSelectionAnchorStyle.
/**
* Register the style configurations to render the selection anchor.
*
* @param configRegistry
* The IConfigRegistry that is used by the NatTable instance to
* which the style configuration should be applied to.
*/
protected void configureSelectionAnchorStyle(IConfigRegistry configRegistry) {
// Selection anchor style for normal display mode
IStyle anchorStyle = getSelectionAnchorStyle();
if (!isStyleEmpty(anchorStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, anchorStyle, DisplayMode.NORMAL, SelectionStyleLabels.SELECTION_ANCHOR_STYLE);
}
ICellPainter anchorPainter = getSelectionAnchorCellPainter();
if (anchorPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, anchorPainter, DisplayMode.NORMAL, SelectionStyleLabels.SELECTION_ANCHOR_STYLE);
}
// Selection anchor style for select display mode
IStyle selectionAnchorStyle = getSelectionAnchorSelectionStyle();
if (!isStyleEmpty(selectionAnchorStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, selectionAnchorStyle, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_STYLE);
}
ICellPainter selectionAnchorPainter = getSelectionAnchorSelectionCellPainter();
if (selectionAnchorPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, selectionAnchorPainter, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_STYLE);
}
// configure selection anchor grid line style
IStyle gridLineStyle = getSelectionAnchorGridLineStyle();
if (!isStyleEmpty(gridLineStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, gridLineStyle, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_GRID_LINE_STYLE);
}
}
use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.
the class ThemeConfiguration method configureDefaultSelectionStyle.
/**
* Register default selection style configurations. Typically these
* configurations are used be the body region and will be overridden by more
* specific configurations of the header regions or custom styling based on
* labels.
*
* @param configRegistry
* The IConfigRegistry that is used by the NatTable instance to
* which the style configuration should be applied to.
*/
protected void configureDefaultSelectionStyle(IConfigRegistry configRegistry) {
// register body cell style for every display mode
IStyle defaultSelectionStyle = getDefaultSelectionCellStyle();
if (!isStyleEmpty(defaultSelectionStyle)) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, defaultSelectionStyle, DisplayMode.SELECT);
}
// register body cell painter for every display mode
ICellPainter defaultSelectionCellPainter = getDefaultSelectionCellPainter();
if (defaultSelectionCellPainter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, defaultSelectionCellPainter, DisplayMode.SELECT);
}
}
use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter 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.painter.cell.ICellPainter 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);
}
}
Aggregations