← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1932: added checkboxes for boolean values on saved forms

 

------------------------------------------------------------
revno: 1932
author: mayank <maayank.joshi@xxxxxxxxx>
committer: Saptarshi <sunbiz@xxxxxxxxxxxxx>
branch nick: cbhis-mobile
timestamp: Wed 2010-10-20 23:10:52 +0530
message:
  added checkboxes for boolean values on saved forms
modified:
  DHISMobile/.classpath
  DHISMobile/.mtj
  DHISMobile/build.properties
  DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java
  DHISMobile/src/org/hisp/dhis/mobile/test/Base64Test.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-20 15:56:07 +0000
+++ DHISMobile/.classpath	2010-10-20 17:40:52 +0000
@@ -2,9 +2,9 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="res"/>
-	<classpathentry kind="con" path="org.elipse.mtj.JavaMEContainer/Sun Java(TM) Wireless Toolkit 2.5.2_01 for CLDC/DefaultColorPhone"/>
+	<classpathentry kind="con" path="org.elipse.mtj.JavaMEContainer/Series 40 5th Edition SDK, Feature Pack 1/S40_5th_Edition_SDK_Feature_Pack_1"/>
 	<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"/>
-	<classpathentry exported="true" kind="con" path="org.eclipse.mtj.core.EXTERNAL_LIBRARY/JMUnit for CLDC 1.1"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

=== modified file 'DHISMobile/.mtj'
--- DHISMobile/.mtj	2010-10-20 14:54:30 +0000
+++ DHISMobile/.mtj	2010-10-20 17:40:52 +0000
@@ -1,55 +1,45 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<<<<<<< TREE
 <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.v201009031435">
-   <device group="Series 40 5th Edition SDK, Feature Pack 1 Lite" name="S40_5th_Edition_SDK_Feature_Pack_1_Lite"/>
->>>>>>> MERGE-SOURCE
    <signing projectSpecific="false" signProject="false">
       <alias/>
    </signing>
    <configurations>
-<<<<<<< TREE
       <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"/>
          <symbolSet name="AmharicColorPhone">
+            <symbol name="screen.isColor" value="true"/>
             <symbol name="MMAPI" value="1.1"/>
-=======
-      <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"/>
-         <symbolSet name="S40_5th_Edition_SDK_Feature_Pack_1">
-            <symbol name="MMAPI" value="1.2"/>
->>>>>>> MERGE-SOURCE
-            <symbol name="screen.isColor" value="true"/>
-            <symbol name="model" value="Series 40 5th Edition SDK,  Feature Pack 1"/>
-            <symbol name="screen.bitDepth" value="16"/>
+            <symbol name="screen.bitDepth" value="8"/>
             <symbol name="JSR82" value="1.1"/>
-            <symbol name="NOKIAUI" value="1.1"/>
-            <symbol name="MIDP" value="1.0"/>
-            <symbol name="CLDC" value="1.0"/>
-            <symbol name="screen.canvas.height" value="248"/>
-            <symbol name="WMA" value="1.1"/>
-            <symbol name="a_3D_API" value="1.1"/>
+            <symbol name="JSR226" value="1.0"/>
+            <symbol name="MIDP" value="2.1"/>
+            <symbol name="JSR229" value="1.1"/>
+            <symbol name="SATSA-PKI" value="1.0"/>
+            <symbol name="CLDC" value="1.1"/>
+            <symbol name="JSR179" 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="AMMS" value="1.0"/>
+            <symbol name="JSR238" value="1.0"/>
+            <symbol name="JSR239" value="1.0"/>
             <symbol name="screen.isTouch" value="false"/>
-            <symbol name="screen.canvas.width" value="240"/>
             <symbol name="JSR211" value="1.0"/>
-            <symbol name="screen.canvas.y" value="40"/>
-            <symbol name="screen.canvas.x" value="0"/>
+            <symbol name="JSR234" value="1.0"/>
             <symbol name="SATSA-APDU" value="1.0"/>
             <symbol name="JSR75" value="1.0"/>
-            <symbol name="SVG" value="1.1"/>
             <symbol name="J2ME-XMLRPC" value="1.0"/>
+            <symbol name="JSR184" value="1.1"/>
             <symbol name="SATSA-CRYPTO" value="1.0"/>
-            <symbol name="version.configuration" value="CDLC-1.1"/>
+            <symbol name="version.configuration" value="CLDC-1.1"/>
             <symbol name="version.profile" value="MIDP-2.1"/>
+            <symbol name="JSR180" value="1.0"/>
             <symbol name="screen.height" value="320"/>
          </symbolSet>
       </configuration>
