Search in sources :

Example 16 with BorderStyle

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

the class SelectionLayerPainter method applyBorderStyle.

/**
 * @deprecated Use {@link #getBorderStyle} instead.
 */
@Deprecated
protected void applyBorderStyle(GC gc, IConfigRegistry configRegistry) {
    BorderStyle borderStyle = configRegistry.getConfigAttribute(SelectionConfigAttributes.SELECTION_GRID_LINE_STYLE, DisplayMode.SELECT);
    // check for backwards compatibility style configuration
    if (borderStyle == null) {
        // Note: If there is no style configured for the
        // SelectionStyleLabels.SELECTION_ANCHOR_GRID_LINE_STYLE
        // label, the style configured for DisplayMode.SELECT will be
        // retrieved by this call.
        // Ensure that the selection style configuration does not contain a
        // border style configuration to avoid strange rendering behavior.
        // By default there is no border configuration added, so there
        // shouldn't be issues with backwards compatibility. And if there
        // are some, they can be solved easily by adding the necessary
        // border style configuration.
        IStyle cellStyle = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_GRID_LINE_STYLE);
        borderStyle = cellStyle != null ? cellStyle.getAttributeValue(CellStyleAttributes.BORDER_STYLE) : null;
    }
    // backwards compatibility
    if (borderStyle == null) {
        gc.setLineStyle(SWT.LINE_CUSTOM);
        gc.setLineDash(new int[] { 1, 1 });
        gc.setForeground(GUIHelper.COLOR_BLACK);
    } else {
        gc.setLineStyle(LineStyleEnum.toSWT(borderStyle.getLineStyle()));
        gc.setLineWidth(borderStyle.getThickness());
        gc.setForeground(borderStyle.getColor());
    }
}
Also used : IStyle(org.eclipse.nebula.widgets.nattable.style.IStyle) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle)

Example 17 with BorderStyle

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

the class ThemeConfiguration method configureFillHandleStyle.

/**
 * Register the style configurations to render the fill handle.
 *
 * @param configRegistry
 *            The IConfigRegistry that is used by the NatTable instance to
 *            which the style configuration should be applied to.
 * @since 1.5
 */
protected void configureFillHandleStyle(IConfigRegistry configRegistry) {
    Color fillHandleColor = getFillHandleColor();
    if (fillHandleColor != null) {
        configRegistry.registerConfigAttribute(FillHandleConfigAttributes.FILL_HANDLE_COLOR, fillHandleColor, DisplayMode.NORMAL);
    }
    BorderStyle fillHandleBorderStyle = getFillHandleBorderStyle();
    if (fillHandleBorderStyle != null) {
        configRegistry.registerConfigAttribute(FillHandleConfigAttributes.FILL_HANDLE_BORDER_STYLE, fillHandleBorderStyle, DisplayMode.NORMAL);
    }
    BorderStyle fillHandleRegionBorderStyle = getFillHandleRegionBorderStyle();
    if (fillHandleRegionBorderStyle != null) {
        configRegistry.registerConfigAttribute(FillHandleConfigAttributes.FILL_HANDLE_REGION_BORDER_STYLE, fillHandleRegionBorderStyle, DisplayMode.NORMAL);
    }
}
Also used : BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle) Color(org.eclipse.swt.graphics.Color)

Example 18 with BorderStyle

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

the class _001_Custom_styling_of_specific_cells method createExampleControl.

@Override
public Control createExampleControl(Composite parent) {
    List<SimplePerson> myList = new ArrayList<>();
    for (int i = 1; i <= 100; i++) {
        myList.add(new SimplePerson(i, "Joe" + i, new Date()));
    }
    String[] propertyNames = { "id", "name", "birthDate" };
    IColumnPropertyAccessor<SimplePerson> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<>(propertyNames);
    ListDataProvider<SimplePerson> listDataProvider = new ListDataProvider<>(myList, columnPropertyAccessor);
    DefaultGridLayer gridLayer = new DefaultGridLayer(listDataProvider, new DummyColumnHeaderDataProvider(listDataProvider));
    final DefaultBodyLayerStack bodyLayer = gridLayer.getBodyLayer();
    // Custom label "FOO" for cell at column, row index (1, 5)
    IConfigLabelAccumulator cellLabelAccumulator = new IConfigLabelAccumulator() {

        @Override
        public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
            int columnIndex = bodyLayer.getColumnIndexByPosition(columnPosition);
            int rowIndex = bodyLayer.getRowIndexByPosition(rowPosition);
            if (columnIndex == 1 && rowIndex == 5) {
                configLabels.addLabel(FOO_LABEL);
            }
            if (columnIndex == 1 && rowIndex == 10) {
                configLabels.addLabel(BAR_LABEL);
            }
            // add labels for surrounding borders
            if (rowIndex == 13) {
                configLabels.addLabel(CustomLineBorderDecorator.TOP_LINE_BORDER_LABEL);
                configLabels.addLabel(CustomLineBorderDecorator.BOTTOM_LINE_BORDER_LABEL);
                if (columnIndex == 0) {
                    configLabels.addLabel(CustomLineBorderDecorator.LEFT_LINE_BORDER_LABEL);
                }
                if (columnIndex == 2) {
                    configLabels.addLabel(CustomLineBorderDecorator.RIGHT_LINE_BORDER_LABEL);
                }
            }
        }
    };
    bodyLayer.setConfigLabelAccumulator(cellLabelAccumulator);
    NatTable natTable = new NatTable(parent, gridLayer, false);
    natTable.addConfiguration(new DefaultNatTableStyleConfiguration() {

        {
            // override the LineBorderDecorator here to show how to paint
            // borders on single sides of a cell
            this.cellPainter = new CustomLineBorderDecorator(new TextPainter());
            // set a border style
            this.borderStyle = new BorderStyle(2, GUIHelper.COLOR_BLUE, LineStyleEnum.DASHDOT);
        }
    });
    // Custom style for label "FOO"
    natTable.addConfiguration(new AbstractRegistryConfiguration() {

        @Override
        public void configureRegistry(IConfigRegistry configRegistry) {
            Style cellStyle = new Style();
            cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_GREEN);
            configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, FOO_LABEL);
            cellStyle = new Style();
            cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION, TextDecorationEnum.UNDERLINE_STRIKETHROUGH);
            configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, BAR_LABEL);
        }
    });
    natTable.configure();
    return natTable;
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) AbstractRegistryConfiguration(org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration) ArrayList(java.util.ArrayList) IConfigLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) Style(org.eclipse.nebula.widgets.nattable.style.Style) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle) TextPainter(org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter) Date(java.util.Date) DummyColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DummyColumnHeaderDataProvider) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) CustomLineBorderDecorator(org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CustomLineBorderDecorator) IConfigRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) DefaultBodyLayerStack(org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack) SimplePerson(org.eclipse.nebula.widgets.nattable.dataset.person.SimplePerson)

