Bug 572888: XY model: Remove deprecated APIs in appearance model
Deprecated in patch:
https://git.eclipse.org/r/159345
Change-Id: I50d0ed593cdcc76ced7e1f7fc6e070b938f46ecc
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/179945
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/presentation/IXYPresentationProvider.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/presentation/IXYPresentationProvider.java
index 2c142b5..ead1162 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/presentation/IXYPresentationProvider.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/presentation/IXYPresentationProvider.java
@@ -25,23 +25,6 @@
public interface IXYPresentationProvider {
/**
- * Returns the {@link IYAppearance} to which the specified series name is
- * mapped. If no appearance is found, a new one will be created with given
- * parameters and added to this presentation provider
- *
- * @param seriesName
- * The name of the series
- * @param type
- * The series type
- * @param width
- * The series width
- * @return The {@link IYAppearance} instance of the Y series.
- * @deprecated As of 6.0, use {@link #getSeriesStyle(Long, String, int)} instead
- */
- @Deprecated
- IYAppearance getAppearance(String seriesName, String type, int width);
-
- /**
* Returns the {@link OutputElementStyle} to which the specified series ID is
* mapped. If no appearance is found, a new one will be created with given
* parameters and added to this presentation provider.
@@ -55,10 +38,7 @@
* @return The {@link IYAppearance} instance of the Y series.
* @since 6.0
*/
- default OutputElementStyle getSeriesStyle(Long seriesId, String type, int width) {
- IYAppearance appearance = getAppearance(String.valueOf(seriesId), type, width);
- return appearance.toOutputElementStyle();
- }
+ OutputElementStyle getSeriesStyle(Long seriesId, String type, int width);
/**
* Returns the {@link IYAppearance} to which the specified series ID is
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/presentation/XYPresentationProvider.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/presentation/XYPresentationProvider.java
index f9322cf..9995db2 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/presentation/XYPresentationProvider.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/presentation/XYPresentationProvider.java
@@ -14,11 +14,8 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.internal.tmf.core.presentation.YAppearance;
import org.eclipse.tracecompass.tmf.core.dataprovider.X11ColorUtils;
import org.eclipse.tracecompass.tmf.core.model.OutputElementStyle;
import org.eclipse.tracecompass.tmf.core.model.StyleProperties;
@@ -63,28 +60,6 @@
/* This map a series name and an IYAppearance */
private final Map<Long, OutputElementStyle> fYAppearances = new HashMap<>();
- /* Temporary map of string to ID for backward-compatibility */
- private final Map<String, Long> fStringToId = new HashMap<>();
- private final AtomicLong fIdGenerator = new AtomicLong();
-
- @Deprecated
- @Override
- public synchronized IYAppearance getAppearance(String serieName, String seriesType, int width) {
- OutputElementStyle seriesStyle = getSeriesStyle(fStringToId.computeIfAbsent(serieName, n -> fIdGenerator.getAndIncrement()), seriesType, width);
- return typeToYAppearance(seriesStyle);
- }
-
- private IYAppearance typeToYAppearance(OutputElementStyle seriesStyle) {
- Map<String, Object> styleValues = seriesStyle.getStyleValues();
- String color = (String) styleValues.get(StyleProperties.COLOR);
- int alpha = (int) ((Double) styleValues.getOrDefault(StyleProperties.OPACITY, 1.0) * 255);
- RGBAColor rgba = (color == null ? generateColor() : Objects.requireNonNull(RGBAColor.fromString(color, alpha)));
- return new YAppearance(String.valueOf(styleValues.getOrDefault(StyleProperties.STYLE_NAME, "style name")), //$NON-NLS-1$
- String.valueOf(styleValues.getOrDefault(StyleProperties.SERIES_TYPE, StyleProperties.SeriesType.LINE)),
- String.valueOf(styleValues.getOrDefault(StyleProperties.SERIES_STYLE, StyleProperties.SeriesStyle.SOLID)),
- rgba,
- (int) styleValues.getOrDefault(StyleProperties.WIDTH, 1));
- }
@Override
public @NonNull OutputElementStyle getSeriesStyle(Long seriesId, @NonNull String type, int width) {