← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1700: (GIS) Work in progress on adapting MapView to the new legend system.

 

------------------------------------------------------------
revno: 1700
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-03-25 20:27:31 +0100
message:
  (GIS) Work in progress on adapting MapView to the new legend system.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportExcelAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLegendsAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegends.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.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-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportExcelAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportExcelAction.java	2010-03-25 16:43:52 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportExcelAction.java	2010-03-25 19:27:31 +0000
@@ -40,7 +40,6 @@
 import jxl.write.WritableImage;
 import jxl.write.WritableSheet;
 import jxl.write.WritableWorkbook;
-
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONSerializer;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLegendsAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLegendsAction.java	2010-03-25 15:27:40 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLegendsAction.java	2010-03-25 19:27:31 +0000
@@ -32,9 +32,12 @@
 
 import org.hisp.dhis.mapping.MapLegend;
 import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.mapping.comparator.MapLegendComparator;
 
 import com.opensymphony.xwork2.Action;
 
+import edu.emory.mathcs.backport.java.util.Collections;
+
 /**
  * @author Jan Henrik Overland
  * @version $Id$
@@ -71,6 +74,8 @@
     public String execute()
     {
         this.object = new ArrayList<MapLegend>( this.mappingService.getAllMapLegends() );
+        
+        Collections.sort( this.object, new MapLegendComparator() );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegends.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegends.vm	2010-03-25 15:27:40 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegends.vm	2010-03-25 19:27:31 +0000
@@ -6,7 +6,8 @@
     "name": "$!encoder.jsEncode( ${mapLegend.name} )",
     "startValue": $!{mapLegend.startValue},
     "endValue": $!{mapLegend.endValue},
-    "color": "$!encoder.jsEncode( ${mapLegend.color} )"
+    "color": "$!encoder.jsEncode( ${mapLegend.color} )",
+    "displayString": "$!encoder.jsEncode( ${mapLegend.name} ), $!{mapLegend.startValue} - $!{mapLegend.endValue}, $!encoder.jsEncode( ${mapLegend.color} )"
   }#if( $velocityCount < $size ),#end
 #end
 ] }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-03-25 18:55:29 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-03-25 19:27:31 +0000
@@ -1229,8 +1229,7 @@
         url: path + 'getAllMapLegends' + type,
         root: 'mapLegends',
 		id: 'id',
-        fields: ['id', 'name'],
-        sortInfo: { field: 'name', direction: 'ASC' },
+        fields: ['id', 'name', 'startValue', 'endValue', 'color', 'displayString'],
         autoLoad: true
     });
 	
@@ -1310,9 +1309,9 @@
         id: 'predefinednewmaplegend_ms',
 		isFormField: true,
 		hideLabel: true,
-        dataFields: ['id', 'name', 'startValue', 'endValue', 'color'], 
+        dataFields: ['id', 'name', 'startValue', 'endValue', 'color', 'displayString'], 
         valueField: 'id',
-        displayField: 'name',
+        displayField: 'displayString',
         width: multiselect_width,
         height: getMultiSelectHeight(),
         store: predefinedMapLegendStore
@@ -1466,7 +1465,7 @@
                 handler: function() {
                     var mlsv = Ext.getCmp('predefinedmaplegendsetname_tf').getValue();
                     var mlms = Ext.getCmp('predefinednewmaplegend_ms').getValue();
-                    
+					
                     if (!mlsv) {
                         Ext.messageRed.msg('New legend set', 'Please select a legend set.');
                         return;