Example 19 with BorderStyle

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

the class NatTableCSSHandler method applyCSSProperty.

@Override
public boolean applyCSSProperty(Object element, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception {
    Object control = null;
    if (element instanceof CSSStylableElement) {
        CSSStylableElement elt = (CSSStylableElement) element;
        control = elt.getNativeWidget();
    }
    NatTable natTable = null;
    String label = null;
    String displayMode = NatTableCSSHelper.getDisplayMode(pseudo);
    CSSElementContext context = null;
    CSSElementContext natTableContext = null;
    if (control instanceof NatTable) {
        natTable = (NatTable) control;
    } else if (control instanceof NatTableWrapper) {
        natTable = ((NatTableWrapper) control).getNatTable();
        label = ((NatTableWrapper) control).getLabel();
        natTableContext = engine.getCSSElementContext(natTable);
    }
    if (natTable != null) {
        context = engine.getCSSElementContext(control);
        Boolean resolvePainter = NatTableCSSHelper.resolvePainter(context, natTableContext, displayMode);
        // check property
        if (NatTableCSSConstants.PAINTER_RESOLUTION.equalsIgnoreCase(property)) {
            NatTableCSSHelper.storeContextValue(context, displayMode, NatTableCSSConstants.PAINTER_RESOLUTION, NatTableCSSHelper.getBoolean(value, true));
        } else if (NatTableCSSConstants.PAINTER.equalsIgnoreCase(property)) {
            NatTableCSSHelper.storeContextValue(context, displayMode, NatTableCSSConstants.PAINTER, NatTableCSSHelper.resolvePainterRepresentation(value));
        } else if (NatTableCSSConstants.BACKGROUND_COLOR.equalsIgnoreCase(property)) {
            CSSPropertyBackgroundSWTHandler.INSTANCE.applyCSSPropertyBackgroundColor(element, value, pseudo, engine);
        } else if (NatTableCSSConstants.BACKGROUND_IMAGE.equalsIgnoreCase(property)) {
            CSSPropertyBackgroundSWTHandler.INSTANCE.applyCSSPropertyBackgroundImage(element, value, pseudo, engine);
        } else if (NatTableCSSConstants.CELL_BACKGROUND_COLOR.equalsIgnoreCase(property)) {
            if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                Color newColor = (Color) engine.convert(value, Color.class, natTable.getDisplay());
                NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.BACKGROUND_COLOR, newColor, displayMode, label);
                if (resolvePainter) {
                    NatTableCSSHelper.storeContextValue(context, displayMode, NatTableCSSConstants.CV_BACKGROUND_PAINTER, CellPainterFactory.BACKGROUND_PAINTER_KEY);
                }
            } else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
                Gradient grad = (Gradient) CSSValueSWTGradientConverterImpl.INSTANCE.convert(value, engine, natTable.getDisplay());
                if (grad != null) {
                    List<?> values = grad.getValues();
                    if (values.size() == 2) {
                        Color background = (Color) engine.convert((CSSPrimitiveValue) values.get(0), Color.class, natTable.getDisplay());
                        NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.GRADIENT_BACKGROUND_COLOR, background, displayMode, label);
                        Color foreground = (Color) engine.convert((CSSPrimitiveValue) values.get(1), Color.class, natTable.getDisplay());
                        NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.GRADIENT_FOREGROUND_COLOR, foreground, displayMode, label);
                        NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.GRADIENT_BACKGROUND_VERTICAL, grad.getVerticalGradient());
                        if (resolvePainter) {
                            NatTableCSSHelper.storeContextValue(context, displayMode, NatTableCSSConstants.CV_BACKGROUND_PAINTER, CellPainterFactory.GRADIENT_BACKGROUND_PAINTER_KEY);
                        }
                    }
                }
            }
        } else if (NatTableCSSConstants.CELL_BACKGROUND_IMAGE.equalsIgnoreCase(property)) {
            Image image = (Image) engine.convert(value, Image.class, natTable.getDisplay());
            if (image != null) {
                NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.CELL_BACKGROUND_IMAGE, image);
                if (resolvePainter) {
                    NatTableCSSHelper.storeContextValue(context, displayMode, NatTableCSSConstants.CV_BACKGROUND_PAINTER, CellPainterFactory.BACKGROUND_IMAGE_PAINTER_KEY);
                }
            }
        } else if (NatTableCSSConstants.FOREGROUND_COLOR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            Color newColor = (Color) engine.convert(value, Color.class, natTable.getDisplay());
            NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.FOREGROUND_COLOR, newColor, displayMode, label);
        } else if (NatTableCSSConstants.HORIZONTAL_ALIGNMENT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            String stringValue = value.getCssText().toLowerCase();
            HorizontalAlignmentEnum align = HorizontalAlignmentEnum.CENTER;
            if ("left".equals(stringValue) || "lead".equals(stringValue)) {
                align = HorizontalAlignmentEnum.LEFT;
            } else if ("right".equals(stringValue) || "trail".equals(stringValue)) {
                align = HorizontalAlignmentEnum.RIGHT;
            } else if ("center".equals(stringValue)) {
                align = HorizontalAlignmentEnum.CENTER;
            }
            NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.HORIZONTAL_ALIGNMENT, align, displayMode, label);
        } else if (NatTableCSSConstants.VERTICAL_ALIGNMENT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            String stringValue = value.getCssText().toLowerCase();
            VerticalAlignmentEnum align = VerticalAlignmentEnum.MIDDLE;
            if ("top".equals(stringValue) || "up".equals(stringValue)) {
                align = VerticalAlignmentEnum.TOP;
            } else if ("bottom".equals(stringValue) || "down".equals(stringValue)) {
                align = VerticalAlignmentEnum.BOTTOM;
            } else if ("middle".equals(stringValue)) {
                align = VerticalAlignmentEnum.MIDDLE;
            }
            NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.VERTICAL_ALIGNMENT, align, displayMode, label);
        } else if (NatTableCSSConstants.FONT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_VALUE_LIST)) {
            NatTableCSSHelper.setFontProperties((CSSValueList) value, NatTableCSSHelper.getFontProperties(context, CSS2FontPropertiesHelpers.CSS2FONT_KEY, natTable, displayMode, label));
        } else if (NatTableCSSConstants.FONT_FAMILY.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, CSS2FontPropertiesHelpers.CSS2FONT_KEY, natTable, displayMode, label);
            font.setFamily((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.FONT_SIZE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, CSS2FontPropertiesHelpers.CSS2FONT_KEY, natTable, displayMode, label);
            font.setSize((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.FONT_STYLE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, CSS2FontPropertiesHelpers.CSS2FONT_KEY, natTable, displayMode, label);
            font.setStyle((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.FONT_WEIGHT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, CSS2FontPropertiesHelpers.CSS2FONT_KEY, natTable, displayMode, label);
            font.setWeight((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.IMAGE.equalsIgnoreCase(property)) {
            Image image = (Image) engine.convert(value, Image.class, natTable.getDisplay());
            NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.IMAGE, image, displayMode, label);
            if (resolvePainter) {
                NatTableCSSHelper.storeContextValue(context, displayMode, NatTableCSSConstants.CV_CONTENT_PAINTER, CellPainterFactory.IMAGE_PAINTER_KEY);
            }
        } else if (NatTableCSSConstants.BORDER.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_VALUE_LIST)) {
            CSSValueList valueList = (CSSValueList) value;
            BorderStyle borderStyle = NatTableCSSHelper.getBorderStyle(context, displayMode);
            NatTableCSSHelper.storeBorderStyle(valueList, borderStyle, engine, natTable.getDisplay());
        } else if (NatTableCSSConstants.BORDER_COLOR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            BorderStyle borderStyle = NatTableCSSHelper.getBorderStyle(context, displayMode);
            borderStyle.setColor((Color) engine.convert(value, Color.class, natTable.getDisplay()));
        } else if (NatTableCSSConstants.BORDER_STYLE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            BorderStyle borderStyle = NatTableCSSHelper.getBorderStyle(context, displayMode);
            CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value;
            borderStyle.setLineStyle(LineStyleEnum.valueOf(primitiveValue.getStringValue().toUpperCase()));
        } else if (NatTableCSSConstants.BORDER_WIDTH.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            BorderStyle borderStyle = NatTableCSSHelper.getBorderStyle(context, displayMode);
            borderStyle.setThickness((int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT));
        } else if (NatTableCSSConstants.BORDER_MODE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            BorderStyle borderStyle = NatTableCSSHelper.getBorderStyle(context, displayMode);
            CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value;
            borderStyle.setBorderMode(BorderModeEnum.valueOf(primitiveValue.getStringValue().toUpperCase()));
        } else if (NatTableCSSConstants.PASSWORD_ECHO_CHAR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            String stringValue = value.getCssText();
            NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.PASSWORD_ECHO_CHAR, stringValue.charAt(0), displayMode, label);
        } else if (NatTableCSSConstants.TEXT_DECORATION.equalsIgnoreCase(property)) {
            if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                String stringValue = value.getCssText();
                if ("none".equals(stringValue)) {
                    NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.TEXT_DECORATION, null, displayMode, label);
                } else if ("underline".equals(stringValue)) {
                    NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.TEXT_DECORATION, TextDecorationEnum.UNDERLINE, displayMode, label);
                } else if ("line-through".equals(stringValue)) {
                    NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.TEXT_DECORATION, TextDecorationEnum.STRIKETHROUGH, displayMode, label);
                }
            } else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
                CSSValueList valueList = (CSSValueList) value;
                int length = valueList.getLength();
                boolean strikethrough = false;
                boolean underline = false;
                for (int i = 0; i < length; i++) {
                    CSSValue value2 = valueList.item(i);
                    if (value2.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                        String stringValue = value2.getCssText();
                        if ("none".equals(stringValue)) {
                            strikethrough = false;
                            underline = false;
                            break;
                        } else if ("underline".equals(stringValue)) {
                            underline = true;
                        } else if ("line-through".equals(stringValue)) {
                            strikethrough = true;
                        }
                    }
                }
                if (!strikethrough && !underline) {
                    NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.TEXT_DECORATION, null, displayMode, label);
                } else if (!strikethrough && underline) {
                    NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.TEXT_DECORATION, TextDecorationEnum.UNDERLINE, displayMode, label);
                } else if (strikethrough && !underline) {
                    NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.TEXT_DECORATION, TextDecorationEnum.STRIKETHROUGH, displayMode, label);
                } else if (strikethrough && underline) {
                    NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.TEXT_DECORATION, TextDecorationEnum.UNDERLINE_STRIKETHROUGH, displayMode, label);
                }
            }
        } else if (NatTableCSSConstants.FREEZE_SEPARATOR_COLOR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            natTable.getConfigRegistry().registerConfigAttribute(IFreezeConfigAttributes.SEPARATOR_COLOR, (Color) engine.convert(value, Color.class, natTable.getDisplay()), displayMode, label);
        } else if (NatTableCSSConstants.GRID_LINE_COLOR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.GRID_LINE_COLOR, (Color) engine.convert(value, Color.class, natTable.getDisplay()), displayMode, label);
        } else if (NatTableCSSConstants.GRID_LINE_WIDTH.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.GRID_LINE_WIDTH, (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT), displayMode, label);
        } else if (NatTableCSSConstants.RENDER_GRID_LINES.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.RENDER_GRID_LINES, NatTableCSSHelper.getBoolean(value, true), displayMode, label);
        } else if (NatTableCSSConstants.CONVERSION_ERROR_FONT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_VALUE_LIST)) {
            NatTableCSSHelper.setFontProperties((CSSValueList) value, NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_CONVERSION_ERROR_FONT_PROPERTIES, natTable, displayMode, label));
        } else if (NatTableCSSConstants.CONVERSION_ERROR_FONT_FAMILY.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_CONVERSION_ERROR_FONT_PROPERTIES, natTable, displayMode, label);
            font.setFamily((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.CONVERSION_ERROR_FONT_SIZE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_CONVERSION_ERROR_FONT_PROPERTIES, natTable, displayMode, label);
            font.setSize((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.CONVERSION_ERROR_FONT_STYLE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_CONVERSION_ERROR_FONT_PROPERTIES, natTable, displayMode, label);
            font.setStyle((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.CONVERSION_ERROR_FONT_WEIGHT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_CONVERSION_ERROR_FONT_PROPERTIES, natTable, displayMode, label);
            font.setWeight((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.CONVERSION_ERROR_BACKGROUND_COLOR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            Color newColor = (Color) engine.convert(value, Color.class, natTable.getDisplay());
            NatTableCSSHelper.applyNatTableStyle(natTable, EditConfigAttributes.CONVERSION_ERROR_STYLE, CellStyleAttributes.BACKGROUND_COLOR, newColor, displayMode, label);
        } else if (NatTableCSSConstants.CONVERSION_ERROR_FOREGROUND_COLOR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            Color newColor = (Color) engine.convert(value, Color.class, natTable.getDisplay());
            NatTableCSSHelper.applyNatTableStyle(natTable, EditConfigAttributes.CONVERSION_ERROR_STYLE, CellStyleAttributes.FOREGROUND_COLOR, newColor, displayMode, label);
        } else if (NatTableCSSConstants.VALIDATION_ERROR_FONT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_VALUE_LIST)) {
            NatTableCSSHelper.setFontProperties((CSSValueList) value, NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_VALIDATION_ERROR_FONT_PROPERTIES, natTable, displayMode, label));
        } else if (NatTableCSSConstants.VALIDATION_ERROR_FONT_FAMILY.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_VALIDATION_ERROR_FONT_PROPERTIES, natTable, displayMode, label);
            font.setFamily((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.VALIDATION_ERROR_FONT_SIZE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_VALIDATION_ERROR_FONT_PROPERTIES, natTable, displayMode, label);
            font.setSize((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.VALIDATION_ERROR_FONT_STYLE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_VALIDATION_ERROR_FONT_PROPERTIES, natTable, displayMode, label);
            font.setStyle((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.VALIDATION_ERROR_FONT_WEIGHT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSS2FontProperties font = NatTableCSSHelper.getFontProperties(context, NatTableCSSConstants.CV_VALIDATION_ERROR_FONT_PROPERTIES, natTable, displayMode, label);
            font.setWeight((CSSPrimitiveValue) value);
        } else if (NatTableCSSConstants.VALIDATION_ERROR_BACKGROUND_COLOR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            Color newColor = (Color) engine.convert(value, Color.class, natTable.getDisplay());
            NatTableCSSHelper.applyNatTableStyle(natTable, EditConfigAttributes.VALIDATION_ERROR_STYLE, CellStyleAttributes.BACKGROUND_COLOR, newColor, displayMode, label);
        } else if (NatTableCSSConstants.VALIDATION_ERROR_FOREGROUND_COLOR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            Color newColor = (Color) engine.convert(value, Color.class, natTable.getDisplay());
            NatTableCSSHelper.applyNatTableStyle(natTable, EditConfigAttributes.VALIDATION_ERROR_STYLE, CellStyleAttributes.FOREGROUND_COLOR, newColor, displayMode, label);
        } else if (NatTableCSSConstants.WORD_WRAP.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.WORD_WRAP, NatTableCSSHelper.getBoolean(value, false));
        } else if (NatTableCSSConstants.TEXT_WRAP.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.TEXT_WRAP, NatTableCSSHelper.getBoolean(value, false));
        } else if (NatTableCSSConstants.TEXT_TRIM.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.TEXT_TRIM, NatTableCSSHelper.getBoolean(value, true));
        } else if (NatTableCSSConstants.TEXT_DIRECTION.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.TEXT_DIRECTION, value.getCssText());
        } else if (NatTableCSSConstants.LINE_SPACING.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.LINE_SPACING, (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT));
        } else if (NatTableCSSConstants.COLUMN_WIDTH.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value;
            short type = primitiveValue.getPrimitiveType();
            switch(type) {
                case CSSPrimitiveValue.CSS_IDENT:
                    if ("auto".equalsIgnoreCase(value.getCssText())) {
                        NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.CALCULATE_CELL_WIDTH, true);
                    } else if ("percentage".equalsIgnoreCase(value.getCssText())) {
                        // set column percentage sizing
                        natTable.doCommand(new ColumnSizeConfigurationCommand(label, null, true));
                    }
                    break;
                case CSSPrimitiveValue.CSS_PERCENTAGE:
                    // set column percentage sizing
                    int percentage = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE);
                    natTable.doCommand(new ColumnSizeConfigurationCommand(label, percentage, true));
                    break;
                case CSSPrimitiveValue.CSS_PT:
                case CSSPrimitiveValue.CSS_NUMBER:
                case CSSPrimitiveValue.CSS_PX:
                    // set column width by label
                    int width = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT);
                    natTable.doCommand(new ColumnSizeConfigurationCommand(label, width, false));
                    break;
            }
        } else if (NatTableCSSConstants.ROW_HEIGHT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value;
            short type = primitiveValue.getPrimitiveType();
            switch(type) {
                case CSSPrimitiveValue.CSS_IDENT:
                    if ("auto".equalsIgnoreCase(value.getCssText())) {
                        NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.CALCULATE_CELL_HEIGHT, true);
                    } else if ("percentage".equalsIgnoreCase(value.getCssText())) {
                        // set column percentage sizing
                        natTable.doCommand(new RowSizeConfigurationCommand(label, null, true));
                    }
                    break;
                case CSSPrimitiveValue.CSS_PERCENTAGE:
                    // set column percentage sizing
                    int percentage = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE);
                    natTable.doCommand(new RowSizeConfigurationCommand(label, percentage, true));
                    break;
                case CSSPrimitiveValue.CSS_PT:
                case CSSPrimitiveValue.CSS_NUMBER:
                case CSSPrimitiveValue.CSS_PX:
                    // set column width by label
                    int width = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT);
                    natTable.doCommand(new RowSizeConfigurationCommand(label, width, false));
                    break;
            }
        } else if (NatTableCSSConstants.CONVERTER.equalsIgnoreCase(property)) {
            if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                if (NatTableCSSHelper.isConverterString(value.getCssText())) {
                    natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, NatTableCSSHelper.getDisplayConverter(value.getCssText(), true, null, null, null), displayMode, label);
                }
            } else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
                String converterKey = null;
                boolean format = true;
                Integer minFractionDigits = null;
                Integer maxFractionDigits = null;
                String pattern = null;
                CSSValueList valueList = (CSSValueList) value;
                int length = valueList.getLength();
                for (int i = 0; i < length; i++) {
                    CSSValue value2 = valueList.item(i);
                    if (value2.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                        CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value2;
                        short type = primitiveValue.getPrimitiveType();
                        switch(type) {
                            case CSSPrimitiveValue.CSS_IDENT:
                                if (NatTableCSSHelper.isConverterString(primitiveValue.getCssText())) {
                                    converterKey = primitiveValue.getCssText();
                                } else if ("true".equals(primitiveValue.getCssText()) || "false".equals(primitiveValue.getCssText())) {
                                    format = NatTableCSSHelper.getBoolean(primitiveValue, true);
                                }
                                break;
                            case CSSPrimitiveValue.CSS_STRING:
                                pattern = primitiveValue.getCssText();
                                break;
                            case CSSPrimitiveValue.CSS_PT:
                            case CSSPrimitiveValue.CSS_NUMBER:
                            case CSSPrimitiveValue.CSS_PX:
                                if (minFractionDigits == null) {
                                    minFractionDigits = (int) primitiveValue.getFloatValue(CSSPrimitiveValue.CSS_PT);
                                } else {
                                    maxFractionDigits = (int) primitiveValue.getFloatValue(CSSPrimitiveValue.CSS_PT);
                                }
                                break;
                        }
                    }
                }
                if (converterKey != null) {
                    natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, NatTableCSSHelper.getDisplayConverter(converterKey, format, minFractionDigits, maxFractionDigits, pattern), displayMode, label);
                }
            }
        } else if (NatTableCSSConstants.PADDING.equalsIgnoreCase(property)) {
            if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_TOP, value, context, displayMode);
                NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_RIGHT, value, context, displayMode);
                NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_BOTTOM, value, context, displayMode);
                NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_LEFT, value, context, displayMode);
            } else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
                CSSValueList valueList = (CSSValueList) value;
                int length = valueList.getLength();
                if (length == 4) {
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_TOP, valueList.item(0), context, displayMode);
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_RIGHT, valueList.item(1), context, displayMode);
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_BOTTOM, valueList.item(2), context, displayMode);
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_LEFT, valueList.item(3), context, displayMode);
                } else if (length == 3) {
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_TOP, valueList.item(0), context, displayMode);
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_RIGHT, valueList.item(1), context, displayMode);
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_BOTTOM, valueList.item(2), context, displayMode);
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_LEFT, valueList.item(1), context, displayMode);
                } else if (length == 2) {
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_TOP, valueList.item(0), context, displayMode);
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_RIGHT, valueList.item(1), context, displayMode);
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_BOTTOM, valueList.item(0), context, displayMode);
                    NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_LEFT, valueList.item(1), context, displayMode);
                }
            }
        } else if (NatTableCSSConstants.PADDING_TOP.equalsIgnoreCase(property)) {
            NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_TOP, value, context, displayMode);
        } else if (NatTableCSSConstants.PADDING_RIGHT.equalsIgnoreCase(property)) {
            NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_RIGHT, value, context, displayMode);
        } else if (NatTableCSSConstants.PADDING_BOTTOM.equalsIgnoreCase(property)) {
            NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_BOTTOM, value, context, displayMode);
        } else if (NatTableCSSConstants.PADDING_LEFT.equalsIgnoreCase(property)) {
            NatTableCSSHelper.storePadding(NatTableCSSConstants.PADDING_LEFT, value, context, displayMode);
        } else if (NatTableCSSConstants.TABLE_BORDER_COLOR.equals(property) && value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
            // remove any prior configured NatTableBorderOverlayPainter
            for (Iterator<IOverlayPainter> it = natTable.getOverlayPainters().iterator(); it.hasNext(); ) {
                IOverlayPainter painter = it.next();
                if (painter instanceof NatTableBorderOverlayPainter) {
                    it.remove();
                }
            }
            // add the new NatTableBorderOverlayPainter
            if ("auto".equalsIgnoreCase(value.getCssText())) {
                natTable.addOverlayPainter(new NatTableBorderOverlayPainter(true, natTable.getConfigRegistry()));
            } else {
                Color newColor = (Color) engine.convert(value, Color.class, natTable.getDisplay());
                natTable.addOverlayPainter(new NatTableBorderOverlayPainter(newColor, true));
            }
        } else if (NatTableCSSConstants.FILL_HANDLE_BORDER.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_VALUE_LIST)) {
            CSSValueList valueList = (CSSValueList) value;
            BorderStyle borderStyle = new BorderStyle();
            NatTableCSSHelper.storeBorderStyle(valueList, borderStyle, engine, natTable.getDisplay());
            natTable.getConfigRegistry().registerConfigAttribute(FillHandleConfigAttributes.FILL_HANDLE_BORDER_STYLE, borderStyle);
        } else if (NatTableCSSConstants.FILL_HANDLE_COLOR.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            natTable.getConfigRegistry().registerConfigAttribute(FillHandleConfigAttributes.FILL_HANDLE_COLOR, (Color) engine.convert(value, Color.class, natTable.getDisplay()));
        } else if (NatTableCSSConstants.FILL_REGION_BORDER.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_VALUE_LIST)) {
            CSSValueList valueList = (CSSValueList) value;
            BorderStyle borderStyle = new BorderStyle();
            NatTableCSSHelper.storeBorderStyle(valueList, borderStyle, engine, natTable.getDisplay());
            natTable.getConfigRegistry().registerConfigAttribute(FillHandleConfigAttributes.FILL_HANDLE_REGION_BORDER_STYLE, borderStyle);
        } else if (NatTableCSSConstants.DECORATION.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_VALUE_LIST)) {
            CSSValueList valueList = (CSSValueList) value;
            int length = valueList.getLength();
            for (int i = 0; i < length; i++) {
                CSSValue value2 = valueList.item(i);
                if (value2.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                    CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value2;
                    short type = primitiveValue.getPrimitiveType();
                    switch(type) {
                        case CSSPrimitiveValue.CSS_IDENT:
                            if ("true".equalsIgnoreCase(value2.getCssText()) || "false".equalsIgnoreCase(value2.getCssText())) {
                                NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.PAINT_DECORATION_DEPENDENT, NatTableCSSHelper.getBoolean(value2, true));
                            } else {
                                CellEdgeEnum edge = NatTableCSSHelper.getCellEdgeEnum(value2.getCssText());
                                NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.DECORATOR_EDGE, edge);
                            }
                            break;
                        case CSSPrimitiveValue.CSS_URI:
                            Image image = (Image) engine.convert(value2, Image.class, natTable.getDisplay());
                            if (image != null) {
                                NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.DECORATOR_IMAGE, image);
                            }
                            break;
                        case CSSPrimitiveValue.CSS_PT:
                        case CSSPrimitiveValue.CSS_NUMBER:
                        case CSSPrimitiveValue.CSS_PX:
                            int spacing = (int) ((CSSPrimitiveValue) value2).getFloatValue(CSSPrimitiveValue.CSS_PT);
                            NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.DECORATOR_SPACING, spacing);
                            break;
                    }
                }
            }
            List<String> decoratorKeys = NatTableCSSHelper.getDecoratorPainter(context, displayMode);
            if (!decoratorKeys.contains(CellPainterFactory.DECORATOR_KEY)) {
                decoratorKeys.add(CellPainterFactory.DECORATOR_KEY);
            }
        } else if (NatTableCSSConstants.INVERT_ICONS.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) {
            NatTableCSSHelper.getPainterProperties(context, displayMode).put(NatTableCSSConstants.INVERT_ICONS, NatTableCSSHelper.getBoolean(value, false));
        } else if (NatTableCSSConstants.PERCENTAGE_DECORATOR_COLORS.equalsIgnoreCase(property)) {
            if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                Color newColor = (Color) engine.convert(value, Color.class, natTable.getDisplay());
                NatTableCSSHelper.applyNatTableStyle(natTable, PercentageBarDecorator.PERCENTAGE_BAR_COMPLETE_REGION_START_COLOR, newColor, displayMode, label);
            } else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
                CSSValueList valueList = (CSSValueList) value;
                int length = valueList.getLength();
                for (int i = 0; i < length; i++) {
                    CSSValue value2 = valueList.item(i);
                    if (value2.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
                        Color newColor = (Color) engine.convert(value2, Color.class, natTable.getDisplay());
                        ConfigAttribute<Color> percentageConfig = null;
                        switch(i) {
                            case 0:
                                percentageConfig = PercentageBarDecorator.PERCENTAGE_BAR_COMPLETE_REGION_START_COLOR;
                                break;
                            case 1:
                                percentageConfig = PercentageBarDecorator.PERCENTAGE_BAR_COMPLETE_REGION_END_COLOR;
                                break;
                            case 2:
                                percentageConfig = PercentageBarDecorator.PERCENTAGE_BAR_INCOMPLETE_REGION_COLOR;
                                break;
                        }
                        if (percentageConfig != null) {
                            NatTableCSSHelper.applyNatTableStyle(natTable, percentageConfig, newColor, displayMode, label);
                        }
                    }
                }
            }
        } else if (NatTableCSSConstants.TREE_STRUCTURE_PAINTER.equalsIgnoreCase(property)) {
            List<String> painterValues = NatTableCSSHelper.resolvePainterRepresentation(value);
            Map<String, Object> painterProperties = NatTableCSSHelper.getPainterPropertiesInherited(context, natTableContext, displayMode);
            // painter
            if (CellPainterFactory.getInstance().isContentPainterKey(painterValues.get(painterValues.size() - 1))) {
                painterValues.remove(painterValues.size() - 1);
            }
            // add none to the end to ensure that the content painter is
            // resolved dynamically by the TreeLayer
            painterValues.add(CellPainterFactory.NONE);
            ICellPainter painter = CellPainterFactory.getInstance().getCellPainter(painterValues, painterProperties);
            if (painter != null) {
                natTable.getConfigRegistry().registerConfigAttribute(TreeConfigAttributes.TREE_STRUCTURE_PAINTER, painter, displayMode);
            }
        }
        return true;
    }
    return false;
}
Also used : CSS2FontProperties(org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties) Image(org.eclipse.swt.graphics.Image) CSSStylableElement(org.eclipse.e4.ui.css.core.dom.CSSStylableElement) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter) CSSValue(org.w3c.dom.css.CSSValue) CSSElementContext(org.eclipse.e4.ui.css.core.engine.CSSElementContext) Iterator(java.util.Iterator) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) CSSValueList(org.w3c.dom.css.CSSValueList) List(java.util.List) NatTableBorderOverlayPainter(org.eclipse.nebula.widgets.nattable.painter.NatTableBorderOverlayPainter) Gradient(org.eclipse.e4.ui.css.core.dom.properties.Gradient) ColumnSizeConfigurationCommand(org.eclipse.nebula.widgets.nattable.resize.command.ColumnSizeConfigurationCommand) IOverlayPainter(org.eclipse.nebula.widgets.nattable.painter.IOverlayPainter) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle) Color(org.eclipse.swt.graphics.Color) CellEdgeEnum(org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum) CSSPrimitiveValue(org.w3c.dom.css.CSSPrimitiveValue) RowSizeConfigurationCommand(org.eclipse.nebula.widgets.nattable.resize.command.RowSizeConfigurationCommand) VerticalAlignmentEnum(org.eclipse.nebula.widgets.nattable.style.VerticalAlignmentEnum) HorizontalAlignmentEnum(org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum) CSSValueList(org.w3c.dom.css.CSSValueList)

