From: David Gageot Date: Thu, 5 Jul 2012 07:28:21 +0000 (+0200) Subject: Revert "SONAR-3529 Display properties in same order as annotation" X-Git-Tag: 3.2~243 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7c1d779b0038531d3b51fee54142c18fc8fb5f8a;p=sonarqube.git Revert "SONAR-3529 Display properties in same order as annotation" This reverts commit f5ddbab60c57c9eb0d1dac904268f0fdfbf8f8f2. --- diff --git a/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java b/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java index 81422af11cb..5945598ca93 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java @@ -21,8 +21,7 @@ package org.sonar.server.ui; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; -import com.google.common.collect.LinkedListMultimap; -import com.google.common.collect.ListMultimap; +import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Maps; import com.google.common.collect.SetMultimap; import org.apache.commons.lang.ArrayUtils; @@ -66,7 +65,7 @@ public class ViewProxy implements Comparable { private String[] defaultForMetrics = {}; private String description = ""; private Map widgetPropertiesByKey = Maps.newHashMap(); - private ListMultimap widgetPropertiesBySet = LinkedListMultimap.create(); + private SetMultimap widgetPropertiesBySet = LinkedHashMultimap.create(); private String[] widgetCategories = {}; private WidgetLayoutType widgetLayout = WidgetLayoutType.DEFAULT; private boolean isDefaultTab = false; @@ -226,8 +225,8 @@ public class ViewProxy implements Comparable { return widgetPropertiesByKey.values(); } - public ListMultimap getWidgetPropertiesBySet() { - return widgetPropertiesBySet; + public SetMultimap getWidgetPropertiesBySet() { + return ImmutableSetMultimap.copyOf(widgetPropertiesBySet); } public WidgetProperty getWidgetProperty(String propertyKey) { diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb index 348a6ab243d..b14797cfcc3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb @@ -13,22 +13,28 @@ <% end %> - <% widget.java_definition.getWidgetPropertiesBySet().asMap().each do |set, properties| %> - <% if widget.java_definition.getWidgetPropertiesBySet().asMap().size > 1 or !set.key().empty? %> - -

<%= set.key().empty? ? 'other' : set.key() -%>

- - <% end %> - <% properties.each do |property_def| %> - - <%= property_def.key() -%><%= " *" unless property_def.optional() -%> - - <%= property_value_field(property_def, widget.property_text_value(property_def.key())) -%> -
- <%= message("widget." + widget.key + ".param." + property_def.key(), :default => property_def.description()) -%> -
- - + <% widget.java_definition.getWidgetPropertiesBySet().asMap().sort { |(s1,p1), (s2,p2)| natural_comparison(s1.key, s2.key) }.each do |set,properties| %> + <% if widget.java_definition.getWidgetPropertiesBySet().asMap().size > 1 %> + <% if set.key().empty? %> + +

other

+ + <% else %> + +

<%= set.key() -%>

+ + <% end %> + <% end %> + <% properties.sort { |w1, w2| natural_comparison(w1.key, w2.key) }.each do |property_def| %> + + <%= property_def.key() -%><%= " *" unless property_def.optional() -%> + + <%= property_value_field(property_def, widget.property_text_value(property_def.key())) -%> +
+ <%= message("widget." + widget.key + ".param." + property_def.key(), :default => property_def.description()) -%> +
+ + <% end %> <% end %>