Search in sources :

Example 41 with ICellPainter

use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.

the class ThemeConfiguration method configureAlternatingRowStyle.

/**
 * When creating a NatTable grid composition, using the
 * {@link DefaultGridLayerConfiguration}, the
 * {@link AlternatingRowConfigLabelAccumulator} is configured for the body
 * region to apply labels for alternating rows. It applies the following
 * labels for which this method registers styles:
 * <ul>
 * <li>{@link AlternatingRowConfigLabelAccumulator#EVEN_ROW_CONFIG_TYPE}
 * </li>
 * <li>{@link AlternatingRowConfigLabelAccumulator#EVEN_ROW_CONFIG_TYPE}
 * </li>
 * </ul>
 * If the {@link AlternatingRowConfigLabelAccumulator} is not configured,
 * this style configuration will have no effect.
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureAlternatingRowStyle(IConfigRegistry configRegistry) {
    IStyle evenStyle = getEvenRowStyle();
    if (!isStyleEmpty(evenStyle)) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, evenStyle, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.EVEN_ROW_CONFIG_TYPE);
    }
    ICellPainter evenCellPainter = getEvenRowCellPainter();
    if (evenCellPainter != null) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, evenCellPainter, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.EVEN_ROW_CONFIG_TYPE);
    }
    IStyle oddStyle = getOddRowStyle();
    if (!isStyleEmpty(oddStyle)) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, oddStyle, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE);
    }
    ICellPainter oddCellPainter = getOddRowCellPainter();
    if (oddCellPainter != null) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, oddCellPainter, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 42 with ICellPainter

use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.

the class ThemeConfiguration method configureFilterRowStyle.

/**
 * This method is used to register style configurations for the filter row.
 * It will only be applied in case the FilterRowHeaderLayer is involved,
 * which introduces a new region that is recognised by
 * {@link GridRegion#FILTER_ROW}.
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureFilterRowStyle(IConfigRegistry configRegistry) {
    IStyle filterRowStyle = getFilterRowStyle();
    if (!isStyleEmpty(filterRowStyle)) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, filterRowStyle, DisplayMode.NORMAL, GridRegion.FILTER_ROW);
    }
    ICellPainter cellPainter = getFilterRowCellPainter();
    if (cellPainter != null) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, GridRegion.FILTER_ROW);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 43 with ICellPainter

use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.

the class ThemeConfiguration method configureSummaryRowStyle.

/**
 * This method is used to register style configurations for a summary row.
 * It will only be applied in case a SummaryRowLayer is involved, which adds
 * the configuration label
 * {@link SummaryRowLayer#DEFAULT_SUMMARY_ROW_CONFIG_LABEL} to the summary
 * row.
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureSummaryRowStyle(IConfigRegistry configRegistry) {
    IStyle style = getSummaryRowStyle();
    if (!isStyleEmpty(style)) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL, SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL);
    }
    ICellPainter cellPainter = getSummaryRowCellPainter();
    if (cellPainter != null) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL);
    }
    style = getSummaryRowSelectionStyle();
    if (!isStyleEmpty(style)) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.SELECT, SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL);
    }
    cellPainter = getSummaryRowSelectionCellPainter();
    if (cellPainter != null) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.SELECT, SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 44 with ICellPainter

use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.

the class ThemeConfiguration method configureRowHeaderStyle.

/**
 * Register the style configurations for rendering the row header in a
 * NatTable.
 * <p>
 * By default this means to register the style configurations against
 * {@link DisplayMode#NORMAL} and config/region label
 * {@link GridRegion#ROW_HEADER}.
 * </p>
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureRowHeaderStyle(IConfigRegistry configRegistry) {
    IStyle rowHeaderStyle = getRowHeaderStyle();
    if (!isStyleEmpty(rowHeaderStyle)) {
        // register row header cell style in normal mode
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, rowHeaderStyle, DisplayMode.NORMAL, GridRegion.ROW_HEADER);
    }
    ICellPainter rowHeaderCellPainter = getRowHeaderCellPainter();
    if (rowHeaderCellPainter != null) {
        // register row 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, rowHeaderCellPainter, DisplayMode.NORMAL, GridRegion.ROW_HEADER);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 45 with ICellPainter

use of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter in project nebula.widgets.nattable by eclipse.

the class ThemeConfiguration method configureRowGroupHeaderStyle.

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

Aggregations

ICellPainter (org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)50 IStyle (org.eclipse.nebula.widgets.nattable.style.IStyle)24 TextPainter (org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter)11 Image (org.eclipse.swt.graphics.Image)10 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)9 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)9 ILayerCell (org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell)9 BackgroundImagePainter (org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundImagePainter)8 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)6 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)6 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)6 Rectangle (org.eclipse.swt.graphics.Rectangle)6 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)5 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)5 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)5 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)5 SortableHeaderTextPainter (org.eclipse.nebula.widgets.nattable.sort.painter.SortableHeaderTextPainter)5 HashMap (java.util.HashMap)4 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)4 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)4