-      <configuration active="false" 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"/>
+      <configuration active="false" name="S40_5th_Edition_SDK_Feature_Pack_1_Lite">
+         <device group="Series 40 5th Edition SDK, Feature Pack 1 Lite" name="S40_5th_Edition_SDK_Feature_Pack_1_Lite"/>
          <symbolSet name="S40_5th_Edition_SDK_Feature_Pack_1_Lite">
             <symbol name="MMAPI" value="1.2"/>
             <symbol name="screen.isColor" value="true"/>
@@ -62,17 +52,9 @@
             <symbol name="screen.canvas.width" value="128"/>
             <symbol name="screen.canvas.y" value="40"/>
             <symbol name="screen.canvas.x" value="0"/>
-<<<<<<< TREE
-            <symbol name="JSR75" value="1.0"/>
-            <symbol name="SATSA-APDU" value="1.0"/>
-=======
-            <symbol name="SATSA-APDU" value="1.0"/>
->>>>>>> MERGE-SOURCE
             <symbol name="MIDP" value="1.0"/>
-<<<<<<< TREE
-=======
             <symbol name="JSR75" value="1.0"/>
->>>>>>> MERGE-SOURCE
+            <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"/>
@@ -82,89 +64,5 @@
             <symbol name="screen.height" value="160"/>
          </symbolSet>
       </configuration>
-<<<<<<< TREE
-      <configuration active="false" 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"/>
-         <symbolSet name="DefaultColorPhone">
-            <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"/>
-            <symbol name="MIDP" value="2.1"/>
-            <symbol name="JSR229" value="1.1"/>
-            <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="J2ME-WS" value="1.0"/>
-            <symbol name="screen.width" value="240"/>
-            <symbol name="JSR238" value="1.0"/>
-            <symbol name="JSR239" value="1.0"/>
-            <symbol name="screen.isTouch" value="false"/>
-            <symbol name="JSR211" value="1.0"/>
-            <symbol name="JSR234" value="1.0"/>
-            <symbol name="SATSA-APDU" value="1.0"/>
-            <symbol name="JSR75" value="1.0"/>
-            <symbol name="J2ME-XMLRPC" value="1.0"/>
-            <symbol name="JSR184" value="1.1"/>
-            <symbol name="SATSA-CRYPTO" value="1.0"/>
-            <symbol name="version.configuration" value="CLDC-1.1"/>
-            <symbol name="version.profile" value="MIDP-2.1"/>
-            <symbol name="JSR180" value="1.0"/>
-            <symbol name="screen.height" value="320"/>
-         </symbolSet>
-      </configuration>
-      <configuration active="false" name="DefaultColorPhone">
-         <device group="Sun Java(TM) Wireless Toolkit 2.5.2_01 for CLDC" name="DefaultColorPhone"/>
-         <symbolSet name="DefaultColorPhone">
-            <symbol name="screen.isColor" value="true"/>
-            <symbol name="MMAPI" value="1.1"/>
-            <symbol name="screen.bitDepth" value="8"/>
-            <symbol name="JSR82" value="1.1"/>
-            <symbol name="JSR226" value="1.0"/>
-            <symbol name="MIDP" value="2.1"/>
-            <symbol name="JSR229" value="1.1"/>
-            <symbol name="SATSA-PKI" value="1.0"/>
-            <symbol name="CLDC" value="1.1"/>
-            <symbol name="JSR179" value="1.0"/>
-            <symbol name="WMA" value="2.0"/>
-            <symbol name="SATSA-JCRMI" value="1.0"/>
-=======
-      <configuration active="false" name="DefaultColorPhone">
-         <device group="Sun Java(TM) Wireless Toolkit 2.5.2 for CLDC" name="DefaultColorPhone"/>
-         <symbolSet name="DefaultColorPhone">
-            <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"/>
-            <symbol name="MIDP" value="2.1"/>
-            <symbol name="JSR229" value="1.1"/>
-            <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"/>
->>>>>>> MERGE-SOURCE
-            <symbol name="J2ME-WS" value="1.0"/>
-            <symbol name="screen.width" value="240"/>
-            <symbol name="JSR238" value="1.0"/>
-            <symbol name="JSR239" value="1.0"/>
-            <symbol name="screen.isTouch" value="false"/>
-            <symbol name="JSR211" value="1.0"/>
-            <symbol name="JSR234" value="1.0"/>
-            <symbol name="SATSA-APDU" value="1.0"/>
-            <symbol name="JSR75" value="1.0"/>
-            <symbol name="J2ME-XMLRPC" value="1.0"/>
-            <symbol name="JSR184" value="1.1"/>
-            <symbol name="SATSA-CRYPTO" value="1.0"/>
-            <symbol name="version.configuration" value="CLDC-1.1"/>
-            <symbol name="version.profile" value="MIDP-2.1"/>
-            <symbol name="JSR180" value="1.0"/>
-            <symbol name="screen.height" value="320"/>
-         </symbolSet>
-      </configuration>
    </configurations>
 </mtjMetadata>
