Search in sources :

Example 31 with IStyle

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

the class DefaultNatTableThemeConfiguration method getSummaryRowStyle.

@Override
protected IStyle getSummaryRowStyle() {
    IStyle cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, this.summaryRowBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, this.summaryRowFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_BACKGROUND_COLOR, this.summaryRowGradientBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_FOREGROUND_COLOR, this.summaryRowGradientFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, this.summaryRowHAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, this.summaryRowVAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, this.summaryRowFont);
    cellStyle.setAttributeValue(CellStyleAttributes.IMAGE, this.summaryRowImage);
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, this.summaryRowBorderStyle);
    cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR, this.summaryRowPWEchoChar);
    cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION, this.summaryRowTextDecoration);
    return cellStyle;
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) Style(org.eclipse.nebula.widgets.nattable.style.Style) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle)

Example 32 with IStyle

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

the class ThemeConfiguration method configureDefaultStyle.

/**
 * Register default 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 configureDefaultStyle(IConfigRegistry configRegistry) {
    IStyle defaultStyle = getDefaultCellStyle();
    if (!isStyleEmpty(defaultStyle)) {
        // register body cell style for every display mode
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, defaultStyle);
    }
    ICellPainter defaultPainter = getDefaultCellPainter();
    if (defaultPainter != null) {
        // register body cell painter for every display mode
        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, defaultPainter);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 33 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle 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);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 34 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle 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);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

Example 35 with IStyle

use of org.eclipse.nebula.widgets.nattable.style.IStyle 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);
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)

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