← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13960: Sorting in GeoFeaturesController

 

------------------------------------------------------------
revno: 13960
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-02-09 15:59:38 +0200
message:
  Sorting in GeoFeaturesController
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/GeoFeatureController.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/GeoFeatureController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/GeoFeatureController.java	2014-02-05 14:32:56 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/GeoFeatureController.java	2014-02-09 13:59:38 +0000
@@ -32,6 +32,8 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -117,6 +119,20 @@
             features.add( feature );
         }
         
+        Collections.sort( features, GeoFeatureTypeComparator.INSTANCE );
+        
         JacksonUtils.toJson( response.getOutputStream(), features );
     }
+    
+    static class GeoFeatureTypeComparator
+        implements Comparator<GeoFeature>
+    {
+        public static final GeoFeatureTypeComparator INSTANCE = new GeoFeatureTypeComparator();
+        
+        @Override
+        public int compare( GeoFeature o1, GeoFeature o2 )
+        {
+            return Integer.valueOf( o1.getTy() ).compareTo( Integer.valueOf( o2.getTy() ) );
+        }        
+    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-02-08 18:09:18 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-02-09 13:59:38 +0000
@@ -2240,7 +2240,7 @@
 					{id: 'Monthly', name: GIS.i18n.monthly},
 					{id: 'BiMonthly', name: GIS.i18n.bimonthly},
 					{id: 'Quarterly', name: GIS.i18n.quarterly},
-                    {id: 'SixMonthly', name: GIS.i18n.sixmonthly},
+					{id: 'SixMonthly', name: GIS.i18n.sixmonthly},
                     {id: 'SixMonthlyApril', name: GIS.i18n.sixmonthly_april},
 					{id: 'Yearly', name: GIS.i18n.yearly},
 					{id: 'FinancialOct', name: GIS.i18n.financial_oct},

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js	2014-02-08 18:09:18 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js	2014-02-09 13:59:38 +0000
@@ -2604,7 +2604,7 @@
 					{id: 'BiMonthly', name: GIS.i18n.bimonthly},
 					{id: 'Quarterly', name: GIS.i18n.quarterly},
 					{id: 'SixMonthly', name: GIS.i18n.sixmonthly},
-                    {id: 'SixMonthlyApril', name: GIS.i18n.sixmonthly_april},
+					{id: 'SixMonthlyApril', name: GIS.i18n.sixmonthly_april},
 					{id: 'Yearly', name: GIS.i18n.yearly},
 					{id: 'FinancialOct', name: GIS.i18n.financial_oct},
 					{id: 'FinancialJuly', name: GIS.i18n.financial_july},

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2014-02-08 18:09:18 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2014-02-09 13:59:38 +0000
@@ -118,7 +118,7 @@
 					{id: 'BiMonthly', name: NS.i18n.bimonthly},
 					{id: 'Quarterly', name: NS.i18n.quarterly},
 					{id: 'SixMonthly', name: NS.i18n.sixmonthly},
-                    {id: 'SixMonthlyApril', name: NS.i18n.sixmonthly_april},
+					{id: 'SixMonthlyApril', name: NS.i18n.sixmonthly_april},
 					{id: 'Yearly', name: NS.i18n.yearly},
 					{id: 'FinancialOct', name: NS.i18n.financial_oct},
 					{id: 'FinancialJuly', name: NS.i18n.financial_july},

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js	2014-02-08 18:09:18 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js	2014-02-09 13:59:38 +0000
@@ -118,8 +118,8 @@
 					{id: 'Monthly', name: PT.i18n.monthly},
 					{id: 'BiMonthly', name: PT.i18n.bimonthly},
 					{id: 'Quarterly', name: PT.i18n.quarterly},
-                    {id: 'SixMonthly', name: PT.i18n.sixmonthly},
-                    {id: 'SixMonthlyApril', name: PT.i18n.sixmonthly_april},
+					{id: 'SixMonthly', name: PT.i18n.sixmonthly},
+					{id: 'SixMonthlyApril', name: PT.i18n.sixmonthly_april},
 					{id: 'Yearly', name: PT.i18n.yearly},
 					{id: 'FinancialOct', name: PT.i18n.financial_oct},
 					{id: 'FinancialJuly', name: PT.i18n.financial_july},

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js	2014-02-08 18:09:18 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js	2014-02-09 13:59:38 +0000
@@ -152,7 +152,7 @@
 					{id: 'BiMonthly', name: NS.i18n.bimonthly},
 					{id: 'Quarterly', name: NS.i18n.quarterly},
 					{id: 'SixMonthly', name: NS.i18n.sixmonthly},
-                    {id: 'SixMonthlyApril', name: NS.i18n.sixmonthly_april},
+					{id: 'SixMonthlyApril', name: NS.i18n.sixmonthly_april},
 					{id: 'Yearly', name: NS.i18n.yearly},
 					{id: 'FinancialOct', name: NS.i18n.financial_oct},
 					{id: 'FinancialJuly', name: NS.i18n.financial_july},

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js	2014-02-08 18:09:18 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js	2014-02-09 13:59:38 +0000
@@ -209,7 +209,7 @@
 					{id: 'BiMonthly', name: DV.i18n.bimonthly},
 					{id: 'Quarterly', name: DV.i18n.quarterly},
 					{id: 'SixMonthly', name: DV.i18n.sixmonthly},
-                    {id: 'SixMonthlyApril', name: DV.i18n.sixmonthly_april},
+					{id: 'SixMonthlyApril', name: DV.i18n.sixmonthly_april},
 					{id: 'Yearly', name: DV.i18n.yearly},
 					{id: 'FinancialOct', name: DV.i18n.financial_oct},
 					{id: 'FinancialJuly', name: DV.i18n.financial_july},