dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08182
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1926: Checkbox for Boolean Values
------------------------------------------------------------
revno: 1926
author: mayank <maayank.joshi@xxxxxxxxx>
committer: Saptarshi <sunbiz@xxxxxxxxxxxxx>
branch nick: cbhis-mobile
timestamp: Wed 2010-10-20 13:08:45 +0530
message:
Checkbox for Boolean Values
added:
DHISMobile/src/org/hisp/dhis/mobile/test/
DHISMobile/src/org/hisp/dhis/mobile/test/AllTestSuite.java
DHISMobile/src/org/hisp/dhis/mobile/test/Base64Test.java
modified:
DHISMobile/.classpath
DHISMobile/.mtj
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-19 18:02:48 +0000
+++ DHISMobile/.classpath 2010-10-20 07:38:45 +0000
@@ -2,9 +2,9 @@
<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 Lite/S40_5th_Edition_SDK_Feature_Pack_1_Lite"/>
+ <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 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="lib" path="lib/LWUIT.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
=== modified file 'DHISMobile/.mtj'
--- DHISMobile/.mtj 2010-10-19 18:02:48 +0000
+++ DHISMobile/.mtj 2010-10-20 07:38:45 +0000
@@ -1,40 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
-<mtjMetadata jad="DHISMobile.jad" version="1.2.1.v201006161022">
+<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"/>
<signing projectSpecific="false" signProject="false">
<alias/>
</signing>
<configurations>
- <configuration active="false" 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="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"/>
<symbol name="screen.isColor" value="true"/>
- <symbol name="screen.bitDepth" value="8"/>
+ <symbol name="model" value="Series 40 5th Edition SDK, Feature Pack 1"/>
+ <symbol name="screen.bitDepth" value="16"/>
<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="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="screen.width" value="240"/>
- <symbol name="JSR238" value="1.0"/>
- <symbol name="JSR239" value="1.0"/>
+ <symbol name="AMMS" value="1.0"/>
<symbol name="screen.isTouch" value="false"/>
+ <symbol name="screen.canvas.width" value="240"/>
<symbol name="JSR211" value="1.0"/>
- <symbol name="JSR234" value="1.0"/>
+ <symbol name="screen.canvas.y" value="40"/>
+ <symbol name="screen.canvas.x" value="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="CLDC-1.1"/>
+ <symbol name="version.configuration" value="CDLC-1.1"/>
<symbol name="version.profile" value="MIDP-2.1"/>
- <symbol name="JSR180" value="1.0"/>
<symbol name="screen.height" value="320"/>
</symbolSet>
</configuration>
@@ -52,20 +50,20 @@
<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="WMA" value="1.1"/>
<symbol name="version.profile" value="MIDP-2.1"/>
- <symbol name="WMA" value="1.1"/>
<symbol name="screen.height" value="160"/>
</symbolSet>
</configuration>
- <configuration active="true" name="DefaultColorPhone">
- <device group="Series 40 5th Edition SDK, Feature Pack 1 Lite" name="S40_5th_Edition_SDK_Feature_Pack_1_Lite"/>
+ <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"/>
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java 2010-10-19 18:02:48 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java 2010-10-20 07:38:45 +0000
@@ -83,6 +83,7 @@
private TextField serverURL;
private TextField pinTextField;
private ChoiceGroup periodChoice;
+ private ChoiceGroup choiceGroup;
private Alert successAlert;
private Alert errorAlert;
private Form activityEntryForm;
@@ -1179,6 +1180,12 @@
intField.setString(dataValue.getVal());
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);
@@ -2068,6 +2075,9 @@
TextField intField = (TextField) dataElements.get(de);
val = intField.getString();
+ } else if (de.getType().equals("bool")) {
+ ChoiceGroup boolField = (ChoiceGroup) dataElements.get(de);
+ val = boolField.isSelected(0) == true ? "true" : "false";
} else {
TextField txtField = (TextField) dataElements.get(de);
val = txtField.getString();
=== added directory 'DHISMobile/src/org/hisp/dhis/mobile/test'
=== added file 'DHISMobile/src/org/hisp/dhis/mobile/test/AllTestSuite.java'
--- DHISMobile/src/org/hisp/dhis/mobile/test/AllTestSuite.java 1970-01-01 00:00:00 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/test/AllTestSuite.java 2010-10-20 07:38:45 +0000
@@ -0,0 +1,24 @@
+package org.hisp.dhis.mobile.test;
+
+import jmunit.framework.cldc11.TestSuite;
+
+public class AllTestSuite extends TestSuite {
+
+ /**
+ * TestSuite Class constructor initializes the test suite.
+ */
+ public AllTestSuite() {
+ super("AllTestSuite");
+ this.setupSuite();
+ }
+
+ /**
+ * This method adds all suite test cases to be run.
+ */
+ private void setupSuite() {
+ //JMUnit-BEGIN
+ add(new Base64Test());
+ //JMUnit-END
+ }
+
+}
=== added file 'DHISMobile/src/org/hisp/dhis/mobile/test/Base64Test.java'
--- DHISMobile/src/org/hisp/dhis/mobile/test/Base64Test.java 1970-01-01 00:00:00 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/test/Base64Test.java 2010-10-20 07:38:45 +0000
@@ -0,0 +1,51 @@
+package org.hisp.dhis.mobile.test;
+import org.hisp.dhis.mobile.reporting.connection.Base64;
+
+import jmunit.framework.cldc11.AssertionFailedException;
+import jmunit.framework.cldc11.TestCase;
+
+/**
+ * A test case to look at the Base64 encoding and verifying it correctly
+ * generates characters
+ */
+public class Base64Test extends TestCase {
+
+ public Base64Test() {
+ super(2, "Base64Test");
+ }
+
+ public void test(int testNumber) {
+ switch (testNumber) {
+ case 0:
+ testDecode();
+ break;
+ case 1:
+ testEncode();
+ break;
+ default:
+ break;
+ }
+ }
+
+ 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 = "";
+ String result_1 = Base64.encode(bytes_1, 0, bytes_1.length);
+ assertEquals(expResult_1, result_1);
+ fail("Could not encode correctly");
+ }
+}