← Back to team overview

dhis-mobile-devs team mailing list archive

[Branch ~dhis-mobile-devs/dhis-mobile/lwuit-tracking] Rev 184: Navigate user directly into data entry

 

------------------------------------------------------------
revno: 184
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: lwuit-tracking
timestamp: Fri 2013-11-08 14:12:04 +0700
message:
  Navigate user directly into data entry
modified:
  src/org/hisp/dhis/mobile/view/DashboardLinkView.java


--
lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking
https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking

Your team DHIS mobile developers is subscribed to branch lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking/+edit-subscription
=== modified file 'src/org/hisp/dhis/mobile/view/DashboardLinkView.java'
--- src/org/hisp/dhis/mobile/view/DashboardLinkView.java	2013-11-05 08:47:26 +0000
+++ src/org/hisp/dhis/mobile/view/DashboardLinkView.java	2013-11-08 07:12:04 +0000
@@ -1,9 +1,10 @@
 package org.hisp.dhis.mobile.view;
 
-import org.hisp.dhis.mobile.connection.ConnectionManager;
 import org.hisp.dhis.mobile.midlet.DHISMIDlet;
 import org.hisp.dhis.mobile.midlet.NameBasedMIDlet;
 import org.hisp.dhis.mobile.model.Patient;
+import org.hisp.dhis.mobile.model.Program;
+import org.hisp.dhis.mobile.model.ProgramStage;
 import org.hisp.dhis.mobile.ui.Text;
 
 import com.sun.lwuit.Command;
@@ -27,6 +28,8 @@
     private Command nextCommand;
 
     private Patient patient;
+    
+    private NameBasedMIDlet namebasedMidlet;
 
     public DashboardLinkView( DHISMIDlet dhisMIDlet, Patient patient )
     {
@@ -34,30 +37,6 @@
         this.patient = patient;
     }
 
-    private NameBasedMIDlet nameBasedMIDlet;
-
-    private ConnectionManager connectionManager;
-
-    public NameBasedMIDlet getNameBasedMIDlet()
-    {
-        return nameBasedMIDlet;
-    }
-
-    public void setNameBasedMIDlet( NameBasedMIDlet nameBasedMIDlet )
-    {
-        this.nameBasedMIDlet = nameBasedMIDlet;
-    }
-
-    public ConnectionManager getConnectionManager()
-    {
-        return connectionManager;
-    }
-
-    public void setConnectionManager( ConnectionManager connectionManager )
-    {
-        this.connectionManager = connectionManager;
-    }
-
     public Form getDashboardLinkForm()
     {
         if ( dashboardLinkForm == null )
@@ -124,7 +103,7 @@
     public DashboardLinkView( DHISMIDlet dhisMIDlet )
     {
         super( dhisMIDlet );
-        this.nameBasedMIDlet = (NameBasedMIDlet) this.dhisMIDlet;
+        this.namebasedMidlet = (NameBasedMIDlet) this.dhisMIDlet;
     }
 
     public void actionPerformed( ActionEvent ae )
@@ -133,13 +112,21 @@
         {
             try
             {
-                nameBasedMIDlet.getWaitingView().showView();
-                nameBasedMIDlet.getPersonDashboardView().setPatient( patient );
-                nameBasedMIDlet.getPersonDashboardView().showView();
-                dashboardLinkForm = null;
-                backCommand = null;
-                nextCommand = null;
-                System.gc();
+                Program currentProgram = (Program) patient.getPrograms().elementAt( 0 );
+                ProgramStage programStage = (ProgramStage) currentProgram.getProgramStages().elementAt( 0 );
+                if ( programStage.getSections().size() > 0 )
+                {
+                    namebasedMidlet.getSectionListView().setPatient( patient );
+                    namebasedMidlet.getSectionListView().setProgramStage( programStage );
+                    namebasedMidlet.getSectionListView().showView();
+                }
+                else
+                {
+                    namebasedMidlet.getTrackingDataEntryView().setPatient( patient );
+                    namebasedMidlet.getTrackingDataEntryView().setProgramStage( programStage );
+                    namebasedMidlet.getTrackingDataEntryView().setTitle( programStage.getName() );
+                    namebasedMidlet.getTrackingDataEntryView().showView();
+                }
             }
             catch ( Exception e )
             {
@@ -149,8 +136,14 @@
         }
         else
         {
-            nameBasedMIDlet.getTrackingMainMenuView().showView();
+            namebasedMidlet.getTrackingMainMenuView().showView();
         }
+        dashboardLinkForm = null;
+        linkTextArea = null;
+        backCommand = null;
+        nextCommand = null;
+        patient = null;
+        System.gc();
     }
 
     public void prepareView()