From: David Gageot Date: Thu, 5 Jul 2012 07:00:27 +0000 (+0200) Subject: SONAR-3529 Display properties in same order as annotation X-Git-Tag: 3.2~244 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f5ddbab60c57c9eb0d1dac904268f0fdfbf8f8f2;p=sonarqube.git SONAR-3529 Display properties in same order as annotation --- 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 5945598ca93..81422af11cb 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,7 +21,8 @@ package org.sonar.server.ui; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; -import com.google.common.collect.LinkedHashMultimap; +import com.google.common.collect.LinkedListMultimap; +import com.google.common.collect.ListMultimap; import com.google.common.collect.Maps; import com.google.common.collect.SetMultimap; import org.apache.commons.lang.ArrayUtils; @@ -65,7 +66,7 @@ public class ViewProxy implements Comparable { private String[] defaultForMetrics = {}; private String description = ""; private Map widgetPropertiesByKey = Maps.newHashMap(); - private SetMultimap widgetPropertiesBySet = LinkedHashMultimap.create(); + private ListMultimap widgetPropertiesBySet = LinkedListMultimap.create(); private String[] widgetCategories = {}; private WidgetLayoutType widgetLayout = WidgetLayoutType.DEFAULT; private boolean isDefaultTab = false; @@ -225,8 +226,8 @@ public class ViewProxy implements Comparable { return widgetPropertiesByKey.values(); } - public SetMultimap getWidgetPropertiesBySet() { - return ImmutableSetMultimap.copyOf(widgetPropertiesBySet); + public ListMultimap getWidgetPropertiesBySet() { + return 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 b14797cfcc3..348a6ab243d 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,28 +13,22 @@ <% end %> - <% 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()) -%> -
- - + <% 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()) -%> +
+ + <% end %> <% end %>