=== 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 @@ - + === 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 @@ - - + + - + - + @@ -18,8 +18,8 @@ + - @@ -52,15 +52,15 @@ + - + - === 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();