@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", options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"})
+ @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric4", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric5", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric6", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric7", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric8", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric9", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric10", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS})
})
public class TimeMachineWidget extends AbstractRubyTemplate implements RubyRailsWidget {
public String getId() {
@WidgetCategory("History")
@WidgetProperties({
@WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
- @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
- @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {"key:^(?!new_).*"}),
+ @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetsConstants.FILTER_OUT_NEW_METRICS}),
@WidgetProperty(key = "hideEvents", type = WidgetPropertyType.BOOLEAN),
@WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "80")
})
--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar 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.
+ *
+ * Sonar 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 Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.core.widgets;
+
+import org.sonar.api.web.WidgetProperty;
+
+/**
+ * Constants shared accross multiple widgets
+ */
+interface WidgetsConstants {
+
+ /**
+ * Widget property option used to filter out all the metrics which keys start with "new_".
+ * @see WidgetProperty#options()
+ */
+ String FILTER_OUT_NEW_METRICS = "key:^(?!new_).*";
+}