← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4090: Fixed bug: Show default case entry form by sorted dataelements.

 

------------------------------------------------------------
revno: 4090
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-07-07 15:49:30 +0700
message:
  Fixed bug: Show default case entry form by sorted dataelements.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2011-06-01 05:14:19 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2011-07-07 08:49:30 +0000
@@ -29,7 +29,9 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.hisp.dhis.dataelement.DataElement;
@@ -51,6 +53,7 @@
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.program.comparator.ProgramStageDataElementSortOrderComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -98,7 +101,7 @@
 
     private I18n i18n;
 
-    private Collection<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
+    private List<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
 
     private Map<Integer, PatientDataValue> patientDataValueMap;
 
@@ -195,7 +198,7 @@
         return customDataEntryFormCode;
     }
 
-    public Collection<ProgramStageDataElement> getProgramStageDataElements()
+    public List<ProgramStageDataElement> getProgramStageDataElements()
     {
         return programStageDataElements;
     }
@@ -225,7 +228,9 @@
 
         organisationUnit = selectionManager.getSelectedOrganisationUnit();
 
-        programStageDataElements = programStage.getProgramStageDataElements();
+        programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
+
+        Collections.sort( programStageDataElements, new ProgramStageDataElementSortOrderComparator() );
 
         programStageInstance = programStageInstanceService.getProgramStageInstance( programInstance, programStage );