dhis-mobile-devs team mailing list archive
-
dhis-mobile-devs team
-
Mailing list archive
-
Message #00299
[Branch ~dhis-mobile-devs/dhis-mobile/lwuit-tracking] Rev 160: add missing files, create lost to follow up details view
------------------------------------------------------------
revno: 160
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: lwuit-tracking
timestamp: Mon 2013-10-07 15:13:22 +0700
message:
add missing files, create lost to follow up details view
added:
src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpDetailTask.java
src/org/hisp/dhis/mobile/model/LostEvent.java
src/org/hisp/dhis/mobile/view/LostToFollowUpDetailView.java
modified:
src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpTask.java
src/org/hisp/dhis/mobile/view/LostToFollowUpView.java
src/org/hisp/dhis/mobile/view/PersonRegistrationView.java
src/org/hisp/dhis/mobile/view/ProgramSelectView.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
=== added file 'src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpDetailTask.java'
--- src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpDetailTask.java 1970-01-01 00:00:00 +0000
+++ src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpDetailTask.java 2013-10-07 08:13:22 +0000
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.mobile.connection.task;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+
+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;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version FindLostToFollowUpDetailTask.java 1:09:50 PM Oct 4, 2013 $
+ */
+public class FindLostToFollowUpDetailTask extends AbstractTask
+{
+ private String programStageInstanceId;
+
+ NameBasedMIDlet nameBasedMIDlet;
+
+ public FindLostToFollowUpDetailTask( String programStageInstanceId )
+ {
+ this.programStageInstanceId = programStageInstanceId;
+ this.nameBasedMIDlet = (NameBasedMIDlet) ConnectionManager.getDhisMIDlet();
+ }
+
+ public void run()
+ {
+ DataInputStream inputStream = null;
+ Patient patient = new Patient();
+ try
+ {
+ inputStream = this.download( programStageInstanceId, "programStageInstanceId" );
+ if ( inputStream != null )
+ {
+ patient.deSerialize( inputStream );
+
+ }
+ }
+ catch ( IOException e )
+ {
+ DHISMIDlet.debug( e.getMessage() );
+ e.printStackTrace();
+ }
+ }
+}
=== modified file 'src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpTask.java'
--- src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpTask.java 2013-10-03 08:31:21 +0000
+++ src/org/hisp/dhis/mobile/connection/task/FindLostToFollowUpTask.java 2013-10-07 08:13:22 +0000
@@ -62,15 +62,23 @@
DHISMIDlet.debug( e.getMessage() );
e.printStackTrace();
String message = e.getMessage();
- Vector eventsInfo = new Vector();
- while ( message.length() > 0 )
- {
- eventsInfo.addElement( message.substring( 0, message.indexOf( "$" ) ) );
- message = message.substring( message.indexOf( "$" ) + 1, message.length() );
- }
- nameBasedMIDlet.getLostToFollowUpView().setEventsInfo( eventsInfo );
- nameBasedMIDlet.getLostToFollowUpView().showView();
- eventsInfo = null;
+ if ( e.getMessage().equalsIgnoreCase( "NO_EVENT_FOUND" ) )
+ {
+ nameBasedMIDlet.getAlertBoxView( "No event found for this program", "No Result" ).showView();
+ nameBasedMIDlet.getProgramSelectView().showView();
+ }
+ else
+ {
+ Vector eventsInfo = new Vector();
+ while ( message.length() > 0 )
+ {
+ eventsInfo.addElement( message.substring( 0, message.indexOf( "$" ) ) );
+ message = message.substring( message.indexOf( "$" ) + 1, message.length() );
+ }
+ nameBasedMIDlet.getLostToFollowUpView().setEventsInfo( eventsInfo );
+ nameBasedMIDlet.getLostToFollowUpView().showView();
+ eventsInfo = null;
+ }
}
}
}
=== added file 'src/org/hisp/dhis/mobile/model/LostEvent.java'
--- src/org/hisp/dhis/mobile/model/LostEvent.java 1970-01-01 00:00:00 +0000
+++ src/org/hisp/dhis/mobile/model/LostEvent.java 2013-10-07 08:13:22 +0000
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.mobile.model;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version LostEvent.java 2:21:32 PM Oct 7, 2013 $
+ */
+public class LostEvent extends Model implements DataStreamSerializable
+{
+ private String dueDate;
+
+ private int status;
+
+ private boolean isRiskCase;
+
+ private String comment;
+
+ private String SMS;
+
+ public void serialize( DataOutputStream dout )
+ throws IOException
+ {
+ super.serialize( dout );
+ dout.writeUTF( dueDate );
+ dout.writeInt( status );
+ dout.writeBoolean( isRiskCase );
+ dout.writeUTF( comment );
+ dout.writeUTF( SMS );
+ }
+
+ public void deSerialize( DataInputStream dint )
+ throws IOException
+ {
+ super.deSerialize( dint );
+ dueDate = dint.readUTF();
+ status = dint.readInt();
+ isRiskCase = dint.readBoolean();
+ comment = dint.readUTF();
+ SMS = dint.readUTF();
+ }
+
+ public String getDueDate()
+ {
+ return dueDate;
+ }
+
+ public void setDueDate( String dueDate )
+ {
+ this.dueDate = dueDate;
+ }
+
+ public String getComment()
+ {
+ return comment;
+ }
+
+ public void setComment( String comment )
+ {
+ this.comment = comment;
+ }
+
+ public String getSMS()
+ {
+ return SMS;
+ }
+
+ public void setSMS( String sMS )
+ {
+ SMS = sMS;
+ }
+
+ public int getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus( int status )
+ {
+ this.status = status;
+ }
+}
=== added file 'src/org/hisp/dhis/mobile/view/LostToFollowUpDetailView.java'
--- src/org/hisp/dhis/mobile/view/LostToFollowUpDetailView.java 1970-01-01 00:00:00 +0000
+++ src/org/hisp/dhis/mobile/view/LostToFollowUpDetailView.java 2013-10-07 08:13:22 +0000
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.mobile.view;
+
+import org.hisp.dhis.mobile.midlet.DHISMIDlet;
+import org.hisp.dhis.mobile.midlet.NameBasedMIDlet;
+import org.hisp.dhis.mobile.model.LostEvent;
+import org.hisp.dhis.mobile.ui.Text;
+
+import com.sun.lwuit.Command;
+import com.sun.lwuit.Form;
+import com.sun.lwuit.animations.CommonTransitions;
+import com.sun.lwuit.events.ActionEvent;
+import com.sun.lwuit.events.ActionListener;
+import com.sun.lwuit.layouts.BoxLayout;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version LostToFollowUpDetailView.java 2:41:02 PM Oct 7, 2013 $
+ */
+public class LostToFollowUpDetailView extends AbstractView implements ActionListener
+{
+ private NameBasedMIDlet nameBasedMIDlet;
+
+ private Form mainForm;
+
+ private Command backCommand;
+
+ private Command sendCommand;
+
+ private LostEvent lostEvent;
+
+ public LostToFollowUpDetailView( DHISMIDlet dhisMIDlet )
+ {
+ super( dhisMIDlet );
+ nameBasedMIDlet = (NameBasedMIDlet) dhisMIDlet;
+ }
+
+ public void actionPerformed( ActionEvent ae )
+ {
+ if( ae.getCommand().getCommandName().equals( Text.SEND() ) )
+ {
+
+ }
+ else
+ {
+ nameBasedMIDlet.getLostToFollowUpView().getMainForm().show();
+ }
+ }
+
+ public void prepareView()
+ {
+ System.gc();
+ getMainForm();
+ mainForm.removeAll();
+ }
+
+ public void showView()
+ {
+ prepareView();
+ mainForm.show();
+ }
+
+ public Form getMainForm()
+ {
+ if ( mainForm == null )
+ {
+ mainForm = new Form( lostEvent.getName() );
+ mainForm.setLayout( new BoxLayout( BoxLayout.Y_AXIS ) );
+ mainForm.setTransitionOutAnimator( CommonTransitions.createSlide( CommonTransitions.SLIDE_HORIZONTAL, true,
+ 200 ) );
+ mainForm.addCommand( this.getBackCommand() );
+ mainForm.addCommand( this.getSendCommand() );
+ mainForm.addCommandListener( this );
+ }
+ return mainForm;
+ }
+
+ public void setMainForm( Form mainForm )
+ {
+ this.mainForm = mainForm;
+ }
+
+ public Command getBackCommand()
+ {
+ if ( backCommand == null )
+ {
+ backCommand = new Command( Text.BACK() );
+ }
+ return backCommand;
+ }
+
+ public void setBackCommand( Command backCommand )
+ {
+ this.backCommand = backCommand;
+ }
+
+ public LostEvent getLostEvent()
+ {
+ return lostEvent;
+ }
+
+ public void setLostEvent( LostEvent lostEvent )
+ {
+ this.lostEvent = lostEvent;
+ }
+
+ public Command getSendCommand()
+ {
+ if ( sendCommand == null )
+ {
+ sendCommand = new Command( Text.SEND() );
+ }
+ return sendCommand;
+ }
+
+ public void setSendCommand( Command sendCommand )
+ {
+ this.sendCommand = sendCommand;
+ }
+
+}
=== modified file 'src/org/hisp/dhis/mobile/view/LostToFollowUpView.java'
--- src/org/hisp/dhis/mobile/view/LostToFollowUpView.java 2013-10-07 03:35:19 +0000
+++ src/org/hisp/dhis/mobile/view/LostToFollowUpView.java 2013-10-07 08:13:22 +0000
@@ -129,7 +129,7 @@
mainForm = null;
eventsInfo = null;
backCommand = null;
- nameBasedMIDlet.getTrackingMainMenuView().showView();
+ nameBasedMIDlet.getProgramSelectView().getMainForm().show();
System.gc();
}
=== modified file 'src/org/hisp/dhis/mobile/view/PersonRegistrationView.java'
--- src/org/hisp/dhis/mobile/view/PersonRegistrationView.java 2013-10-03 08:31:21 +0000
+++ src/org/hisp/dhis/mobile/view/PersonRegistrationView.java 2013-10-07 08:13:22 +0000
@@ -316,12 +316,11 @@
dobDialog.show();
}
} );
- // Hide fullname for hard-code testing
- // personRegistrationForm.addComponent( getRequiredLabel() );
- // personRegistrationForm.addComponent( fullNameLabel );
- // personRegistrationForm.addComponent( getFullNameTextField() );
- // fullNameTextField.requestFocus();
+ personRegistrationForm.addComponent( getRequiredLabel() );
+ personRegistrationForm.addComponent( fullNameLabel );
+ personRegistrationForm.addComponent( getFullNameTextField() );
+ fullNameTextField.requestFocus();
// add identifier
@@ -760,7 +759,7 @@
e.printStackTrace();
}
- nameBasedMIDlet.getTrackingMainMenuView().showView();
+ nameBasedMIDlet.getProgramSelectView().getMainForm().show();
patientAttributeValueVector.removeAllElements();
patientIdentifierValueVector.removeAllElements();
requiredLabel = null;
@@ -818,7 +817,8 @@
try
{
birthYear = currentYear - Integer.parseInt( dateOfBirth );
- //dateOfBirth = birthYear + "-" + currentMonth + "-" + currentDate;
+ // dateOfBirth = birthYear + "-" + currentMonth + "-" +
+ // currentDate;
dateOfBirth = currentDate + "-" + currentMonth + "-" + birthYear;
}
catch ( Exception e )
=== modified file 'src/org/hisp/dhis/mobile/view/ProgramSelectView.java'
--- src/org/hisp/dhis/mobile/view/ProgramSelectView.java 2013-10-03 08:31:21 +0000
+++ src/org/hisp/dhis/mobile/view/ProgramSelectView.java 2013-10-07 08:13:22 +0000
@@ -43,7 +43,8 @@
{
if ( ae.getCommand().getCommandName().equals( Text.BACK() ) )
{
- nameBasedMIDlet.getOrgUnitSelectView().setProgramType( "1" );
+ nameBasedMIDlet.getOrgUnitSelectView().setProgramType( programType );
+ nameBasedMIDlet.getOrgUnitSelectView().setLostToFollowUp( isLostToFollowUp );
nameBasedMIDlet.getOrgUnitSelectView().showView();
}
}