Search in sources :

Example 56 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle 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 57 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle 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 58 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.

the class DefaultGroupByThemeExtension method configureGroupByHint.

/**
 * Method to configure the styling of the GroupBy hint in the GroupBy
 * header.
 * <p>
 * The GroupBy hint is usually rendered by the GroupByHeaderPainter. If you
 * registered a different {@link ICellPainter} for the GroupByHeaderLayer,
 * this might not be interpreted.
 * </p>
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 */
protected void configureGroupByHint(IConfigRegistry configRegistry) {
    String groupByHint = getGroupByHint();
    if (groupByHint != null && groupByHint.length() > 0) {
        configRegistry.registerConfigAttribute(GroupByConfigAttributes.GROUP_BY_HINT, groupByHint);
    }
    IStyle hintStyle = getGroupByHintStyle();
    if (!ThemeConfiguration.isStyleEmpty(hintStyle)) {
        configRegistry.registerConfigAttribute(GroupByConfigAttributes.GROUP_BY_HINT_STYLE, hintStyle);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle)

Example 59 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle 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 60 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle in project nebula.widgets.nattable by eclipse.

the class RichTextCellPainter method paintCell.

@Override
public void paintCell(ILayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
    IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry);
    setupGCFromConfig(gc, cellStyle);
    String htmlText = CellDisplayConversionUtils.convertDataType(cell, configRegistry);
    Rectangle painterBounds = new Rectangle(bounds.x, bounds.y - this.richTextPainter.getParagraphSpace(), bounds.width, bounds.height);
    this.richTextPainter.paintHTML(htmlText, gc, painterBounds);
    int height = this.richTextPainter.getPreferredSize().y - 2 * this.richTextPainter.getParagraphSpace();
    if (performRowResize(height, painterBounds)) {
        cell.getLayer().doCommand(new RowResizeCommand(cell.getLayer(), cell.getRowPosition(), GUIHelper.convertVerticalDpiToPixel(height) + (cell.getBounds().height - bounds.height)));
    }
    if (performColumnResize(this.richTextPainter.getPreferredSize().x, painterBounds)) {
        cell.getLayer().doCommand(new ColumnResizeCommand(cell.getLayer(), cell.getColumnPosition(), GUIHelper.convertHorizontalDpiToPixel(this.richTextPainter.getPreferredSize().x) + (cell.getBounds().width - bounds.width)));
    }
}
Also used : ColumnResizeCommand(org.eclipse.nebula.widgets.nattable.resize.command.ColumnResizeCommand) IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) Rectangle(org.eclipse.swt.graphics.Rectangle) RowResizeCommand(org.eclipse.nebula.widgets.nattable.resize.command.RowResizeCommand)

Aggregations

IStyle (org.eclipse.nebula.widgets.nattable.style.IStyle)97 BorderStyle (org.eclipse.nebula.widgets.nattable.style.BorderStyle)50 Style (org.eclipse.nebula.widgets.nattable.style.Style)49 ICellPainter (org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)24 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)8 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)7 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)6 HashMap (java.util.HashMap)5 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)5 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)5 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)5 ExtendedPersonWithAddress (org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress)5 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)5 VisualRefreshCommand (org.eclipse.nebula.widgets.nattable.command.VisualRefreshCommand)4 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)4 ExtendedReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ExtendedReflectiveColumnPropertyAccessor)4 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)4 DefaultDoubleDisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter)4 GroupByDataLayer (org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDataLayer)4 GroupByHeaderLayer (org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByHeaderLayer)4