dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08179
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1923: - Change the MainMenu Screen, SettingCommand and add 2 more method to ActivityRecordStore.
------------------------------------------------------------
revno: 1923
committer: Long <thanhlongngo1988>
branch nick: cbhis-mobile
timestamp: Mon 2010-10-18 15:10:12 +0700
message:
- Change the MainMenu Screen, SettingCommand and add 2 more method to ActivityRecordStore.
modified:
DHISMobile/.classpath
DHISMobile/.mtj
DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordStore.java
DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.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 'DHISMobile/.classpath'
--- DHISMobile/.classpath 2010-10-18 03:25:22 +0000
+++ DHISMobile/.classpath 2010-10-18 08:10:12 +0000
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/>
- <classpathentry kind="con" path="org.elipse.mtj.JavaMEContainer/Series 40 5th Edition SDK, Feature Pack 1/S40_5th_Edition_SDK_Feature_Pack_1"/>
+ <classpathentry kind="con" path="org.elipse.mtj.JavaMEContainer/Series 40 5th Edition SDK, Feature Pack 1 Lite/S40_5th_Edition_SDK_Feature_Pack_1_Lite"/>
<classpathentry exported="true" kind="lib" path="lib/jzlib-1.0.7.jar"/>
<classpathentry exported="true" kind="con" path="org.eclipse.mtj.core.EXTERNAL_LIBRARY/JMUnit for CLDC 1.1"/>
<classpathentry kind="lib" path="lib/LWUIT.jar"/>
=== modified file 'DHISMobile/.mtj'
--- DHISMobile/.mtj 2010-10-18 03:25:22 +0000
+++ DHISMobile/.mtj 2010-10-18 08:10:12 +0000
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
-<mtjMetadata jad="DHISMobile.jad" version="1.2.1.v201009031435">
- <device group="Series 40 5th Edition SDK, Feature Pack 1" name="S40_5th_Edition_SDK_Feature_Pack_1"/>
+<mtjMetadata jad="DHISMobile.jad" version="1.2.1.v201006161022">
+ <device group="Series 40 5th Edition SDK, Feature Pack 1 Lite" name="S40_5th_Edition_SDK_Feature_Pack_1_Lite"/>
<signing projectSpecific="false" signProject="false">
<alias/>
</signing>
<configurations>
<configuration active="true" name="S40_5th_Edition_SDK_Feature_Pack_1">
- <device group="Series 40 5th Edition SDK, Feature Pack 1" name="S40_5th_Edition_SDK_Feature_Pack_1"/>
+ <device group="Series 40 5th Edition SDK, Feature Pack 1 Lite" name="S40_5th_Edition_SDK_Feature_Pack_1_Lite"/>
<symbolSet name="AmharicColorPhone">
- <symbol name="screen.isColor" value="true"/>
<symbol name="MMAPI" value="1.1"/>
+ <symbol name="screen.isColor" value="true"/>
<symbol name="screen.bitDepth" value="8"/>
<symbol name="JSR82" value="1.1"/>
<symbol name="JSR226" value="1.0"/>
@@ -18,8 +18,8 @@
<symbol name="SATSA-PKI" value="1.0"/>
<symbol name="CLDC" value="1.1"/>
<symbol name="JSR179" value="1.0"/>
+ <symbol name="SATSA-JCRMI" value="1.0"/>
<symbol name="WMA" value="2.0"/>
- <symbol name="SATSA-JCRMI" value="1.0"/>
<symbol name="J2ME-WS" value="1.0"/>
<symbol name="screen.width" value="240"/>
<symbol name="JSR238" value="1.0"/>
@@ -52,15 +52,15 @@
<symbol name="screen.canvas.width" value="128"/>
<symbol name="screen.canvas.y" value="40"/>
<symbol name="screen.canvas.x" value="0"/>
+ <symbol name="SATSA-APDU" value="1.0"/>
<symbol name="MIDP" value="1.0"/>
<symbol name="JSR75" value="1.0"/>
- <symbol name="SATSA-APDU" value="1.0"/>
<symbol name="CLDC" value="1.0"/>
<symbol name="screen.canvas.height" value="160"/>
<symbol name="SATSA-CRYPTO" value="1.0"/>
<symbol name="version.configuration" value="CDLC-1.1"/>
+ <symbol name="version.profile" value="MIDP-2.1"/>
<symbol name="WMA" value="1.1"/>
- <symbol name="version.profile" value="MIDP-2.1"/>
<symbol name="screen.height" value="160"/>
</symbolSet>
</configuration>
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordStore.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordStore.java 2010-10-15 20:03:33 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordStore.java 2010-10-18 08:10:12 +0000
@@ -17,14 +17,19 @@
*
*/
public class ActivityRecordStore implements Runnable {
+ public static final String LOAD_ALL_ACTIVITYPLAN = "loadall";
+ public static final String LOAD_CURRENT_ACTIVITYPLAN = "loadcurrent";
+ public static final String LOAD_COMPLETED_ACTIVITYPLAN = "loadcompleted";
private String dbName;
+ private String task;
private Vector activityVector;
private DHISMIDlet dhisMIDlet;
// Constructor
- public ActivityRecordStore(DHISMIDlet dhisMIDlet) {
+ public ActivityRecordStore(DHISMIDlet dhisMIDlet, String task) {
this.dbName = ModelRecordStore.ACTIVITY_DB;
this.dhisMIDlet = dhisMIDlet;
+ this.task = task;
}
// Constructor
@@ -187,9 +192,69 @@
}
}
}
+
+ public void loadCurrentActivityPlan(){
+ RecordStore rs = null;
+ RecordEnumeration re = null;
+ ActivityRecordFilter rf = new ActivityRecordFilter( ActivityRecordFilter.filterByStatusIncomplete );
+ activityVector = new Vector();
+ try {
+ rs = RecordStore.openRecordStore(dbName, true);
+ re = rs.enumerateRecords(rf, null, false);
+ while (re.hasNextElement()) {
+ activityVector.addElement(Activity.recordToActivity(re.nextRecord()));
+ }
+ } catch (Exception e) {
+
+ } finally {
+ if (re != null)
+ re.destroy();
+ if (rs != null)
+ try {
+ rs.closeRecordStore();
+ } catch (RecordStoreNotOpenException e) {
+ e.printStackTrace();
+ } catch (RecordStoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void loadCompletedActivityPlan(){
+ RecordStore rs = null;
+ RecordEnumeration re = null;
+ ActivityRecordFilter rf = new ActivityRecordFilter( ActivityRecordFilter.filterByStatusComplete );
+ activityVector = new Vector();
+ try {
+ rs = RecordStore.openRecordStore(dbName, true);
+ re = rs.enumerateRecords(rf, null, false);
+ while (re.hasNextElement()) {
+ activityVector.addElement(Activity.recordToActivity(re.nextRecord()));
+ }
+ } catch (Exception e) {
+
+ } finally {
+ if (re != null)
+ re.destroy();
+ if (rs != null)
+ try {
+ rs.closeRecordStore();
+ } catch (RecordStoreNotOpenException e) {
+ e.printStackTrace();
+ } catch (RecordStoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
public void run() {
+ if (task.equalsIgnoreCase(LOAD_ALL_ACTIVITYPLAN)){
loadAll();
dhisMIDlet.loadActivityPlan(getActivityVector());
+ } else if (task.equalsIgnoreCase(LOAD_COMPLETED_ACTIVITYPLAN)){
+
+ } else {
+
+ }
}
}
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java 2010-10-18 03:25:22 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java 2010-10-18 08:10:12 +0000
@@ -133,8 +133,10 @@
private Command selectDailyPeriodCmd;
private Command pinFormNextCmd;
private Command pinFormReinitCmd;
+ private Command settingCommand;
private Image logo;
+
/**
* The DHISMIDlet constructor.
*/
@@ -266,6 +268,9 @@
mainMenuListAction();
} else if (command == mnuListExtCmd) {
exitMIDlet();
+ } else {
+ loadSettings();
+ switchDisplayable(null, getSettingsForm());
}
} else if (displayable == servicesList) {
if (command == List.SELECT_COMMAND) {
@@ -394,10 +399,14 @@
public List getMainMenuList() {
if (mainMenuList == null) {
mainMenuList = new List("Main Menu", Choice.IMPLICIT);
- mainMenuList.append("Services", null);
- mainMenuList.append("Maintenance", null);
- mainMenuList.append("Settings", null);
+ mainMenuList.append("Current Activity Plan", null);
+ mainMenuList.append("Completed Activity Plan", null);
+ mainMenuList.append("Update Avtivity Plan", null);
+// mainMenuList.append("Services", null);
+// mainMenuList.append("Maintenance", null);
+// mainMenuList.append("Settings", null);
mainMenuList.addCommand(getMnuListExtCmd());
+ mainMenuList.addCommand(getSettingCommand());
mainMenuList.setCommandListener(this);
mainMenuList.setFitPolicy(Choice.TEXT_WRAP_DEFAULT);
mainMenuList
@@ -406,6 +415,13 @@
return mainMenuList;
}
+ private Command getSettingCommand() {
+ if (settingCommand == null){
+ settingCommand = new Command("Settings", Command.SCREEN, 0);
+ }
+ return settingCommand;
+ }
+
/**
* Performs an action assigned to the selected list element in the
* mainMenuList component.
@@ -624,7 +640,7 @@
*/
public TextField getUrl() {
if (url == null) {
- url = new TextField("Server Location", "http://localhost:8080/",
+ url = new TextField("Server Location", "http://localhost:8080/api/",
64, TextField.URL);
}
return url;
@@ -877,7 +893,7 @@
public TextField getServerUrl() {
if (serverURL == null) {
serverURL = new TextField("Server Location",
- "http://localhost:8080/cbhis/api/", 64, TextField.URL);
+ "http://localhost:8080/api/", 64, TextField.URL);
}
return serverURL;
}
@@ -1067,7 +1083,7 @@
switchDisplayable(null, getWaitForm());
ActivityRecordStore activityRecordStore = new ActivityRecordStore(
- this);
+ this, ActivityRecordStore.LOAD_ALL_ACTIVITYPLAN);
Thread thread = new Thread(activityRecordStore);
thread.start();
}
@@ -1514,7 +1530,7 @@
if (getUserName().getString().trim().length() != 0
&& getPassword().getString().trim().length() != 0) {
ConnectionManager connectionManager = new ConnectionManager(
- this, getServerUrl().getString(), getUserName()
+ this, getUrl().getString(), getUserName()
.getString(), getPassword().getString(),
getLocale().getString(), ConnectionManager.AUTHENTICATE);
connectionManager.start();