Search in sources :

Example 6 with BackgroundImagePainter

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

the class StyledColumnHeaderConfiguration method addSelectedModeStyling.

private void addSelectedModeStyling(IConfigRegistry configRegistry) {
    Image selectedBgImage = GUIHelper.getImageByURL("selectedColumnHeaderBg", getClass().getResource("selected_column_header_bg.png"));
    TextPainter txtPainter = new TextPainter(false, false);
    ICellPainter selectedCellPainter = new BackgroundImagePainter(txtPainter, selectedBgImage, GUIHelper.getColor(192, 192, 192));
    // If sorting is enables we still want the sort icon to be drawn.
    SortableHeaderTextPainter selectedHeaderPainter = new SortableHeaderTextPainter(selectedCellPainter, false, true);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, selectedHeaderPainter, DisplayMode.SELECT, GridRegion.COLUMN_HEADER);
}
Also used : SortableHeaderTextPainter(org.eclipse.nebula.widgets.nattable.sort.painter.SortableHeaderTextPainter) TextPainter(org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter) SortableHeaderTextPainter(org.eclipse.nebula.widgets.nattable.sort.painter.SortableHeaderTextPainter) BackgroundImagePainter(org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundImagePainter) Image(org.eclipse.swt.graphics.Image) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 7 with BackgroundImagePainter

use of org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundImagePainter 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)

Aggregations

BackgroundImagePainter (org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundImagePainter)7 ICellPainter (org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)7 TextPainter (org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter)7 Image (org.eclipse.swt.graphics.Image)7 SortableHeaderTextPainter (org.eclipse.nebula.widgets.nattable.sort.painter.SortableHeaderTextPainter)4 Style (org.eclipse.nebula.widgets.nattable.style.Style)3 HashMap (java.util.HashMap)2 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)2 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)2 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)2 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)2 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)2 DefaultBodyDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider)2 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)2 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)2 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)2 HoverLayer (org.eclipse.nebula.widgets.nattable.hover.HoverLayer)2 ColumnHeaderHoverLayerConfiguration (org.eclipse.nebula.widgets.nattable.hover.config.ColumnHeaderHoverLayerConfiguration)2 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)2 BeveledBorderDecorator (org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator)2