]> source.dussan.org Git - sonarqube.git/commitdiff
Revert "SONAR-3529 Display properties in same order as annotation"
authorDavid Gageot <david@gageot.net>
Thu, 5 Jul 2012 07:28:21 +0000 (09:28 +0200)
committerDavid Gageot <david@gageot.net>
Thu, 5 Jul 2012 07:28:21 +0000 (09:28 +0200)
This reverts commit f5ddbab60c57c9eb0d1dac904268f0fdfbf8f8f2.

sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb

index 81422af11cbc080017ada0bc87ec3882f4c83999..5945598ca9351c092067a3d48201b7356b1682c1 100644 (file)
@@ -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<V extends View> implements Comparable<ViewProxy> {
   private String[] defaultForMetrics = {};
   private String description = "";
   private Map<String, WidgetProperty> widgetPropertiesByKey = Maps.newHashMap();
-  private ListMultimap<WidgetPropertySet, WidgetProperty> widgetPropertiesBySet = LinkedListMultimap.create();
+  private SetMultimap<WidgetPropertySet, WidgetProperty> widgetPropertiesBySet = LinkedHashMultimap.create();
   private String[] widgetCategories = {};
   private WidgetLayoutType widgetLayout = WidgetLayoutType.DEFAULT;
   private boolean isDefaultTab = false;
@@ -226,8 +225,8 @@ public class ViewProxy<V extends View> implements Comparable<ViewProxy> {
     return widgetPropertiesByKey.values();
   }
 
-  public ListMultimap<WidgetPropertySet, WidgetProperty> getWidgetPropertiesBySet() {
-    return widgetPropertiesBySet;
+  public SetMultimap<WidgetPropertySet, WidgetProperty> getWidgetPropertiesBySet() {
+    return ImmutableSetMultimap.copyOf(widgetPropertiesBySet);
   }
 
   public WidgetProperty getWidgetProperty(String propertyKey) {
index 348a6ab243db4f8c5a7d437eda42976b1c4687fc..b14797cfcc3979f02a81b8515a017ec103d26ece 100644 (file)
       </tr>
     <% end %>
 
-    <% widget.java_definition.getWidgetPropertiesBySet().asMap().each do |set, properties| %>
-      <% if widget.java_definition.getWidgetPropertiesBySet().asMap().size > 1 or !set.key().empty? %>
-        <tr>
-          <td celspan="2"><h3><%= set.key().empty? ? 'other' : set.key() -%></h3></td>
-        </tr>
-      <% end %>
-      <% properties.each do |property_def| %>
-        <tr>
-          <td class="form-key-cell"><%= property_def.key() -%><%= " *" unless property_def.optional() -%></td>
-          <td class="form-val-cell" id="row_<%= property_def.key() -%>">
-            <%= property_value_field(property_def, widget.property_text_value(property_def.key())) -%>
-            <div class="form-val-note">
-              <%= message("widget." + widget.key + ".param." + property_def.key(), :default => property_def.description()) -%>
-            </div>
-          </td>
-        </tr>
+    <% 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? %>
+             <tr>
+              <td celspan="2"><h3>other</h3></td>
+            </tr>
+          <% else %>
+            <tr>
+              <td celspan="2"><h3><%= set.key() -%></h3></td>
+            </tr>
+          <% end %>
+        <% end %>
+        <% properties.sort { |w1, w2| natural_comparison(w1.key, w2.key) }.each do |property_def| %>
+         <tr>
+            <td class="form-key-cell"><%= property_def.key() -%><%= " *" unless property_def.optional() -%></td>
+            <td class="form-val-cell" id="row_<%= property_def.key() -%>">
+                <%= property_value_field(property_def, widget.property_text_value(property_def.key())) -%>
+                <div class="form-val-note">
+                    <%= message("widget." + widget.key + ".param." + property_def.key(), :default => property_def.description()) -%>
+                </div>
+            </td>
+         </tr>
       <% end %>
     <% end %>