dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15951
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5900: Fixed issue with sorting in Dv
------------------------------------------------------------
revno: 5900
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-02-09 14:03:47 +0100
message:
Fixed issue with sorting in Dv
modified:
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java
--
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-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java 2012-01-23 19:44:06 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java 2012-02-09 13:03:47 +0000
@@ -29,12 +29,11 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.chart.ChartService;
-import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -134,16 +133,16 @@
this.filter = filter;
}
- private Collection<Integer> indicatorIds;
+ private List<Integer> indicatorIds = new ArrayList<Integer>();
- public void setIndicatorIds( Collection<Integer> indicatorIds )
+ public void setIndicatorIds( List<Integer> indicatorIds )
{
this.indicatorIds = indicatorIds;
}
- private Collection<Integer> dataElementIds;
+ private List<Integer> dataElementIds = new ArrayList<Integer>();
- public void setDataElementIds( Collection<Integer> dataElementIds )
+ public void setDataElementIds( List<Integer> dataElementIds )
{
this.dataElementIds = dataElementIds;
}
@@ -317,13 +316,24 @@
chart.setFilter( filter );
}
- if ( indicatorIds != null || dataElementIds != null )
- {
- chart.setIndicators( indicatorIds != null ? new ArrayList<Indicator>( indicatorService
- .getIndicators( indicatorIds ) ) : new ArrayList<Indicator>() );
-
- chart.setDataElements( dataElementIds != null ? new ArrayList<DataElement>( dataElementService
- .getDataElements( dataElementIds ) ) : new ArrayList<DataElement>() );
+ if ( indicatorIds != null )
+ {
+ chart.getIndicators().clear();
+
+ for ( Integer id : indicatorIds )
+ {
+ chart.getIndicators().add( indicatorService.getIndicator( id ) );
+ }
+ }
+
+ if ( dataElementIds != null )
+ {
+ chart.getDataElements().clear();
+
+ for ( Integer id : dataElementIds )
+ {
+ chart.getDataElements().add( dataElementService.getDataElement( id ) );
+ }
}
if ( lastMonth || last12Months || lastQuarter || last4Quarters || lastSixMonth || last2SixMonths || thisYear