Search in sources :

Example 31 with ICellPainter

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

the class ColumnGroupConfiguration method configureRegistry.

@Override
public void configureRegistry(IConfigRegistry configRegistry) {
    Image bgImage = this.tableModel.tableStyle.columnHeaderBgImage;
    if (ObjectUtils.isNotNull(bgImage)) {
        TextPainter txtPainter = new TextPainter(false, false);
        ICellPainter cellPainter = new BackgroundImagePainter(txtPainter, bgImage, GUIHelper.getColor(192, 192, 192));
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new ColumnGroupHeaderTextPainter(cellPainter), DisplayMode.NORMAL, GridRegion.COLUMN_GROUP_HEADER);
    } else {
        super.configureRegistry(configRegistry);
    }
}
Also used : TextPainter(org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter) ColumnGroupHeaderTextPainter(org.eclipse.nebula.widgets.nattable.group.painter.ColumnGroupHeaderTextPainter) BackgroundImagePainter(org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundImagePainter) ColumnGroupHeaderTextPainter(org.eclipse.nebula.widgets.nattable.group.painter.ColumnGroupHeaderTextPainter) Image(org.eclipse.swt.graphics.Image) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 32 with ICellPainter

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

the class DefaultGroupByThemeExtension method configureGroupBySummaryStyle.

/**
 * Registering the style configuration for the GroupBy summary.
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureGroupBySummaryStyle(IConfigRegistry configRegistry) {
    IStyle groupBySummaryStyle = getGroupBySummaryStyle();
    if (!ThemeConfiguration.isStyleEmpty(groupBySummaryStyle)) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, groupBySummaryStyle, DisplayMode.NORMAL, GroupByDataLayer.GROUP_BY_SUMMARY);
    }
    ICellPainter cellPainter = getGroupBySummaryCellPainter();
    if (cellPainter != null) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, GroupByDataLayer.GROUP_BY_SUMMARY);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 33 with ICellPainter

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

the class DefaultGroupByThemeExtension method configureGroupBySummarySelectionStyle.

/**
 * Registering the style configuration for the selected GroupBy summary.
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureGroupBySummarySelectionStyle(IConfigRegistry configRegistry) {
    IStyle groupBySummaryStyle = getGroupBySummarySelectionStyle();
    if (!ThemeConfiguration.isStyleEmpty(groupBySummaryStyle)) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, groupBySummaryStyle, DisplayMode.SELECT, GroupByDataLayer.GROUP_BY_SUMMARY);
    }
    ICellPainter cellPainter = getGroupBySummarySelectionCellPainter();
    if (cellPainter != null) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.SELECT, GroupByDataLayer.GROUP_BY_SUMMARY);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 34 with ICellPainter

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

the class DefaultGroupByThemeExtension method configureGroupByObjectSelectionStyle.

/**
 * Registering the style configuration for the selected GroupBy objects.
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureGroupByObjectSelectionStyle(IConfigRegistry configRegistry) {
    IStyle groupByObjectStyle = getGroupByObjectSelectionStyle();
    if (!ThemeConfiguration.isStyleEmpty(groupByObjectStyle)) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, groupByObjectStyle, DisplayMode.SELECT, GroupByDataLayer.GROUP_BY_OBJECT);
    }
    ICellPainter cellPainter = getGroupByObjectSelectionCellPainter();
    if (cellPainter != null) {
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.SELECT, GroupByDataLayer.GROUP_BY_OBJECT);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 35 with ICellPainter

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

the class CellPainterFactory method getContentPainter.

/**
 * Create the content painter for the given key and properties.
 *
 * @param key
 *            The content painter key.
 * @param painterProperties
 *            The painter properties for painter initialization.
 * @return The content painter to use
 */
public ICellPainter getContentPainter(String key, Map<String, Object> painterProperties) {
    ICellPainter result = null;
    String lowerKey = key.toLowerCase();
    CellPainterCreator creator = this.contentPainter.get(lowerKey);
    if (creator != null) {
        result = creator.createCellPainter(painterProperties, null);
    }
    return result;
}
Also used : 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