]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3762 SONAR-3113 Add some properties
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Dec 2013 16:50:38 +0000 (17:50 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Dec 2013 16:50:38 +0000 (17:50 +0100)
15 files changed:
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CloudWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HistogramWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/PieChartWidget.java [deleted file]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/WidgetConstants.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java [new file with mode: 0644]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsHistogramWidget.java [new file with mode: 0644]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsPieChartWidget.java [new file with mode: 0644]
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/cloud.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/histogram.html.erb [deleted file]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb [new file with mode: 0644]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_histogram.html.erb [new file with mode: 0644]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_pie_chart.html.erb [new file with mode: 0644]
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/pie_chart.html.erb [deleted file]

index a296657f4de3769b705a3e01dddad1be9fc6a883..cbae32fb865442e51f9c55795363e844ca147eb8 100644 (file)
 package org.sonar.plugins.core;
 
 import com.google.common.collect.ImmutableList;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.Properties;
-import org.sonar.api.Property;
-import org.sonar.api.PropertyType;
-import org.sonar.api.SonarPlugin;
+import org.sonar.api.*;
 import org.sonar.api.checks.NoSonarFilter;
 import org.sonar.api.config.PropertyDefinition;
 import org.sonar.api.resources.Java;
@@ -37,94 +33,24 @@ import org.sonar.plugins.core.charts.DistributionAreaChart;
 import org.sonar.plugins.core.charts.DistributionBarChart;
 import org.sonar.plugins.core.charts.XradarChart;
 import org.sonar.plugins.core.colorizers.JavaColorizerFormat;
-import org.sonar.plugins.core.dashboards.GlobalDefaultDashboard;
-import org.sonar.plugins.core.dashboards.ProjectDefaultDashboard;
-import org.sonar.plugins.core.dashboards.ProjectHotspotDashboard;
-import org.sonar.plugins.core.dashboards.ProjectIssuesDashboard;
-import org.sonar.plugins.core.dashboards.ProjectTimeMachineDashboard;
-import org.sonar.plugins.core.issue.CountFalsePositivesDecorator;
-import org.sonar.plugins.core.issue.CountUnresolvedIssuesDecorator;
-import org.sonar.plugins.core.issue.InitialOpenIssuesSensor;
-import org.sonar.plugins.core.issue.InitialOpenIssuesStack;
-import org.sonar.plugins.core.issue.IssueHandlers;
-import org.sonar.plugins.core.issue.IssueTracking;
-import org.sonar.plugins.core.issue.IssueTrackingDecorator;
-import org.sonar.plugins.core.issue.IssuesDensityDecorator;
-import org.sonar.plugins.core.issue.WeightedIssuesDecorator;
+import org.sonar.plugins.core.dashboards.*;
+import org.sonar.plugins.core.issue.*;
 import org.sonar.plugins.core.issue.ignore.IgnoreIssuesPlugin;
-import org.sonar.plugins.core.issue.notification.ChangesOnMyIssueNotificationDispatcher;
-import org.sonar.plugins.core.issue.notification.IssueChangesEmailTemplate;
-import org.sonar.plugins.core.issue.notification.NewFalsePositiveNotificationDispatcher;
-import org.sonar.plugins.core.issue.notification.NewIssuesEmailTemplate;
-import org.sonar.plugins.core.issue.notification.NewIssuesNotificationDispatcher;
-import org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob;
+import org.sonar.plugins.core.issue.notification.*;
 import org.sonar.plugins.core.measurefilters.MyFavouritesFilter;
 import org.sonar.plugins.core.measurefilters.ProjectFilter;
 import org.sonar.plugins.core.notifications.alerts.NewAlerts;
 import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
-import org.sonar.plugins.core.sensors.BranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.CheckAlertThresholds;
-import org.sonar.plugins.core.sensors.CommentDensityDecorator;
-import org.sonar.plugins.core.sensors.CoverageDecorator;
-import org.sonar.plugins.core.sensors.CoverageMeasurementFilter;
-import org.sonar.plugins.core.sensors.DirectoriesDecorator;
-import org.sonar.plugins.core.sensors.FileHashSensor;
-import org.sonar.plugins.core.sensors.FilesDecorator;
-import org.sonar.plugins.core.sensors.GenerateAlertEvents;
-import org.sonar.plugins.core.sensors.ItBranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.ItCoverageDecorator;
-import org.sonar.plugins.core.sensors.ItLineCoverageDecorator;
-import org.sonar.plugins.core.sensors.LineCoverageDecorator;
-import org.sonar.plugins.core.sensors.ManualMeasureDecorator;
-import org.sonar.plugins.core.sensors.OverallBranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.OverallCoverageDecorator;
-import org.sonar.plugins.core.sensors.OverallLineCoverageDecorator;
-import org.sonar.plugins.core.sensors.ProfileEventsSensor;
-import org.sonar.plugins.core.sensors.ProfileSensor;
-import org.sonar.plugins.core.sensors.ProjectLinksSensor;
-import org.sonar.plugins.core.sensors.UnitTestDecorator;
-import org.sonar.plugins.core.sensors.VersionEventsSensor;
+import org.sonar.plugins.core.sensors.*;
 import org.sonar.plugins.core.technicaldebt.NewTechnicalDebtDecorator;
 import org.sonar.plugins.core.technicaldebt.TechnicalDebtDecorator;
-import org.sonar.plugins.core.timemachine.NewCoverageAggregator;
-import org.sonar.plugins.core.timemachine.NewCoverageFileAnalyzer;
-import org.sonar.plugins.core.timemachine.NewItCoverageFileAnalyzer;
-import org.sonar.plugins.core.timemachine.NewOverallCoverageFileAnalyzer;
-import org.sonar.plugins.core.timemachine.TendencyDecorator;
-import org.sonar.plugins.core.timemachine.TimeMachineConfigurationPersister;
-import org.sonar.plugins.core.timemachine.VariationDecorator;
+import org.sonar.plugins.core.timemachine.*;
 import org.sonar.plugins.core.web.TestsViewer;
-import org.sonar.plugins.core.widgets.AlertsWidget;
-import org.sonar.plugins.core.widgets.BubbleChartWidget;
-import org.sonar.plugins.core.widgets.CloudWidget;
-import org.sonar.plugins.core.widgets.ComplexityWidget;
-import org.sonar.plugins.core.widgets.CoverageWidget;
-import org.sonar.plugins.core.widgets.CustomMeasuresWidget;
-import org.sonar.plugins.core.widgets.DescriptionWidget;
-import org.sonar.plugins.core.widgets.DocumentationCommentsWidget;
-import org.sonar.plugins.core.widgets.DuplicationsWidget;
-import org.sonar.plugins.core.widgets.EventsWidget;
-import org.sonar.plugins.core.widgets.HistogramWidget;
-import org.sonar.plugins.core.widgets.HotspotMetricWidget;
-import org.sonar.plugins.core.widgets.HotspotMostViolatedResourcesWidget;
-import org.sonar.plugins.core.widgets.HotspotMostViolatedRulesWidget;
-import org.sonar.plugins.core.widgets.ItCoverageWidget;
-import org.sonar.plugins.core.widgets.MeasureFilterListWidget;
-import org.sonar.plugins.core.widgets.MeasureFilterTreemapWidget;
-import org.sonar.plugins.core.widgets.PieChartWidget;
-import org.sonar.plugins.core.widgets.SizeWidget;
-import org.sonar.plugins.core.widgets.TechnicalDebtPyramidWidget;
-import org.sonar.plugins.core.widgets.TimeMachineWidget;
-import org.sonar.plugins.core.widgets.TimelineWidget;
-import org.sonar.plugins.core.widgets.TreemapWidget;
-import org.sonar.plugins.core.widgets.WelcomeWidget;
-import org.sonar.plugins.core.widgets.issues.ActionPlansWidget;
-import org.sonar.plugins.core.widgets.issues.FalsePositiveIssuesWidget;
-import org.sonar.plugins.core.widgets.issues.IssueFilterWidget;
-import org.sonar.plugins.core.widgets.issues.IssuesWidget;
-import org.sonar.plugins.core.widgets.issues.MyUnresolvedIssuesWidget;
-import org.sonar.plugins.core.widgets.issues.UnresolvedIssuesPerAssigneeWidget;
-import org.sonar.plugins.core.widgets.issues.UnresolvedIssuesStatusesWidget;
+import org.sonar.plugins.core.widgets.*;
+import org.sonar.plugins.core.widgets.issues.*;
+import org.sonar.plugins.core.widgets.measures.MeasureFilterAsCloudWidget;
+import org.sonar.plugins.core.widgets.measures.MeasureFilterAsHistogramWidget;
+import org.sonar.plugins.core.widgets.measures.MeasureFilterAsPieChartWidget;
 
 import java.util.Arrays;
 import java.util.List;
@@ -324,9 +250,9 @@ public final class CorePlugin extends SonarPlugin {
       DocumentationCommentsWidget.class,
       DuplicationsWidget.class,
       TechnicalDebtPyramidWidget.class,
-      PieChartWidget.class,
-      CloudWidget.class,
-      HistogramWidget.class,
+      MeasureFilterAsPieChartWidget.class,
+      MeasureFilterAsCloudWidget.class,
+      MeasureFilterAsHistogramWidget.class,
 
       // dashboards
       ProjectDefaultDashboard.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CloudWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CloudWidget.java
deleted file mode 100644 (file)
index ed94fe6..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.plugins.core.widgets;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.*;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory("Global")
-@WidgetScope(GLOBAL)
-@WidgetProperties({
-  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
-  @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
-  @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
-  @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "50")
-})
-public class CloudWidget extends CoreWidget {
-
-  public CloudWidget() {
-    super("cloud", "Cloud", "/org/sonar/plugins/core/widgets/cloud.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HistogramWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/HistogramWidget.java
deleted file mode 100644 (file)
index 86d2378..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.plugins.core.widgets;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.*;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory("Global")
-@WidgetScope(GLOBAL)
-@WidgetProperties({
-  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
-  @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
-  @WidgetProperty(key = "metric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "40")
-})
-public class HistogramWidget extends CoreWidget {
-
-  public HistogramWidget() {
-    super("histogram", "Histogram", "/org/sonar/plugins/core/widgets/histogram.html.erb");
-  }
-
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/PieChartWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/PieChartWidget.java
deleted file mode 100644 (file)
index 012ea7b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.plugins.core.widgets;
-
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.web.*;
-
-import static org.sonar.api.web.WidgetScope.GLOBAL;
-
-@WidgetCategory("Global")
-@WidgetScope(GLOBAL)
-@WidgetProperties({
-  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
-  @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
-  @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
-  @WidgetProperty(key = "mainMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "extraMetric1", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
-  @WidgetProperty(key = "extraMetric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS})
-})
-public class PieChartWidget extends CoreWidget {
-
-  public PieChartWidget() {
-    super("pie_chart", "Pie Chart", "/org/sonar/plugins/core/widgets/pie_chart.html.erb");
-  }
-
-}
index 0841208ae315695b09720bd8c2695e61d719bf0b..e3f016aa92115921f9c2d41d711e7e1049d175ac 100644 (file)
@@ -22,7 +22,7 @@ package org.sonar.plugins.core.widgets;
 /**
  * Constants shared accross multiple widgets
  */
-interface WidgetConstants {
+public interface WidgetConstants {
 
   /**
    * Widget property option used to filter out all the metrics which keys start with "new_".
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
new file mode 100644 (file)
index 0000000..e36e568
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.plugins.core.widgets.measures;
+
+import org.sonar.api.measures.CoreMetrics;
+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;
+
+@WidgetCategory("Global")
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
+  @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
+  @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COMPLEXITY_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "50"),
+  @WidgetProperty(key = "reverseColor", type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
+})
+public class MeasureFilterAsCloudWidget extends CoreWidget {
+
+  public MeasureFilterAsCloudWidget() {
+    super("measure_filter_cloud", "Measure Filter as Cloud", "/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb");
+  }
+
+}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsHistogramWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsHistogramWidget.java
new file mode 100644 (file)
index 0000000..d21645e
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.plugins.core.widgets.measures;
+
+import org.sonar.api.measures.CoreMetrics;
+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;
+
+@WidgetCategory("Global")
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
+  @WidgetProperty(key = "metric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "40"),
+  @WidgetProperty(key = "reverseOrder", type = WidgetPropertyType.BOOLEAN, defaultValue = "false"),
+  @WidgetProperty(key = "displayWorstBestValues", type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
+})
+public class MeasureFilterAsHistogramWidget extends CoreWidget {
+
+  public MeasureFilterAsHistogramWidget() {
+    super("measure_filter_histogram", "Measure Filter as Histogram", "/org/sonar/plugins/core/widgets/measures/measure_filter_histogram.html.erb");
+  }
+
+}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsPieChartWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsPieChartWidget.java
new file mode 100644 (file)
index 0000000..a95222c
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.plugins.core.widgets.measures;
+
+import org.sonar.api.measures.CoreMetrics;
+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;
+
+@WidgetCategory("Global")
+@WidgetScope(GLOBAL)
+@WidgetProperties({
+  @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+  @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "300"),
+  @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, optional = false),
+  @WidgetProperty(key = "mainMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.TECHNICAL_DEBT_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "extraMetric1", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+  @WidgetProperty(key = "extraMetric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS})
+})
+public class MeasureFilterAsPieChartWidget extends CoreWidget {
+
+  public MeasureFilterAsPieChartWidget() {
+    super("measure_filter_pie_chart", "Measure Filter as Pie Chart", "/org/sonar/plugins/core/widgets/measures/measure_filter_pie_chart.html.erb");
+  }
+
+}
index 9db2dcd63acfb1cd64f43ac6019462027a64fe54..343fe7467311c1c2ff4f3291bf3d114b4a39e3f8 100644 (file)
@@ -1,3 +1,4 @@
+
 #------------------------------------------------------------------------------
 #
 # GENERIC WORDS, sorted alphabetically
@@ -1105,29 +1106,29 @@ widget.bubble_chart.property.sizeMetric.name=Size Metric
 widget.bubble_chart.property.xLogarithmic.name=X Logarithmic Scale
 widget.bubble_chart.property.yLogarithmic.name=Y Logarithmic Scale
 
-widget.pie_chart.name=Measure Filter as Pie Chart
-widget.pie_chart.description=Displays the result of a pre-configured measure filter as a pie chart.
-widget.pie_chart.property.chartTitle.name=Chart Title
-widget.pie_chart.property.chartHeight.name=Chart Height
-widget.pie_chart.property.filter.name=Filter
-widget.pie_chart.property.mainMetric.name=Main Metric
-widget.pie_chart.property.extraMetric1.name=Extra Metric 1
-widget.pie_chart.property.extraMetric2.name=Extra Metric 2
-
-widget.cloud.name=Measure Filter as Word Cloud
-widget.cloud.description=Displays the result of a pre-configured measure filter as a word cloud.
-widget.cloud.property.chartTitle.name=Chart Title
-widget.cloud.property.chartHeight.name=Chart Height
-widget.cloud.property.filter.name=Filter
-widget.cloud.property.colorMetric.name=Color Metric
-widget.cloud.property.sizeMetric.name=Size Metric
-
-widget.histogram.name=Measure Filter as Histogram
-widget.histogram.description=Displays the result of a pre-configured measure filter as a histogram.
-widget.histogram.property.chartTitle.name=Chart Title
-widget.histogram.property.chartHeight.name=Chart Height
-widget.histogram.property.filter.name=Filter
-widget.histogram.property.metric.name=Metric
+widget.measure_filter_pie_chart.name=Measure Filter as Pie Chart
+widget.measure_filter_pie_chart.description=Displays the result of a pre-configured measure filter as a pie chart.
+widget.measure_filter_pie_chart.property.chartTitle.name=Chart Title
+widget.measure_filter_pie_chart.property.chartHeight.name=Chart Height
+widget.measure_filter_pie_chart.property.filter.name=Filter
+widget.measure_filter_pie_chart.property.mainMetric.name=Main Metric
+widget.measure_filter_pie_chart.property.extraMetric1.name=Extra Metric 1
+widget.measure_filter_pie_chart.property.extraMetric2.name=Extra Metric 2
+
+widget.measure_filter_cloud.name=Measure Filter as Word Cloud
+widget.measure_filter_cloud.description=Displays the result of a pre-configured measure filter as a word cloud.
+widget.measure_filter_cloud.property.chartTitle.name=Chart Title
+widget.measure_filter_cloud.property.chartHeight.name=Chart Height
+widget.measure_filter_cloud.property.filter.name=Filter
+widget.measure_filter_cloud.property.colorMetric.name=Color Metric
+widget.measure_filter_cloud.property.sizeMetric.name=Size Metric
+
+widget.measure_filter_histogram.name=Measure Filter as Histogram
+widget.measure_filter_histogram.description=Displays the result of a pre-configured measure filter as a histogram.
+widget.measure_filter_histogram.property.chartTitle.name=Chart Title
+widget.measure_filter_histogram.property.chartHeight.name=Chart Height
+widget.measure_filter_histogram.property.filter.name=Filter
+widget.measure_filter_histogram.property.metric.name=Metric
 
 widget.time_machine.name=History Table
 widget.time_machine.description=Displays up to 10 metrics in a table, showing their value for a specified number of past snapshots.
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/cloud.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/cloud.html.erb
deleted file mode 100644 (file)
index 556f1f2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<%
-containerId = 'pie-chart-widget' + widget.id.to_s
-chartTitle = widget_properties["chartTitle"]
-filterId = widget_properties["filter"].to_i
-maxItems = widget_properties["maxItems"].to_i
-%>
-
-<div class="histogram-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-  <h3 style="text-align: center;"><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    var metrics = [
-          '<%= widget_properties["colorMetric"].name -%>',
-          '<%= widget_properties["sizeMetric"].name -%>'
-        ],
-        query = [
-          'filter=<%= filterId -%>',
-          'metrics=' + metrics.join(','),
-          'fields=name,qualifier',
-          'pageSize=<%= maxItems -%>',
-          'page=1',
-          'sort=metric:' + metrics[0],
-          'asc=false'
-        ].join('&'),
-        widget = new SonarWidgets.Widget();
-
-    widget
-      .type('WordCloud')
-      .source(baseUrl + '/measures/search_filter?' + query)
-      .metricsPriority(metrics)
-      .options({
-        baseUrl: baseUrl + '/dashboard/index/'
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
-
-
-
-
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/histogram.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/histogram.html.erb
deleted file mode 100644 (file)
index 442e908..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<%
-containerId = 'pie-chart-widget' + widget.id.to_s
-chartTitle = widget_properties["chartTitle"]
-filterId = widget_properties["filter"].to_i
-maxItems = widget_properties["maxItems"].to_i
-%>
-
-<div class="histogram-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-  <h3 style="text-align: center;"><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    var metrics = [
-          '<%= widget_properties["metric"].name -%>'
-        ],
-        query = [
-          'filter=<%= filterId -%>',
-          'metrics=' + metrics.join(','),
-          'fields=name,qualifier',
-          'pageSize=<%= maxItems -%>',
-          'page=1',
-          'sort=metric:' + metrics[0],
-          'asc=false'
-        ].join('&'),
-        widget = new SonarWidgets.Widget();
-
-    widget
-      .type('Histogram')
-      .source(baseUrl + '/measures/search_filter?' + query)
-      .metricsPriority(metrics)
-      .options({
-        baseUrl: baseUrl + '/dashboard/index/'
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
-
-
-
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb
new file mode 100644 (file)
index 0000000..a933e65
--- /dev/null
@@ -0,0 +1,55 @@
+<%
+containerId = 'pie-chart-widget' + widget.id.to_s
+chartTitle = widget_properties["chartTitle"]
+filterId = widget_properties["filter"].to_i
+maxItems = widget_properties["maxItems"].to_i
+reverseColor = widget_properties["reverseColor"]
+%>
+
+<div class="histogram-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+  <h3 style="text-align: center;"><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    var metrics = [
+          '<%= widget_properties["colorMetric"].name -%>',
+          '<%= widget_properties["sizeMetric"].name -%>'
+        ],
+        query = [
+          'filter=<%= filterId -%>',
+          'metrics=' + metrics.join(','),
+          'fields=name,qualifier',
+          'pageSize=<%= maxItems -%>',
+          'page=1',
+          'sort=metric:' + metrics[0],
+          'asc=false'
+        ].join('&'),
+        widget = new SonarWidgets.Widget();
+
+    widget
+      .type('WordCloud')
+      .source(baseUrl + '/measures/search_filter?' + query)
+      .metricsPriority(metrics)
+      .options({
+        baseUrl: baseUrl + '/dashboard/index/'
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
+
+
+
+
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_histogram.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_histogram.html.erb
new file mode 100644 (file)
index 0000000..b565001
--- /dev/null
@@ -0,0 +1,54 @@
+<%
+containerId = 'pie-chart-widget' + widget.id.to_s
+chartTitle = widget_properties["chartTitle"]
+filterId = widget_properties["filter"].to_i
+maxItems = widget_properties["maxItems"].to_i
+reverseOrder = widget_properties["reverseOrder"]
+displayWorstBestValues = widget_properties["displayWorstBestValues"]
+%>
+
+<div class="histogram-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+  <h3 style="text-align: center;"><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    var metrics = [
+          '<%= widget_properties["metric"].name -%>'
+        ],
+        query = [
+          'filter=<%= filterId -%>',
+          'metrics=' + metrics.join(','),
+          'fields=name,qualifier',
+          'pageSize=<%= maxItems -%>',
+          'page=1',
+          'sort=metric:' + metrics[0],
+          'asc=false'
+        ].join('&'),
+        widget = new SonarWidgets.Widget();
+
+    widget
+      .type('Histogram')
+      .source(baseUrl + '/measures/search_filter?' + query)
+      .metricsPriority(metrics)
+      .options({
+        baseUrl: baseUrl + '/dashboard/index/'
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
+
+
+
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_pie_chart.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_pie_chart.html.erb
new file mode 100644 (file)
index 0000000..bcd7e13
--- /dev/null
@@ -0,0 +1,57 @@
+<%
+  containerId = 'pie-chart-widget' + widget.id.to_s
+  chartHeight = widget_properties["chartHeight"]
+  chartTitle = widget_properties["chartTitle"]
+  filterId = widget_properties["filter"].to_i
+%>
+
+<div class="pie-chart-widget" id="<%= containerId %>">
+  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
+
+  <!--[if (gte IE 9)|!(IE)]><!-->
+  <% if chartTitle %>
+  <h3 style="text-align: center;"><%= h(chartTitle) -%></h3>
+  <% end %>
+  <!--<![endif]-->
+</div>
+
+<!--[if (gte IE 9)|!(IE)]><!-->
+<script>
+  (function () {
+    var metrics = [
+          '<%= widget_properties["mainMetric"].name -%>',
+          '<%= widget_properties["extraMetric1"].name -%>'
+          <% if (widget_properties["extraMetric2"]) %>
+          , '<%= widget_properties["extraMetric2"].name -%>'
+          <% end %>
+        ],
+        query = [
+          'filter=<%= filterId -%>',
+          'metrics=' + metrics.join(','),
+          'fields=name,qualifier',
+          'pageSize=10',
+          'page=1',
+          'sort=metric:' + metrics[0],
+          'asc=false'
+        ].join('&'),
+        widget = new SonarWidgets.Widget();
+
+    widget
+      .type('PieChart')
+      .source(baseUrl + '/measures/search_filter?' + query)
+      .metricsPriority(metrics)
+      .height(<%= chartHeight %>)
+      .options({
+        baseUrl: baseUrl + '/dashboard/index/'
+      })
+      .render('#<%= containerId -%>');
+
+    autoResize(500, function() {
+      widget.update('#<%= containerId -%>');
+    });
+  })();
+</script>
+<!--<![endif]-->
+
+
+
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/pie_chart.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/pie_chart.html.erb
deleted file mode 100644 (file)
index bcd7e13..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<%
-  containerId = 'pie-chart-widget' + widget.id.to_s
-  chartHeight = widget_properties["chartHeight"]
-  chartTitle = widget_properties["chartTitle"]
-  filterId = widget_properties["filter"].to_i
-%>
-
-<div class="pie-chart-widget" id="<%= containerId %>">
-  <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]-->
-
-  <!--[if (gte IE 9)|!(IE)]><!-->
-  <% if chartTitle %>
-  <h3 style="text-align: center;"><%= h(chartTitle) -%></h3>
-  <% end %>
-  <!--<![endif]-->
-</div>
-
-<!--[if (gte IE 9)|!(IE)]><!-->
-<script>
-  (function () {
-    var metrics = [
-          '<%= widget_properties["mainMetric"].name -%>',
-          '<%= widget_properties["extraMetric1"].name -%>'
-          <% if (widget_properties["extraMetric2"]) %>
-          , '<%= widget_properties["extraMetric2"].name -%>'
-          <% end %>
-        ],
-        query = [
-          'filter=<%= filterId -%>',
-          'metrics=' + metrics.join(','),
-          'fields=name,qualifier',
-          'pageSize=10',
-          'page=1',
-          'sort=metric:' + metrics[0],
-          'asc=false'
-        ].join('&'),
-        widget = new SonarWidgets.Widget();
-
-    widget
-      .type('PieChart')
-      .source(baseUrl + '/measures/search_filter?' + query)
-      .metricsPriority(metrics)
-      .height(<%= chartHeight %>)
-      .options({
-        baseUrl: baseUrl + '/dashboard/index/'
-      })
-      .render('#<%= containerId -%>');
-
-    autoResize(500, function() {
-      widget.update('#<%= containerId -%>');
-    });
-  })();
-</script>
-<!--<![endif]-->
-
-
-