\ No newline at end of file

=== modified file 'DHISMobile/build.properties'
--- DHISMobile/build.properties	2010-10-20 15:56:07 +0000
+++ DHISMobile/build.properties	2010-10-20 17:40:52 +0000
@@ -1,21 +1,11 @@
 # MTJ Build Properties
-DefaultColorPhone.includes=src\
-,res\
-
-DefaultColorPhone.excludes=\
-
-S40_5th_Edition_SDK_Feature_Pack_1.includes=src\
-,res\
-
-S40_5th_Edition_SDK_Feature_Pack_1.excludes=\
-
-S40_5th_Edition_SDK_Feature_Pack_1.includes=src\
-,res\
-
-S40_5th_Edition_SDK_Feature_Pack_1.excludes=\
-
-DefaultColorPhone.includes=src\
-,res\
-
-DefaultColorPhone.excludes=\
+S40_5th_Edition_SDK_Feature_Pack_1.includes=src\
+,res\
+
+S40_5th_Edition_SDK_Feature_Pack_1.excludes=\
+
+S40_5th_Edition_SDK_Feature_Pack_1_Lite.includes=src\
+,res\
+
+S40_5th_Edition_SDK_Feature_Pack_1_Lite.excludes=\
 

=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java	2010-10-20 15:56:07 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java	2010-10-20 17:40:52 +0000
@@ -54,7 +54,6 @@
 import org.hisp.dhis.mobile.reporting.util.AlertUtil;
 import org.hisp.dhis.mobile.reporting.util.ReinitConfirmListener;
 
-
 /**
  * @author abyotag_adm
  */
@@ -257,19 +256,18 @@
 		} else if (displayable == loginForm) {
 			if (command == lgnFrmExtCmd) {
 				exitMIDlet();
-			} 
-			else if (command == lgnFrmLgnCmd) {
+			} else if (command == lgnFrmLgnCmd) {
 				if (getUserName().getString().trim().length() == 0
 						|| getPassword().getString().trim().length() == 0) {
 					switchDisplayable(AlertUtil.getErrorAlert(
 							"Incomplete Form", "Username or Password Missing"),
 							getLoginForm());
 					return;
-			}
+				}
 				switchDisplayable(null, getWaitForm());
-				
+
 				login();
-				
+
 				// switchDisplayable(null, getMainMenuList());
 			}
 		} else if (displayable == mainMenuList) {
@@ -387,8 +385,6 @@
 			e.printStackTrace();
 		}
 	}
-	
-	
 
 	public boolean isDownloading() {
 		return downloading;
@@ -679,7 +675,7 @@
 	public TextField getUrl() {
 		if (url == null) {
 			url = new TextField("Server Location",
-					"http://localhost:8080/api/";, 64, TextField.URL);
+					"http://localhost:8080/cbhis/api/";, 64, TextField.URL);
 		}
 		return url;
 	}
@@ -1198,6 +1194,11 @@
 						choiceGroup = new ChoiceGroup("", Choice.MULTIPLE);
 						choiceGroup.append(de.getName(), null);
 						choiceGroup.setFitPolicy(Choice.TEXT_WRAP_ON);
+						if (dataValue.getVal().equals("false")) {
+							choiceGroup.setSelectedIndex(0, false);
+						} else {
+							choiceGroup.setSelectedIndex(0, true);
+						}
 						form.append(choiceGroup);
 						dataElements.put(de, choiceGroup);
 					} else {
@@ -1220,9 +1221,14 @@
 					} else if (de.getType().equals("int")) {
 						TextField intField = new TextField(de.getName(), "",
 								32, TextField.NUMERIC);
-						;
 						form.append(intField);
 						dataElements.put(de, intField);
+					} else if (de.getType().equals("bool")) {
+						choiceGroup = new ChoiceGroup("", Choice.MULTIPLE);
+						choiceGroup.append(de.getName(), null);
+						choiceGroup.setFitPolicy(Choice.TEXT_WRAP_ON);
+						form.append(choiceGroup);
+						dataElements.put(de, choiceGroup);
 					} else {
 						TextField txtField = new TextField(de.getName(), "",
 								32, TextField.ANY);
@@ -1307,7 +1313,7 @@
 			maintenanceList.append("Delete Program", null);
 			maintenanceList.append("Download Activity Plan", null);
 			maintenanceList.append("Delete Activity Plan", null);
-			maintenanceList.append("Download All",null);
+			maintenanceList.append("Download All", null);
 			maintenanceList.addCommand(getMntnceBakCmd());
 			maintenanceList.setCommandListener(this);
 			// maintenanceList.setSelectedFlags(new boolean[] { false, false });
@@ -1355,7 +1361,7 @@
 				switchDisplayable(null, getWaitForm());
 
 				deleteActivityPlan();
-			}else if(__selectedString.equals("Download All")){
+			} else if (__selectedString.equals("Download All")) {
 				getWaitForm().deleteAll();
 				getWaitForm().setTitle("Download All");
 				getWaitForm().append("Please wait........");
@@ -1365,8 +1371,6 @@
 			}
 		}
 	}
