From 484effe6bc3e2984f233c771339dda7aa7845041 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Tue, 8 Apr 2014 15:47:49 +0200 Subject: [PATCH] SONAR-5003 Filter out new_* metrics in concerned widgets --- .../org/sonar/plugins/core/widgets/HotspotMetricWidget.java | 2 +- .../java/org/sonar/plugins/core/widgets/TreemapWidget.java | 5 +++-- .../core/widgets/measures/MeasureFilterAsCloudWidget.java | 3 ++- .../core/widgets/measures/MeasureFilterTreemapWidget.java | 6 ++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMetricWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMetricWidget.java index 26f3c86820f..11986e6f558 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMetricWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HotspotMetricWidget.java @@ -27,7 +27,7 @@ import org.sonar.api.web.WidgetPropertyType; @WidgetCategory({ "Hotspots" }) @WidgetProperties({ @WidgetProperty(key = "title", type = WidgetPropertyType.STRING), - @WidgetProperty(key = "metric", type = WidgetPropertyType.METRIC, defaultValue = "ncloc"), + @WidgetProperty(key = "metric", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}), @WidgetProperty(key = "numberOfLines", type = WidgetPropertyType.INTEGER, defaultValue = "5") }) public class HotspotMetricWidget extends CoreWidget { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java index 9c0956388eb..508925942af 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java @@ -25,8 +25,9 @@ import org.sonar.api.web.WidgetProperty; import org.sonar.api.web.WidgetPropertyType; @WidgetProperties({ - @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY), - @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_DENSITY_KEY, options = "type:PERCENT,RATING,LEVEL"), + @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}), + @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_DENSITY_KEY, + options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT,RATING,LEVEL"}), @WidgetProperty(key = "heightInPercents", type = WidgetPropertyType.INTEGER, optional = true, defaultValue = "55") }) public class TreemapWidget extends CoreWidget { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java index daf8d2f6f5c..cff7bd88926 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java @@ -31,7 +31,8 @@ import static org.sonar.api.web.WidgetScope.GLOBAL; @WidgetProperties({ @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING), @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false), - @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY, options = "type:PERCENT"), + @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY, + options = { WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT" }), @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}), @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100"), @WidgetProperty(key = "reverseColor", type = WidgetPropertyType.BOOLEAN, defaultValue = "false") diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterTreemapWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterTreemapWidget.java index 1ded97471eb..29bc578b684 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterTreemapWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterTreemapWidget.java @@ -21,6 +21,7 @@ package org.sonar.plugins.core.widgets.measures; import org.sonar.api.web.*; import org.sonar.plugins.core.widgets.CoreWidget; +import org.sonar.plugins.core.widgets.WidgetConstants; import static org.sonar.api.web.WidgetScope.GLOBAL; @@ -28,8 +29,9 @@ import static org.sonar.api.web.WidgetScope.GLOBAL; @WidgetScope(GLOBAL) @WidgetProperties({ @WidgetProperty(key = MeasureFilterTreemapWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER, optional = false), - @WidgetProperty(key = MeasureFilterTreemapWidget.SIZE_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true), - @WidgetProperty(key = MeasureFilterTreemapWidget.COLOR_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true, options = "type:PERCENT,RATING,LEVEL"), + @WidgetProperty(key = MeasureFilterTreemapWidget.SIZE_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}), + @WidgetProperty(key = MeasureFilterTreemapWidget.COLOR_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true, + options = {WidgetConstants.FILTER_OUT_NEW_METRICS,"type:PERCENT,RATING,LEVEL"}), @WidgetProperty(key = MeasureFilterTreemapWidget.HEIGHT_PERCENTS_PROPERTY, type = WidgetPropertyType.INTEGER, optional = true, defaultValue = "55", description = "Height in percents of width"), @WidgetProperty(key = MeasureFilterListWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false") -- 2.39.5