diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/.settings/.api_filters b/org.eclipse.nebula.widgets.nattable.extension.e4/.settings/.api_filters new file mode 100644 index 00000000..5cbe9749 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.extension.e4/.settings/.api_filters @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.extension.e4/META-INF/MANIFEST.MF index 3c409f8f..9cf9bea1 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.e4/META-INF/MANIFEST.MF +++ b/org.eclipse.nebula.widgets.nattable.extension.e4/META-INF/MANIFEST.MF @@ -5,8 +5,8 @@ Bundle-SymbolicName: org.eclipse.nebula.widgets.nattable.extension.e4;singleton: Bundle-Version: 2.8.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-21 Require-Bundle: org.eclipse.swt;bundle-version="3.103.0", - org.eclipse.e4.ui.css.core;bundle-version="0.11.0", - org.eclipse.e4.ui.css.swt;bundle-version="0.12.0" + org.eclipse.e4.ui.css.core;bundle-version="0.14.800", + org.eclipse.e4.ui.css.swt;bundle-version="0.17.100" Import-Package: org.eclipse.e4.core.di.annotations, org.eclipse.e4.ui.workbench.modeling, org.eclipse.nebula.widgets.nattable;version="[2.0.0,3.0.0)", @@ -36,7 +36,6 @@ Import-Package: org.eclipse.e4.core.di.annotations, org.eclipse.nebula.widgets.nattable.tree.painter;version="[2.0.0,3.0.0)", org.eclipse.nebula.widgets.nattable.ui.util;version="[2.0.0,3.0.0)", org.eclipse.nebula.widgets.nattable.util;version="[2.0.0,3.0.0)", - org.slf4j;version="1.7.2", org.w3c.dom Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.nebula.widgets.nattable.extension.e4.css;version="2.8.0", diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableCSSHandler.java b/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableCSSHandler.java index e1a8e647..aee1b233 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableCSSHandler.java +++ b/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableCSSHandler.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015, 2025 CEA LIST and others. + * Copyright (c) 2015, 2026 CEA LIST and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -22,11 +22,11 @@ import org.eclipse.e4.ui.css.core.dom.CSSStylableElement; import org.eclipse.e4.ui.css.core.dom.properties.Gradient; import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler; -import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler2; import org.eclipse.e4.ui.css.core.dom.properties.converters.ICSSValueConverter; import org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties; import org.eclipse.e4.ui.css.core.engine.CSSElementContext; import org.eclipse.e4.ui.css.core.engine.CSSEngine; +import org.eclipse.e4.ui.css.core.impl.dom.CssValues.CssPrimitive; import org.eclipse.e4.ui.css.core.util.resources.IResourcesLocatorManager; import org.eclipse.e4.ui.css.swt.helpers.CSSSWTFontHelper; import org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTGradientConverterImpl; @@ -66,12 +66,11 @@ import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Image; -import org.w3c.dom.css.CSSPrimitiveValue; import org.w3c.dom.css.CSSValue; import org.w3c.dom.css.CSSValueList; @SuppressWarnings("restriction") -public class NatTableCSSHandler implements ICSSPropertyHandler, ICSSPropertyHandler2 { +public class NatTableCSSHandler implements ICSSPropertyHandler { private CSSPropertyBackgroundSWTHandler backgroundSWTHandler = new CSSPropertyBackgroundSWTHandler(); @@ -145,7 +144,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, List values = grad.getValues(); if (values.size() == 2) { Color background = (Color) engine.convert( - (CSSPrimitiveValue) values.get(0), Color.class, natTable.getDisplay()); + (CssPrimitive) values.get(0), Color.class, natTable.getDisplay()); NatTableCSSHelper.applyNatTableStyle( natTable, CellStyleAttributes.GRADIENT_BACKGROUND_COLOR, @@ -153,7 +152,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, displayMode, label); Color foreground = (Color) engine.convert( - (CSSPrimitiveValue) values.get(1), Color.class, natTable.getDisplay()); + (CssPrimitive) values.get(1), Color.class, natTable.getDisplay()); NatTableCSSHelper.applyNatTableStyle( natTable, CellStyleAttributes.GRADIENT_FOREGROUND_COLOR, @@ -239,29 +238,29 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, 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)); + CSS2FontProperties font = + NatTableCSSHelper.getFontProperties(context, CSS2FontPropertiesHelpers.CSS2FONT_KEY, natTable, displayMode, label); + CSS2FontPropertiesHelpers.updateCSSPropertyFontComposite(font, value); } 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); + CSS2FontPropertiesHelpers.updateCSSPropertyFontFamily(font, 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); + CSS2FontPropertiesHelpers.updateCSSPropertyFontSize(font, 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); + CSS2FontPropertiesHelpers.updateCSSPropertyFontStyle(font, 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); + CSS2FontPropertiesHelpers.updateCSSPropertyFontWeight(font, value); } else if (NatTableCSSConstants.IMAGE.equalsIgnoreCase(property)) { Image image = (Image) engine.convert(value, Image.class, natTable.getDisplay()); NatTableCSSHelper.applyNatTableStyle( @@ -290,18 +289,18 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, } else if (NatTableCSSConstants.BORDER_STYLE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { BorderStyle borderStyle = NatTableCSSHelper.getBorderStyle(context, displayMode); - CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value; + CssPrimitive primitiveValue = (CssPrimitive) 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)); + (int) ((CssPrimitive) value).getFloatValue(CssPrimitive.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; + CssPrimitive primitiveValue = (CssPrimitive) value; borderStyle.setBorderMode( BorderModeEnum.valueOf(primitiveValue.getStringValue().toUpperCase())); } else if (NatTableCSSConstants.PASSWORD_ECHO_CHAR.equalsIgnoreCase(property) @@ -400,7 +399,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { natTable.getConfigRegistry().registerConfigAttribute( FreezeConfigAttributes.SEPARATOR_WIDTH, - (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT), + (int) ((CssPrimitive) value).getFloatValue(CssPrimitive.CSS_PT), displayMode, label); } else if (NatTableCSSConstants.GRID_LINE_COLOR.equalsIgnoreCase(property) @@ -414,7 +413,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { natTable.getConfigRegistry().registerConfigAttribute( CellConfigAttributes.GRID_LINE_WIDTH, - (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT), + (int) ((CssPrimitive) value).getFloatValue(CssPrimitive.CSS_PT), displayMode, label); } else if (NatTableCSSConstants.RENDER_GRID_LINES.equalsIgnoreCase(property) @@ -426,14 +425,13 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, 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)); + CSS2FontProperties font = NatTableCSSHelper.getFontProperties( + context, + NatTableCSSConstants.CV_CONVERSION_ERROR_FONT_PROPERTIES, + natTable, + displayMode, + label); + CSS2FontPropertiesHelpers.updateCSSPropertyFontComposite(font, value); } else if (NatTableCSSConstants.CONVERSION_ERROR_FONT_FAMILY.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { CSS2FontProperties font = NatTableCSSHelper.getFontProperties( @@ -442,7 +440,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable, displayMode, label); - font.setFamily((CSSPrimitiveValue) value); + CSS2FontPropertiesHelpers.updateCSSPropertyFontFamily(font, value); } else if (NatTableCSSConstants.CONVERSION_ERROR_FONT_SIZE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { CSS2FontProperties font = NatTableCSSHelper.getFontProperties( @@ -451,7 +449,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable, displayMode, label); - font.setSize((CSSPrimitiveValue) value); + CSS2FontPropertiesHelpers.updateCSSPropertyFontSize(font, value); } else if (NatTableCSSConstants.CONVERSION_ERROR_FONT_STYLE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { CSS2FontProperties font = NatTableCSSHelper.getFontProperties( @@ -460,7 +458,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable, displayMode, label); - font.setStyle((CSSPrimitiveValue) value); + CSS2FontPropertiesHelpers.updateCSSPropertyFontStyle(font, value); } else if (NatTableCSSConstants.CONVERSION_ERROR_FONT_WEIGHT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { CSS2FontProperties font = NatTableCSSHelper.getFontProperties( @@ -469,7 +467,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable, displayMode, label); - font.setWeight((CSSPrimitiveValue) value); + CSS2FontPropertiesHelpers.updateCSSPropertyFontWeight(font, 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()); @@ -492,14 +490,13 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, 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)); + CSS2FontProperties font = NatTableCSSHelper.getFontProperties( + context, + NatTableCSSConstants.CV_VALIDATION_ERROR_FONT_PROPERTIES, + natTable, + displayMode, + label); + CSS2FontPropertiesHelpers.updateCSSPropertyFontComposite(font, value); } else if (NatTableCSSConstants.VALIDATION_ERROR_FONT_FAMILY.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { CSS2FontProperties font = NatTableCSSHelper.getFontProperties( @@ -508,7 +505,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable, displayMode, label); - font.setFamily((CSSPrimitiveValue) value); + CSS2FontPropertiesHelpers.updateCSSPropertyFontFamily(font, value); } else if (NatTableCSSConstants.VALIDATION_ERROR_FONT_SIZE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { CSS2FontProperties font = NatTableCSSHelper.getFontProperties( @@ -517,7 +514,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable, displayMode, label); - font.setSize((CSSPrimitiveValue) value); + CSS2FontPropertiesHelpers.updateCSSPropertyFontSize(font, value); } else if (NatTableCSSConstants.VALIDATION_ERROR_FONT_STYLE.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { CSS2FontProperties font = NatTableCSSHelper.getFontProperties( @@ -526,7 +523,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable, displayMode, label); - font.setStyle((CSSPrimitiveValue) value); + CSS2FontPropertiesHelpers.updateCSSPropertyFontStyle(font, value); } else if (NatTableCSSConstants.VALIDATION_ERROR_FONT_WEIGHT.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { CSS2FontProperties font = NatTableCSSHelper.getFontProperties( @@ -535,7 +532,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable, displayMode, label); - font.setWeight((CSSPrimitiveValue) value); + CSS2FontPropertiesHelpers.updateCSSPropertyFontWeight(font, 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()); @@ -580,13 +577,13 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { NatTableCSSHelper .getPainterProperties(context, displayMode) - .put(NatTableCSSConstants.LINE_SPACING, (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT)); + .put(NatTableCSSConstants.LINE_SPACING, (int) ((CssPrimitive) value).getFloatValue(CssPrimitive.CSS_PT)); } else if (NatTableCSSConstants.COLUMN_WIDTH.equalsIgnoreCase(property) && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { - CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value; + CssPrimitive primitiveValue = (CssPrimitive) value; short type = primitiveValue.getPrimitiveType(); switch (type) { - case CSSPrimitiveValue.CSS_IDENT: + case CssPrimitive.CSS_IDENT: if ("auto".equalsIgnoreCase(value.getCssText())) { NatTableCSSHelper .getPainterProperties(context, displayMode) @@ -596,25 +593,25 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable.doCommand(new ColumnSizeConfigurationCommand(label, null, true)); } break; - case CSSPrimitiveValue.CSS_PERCENTAGE: + case CssPrimitive.CSS_PERCENTAGE: // set column percentage sizing - int percentage = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE); + int percentage = (int) ((CssPrimitive) value).getFloatValue(CssPrimitive.CSS_PERCENTAGE); natTable.doCommand(new ColumnSizeConfigurationCommand(label, percentage, true)); break; - case CSSPrimitiveValue.CSS_PT: - case CSSPrimitiveValue.CSS_NUMBER: - case CSSPrimitiveValue.CSS_PX: + case CssPrimitive.CSS_PT: + case CssPrimitive.CSS_NUMBER: + case CssPrimitive.CSS_PX: // set column width by label - int width = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT); + int width = (int) ((CssPrimitive) value).getFloatValue(CssPrimitive.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; + CssPrimitive primitiveValue = (CssPrimitive) value; short type = primitiveValue.getPrimitiveType(); switch (type) { - case CSSPrimitiveValue.CSS_IDENT: + case CssPrimitive.CSS_IDENT: if ("auto".equalsIgnoreCase(value.getCssText())) { NatTableCSSHelper .getPainterProperties(context, displayMode) @@ -624,16 +621,16 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, natTable.doCommand(new RowSizeConfigurationCommand(label, null, true)); } break; - case CSSPrimitiveValue.CSS_PERCENTAGE: + case CssPrimitive.CSS_PERCENTAGE: // set column percentage sizing - int percentage = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE); + int percentage = (int) ((CssPrimitive) value).getFloatValue(CssPrimitive.CSS_PERCENTAGE); natTable.doCommand(new RowSizeConfigurationCommand(label, percentage, true)); break; - case CSSPrimitiveValue.CSS_PT: - case CSSPrimitiveValue.CSS_NUMBER: - case CSSPrimitiveValue.CSS_PX: + case CssPrimitive.CSS_PT: + case CssPrimitive.CSS_NUMBER: + case CssPrimitive.CSS_PX: // set column width by label - int width = (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT); + int width = (int) ((CssPrimitive) value).getFloatValue(CssPrimitive.CSS_PT); natTable.doCommand(new RowSizeConfigurationCommand(label, width, false)); break; } @@ -663,10 +660,10 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, for (int i = 0; i < length; i++) { CSSValue value2 = valueList.item(i); if (value2.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value2; + CssPrimitive primitiveValue = (CssPrimitive) value2; short type = primitiveValue.getPrimitiveType(); switch (type) { - case CSSPrimitiveValue.CSS_IDENT: + case CssPrimitive.CSS_IDENT: if (NatTableCSSHelper.isConverterString(primitiveValue.getCssText())) { converterKey = primitiveValue.getCssText(); } else if ("true".equals(primitiveValue.getCssText()) @@ -674,16 +671,16 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, format = NatTableCSSHelper.getBoolean(primitiveValue, true); } break; - case CSSPrimitiveValue.CSS_STRING: + case CssPrimitive.CSS_STRING: pattern = primitiveValue.getCssText(); break; - case CSSPrimitiveValue.CSS_PT: - case CSSPrimitiveValue.CSS_NUMBER: - case CSSPrimitiveValue.CSS_PX: + case CssPrimitive.CSS_PT: + case CssPrimitive.CSS_NUMBER: + case CssPrimitive.CSS_PX: if (minFractionDigits == null) { - minFractionDigits = (int) primitiveValue.getFloatValue(CSSPrimitiveValue.CSS_PT); + minFractionDigits = (int) primitiveValue.getFloatValue(CssPrimitive.CSS_PT); } else { - maxFractionDigits = (int) primitiveValue.getFloatValue(CSSPrimitiveValue.CSS_PT); + maxFractionDigits = (int) primitiveValue.getFloatValue(CssPrimitive.CSS_PT); } break; } @@ -783,10 +780,10 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, for (int i = 0; i < length; i++) { CSSValue value2 = valueList.item(i); if (value2.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value2; + CssPrimitive primitiveValue = (CssPrimitive) value2; short type = primitiveValue.getPrimitiveType(); switch (type) { - case CSSPrimitiveValue.CSS_IDENT: + case CssPrimitive.CSS_IDENT: if ("true".equalsIgnoreCase(value2.getCssText()) || "false".equalsIgnoreCase(value2.getCssText())) { NatTableCSSHelper @@ -801,7 +798,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, } break; - case CSSPrimitiveValue.CSS_URI: + case CssPrimitive.CSS_URI: // first try to resolve the image using NatTable // GUIHelper to support scaling Image image = null; @@ -821,10 +818,10 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, .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); + case CssPrimitive.CSS_PT: + case CssPrimitive.CSS_NUMBER: + case CssPrimitive.CSS_PX: + int spacing = (int) ((CssPrimitive) value2).getFloatValue(CssPrimitive.CSS_PT); NatTableCSSHelper .getPainterProperties(context, displayMode) .put(NatTableCSSConstants.DECORATOR_SPACING, spacing); @@ -916,7 +913,7 @@ public boolean applyCSSProperty(Object element, String property, CSSValue value, && (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)) { natTable.getConfigRegistry().registerConfigAttribute( HideIndicatorConfigAttributes.HIDE_INDICATOR_LINE_WIDTH, - (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_PT), + (int) ((CssPrimitive) value).getFloatValue(CssPrimitive.CSS_PT), displayMode, label); } @@ -1536,8 +1533,11 @@ public String retrieveCSSProperty(Object control, String property, String pseudo return null; } + /** + * @since 2.8 + */ @Override - public void onAllCSSPropertiesApplyed(Object element, CSSEngine engine, String pseudo) throws Exception { + public void onAllCSSPropertiesApplied(Object element, CSSEngine engine, String pseudo) throws Exception { Object control = null; if (element instanceof CSSStylableElement) { diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableCSSHelper.java b/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableCSSHelper.java index 5172d5a9..7b08d3dc 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableCSSHelper.java +++ b/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableCSSHelper.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015, 2020 CEA LIST and others. + * Copyright (c) 2015, 2026 CEA LIST and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -22,9 +22,11 @@ import org.eclipse.e4.ui.css.core.css2.CSS2ColorHelper; import org.eclipse.e4.ui.css.core.css2.CSS2FontHelper; +import org.eclipse.e4.ui.css.core.css2.CSS2FontPropertiesHelpers; import org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties; import org.eclipse.e4.ui.css.core.engine.CSSElementContext; import org.eclipse.e4.ui.css.core.engine.CSSEngine; +import org.eclipse.e4.ui.css.core.impl.dom.CssValues.CssPrimitive; import org.eclipse.e4.ui.css.swt.helpers.CSSSWTFontHelper; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; @@ -454,7 +456,7 @@ public static CSS2FontProperties getFontProperties( /** * Sets the values from the given {@link CSSValueList} to the given - * {@link CSS2FontProperties}CSS2FontProperties. + * {@link CSS2FontProperties}. * * @param valueList * The value list containing the css property values @@ -466,16 +468,17 @@ public static void setFontProperties(CSSValueList valueList, CSS2FontProperties for (int i = 0; i < length; i++) { CSSValue value2 = valueList.item(i); if (value2.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - String fontProperty = CSS2FontHelper.getCSSFontPropertyName((CSSPrimitiveValue) value2); + CssPrimitive cssPrimitiveValue = (CssPrimitive) value2; + String fontProperty = CSS2FontHelper.getCSSFontPropertyName(cssPrimitiveValue); if (fontProperty != null) { if (NatTableCSSConstants.FONT_FAMILY.equalsIgnoreCase(fontProperty)) { - font.setFamily((CSSPrimitiveValue) value2); + CSS2FontPropertiesHelpers.updateCSSPropertyFontFamily(font, cssPrimitiveValue); } else if (NatTableCSSConstants.FONT_SIZE.equalsIgnoreCase(fontProperty)) { - font.setSize((CSSPrimitiveValue) value2); + CSS2FontPropertiesHelpers.updateCSSPropertyFontSize(font, cssPrimitiveValue); } else if (NatTableCSSConstants.FONT_STYLE.equalsIgnoreCase(fontProperty)) { - font.setStyle((CSSPrimitiveValue) value2); + CSS2FontPropertiesHelpers.updateCSSPropertyFontStyle(font, cssPrimitiveValue); } else if (NatTableCSSConstants.FONT_WEIGHT.equalsIgnoreCase(fontProperty)) { - font.setWeight((CSSPrimitiveValue) value2); + CSS2FontPropertiesHelpers.updateCSSPropertyFontWeight(font, cssPrimitiveValue); } } } diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableElementAdapter.java b/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableElementAdapter.java index 87295d7b..637a6d34 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableElementAdapter.java +++ b/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/css/NatTableElementAdapter.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015, 2020 CEA LIST. + * Copyright (c) 2015, 2026 CEA LIST. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,29 +13,22 @@ *****************************************************************************/ package org.eclipse.nebula.widgets.nattable.extension.e4.css; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.e4.ui.css.core.engine.CSSEngine; -import org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine; import org.eclipse.e4.ui.css.swt.dom.WidgetElement; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @SuppressWarnings("restriction") public class NatTableElementAdapter extends WidgetElement { - private static final Logger LOG = LoggerFactory.getLogger(NatTableElementAdapter.class); - /** * Static flag to ensure that the update listener is only applied once to * the display. @@ -126,18 +119,7 @@ public void dispose() { for (Node node : this.virtualChildren) { if (node instanceof NatTableWrapperElementAdapter) { ((NatTableWrapperElementAdapter) node).dispose(); - - if (this.engine instanceof AbstractCSSEngine) { - try { - Method method = AbstractCSSEngine.class.getDeclaredMethod("handleWidgetDisposed", Object.class); - if (method != null) { - method.setAccessible(true); - method.invoke(this.engine, ((NatTableWrapperElementAdapter) node).natTableWrapper); - } - } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - LOG.error("Error on disposal", e); - } - } + this.engine.handleWidgetDisposed(((NatTableWrapperElementAdapter) node).natTableWrapper); } } } diff --git a/target-platform/target-platform.target b/target-platform/target-platform.target index 82f954f5..b9bf3a82 100644 --- a/target-platform/target-platform.target +++ b/target-platform/target-platform.target @@ -4,9 +4,8 @@ - - +