-	
-	
 
 	/**
 	 * Returns an initialized instance of mntnceBakCmd component.
@@ -1668,11 +1672,12 @@
 
 		for (int i = 0; i < activities.size(); i++) {
 			Activity activity = (Activity) activities.elementAt(i);
-			
+
 			getActivityPlanList().insert(
 					i,
 					activity.getBeneficiary().getFullName() + "\n"
-							+ Period.formatDailyPeriod(activity.getDueDate()), null);
+							+ Period.formatDailyPeriod(activity.getDueDate()),
+					null);
 
 		}
 
@@ -1755,8 +1760,8 @@
 				ConnectionManager.BROWSE_DATASETS);
 		connectionManager.start();
 	}
-	
-	public void downloadAll(){
+
+	public void downloadAll() {
 		loadSettings();
 		ConnectionManager connectionManager = new ConnectionManager(this,
 				getUrl().getString(), getDhisUserName().getString(),
@@ -1930,9 +1935,9 @@
 					getErrorAlert().setString("FAILURE");
 					switchDisplayable(getErrorAlert(), getDsDnldList());
 				}
-//				getSuccessAlert().setTitle("Download Status");
-//				getSuccessAlert().setString("SUCCESS");
-//				switchDisplayable(getSuccessAlert(), getPrDnldList());
+				// getSuccessAlert().setTitle("Download Status");
+				// getSuccessAlert().setString("SUCCESS");
+				// switchDisplayable(getSuccessAlert(), getPrDnldList());
 				switchDisplayable(getSuccessAlert(), getMainMenuList());
 
 			} catch (RecordStoreException rse) {
@@ -1959,7 +1964,7 @@
 		} else {
 			getErrorAlert().setTitle("Download Status");
 			getErrorAlert().setString("FAILURE");
-//			switchDisplayable(getErrorAlert(), getMaintenanceList());
+			// switchDisplayable(getErrorAlert(), getMaintenanceList());
 			switchDisplayable(getErrorAlert(), getMainMenuList());
 		}
 	}
@@ -2122,10 +2127,15 @@
 			}
 
 			DataValue dv = new DataValue();
-			dv.setId(de.getId());
-			dv.setVal(val);
-
-			activityValue.getDataValues().addElement(dv);
+			if (val != null && val.equals("")) {
+				switchDisplayable(AlertUtil.getInfoAlert("Warning",
+						"Some fields are empty... Please check"),
+						getActivityEntryForm());
+			} else {
+				dv.setId(de.getId());
+				dv.setVal(val);
+				activityValue.getDataValues().addElement(dv);
+			}
 		}
 
 		return activityValue;

=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/test/Base64Test.java'
--- DHISMobile/src/org/hisp/dhis/mobile/test/Base64Test.java	2010-10-20 07:38:45 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/test/Base64Test.java	2010-10-20 17:40:52 +0000
@@ -1,4 +1,5 @@
 package org.hisp.dhis.mobile.test;
+
 import org.hisp.dhis.mobile.reporting.connection.Base64;
 
 import jmunit.framework.cldc11.AssertionFailedException;
@@ -11,15 +12,12 @@
 public class Base64Test extends TestCase {
 
 	public Base64Test() {
-		super(2, "Base64Test");
+		super(1, "Base64Test");
 	}
 
 	public void test(int testNumber) {
 		switch (testNumber) {
 		case 0:
-			testDecode();
-			break;
-		case 1:
 			testEncode();
 			break;
 		default:
@@ -27,25 +25,11 @@
 		}
 	}
 
-	public void testDecode() throws AssertionFailedException {
-		try {
-			System.out.println("decode");
-			String strs_1 = "";
-			byte[] expResult_1 = null;
-			byte[] result_1 = Base64.decode(strs_1);
-			assertEquals(expResult_1, result_1);
-			fail("Could not decode correctly");
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
 	public void testEncode() throws AssertionFailedException {
 		System.out.println("encode");
-		byte[] bytes_1 = null;
-		String expResult_1 = "";
+		byte[] bytes_1 = "admin:District@123".getBytes();
+		String expResult_1 = "YWRtaW46RGlzdHJpY3RAMTIz";
 		String result_1 = Base64.encode(bytes_1, 0, bytes_1.length);
 		assertEquals(expResult_1, result_1);
-		fail("Could not encode correctly");
 	}
 }