Search in sources :

Example 61 with Style

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

the class DefaultGroupByThemeExtension method getGroupBySummaryStyle.

/**
 * Returns the {@link IStyle} that should be used to render the GroupBy row
 * summary cells in a NatTable.
 * <p>
 * That means this {@link IStyle} is registered against
 * {@link DisplayMode#NORMAL} and the configuration label
 * {@link GroupByDataLayer#GROUP_BY_SUMMARY}.
 * </p>
 * <p>
 * If this method returns <code>null</code>, no value will be registered to
 * keep the IConfigRegistry clean. The result would be the same, as if no
 * value is found in the IConfigRegistry. In this case the rendering will
 * fallback to the default configuration.
 * </p>
 *
 * @return The {@link IStyle} that should be used to render the GroupBy
 *         summary row cells in a NatTable.
 */
protected IStyle getGroupBySummaryStyle() {
    IStyle cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, this.groupBySummaryBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, this.groupBySummaryFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_BACKGROUND_COLOR, this.groupBySummaryGradientBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.GRADIENT_FOREGROUND_COLOR, this.groupBySummaryGradientFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, this.groupBySummaryHAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, this.groupBySummaryVAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, this.groupBySummaryFont);
    cellStyle.setAttributeValue(CellStyleAttributes.IMAGE, this.groupBySummaryImage);
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, this.groupBySummaryBorderStyle);
    cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR, this.groupBySummaryPWEchoChar);
    cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION, this.groupBySummaryTextDecoration);
    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 62 with Style

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

the class CrossValidationDialogErrorHandling method configureRegistry.

@Override
public void configureRegistry(IConfigRegistry configRegistry) {
    configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE);
    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDateDisplayConverter(), DisplayMode.NORMAL, CrossValidationGridExample.DATE_LABEL);
    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDateDisplayConverter(), DisplayMode.EDIT, CrossValidationGridExample.DATE_LABEL);
    // configure the validation error style
    IStyle validationErrorStyle = new Style();
    validationErrorStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_RED);
    validationErrorStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, GUIHelper.COLOR_WHITE);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, validationErrorStyle, DisplayMode.NORMAL, CrossValidationGridExample.INVALID_LABEL);
    configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, new EventDataValidator(this.bodyDataProvider), DisplayMode.EDIT, CrossValidationGridExample.DATE_LABEL);
    configRegistry.registerConfigAttribute(EditConfigAttributes.VALIDATION_ERROR_HANDLER, new DialogErrorHandling(true), DisplayMode.EDIT, CrossValidationGridExample.DATE_LABEL);
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) DialogErrorHandling(org.eclipse.nebula.widgets.nattable.edit.config.DialogErrorHandling) IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) Style(org.eclipse.nebula.widgets.nattable.style.Style) DefaultDateDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter)

Example 63 with Style

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

the class EditableGridExample method registerSecurityDescriptionCellStyle.

private static void registerSecurityDescriptionCellStyle(IConfigRegistry configRegistry) {
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, ALIGN_CELL_CONTENTS_LEFT_CONFIG_LABEL);
}
Also used : Style(org.eclipse.nebula.widgets.nattable.style.Style)

Example 64 with Style

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

the class EditableGridExample method registerPricingCellStyle.

private static void registerPricingCellStyle(IConfigRegistry configRegistry) {
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.RIGHT);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, ALIGN_CELL_CONTENTS_RIGHT_CONFIG_LABEL);
}
Also used : Style(org.eclipse.nebula.widgets.nattable.style.Style)

Example 65 with Style

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

the class NatTableCSSHelper method applyNatTableStyle.

/**
 * Apply a style attribute value for the {@link IStyle} registered for the
 * given styleAttribute.
 *
 * @param natTable
 *            The NatTable to apply the style configuration to.
 * @param styleAttribute
 *            The {@link ConfigAttribute} that points to the {@link IStyle}
 *            that should be configured.
 * @param styleConfig
 *            The style {@link ConfigAttribute} that should be applied.
 * @param value
 *            The value to apply.
 * @param displayMode
 *            The {@link DisplayMode} for which the configuration should be
 *            applied.
 * @param configLabel
 *            The label for which the configuration should be applied.
 */
public static <T> void applyNatTableStyle(NatTable natTable, ConfigAttribute<IStyle> styleAttribute, ConfigAttribute<T> styleConfig, T value, String displayMode, String configLabel) {
    IConfigRegistry configRegistry = natTable.getConfigRegistry();
    // retrieve the style object for the given selector
    IStyle style = configRegistry.getSpecificConfigAttribute(styleAttribute, displayMode, configLabel);
    if (style == null) {
        style = new Style();
        if (configLabel != null) {
            configRegistry.registerConfigAttribute(styleAttribute, style, displayMode, configLabel);
        } else {
            configRegistry.registerConfigAttribute(styleAttribute, style, displayMode);
        }
    }
    // set the value to the style object
    style.setAttributeValue(styleConfig, value);
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) IConfigRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) Style(org.eclipse.nebula.widgets.nattable.style.Style) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle)

Aggregations

Style (org.eclipse.nebula.widgets.nattable.style.Style)115 BorderStyle (org.eclipse.nebula.widgets.nattable.style.BorderStyle)60 IStyle (org.eclipse.nebula.widgets.nattable.style.IStyle)52 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)18 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)17 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)16 HashMap (java.util.HashMap)15 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)15 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)13 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)13 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)12 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)12 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)12 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)12 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)11 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)11 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)10 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)10 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)10 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)10