Example 20 with BorderStyle

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

the class NatTableCSSHandler method onAllCSSPropertiesApplyed.

@Override
public void onAllCSSPropertiesApplyed(Object element, CSSEngine engine, String pseudo) throws Exception {
    Object control = null;
    if (element instanceof CSSStylableElement) {
        CSSStylableElement elt = (CSSStylableElement) element;
        control = elt.getNativeWidget();
    }
    NatTable natTable = null;
    String label = null;
    CSSElementContext context = null;
    CSSElementContext natTableContext = null;
    if (control instanceof NatTable) {
        natTable = (NatTable) control;
    } else if (control instanceof NatTableWrapper) {
        natTable = ((NatTableWrapper) control).getNatTable();
        label = ((NatTableWrapper) control).getLabel();
        natTableContext = engine.getCSSElementContext(natTable);
    }
    if (natTable != null) {
        context = engine.getCSSElementContext(control);
        String displayMode = NatTableCSSHelper.getDisplayMode(pseudo);
        CSS2FontProperties fontProperties = (CSS2FontProperties) NatTableCSSHelper.getContextValue(context, displayMode, CSS2FontPropertiesHelpers.CSS2FONT_KEY);
        if (fontProperties != null) {
            // if there are font properties, register the font
            // check if there is a font registered in the hierarchy
            Font font = NatTableCSSHelper.getNatTableStyle(natTable, CellStyleAttributes.FONT, displayMode, label);
            if (font == null) {
                // if there are no font properties already and no font, use
                // the default font
                font = GUIHelper.DEFAULT_FONT;
            }
            FontData fontData = CSSSWTFontHelper.getFontData(fontProperties, CSSSWTFontHelper.getFirstFontData(font));
            NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.FONT, GUIHelper.getFont(fontData), displayMode, label);
        }
        BorderStyle borderStyle = (BorderStyle) NatTableCSSHelper.getContextValue(context, displayMode, NatTableCSSConstants.CV_BORDER_CONFIGURATION);
        if (borderStyle != null) {
            NatTableCSSHelper.applyNatTableStyle(natTable, CellStyleAttributes.BORDER_STYLE, borderStyle, displayMode, label);
        }
        CSS2FontProperties conversionErrorFontProperties = (CSS2FontProperties) NatTableCSSHelper.getContextValue(context, displayMode, NatTableCSSConstants.CV_CONVERSION_ERROR_FONT_PROPERTIES);
        if (conversionErrorFontProperties != null) {
            // if there are font properties, register the font
            FontData fontData = CSSSWTFontHelper.getFontData(conversionErrorFontProperties, CSSSWTFontHelper.getFirstFontData(GUIHelper.DEFAULT_FONT));
            NatTableCSSHelper.applyNatTableStyle(natTable, EditConfigAttributes.CONVERSION_ERROR_STYLE, CellStyleAttributes.FONT, GUIHelper.getFont(fontData), displayMode, label);
        }
        CSS2FontProperties validationErrorFontProperties = (CSS2FontProperties) NatTableCSSHelper.getContextValue(context, displayMode, NatTableCSSConstants.CV_VALIDATION_ERROR_FONT_PROPERTIES);
        if (validationErrorFontProperties != null) {
            // if there are font properties, register the font
            FontData fontData = CSSSWTFontHelper.getFontData(validationErrorFontProperties, CSSSWTFontHelper.getFirstFontData(GUIHelper.DEFAULT_FONT));
            NatTableCSSHelper.applyNatTableStyle(natTable, EditConfigAttributes.VALIDATION_ERROR_STYLE, CellStyleAttributes.FONT, GUIHelper.getFont(fontData), displayMode, label);
        }
        Object pv = NatTableCSSHelper.getContextValue(context, displayMode, NatTableCSSConstants.PAINTER);
        if (pv != null && pv instanceof List<?>) {
            @SuppressWarnings("unchecked") List<String> painterValues = (List<String>) pv;
            Map<String, Object> painterProperties = NatTableCSSHelper.getPainterPropertiesInherited(context, natTableContext, displayMode);
            ICellPainter painter = CellPainterFactory.getInstance().getCellPainter(painterValues, painterProperties);
            if (painter != null) {
                natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, painter, displayMode, label);
            }
        } else if (NatTableCSSHelper.resolvePainter(context, natTableContext, displayMode)) {
            String backgroundKey = (String) NatTableCSSHelper.getContextValueInherited(context, natTableContext, displayMode, NatTableCSSConstants.CV_BACKGROUND_PAINTER);
            List<String> decoratorKeys = NatTableCSSHelper.getDecoratorPainter(context, displayMode);
            String contentKey = (String) NatTableCSSHelper.getContextValue(context, displayMode, NatTableCSSConstants.CV_CONTENT_PAINTER);
            Map<String, Object> painterProperties = NatTableCSSHelper.getPainterPropertiesInherited(context, natTableContext, displayMode);
            if ((painterProperties.containsKey(NatTableCSSConstants.PADDING_TOP) || painterProperties.containsKey(NatTableCSSConstants.PADDING_LEFT) || painterProperties.containsKey(NatTableCSSConstants.PADDING_BOTTOM) || painterProperties.containsKey(NatTableCSSConstants.PADDING_RIGHT)) && !decoratorKeys.contains(CellPainterFactory.PADDING_DECORATOR_KEY)) {
                decoratorKeys.add(0, CellPainterFactory.PADDING_DECORATOR_KEY);
            }
            if (borderStyle != null && !decoratorKeys.contains(CellPainterFactory.LINE_BORDER_DECORATOR_KEY)) {
                decoratorKeys.add(0, CellPainterFactory.LINE_BORDER_DECORATOR_KEY);
            }
            ICellPainter painter = CellPainterFactory.getInstance().getCellPainter(backgroundKey, decoratorKeys, contentKey, painterProperties);
            if (painter != null) {
                natTable.getConfigRegistry().registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, painter, displayMode, label);
            }
        }
    }
}
Also used : CSS2FontProperties(org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties) BorderStyle(org.eclipse.nebula.widgets.nattable.style.BorderStyle) FontData(org.eclipse.swt.graphics.FontData) CSSStylableElement(org.eclipse.e4.ui.css.core.dom.CSSStylableElement) Font(org.eclipse.swt.graphics.Font) ICellPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter) CSSElementContext(org.eclipse.e4.ui.css.core.engine.CSSElementContext) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) CSSValueList(org.w3c.dom.css.CSSValueList) List(java.util.List) Map(java.util.Map)

Aggregations

BorderStyle (org.eclipse.nebula.widgets.nattable.style.BorderStyle)33 Color (org.eclipse.swt.graphics.Color)11 IStyle (org.eclipse.nebula.widgets.nattable.style.IStyle)9 Style (org.eclipse.nebula.widgets.nattable.style.Style)6 Rectangle (org.eclipse.swt.graphics.Rectangle)5 Test (org.junit.Test)5 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)4 ILayerCell (org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell)3 ICellPainter (org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter)3 HorizontalAlignmentEnum (org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum)3 VerticalAlignmentEnum (org.eclipse.nebula.widgets.nattable.style.VerticalAlignmentEnum)3 Font (org.eclipse.swt.graphics.Font)3 Point (org.eclipse.swt.graphics.Point)3 List (java.util.List)2 CSSStylableElement (org.eclipse.e4.ui.css.core.dom.CSSStylableElement)2 CSS2FontProperties (org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties)2 CSSElementContext (org.eclipse.e4.ui.css.core.engine.CSSElementContext)2 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)2 IOverlayPainter (org.eclipse.nebula.widgets.nattable.painter.IOverlayPainter)2 BorderPainter (org.eclipse.nebula.widgets.nattable.painter.cell.BorderPainter)2