dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00792
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 226: MapLegendSet components logic fixed.
------------------------------------------------------------
revno: 226
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-04-22 18:19:08 +0200
message:
MapLegendSet components logic fixed.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java
gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js
gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java 2009-04-21 16:24:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java 2009-04-22 16:19:08 +0000
@@ -1,6 +1,6 @@
package org.hisp.dhis.mapping;
-import java.util.Collection;
+import java.util.Set;
import org.hisp.dhis.indicator.Indicator;
@@ -45,13 +45,13 @@
private String colorHigh;
- private Collection<Indicator> indicators;
+ private Set<Indicator> indicators;
public MapLegendSet()
{
}
- public MapLegendSet( String name, String colorLow, String colorHigh, Collection<Indicator> indicators )
+ public MapLegendSet( String name, String colorLow, String colorHigh, Set<Indicator> indicators )
{
this.name = name;
this.colorLow = colorLow;
@@ -136,12 +136,12 @@
this.colorHigh = colorHigh;
}
- public Collection<Indicator> getIndicators()
+ public Set<Indicator> getIndicators()
{
return indicators;
}
- public void setIndicators( Collection<Indicator> indicators )
+ public void setIndicators( Set<Indicator> indicators )
{
this.indicators = indicators;
}
=== modified file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java 2009-04-22 16:10:50 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java 2009-04-22 16:19:08 +0000
@@ -27,8 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
@@ -87,9 +87,9 @@
this.colorHigh = colorHigh;
}
- private Collection<Integer> indicators;
+ private Collection<String> indicators;
- public void setIndicators( Collection<Integer> indicators )
+ public void setIndicators( Collection<String> indicators )
{
this.indicators = indicators;
}
@@ -105,11 +105,11 @@
legendSet.setName( name );
legendSet.setColorLow( colorLow );
legendSet.setColorHigh( colorHigh );
- legendSet.setIndicators( new ArrayList<Indicator>() );
+ legendSet.setIndicators( new HashSet<Indicator>() );
- for ( Integer indicator : indicators )
+ for ( String indicator : indicators )
{
- legendSet.getIndicators().add( indicatorService.getIndicator( indicator ) );
+ legendSet.getIndicators().add( indicatorService.getIndicator( Integer.valueOf( indicator ) ) );
}
mappingService.addMapLegendSet( legendSet );
=== modified file 'gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js'
--- gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js 2009-04-22 13:08:50 +0000
+++ gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js 2009-04-22 16:19:08 +0000
@@ -601,7 +601,7 @@
});
var legendSetNameTextField = new Ext.form.TextField({
- id: 'legendSetName_tf',
+ id: 'legendsetname_tf',
emptyText: 'Required',
width: combo_width
});
@@ -684,7 +684,7 @@
});
var legendSetStore = new Ext.data.JsonStore({
- url: path + 'getAllLegendSets' + type,
+ url: path + 'getAllMapLegendSets' + type,
root: 'legendSets',
fields: ['id', 'name'],
sortInfo: { field: 'name', direction: 'ASC' },
@@ -712,7 +712,7 @@
text: 'Register new legend set',
handler: function()
{
- var ln = Ext.getCmp('legendSetName_tf').getValue();
+ var ln = Ext.getCmp('legendsetname_tf').getValue();
var llc = Ext.getCmp('legendsetlowcolor_cp').getValue();
var lhc = Ext.getCmp('legendsethighcolor_cp').getValue();
var li = Ext.getCmp('legendsetindicator_cb').getValue();
@@ -727,7 +727,7 @@
{
url: path + 'addMapLegendSet' + type,
method: 'GET',
- params: { name: ln, colorLow: llc, colorHigh: lhc, indicatorId: li },
+ params: { name: ln, colorLow: llc, colorHigh: lhc, indicators: li },
success: function( responseObject )
{
=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-04-22 13:00:15 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-04-22 16:19:08 +0000
@@ -194,8 +194,8 @@
});
legendStore = new Ext.data.JsonStore({
- url: path + 'getLegendMinAndMaxOfIndicator' + type,
- root: 'legendSet',
+ url: path + 'getMapLegendSetByIndicator' + type,
+ root: 'mapLegendSet',
fields: ['id', 'name'],
autoLoad: false
});
@@ -372,20 +372,18 @@
fn: function()
{
var iId = Ext.getCmp('indicator_cb').getValue();
- var url = path + 'getLegendMinAndMaxOfIndicator' + type;
- var format = 'json';
-
- Ext.Ajax.request({
-
- url: url,
+
+ Ext.Ajax.request(
+ {
+ url: path + 'getMapLegendSetByIndicator' + type,
method: 'GET',
- params: { indicatorId: iId, format: format },
+ params: { indicatorId: iId, format: 'json' },
success: function( responseObject )
{
var data = Ext.util.JSON.decode(responseObject.responseText);
- var color1 = "#" + data.legendSet[0]["min-color"];
- var color2 = "#" + data.legendSet[0]["max-color"];
+ var color1 = data.mapLegendSet[0]['colorlow'];
+ var color2 = data.mapLegendSet[0]['colorhigh'];
Ext.getCmp('colorA_cf').setValue(color1);
Ext.getCmp('colorB_cf').setValue(color2);
--
Trunk
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.