tmf: Bug 573249: Allow any Number for opacity or -factor in StyleManager
In StyleManager, remove the restriction that opacity and -factor
property values must be instances of Float. Allow any instance of Number
and use its float value internally.
Change-Id: Id841e83d7a215cdaa0b444ed5dbaec98677a40ba
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/179991
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/model/StyleManager.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/model/StyleManager.java
index 2365e2d..84f31a3 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/model/StyleManager.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/model/StyleManager.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2019 Ericsson
+ * Copyright (c) 2019, 2021 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
@@ -116,8 +116,8 @@
Map<String, Object> styleValues = style.getStyleValues();
if (factor == null) {
Object value = styleValues.get(property + StyleProperties.FACTOR);
- if (value instanceof Float) {
- factor = (Float) value;
+ if (value instanceof Number) {
+ factor = ((Number) value).floatValue();
}
}
Object value = styleValues.get(property);
@@ -164,8 +164,8 @@
}
if (opacity == null) {
Object value = styleValues.get(StyleProperties.OPACITY);
- if (value instanceof Float) {
- opacity = (Float) value;
+ if (value instanceof Number) {
+ opacity = ((Number) value).floatValue();
if (color != null) {
break;
}