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;
}
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);
}
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);
}
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);
}
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);
}
Aggregations