From 3f770e492aef9eb4ce0e38d28ea13ebe712d8757 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Fri, 22 Jun 2012 18:11:12 +0200 Subject: [PATCH] SONAR-3416 Add possibility to have a title on the time machine widget --- .../core/widgets/TimeMachineWidget.java | 35 +++++++++---------- .../core/widgets/time_machine.html.erb | 6 ++++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimeMachineWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimeMachineWidget.java index 73c6dd8848b..47f2f63c562 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimeMachineWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimeMachineWidget.java @@ -26,23 +26,22 @@ import org.sonar.api.web.WidgetProperties; import org.sonar.api.web.WidgetProperty; import org.sonar.api.web.WidgetPropertyType; -@WidgetCategory({ "History" }) -@WidgetProperties( - { - @WidgetProperty(key = "numberOfColumns", type = WidgetPropertyType.INTEGER, defaultValue = "3"), - @WidgetProperty(key = "displaySparkLine", type = WidgetPropertyType.BOOLEAN), - @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc"), - @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC), - @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC), - @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC), - @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC), - @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC), - @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC), - @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC), - @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC), - @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC) - } -) +@WidgetCategory({"History"}) +@WidgetProperties({ + @WidgetProperty(key = "title", type = WidgetPropertyType.STRING), + @WidgetProperty(key = "numberOfColumns", type = WidgetPropertyType.INTEGER, defaultValue = "3"), + @WidgetProperty(key = "displaySparkLine", type = WidgetPropertyType.BOOLEAN), + @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc"), + @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC), + @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC), + @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC), + @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC), + @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC), + @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC), + @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC), + @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC), + @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC) +}) public class TimeMachineWidget extends AbstractRubyTemplate implements RubyRailsWidget { public String getId() { return "time_machine"; @@ -56,4 +55,4 @@ public class TimeMachineWidget extends AbstractRubyTemplate implements RubyRails protected String getTemplatePath() { return "/org/sonar/plugins/core/widgets/time_machine.html.erb"; } -} \ No newline at end of file +} diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb index 9a9b8ee12e4..3c00988eae9 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb @@ -71,6 +71,12 @@ display_sparkline = !sparkline_urls_by_row.empty? %> +<% if widget_properties["title"] %> +
+

<%= h(widget_properties["title"]) -%>

+
+<% end %> +
-- 2.39.5