dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11211
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3170: Work in progress - removing mobile client generation code
------------------------------------------------------------
revno: 3170
committer: Saptarshi <sunbiz@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2011-03-27 17:43:20 +0200
message:
Work in progress - removing mobile client generation code
removed:
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/createMobileAppPage.vm
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/dataElementsResponse.vm
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/pom.xml
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/README
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DHISMobile.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DatasetPage.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/FormRunner.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/FormsListPage.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/PeriodPage.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SendPage.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SettingsPage.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SplashScreen.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/DateForm.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizDateField.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizImplementationFactory.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizMidpImplementation.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizTextArea.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/dhismobile-icon.png
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/dhismobile.res
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/splash/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/splash/dhislogo.png
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/site/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/site/apt/
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/splashUploadResponse.vm
modified:
dhis-mobile/dhis-service-mobile/pom.xml
dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/SmsService.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm
--
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 'dhis-mobile/dhis-service-mobile/pom.xml'
--- dhis-mobile/dhis-service-mobile/pom.xml 2011-03-02 03:38:25 +0000
+++ dhis-mobile/dhis-service-mobile/pom.xml 2011-03-27 15:43:20 +0000
@@ -15,16 +15,15 @@
<repositories>
<repository>
- <id>motech-repo</id>
- <name>Motech Maven Repository</name>
- <url>http://motech.rcg.usm.maine.edu/archiva/repository/all</url>
+ <id>smslib-staging-037</id>
+ <url>https://oss.sonatype.org/content/repositories/orgsmslib-037</url>
+ <snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<dependencies>
<!-- DHIS -->
-
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-api</artifactId>
@@ -32,10 +31,21 @@
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-service-core</artifactId>
- </dependency>
-
+ </dependency>
+
+ <!-- smslib -->
+ <dependency>
+ <groupId>org.smslib</groupId>
+ <artifactId>smslib</artifactId>
+ <version>3.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.rxtx</groupId>
+ <artifactId>rxtx</artifactId>
+ <version>2.1.7</version>
+ </dependency>
+
<!-- Other -->
-
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
@@ -46,26 +56,6 @@
<artifactId>quartz</artifactId>
<version>1.6.3</version>
</dependency>
- <dependency>
- <groupId>smslib</groupId>
- <artifactId>smslib-all</artifactId>
- <version>3.4.5</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.5.11</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- <version>1.5.11</version>
- </dependency>
- <dependency>
- <groupId>org.rxtx</groupId>
- <artifactId>rxtx</artifactId>
- <version>2.1.7</version>
- </dependency>
</dependencies>
<properties>
=== modified file 'dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/SmsService.java'
--- dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/SmsService.java 2010-12-03 13:29:28 +0000
+++ dhis-mobile/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/SmsService.java 2011-03-27 15:43:20 +0000
@@ -36,7 +36,6 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -48,6 +47,7 @@
import org.hisp.dhis.mobile.api.SendSMS;
import org.hisp.dhis.mobile.api.SendSMSService;
import org.hisp.dhis.mobile.api.XmlCreatorService;
+import org.smslib.AGateway;
import org.smslib.GatewayException;
import org.smslib.ICallNotification;
import org.smslib.IInboundMessageNotification;
@@ -63,6 +63,7 @@
import org.smslib.InboundMessage.MessageClasses;
import org.smslib.Message.MessageTypes;
import org.smslib.OutboundWapSIMessage.WapSISignals;
+import org.smslib.helper.Logger;
import org.smslib.modem.SerialModemGateway;
public class SmsService implements MessageService
@@ -86,13 +87,12 @@
}
private SendSMSService sendSMSService;
-
+
public void setSendSMSService( SendSMSService sendSMSService )
{
this.sendSMSService = sendSMSService;
}
-
/*------------------------------------------------------------------
* Implementation
------------------------------------------------------------------*/
@@ -114,13 +114,13 @@
public SmsService()
{
- serv = new Service();
+ serv = Service.getInstance();
inboundNotification = new InboundNotification();
outboundNotification = new OutboundNotification();
callNotification = new CallNotification();
}
-
- @Override
+
+ @Override
public String sendOtaMessage( String recipient, String url, String prompt )
{
String status = new String();
@@ -143,7 +143,7 @@
}
return status;
}
-
+
private Service getService()
{
return serv;
@@ -213,9 +213,9 @@
if ( getServiceStatus() )
{
serv.createGroup( groupName );
-
+
//Collection<OutboundMessage> messages = new ArrayList<OutboundMessage>();
- for( String recepient : recepients )
+ for ( String recepient : recepients )
{
//OutboundMessage message = new OutboundMessage( recepient, msg );
//System.out.println("Phone:"+recepient);
@@ -224,118 +224,115 @@
}
OutboundMessage message = new OutboundMessage( groupName, msg );
-
+
try
{
- serv.sendMessage( message );
+ serv.sendMessage( message );
//serv.sendMessages( messages );
- getService().getLogger().logInfo( "Message Sent to Group: " + groupName, null, null );
+ Logger.getInstance().logInfo( "Message Sent to Group: " + groupName, null, null );
return "SUCCESS";
- }
- catch ( TimeoutException ex )
- {
- getService().getLogger().logError( "Timeout error in sending message", ex, null );
- return "ERROR";
- }
- catch ( GatewayException ex )
- {
- getService().getLogger().logError( "Gateway Exception in sending message", ex, null );
- return "ERROR";
- }
- catch ( IOException ex )
- {
- getService().getLogger().logError( "IO Exception in sending message", ex, null );
- return "ERROR";
- }
- catch ( InterruptedException ex )
- {
- getService().getLogger().logError( "Interrupted Exception in sending message", ex, null );
- return "ERROR";
- }
- finally
+ } catch ( TimeoutException ex )
+ {
+ Logger.getInstance().logError( "Timeout error in sending message", ex, null );
+ return "ERROR";
+ } catch ( GatewayException ex )
+ {
+ Logger.getInstance().logError( "Gateway Exception in sending message", ex, null );
+ return "ERROR";
+ } catch ( IOException ex )
+ {
+ Logger.getInstance().logError( "IO Exception in sending message", ex, null );
+ return "ERROR";
+ } catch ( InterruptedException ex )
+ {
+ Logger.getInstance().logError( "Interrupted Exception in sending message", ex, null );
+ return "ERROR";
+ } finally
{
serv.removeGroup( groupName );
}
- }
- else
+ } else
{
- getService().getLogger().logError( "Service not running", null, null );
+ Logger.getInstance().logError( "Service not running", null, null );
return "SERVICE NOT RUNNING";
}
}
-
+
@Override
public String sendDrafts()
{
int successCount = 0;
int failCount = 0;
-
+
int draftCount = (int) sendSMSService.getRowCount();
-
+
List<SendSMS> sendSMSList = new ArrayList<SendSMS>();
-
- if( draftCount == 0 )
+
+ if ( draftCount == 0 )
{
return "No Drafts to send";
- }
- else if( draftCount < SendSMS.sendSMSRange )
- {
- sendSMSList.addAll( sendSMSService.getSendSMS( 0, draftCount ) );
- }
- else
- {
- sendSMSList.addAll( sendSMSService.getSendSMS( 0, SendSMS.sendSMSRange-1 ) );
+ } else
+ {
+ if ( draftCount < SendSMS.sendSMSRange )
+ {
+ sendSMSList.addAll( sendSMSService.getSendSMS( 0, draftCount ) );
+ } else
+ {
+ sendSMSList.addAll( sendSMSService.getSendSMS( 0, SendSMS.sendSMSRange - 1 ) );
+ }
}
- for( SendSMS sendSMS : sendSMSList )
+ for ( SendSMS sendSMS : sendSMSList )
{
String status = sendMessage( sendSMS.getSenderInfo().split( "_" )[0], sendSMS.getSendingMessage() );
- if( status.equalsIgnoreCase( "SUCCESS" ) )
+ if ( status.equalsIgnoreCase( "SUCCESS" ) )
{
sendSMSService.deleteSendSMS( sendSMS );
successCount++;
- }
- else if( status.equalsIgnoreCase( "MODEMERROR" ) )
- {
- getService().getLogger().logError( "Modem Stops Responding...Till then successfully sent : "+successCount, null, null );
- return "Modem Stops Responding...Till then successfully sent : "+successCount;
- }
- else
- {
- failCount++;
+ } else
+ {
+ if ( status.equalsIgnoreCase( "MODEMERROR" ) )
+ {
+ Logger.getInstance().logError( "Modem Stops Responding...Till then successfully sent : " + successCount, null, null );
+ return "Modem Stops Responding...Till then successfully sent : " + successCount;
+ } else
+ {
+ failCount++;
+ }
}
}
-
- return "SMS Successfully Sent : "+ successCount +" Failed : " + failCount;
+
+ return "SMS Successfully Sent : " + successCount + " Failed : " + failCount;
}
-
+
@Override
public String sendMessages( List<SendSMS> sendSMSList )
{
int successCount = 0;
int failCount = 0;
-
- for( SendSMS sendSMS : sendSMSList )
+
+ for ( SendSMS sendSMS : sendSMSList )
{
String status = sendMessage( sendSMS.getSenderInfo().split( "_" )[0], sendSMS.getSendingMessage() );
- if( status.equalsIgnoreCase( "SUCCESS" ) )
+ if ( status.equalsIgnoreCase( "SUCCESS" ) )
{
successCount++;
- }
- else if( status.equalsIgnoreCase( "MODEMERROR" ) )
- {
- getService().getLogger().logError( "Modem Stops Responding...Till then successfully sent : "+successCount, null, null );
- return "Modem Stops Responding...Till then successfully sent : "+successCount;
- }
- else
- {
- failCount++;
+ } else
+ {
+ if ( status.equalsIgnoreCase( "MODEMERROR" ) )
+ {
+ Logger.getInstance().logError( "Modem Stops Responding...Till then successfully sent : " + successCount, null, null );
+ return "Modem Stops Responding...Till then successfully sent : " + successCount;
+ } else
+ {
+ failCount++;
+ }
}
}
-
- return "Successfully sent : "+ successCount +" Failed : " + failCount;
+
+ return "Successfully sent : " + successCount + " Failed : " + failCount;
}
-
+
@Override
public String sendMessage( String recipient, String msg )
{
@@ -344,41 +341,35 @@
{
try
{
- if( serv.sendMessage( message ) )
+ if ( serv.sendMessage( message ) )
{
- getService().getLogger().logInfo( "Message Sent to: " + recipient, null, null );
+ Logger.getInstance().logInfo( "Message Sent to: " + recipient, null, null );
return "SUCCESS";
- }
- else
+ } else
{
- getService().getLogger().logError( "Timeout error in sending message to: "+recipient, null, null );
+ Logger.getInstance().logError( "Timeout error in sending message to: " + recipient, null, null );
return "MODEMERROR";
}
- }
- catch ( TimeoutException ex )
- {
- getService().getLogger().logError( "Timeout error in sending message", ex, null );
- return "ERROR";
- }
- catch ( GatewayException ex )
- {
- getService().getLogger().logError( "Gateway Exception in sending message", ex, null );
- return "ERROR";
- }
- catch ( IOException ex )
- {
- getService().getLogger().logError( "IO Exception in sending message", ex, null );
- return "ERROR";
- }
- catch ( InterruptedException ex )
- {
- getService().getLogger().logError( "Interrupted Exception in sending message", ex, null );
+ } catch ( TimeoutException ex )
+ {
+ Logger.getInstance().logError( "Timeout error in sending message", ex, null );
+ return "ERROR";
+ } catch ( GatewayException ex )
+ {
+ Logger.getInstance().logError( "Gateway Exception in sending message", ex, null );
+ return "ERROR";
+ } catch ( IOException ex )
+ {
+ Logger.getInstance().logError( "IO Exception in sending message", ex, null );
+ return "ERROR";
+ } catch ( InterruptedException ex )
+ {
+ Logger.getInstance().logError( "Interrupted Exception in sending message", ex, null );
return "ERROR";
}
- }
- else
+ } else
{
- getService().getLogger().logError( "Service not running", null, null );
+ Logger.getInstance().logError( "Service not running", null, null );
return "SERVICE NOT RUNNING";
}
}
@@ -389,90 +380,82 @@
int delSMSflag = 0;
try
{
- getService().getLogger().logInfo( "---Starting processing message---", null, null );
+ Logger.getInstance().logInfo( "---Starting processing message---", null, null );
InboundBinaryMessage binaryMsg = (InboundBinaryMessage) message;
byte[] compressedData = binaryMsg.getDataBytes();
String unCompressedText = new String( Compressor.decompress( compressedData ), "UTF-8" );
String sender = binaryMsg.getOriginator();
Date sendTime = binaryMsg.getDate();
-
+
// Creating XML File
- getService().getLogger().logInfo( "Creating XML file...", null, null );
+ Logger.getInstance().logInfo( "Creating XML file...", null, null );
createXMLFile( sender, sendTime, unCompressedText );
-
+
//Delete SMS
- getService().getLogger().logInfo( "Deleting SMS...", null, null );
+ Logger.getInstance().logInfo( "Deleting SMS...", null, null );
if ( getProperties().getProperty( "settings.delete_after_processing", "no" ).equalsIgnoreCase( "yes" ) )
{
try
{
getService().deleteMessage( (InboundMessage) message );
- getService().getLogger().logInfo( "Deleted message", null, null );
+ Logger.getInstance().logInfo( "Deleted message", null, null );
delSMSflag = 1;
- }
- catch ( Exception e )
+ } catch ( Exception e )
{
- getService().getLogger().logError( "Error deleting received message!", e, null );
+ Logger.getInstance().logError( "Error deleting received message!", e, null );
}
}
-
+
// Import data into DHIS
//getService().getLogger().logInfo( "Importing data into DHIS...", null, null );
//String statusMessage = importData( sender, sendTime, unCompressedText );
-
+
//Sending ACK/Status SMS
//getService().getLogger().logInfo( "Sending ACK/Status messge...", null, null );
//sendMessage( sender, statusMessage );
-
- getService().getLogger().logInfo( "---Message Processing Finished---", null, null );
-
+
+ Logger.getInstance().logInfo( "---Message Processing Finished---", null, null );
+
//String statusMessage = saveData( sender, sendTime, unCompressedText );
//getService().getLogger().logInfo( "Saved Report. Sending Acknowledgement to " + sender, null, null );
//sendAck( sender, "REPORT", unCompressedText );
//sendMessage( sender, statusMessage );
- }
- catch ( UnsupportedEncodingException uneex )
- {
- getService().getLogger().logError( "Error reading encoding: ", uneex, null );
- return;
- }
- catch ( ClassCastException ccex )
- {
- getService().getLogger().logError( "Error performing ClassCast: ", ccex, null );
- return;
- }
- catch ( ArithmeticException aex )
- {
- getService().getLogger().logError( "Error performing arithmatic operation: ", aex, null );
- return;
- }
- catch (ArrayIndexOutOfBoundsException aiobex)
- {
- getService().getLogger().logError( "Error with message format. PLEASE CHECK APP VERSION: ", aiobex, null );
- return;
- }
- catch (NullPointerException npex)
- {
- getService().getLogger().logError( "MISSING form number. PLEASE CHECK formIDLayout.csv: ", npex, null );
- return;
- }
- finally
+ } catch ( UnsupportedEncodingException uneex )
+ {
+ Logger.getInstance().logError( "Error reading encoding: ", uneex, null );
+ return;
+ } catch ( ClassCastException ccex )
+ {
+ Logger.getInstance().logError( "Error performing ClassCast: ", ccex, null );
+ return;
+ } catch ( ArithmeticException aex )
+ {
+ Logger.getInstance().logError( "Error performing arithmatic operation: ", aex, null );
+ return;
+ } catch ( ArrayIndexOutOfBoundsException aiobex )
+ {
+ Logger.getInstance().logError( "Error with message format. PLEASE CHECK APP VERSION: ", aiobex, null );
+ return;
+ } catch ( NullPointerException npex )
+ {
+ Logger.getInstance().logError( "MISSING form number. PLEASE CHECK formIDLayout.csv: ", npex, null );
+ return;
+ } finally
{
if ( getProperties().getProperty( "settings.delete_after_processing", "no" ).equalsIgnoreCase( "yes" ) && delSMSflag == 0 )
{
try
{
getService().deleteMessage( (InboundMessage) message );
- getService().getLogger().logInfo( "Deleted message", null, null );
- }
- catch ( Exception e )
+ Logger.getInstance().logInfo( "Deleted message", null, null );
+ } catch ( Exception e )
{
- getService().getLogger().logError( "Error deleting received message!", e, null );
+ Logger.getInstance().logError( "Error deleting received message!", e, null );
}
}
- getService().getLogger().logInfo( "---Message Processing Finished---", null, null );
+ Logger.getInstance().logInfo( "---Message Processing Finished---", null, null );
}
}
@@ -526,7 +509,7 @@
xmlCreatorService.setSendTime( timeStamp );
xmlCreatorService.setInfo( data );
xmlCreatorService.run(); //should be made thread-safe
- getService().getLogger().logInfo( "XML successfully created for msg from: " + mobileNumber, null, null );
+ Logger.getInstance().logInfo( "XML successfully created for msg from: " + mobileNumber, null, null );
}
public String importData( String mobileNumber, Date sendTime, String data )
@@ -536,10 +519,10 @@
String importFileName = mobileNumber + "_" + timeStamp.replace( ":", "-" ) + ".xml";
String statusMessage = mobileImportService.importXMLFile( importFileName );
- getService().getLogger().logInfo( "Importing Completed for current messages", null, null );
+ Logger.getInstance().logInfo( "Importing Completed for current messages", null, null );
return statusMessage;
}
-
+
@Override
public String saveData( String mobileNumber, Date sendTime, String data )
{
@@ -549,69 +532,66 @@
xmlCreatorService.setSendTime( timeStamp );
xmlCreatorService.setInfo( data );
xmlCreatorService.run(); //should be made thread-safe
- getService().getLogger().logInfo( "XML successfully created for msg from: " + mobileNumber, null, null );
+ Logger.getInstance().logInfo( "XML successfully created for msg from: " + mobileNumber, null, null );
//mobileImportService.importAllFiles();
String importFileName = mobileNumber + "_" + timeStamp.replace( ":", "-" ) + ".xml";
String statusMessage = mobileImportService.importXMLFile( importFileName );
- getService().getLogger().logInfo( "Importing Completed for current messages", null, null );
+ Logger.getInstance().logInfo( "Importing Completed for current messages", null, null );
return statusMessage;
}
private void processStatusReport( InboundMessage message )
{
String originator = message.getOriginator();
- getService().getLogger().logInfo( "STATUS REPORT received from: " + originator, null, null );
+ Logger.getInstance().logInfo( "STATUS REPORT received from: " + originator, null, null );
}
@Override
public String processPendingMessages()
{
- if( !getServiceStatus() )
+ if ( !getServiceStatus() )
{
- getService().getLogger().logError( "SMSService not running", null, null );
-
+ Logger.getInstance().logError( "SMSService not running", null, null );
return "SMSService not running";
}
-
+
List<InboundMessage> msgList = new ArrayList<InboundMessage>();
-
+
msgList = readAllMessages();
-
- if( msgList != null && msgList.size() > 0 )
+
+ if ( msgList != null && msgList.size() > 0 )
{
- for( InboundMessage msg : msgList )
+ for ( InboundMessage msg : msgList )
{
processMessage( msg );
}
-
+
return "Successfully Processed all Pending Messages.";
- }
- else
+ } else
{
return "No Pending Messages to Process.";
}
}
-
+
@Override
- public Map<String,String> readAllPendingMessages()
+ public Map<String, String> readAllPendingMessages()
{
- if( !getServiceStatus() )
+ if ( !getServiceStatus() )
{
- getService().getLogger().logError( "SMSService not running", null, null );
-
+ Logger.getInstance().logError( "SMSService not running", null, null );
return null;
}
-
- Map<String,String> pendingMessages = new HashMap<String,String>();
+
+ Map<String, String> pendingMessages = new HashMap<String, String>();
// Define a list which will hold the read messages.
List<InboundMessage> msgList = new ArrayList<InboundMessage>();
try
{
- getService().getLogger().logInfo( "Reading All Pending Messages...", null, null );
-
- serv.readMessages(msgList, MessageClasses.ALL);
-
- for( Object msg : msgList )
+ Logger.getInstance().logInfo( "Reading All Pending Messages...", null, null );
+
+ serv.readMessages( msgList, MessageClasses.ALL );
+
+ for ( Object msg : msgList )
{
try
{
@@ -622,76 +602,66 @@
String sender = binaryMsg.getOriginator();
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd_HH-mm-ss" );
String timeStamp = dateFormat.format( sendTime );
-
- pendingMessages.put( sender+"_"+timeStamp, unCompressedText );
-
- }
- catch ( ClassCastException ccex )
+
+ pendingMessages.put( sender + "_" + timeStamp, unCompressedText );
+
+ } catch ( ClassCastException ccex )
{
InboundMessage message = (InboundMessage) msg;
Date sendTime = message.getDate();
String sender = message.getOriginator();
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd_HH-mm-ss" );
String timeStamp = dateFormat.format( sendTime );
-
+
try
{
- pendingMessages.put( sender+"_"+timeStamp, message.getText() );
- getService().getLogger().logInfo( "Normal Text Message", null, null );
- }
- catch( Exception e )
+ pendingMessages.put( sender + "_" + timeStamp, message.getText() );
+ Logger.getInstance().logInfo( "Normal Text Message", null, null );
+ } catch ( Exception e )
{
- pendingMessages.put( sender+"_"+timeStamp, "Unsupported Format" );
- getService().getLogger().logError( "UnSupported Format", null, null );
+ pendingMessages.put( sender + "_" + timeStamp, "Unsupported Format" );
+ Logger.getInstance().logError( "UnSupported Format", null, null );
}
- }
- catch( Exception e )
+ } catch ( Exception e )
{
- getService().getLogger().logError( "Error While reading messages, returning whatever sms got till now", null, null );
+ Logger.getInstance().logError( "Error While reading messages, returning whatever sms got till now", null, null );
return pendingMessages;
}
}
-
+
return pendingMessages;
- }
- catch (Exception e)
+ } catch ( Exception e )
{
e.printStackTrace();
- getService().getLogger().logError( "SMSServer: error setting custom balancer!", null, null );
-
+ Logger.getInstance().logError( "SMSServer: error setting custom balancer!", null, null );
return null;
}
}
-
+
@Override
public List<InboundMessage> readAllMessages()
{
- if( !getServiceStatus() )
+ if ( !getServiceStatus() )
{
- getService().getLogger().logError( "SMSService not running", null, null );
-
+ Logger.getInstance().logError( "SMSService not running", null, null );
return null;
}
-
+
// Define a list which will hold the read messages.
List<InboundMessage> msgList = new ArrayList<InboundMessage>();
try
{
- getService().getLogger().logInfo( "Reading All Messages...", null, null );
-
- serv.readMessages(msgList, MessageClasses.ALL);
-
+ Logger.getInstance().logInfo( "Reading All Messages...", null, null );
+ serv.readMessages( msgList, MessageClasses.ALL );
return msgList;
- }
- catch (Exception e)
+ } catch ( Exception e )
{
e.printStackTrace();
- getService().getLogger().logError( "SMSServer: error setting custom balancer!", null, null );
-
+ Logger.getInstance().logError( "SMSServer: error setting custom balancer!", null, null );
return null;
}
}
-
+
/*------------------------------------------------------------------
* Internal methods
------------------------------------------------------------------*/
@@ -700,7 +670,7 @@
private String loadConfiguration() throws Exception
{
CONFIG_FILE = System.getenv( "DHIS2_HOME" ) + File.separator + "SMSServer.conf";
-
+
if ( new File( CONFIG_FILE ).exists() )
{
FileInputStream f = new FileInputStream( CONFIG_FILE );
@@ -725,11 +695,11 @@
Constructor<?> constructor = c.getConstructor( argsClass );
org.smslib.balancing.LoadBalancer balancer = (org.smslib.balancing.LoadBalancer) constructor.newInstance( args );
getService().setLoadBalancer( balancer );
- getService().getLogger().logInfo( "SMSServer: set balancer to: " + getProperties().getProperty( "smsserver.balancer", "" ), null, null );
+ Logger.getInstance().logInfo( "SMSServer: set balancer to: " + getProperties().getProperty( "smsserver.balancer", "" ), null, null );
} catch ( Exception e )
{
e.printStackTrace();
- getService().getLogger().logError( "SMSServer: error setting custom balancer!", null, null );
+ Logger.getInstance().logError( "SMSServer: error setting custom balancer!", null, null );
}
}
//</editor-fold>
@@ -751,10 +721,10 @@
Constructor<?> constructor = c.getConstructor( argsClass );
org.smslib.routing.Router router = (org.smslib.routing.Router) constructor.newInstance( args );
getService().setRouter( router );
- getService().getLogger().logInfo( "SMSServer: set router to: " + getProperties().getProperty( "smsserver.router", "" ), null, null );
+ Logger.getInstance().logInfo( "SMSServer: set router to: " + getProperties().getProperty( "smsserver.router", "" ), null, null );
} catch ( Exception e )
{
- getService().getLogger().logError( "SMSServer: error setting custom balancer!", null, null );
+ Logger.getInstance().logError( "SMSServer: error setting custom balancer!", null, null );
}
}
//</editor-fold>
@@ -779,13 +749,13 @@
String pin = getProperties().getProperty( modemName + ".pin" );
String inbound = getProperties().getProperty( modemName + ".inbound" );
String outbound = getProperties().getProperty( modemName + ".outbound" );
- String simMemLocation = getProperties().getProperty(modemName + ".simMemLocation");
+ String simMemLocation = getProperties().getProperty( modemName + ".simMemLocation" );
SerialModemGateway gateway = new SerialModemGateway( modemName, port, baudRate, manufacturer, model );
- if( simMemLocation != null || !simMemLocation.equals("-") )
+ if ( simMemLocation != null || !simMemLocation.equals( "-" ) )
{
- gateway.getATHandler().setStorageLocations(simMemLocation);
+ gateway.getATHandler().setStorageLocations( simMemLocation );
}
if ( protocol != null && protocol.equalsIgnoreCase( "PDU" ) )
@@ -829,10 +799,10 @@
{
getService().addGateway( gateway );
}
- getService().getLogger().logInfo( "SMSServer: added gateway " + i + " / ", null, null );
+ Logger.getInstance().logInfo( "SMSServer: added gateway " + i + " / ", null, null );
} catch ( Exception e )
{
- getService().getLogger().logError( "SMSServer: Unknown Gateway in configuration file!, " + e.getMessage(), null, null );
+ Logger.getInstance().logError( "SMSServer: Unknown Gateway in configuration file!, " + e.getMessage(), null, null );
e.printStackTrace();
}
}
@@ -858,18 +828,17 @@
{
@Override
- public void process( String gatewayId, MessageTypes msgType, InboundMessage msg )
+ public void process( AGateway gatewayId, MessageTypes msgType, InboundMessage msg )
{
if ( msgType == MessageTypes.INBOUND )
{
- getService().getLogger().logInfo( "New INBOUND MESSAGE on Gateway: " + gatewayId + " from " + msg.getOriginator(), null, null );
+ Logger.getInstance().logInfo( "New INBOUND MESSAGE on Gateway: " + gatewayId + " from " + msg.getOriginator(), null, null );
processMessage( msg );
- }
- else
+ } else
{
if ( msgType == MessageTypes.STATUSREPORT )
{
- getService().getLogger().logInfo( "New STATUS REPORT on Gateway: " + gatewayId + " from " + msg.getOriginator(), null, null );
+ Logger.getInstance().logInfo( "New STATUS REPORT on Gateway: " + gatewayId + " from " + msg.getOriginator(), null, null );
processStatusReport( msg );
}
@@ -878,29 +847,13 @@
try
{
getService().deleteMessage( msg );
- getService().getLogger().logInfo( "Deleted message", null, null );
- }
- catch ( Exception e )
+ Logger.getInstance().logInfo( "Deleted message", null, null );
+ } catch ( Exception e )
{
- getService().getLogger().logError( "Error deleting received message!", e, null );
+ Logger.getInstance().logError( "Error deleting received message!", e, null );
}
}
}
-
- /*
- if ( getProperties().getProperty( "settings.delete_after_processing", "no" ).equalsIgnoreCase( "yes" ) )
- {
- try
- {
- getService().deleteMessage( msg );
- getService().getLogger().logInfo( "Deleted message", null, null );
- }
- catch ( Exception e )
- {
- getService().getLogger().logError( "Error deleting received message!", e, null );
- }
- }
- */
}
}
//</editor-fold>
@@ -910,7 +863,7 @@
{
@Override
- public void process( String gtwId, org.smslib.OutboundMessage msg )
+ public void process( AGateway gtwId, OutboundMessage msg )
{
}
}
@@ -921,9 +874,9 @@
{
@Override
- public void process( String gtwId, OutboundMessage msg )
+ public void process( AGateway gtwId, OutboundMessage msg )
{
- getService().getLogger().logInfo( "**** >>>> Now Sending: " + msg.getRecipient(), null, gtwId );
+ Logger.getInstance().logInfo( "**** >>>> Now Sending: " + msg.getRecipient(), null, gtwId.getGatewayId() );
}
}
//</editor-fold>
@@ -932,14 +885,13 @@
class CallNotification implements ICallNotification
{
- public void process( String gatewayId, String callerId )
+ @Override
+ public void process( AGateway gatewayId, String callerId )
{
- getService().getLogger().logInfo( "**** >>>> Getting call from: " + callerId, null, null );
+ Logger.getInstance().logInfo( "**** >>>> Getting call from: " + callerId, null, null );
}
}
//</editor-fold>
-
-
//</editor-fold>
/*----------------------------------------------------------------*/
}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/createMobileAppPage.vm'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/createMobileAppPage.vm 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/createMobileAppPage.vm 1970-01-01 00:00:00 +0000
@@ -1,101 +0,0 @@
-<link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/util/css/redmond/jquery-ui.css">
-<script type="text/javascript" src="../dhis-web-commons/util/jquery-ui.js"></script>
-<script type="text/javascript" src="javascript/jquery-form.js"></script>
-<script type="text/javascript" src="javascript/createMobileApp.js"></script>
-<table width="100%">
- <tr>
- <td>
- <h1>Create Mobile Application</h1>
- <div id="mvnStatusDiv">
- #set ($path = "$!mvnPath")
- #if($path != "")
- #set ($status = "$!mvnStatus")
- #if($status != "")
- <span style="color:red">$status</span> <br/>
- #end
- <img src="../images/check.png" alt="" /> Using mvn found in PATH at $path (<a href="javascript: showPathField()">Change</a>)<br/><br/>
- <div id="mvnDiv">
- <form id="mvnForm" method="post">
- Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
- <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
- </form>
- </div>
- #else
- #set ($status = "$!mvnStatus")
- #if($status != "")
- <span style="color:red">$status</span>
- #end
- mvn not found... Please configure mvn location <br/>
- <form id="mvnForm" method="post">
- Enter mvn Folder Path: <input name="mvnPath" type="text" value="$!mvnPath" size="40" />
- <input type="button" value="Set mvn Path" onclick="submitMvnForm()" />
- </form>
- #end
- </div>
- </td>
- <td align="right">
- #if ($mobileAppFilename)
- <a href="javame_src/target/$mobileAppFilename">Download $mobileAppFilename</a>
- #end
- </td>
- </tr>
-</table>
-
-<input id="mvnBin" style=" visibility: hidden" name="mvnBin" value="$path"/>
-<div id="accordion">
- <h3><a href="#">Step 1: Splash Screen Selection</a></h3>
- <div id="splashDesigner" style="height: 180px">
- <div id="splashUpdate">
- <table>
- <tr>
- #foreach($var in $splashImg)
- <td>
- <div style=" width: 96px; height: 120px; border: dotted; text-align: center;">
- <img style="margin-top: 30px" alt="" src="javame_src/src/main/resources/splash/$var" width="60" height="60"/> <br/>
- <input style="bottom: 5px" type="radio" name="splash" value="$var" />
- </div>
- </td>
- #end
- </tr>
- </table>
- </div> <br/>
- <div>
- <form id="splashForm" method="post" enctype="multipart/form-data">
- Splash Image: <input type="file" name="upload" size="40" />
- <input type="submit" value="Upload Image" />
- </form>
- </div>
- </div>
- <h3><a href="#">Step 2: Dataset Selection</a></h3>
- <div id="dataSetSelector">
- <form id="dataSetForm">
- <select name="dataSetName" style="vertical-align: top" >
- #foreach($var in $availableDatasets)
- <option>$var</option>
- #end
- </select>
- <a href="#" onclick="addDataSet()"><img src="../images/add.png" alt="" align="top" width="16" /></a>
- <span id="dataElementsListDiv"></span>
- </form>
- </div>
- <h3><a href="#">Step 3: Set Pages</a></h3>
- <div id="pageSelector">
- <p>
-
- </p>
- </div>
- <h3><a href="#">Step 4: Select Language Or Translate Data Elements</a></h3>
- <div id="languageSelector">
- <table>
- <tr>
- <td>English<input type="checkbox" name="langEng" value="English" /></td>
- <td>Gujarati<input type="checkbox" name="langGuj" value="Gujarati" /></td>
- <td>Punjabi<input type="checkbox" name="langPun" value="Punjabi" /></td>
- </tr>
- </table>
- </div>
- <h3><a href="#">Step 5: Generate Application</a></h3>
- <div id="jarGenerator">
- <input id="genButton" type="button" value="Generate Mobile Application" onclick="submitJarGenerator()" />
- </div>
-</div>
\ No newline at end of file
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/dataElementsResponse.vm'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/dataElementsResponse.vm 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/dataElementsResponse.vm 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-<select name="dataSet" id="$dataSetName" multiple="false" style="width: 250px; height: 180px;">
-#foreach( $dataElement in $dataElements )
- <option value="$dataElement.id">$dataElement.name</option>
-#end
-</select>
\ No newline at end of file
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src'
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/pom.xml'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/pom.xml 2010-12-29 06:38:03 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/pom.xml 1970-01-01 00:00:00 +0000
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>com.pyx4me</groupId>
- <artifactId>pyx4me</artifactId>
- <version>2.0.4</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <groupId>org.dhis2.mobile</groupId>
- <artifactId>dhis-javame</artifactId>
- <version>1.0.0</version>
- <name>dhis-javame</name>
- <description>The DHIS Mobile application with LWUIT visual elements, SMS/GPRS data transmission. Part of jar generated by the dhis-web-mobile module of DHIS 2.</description>
-
- <dependencies>
- <dependency>
- <groupId>org.microemu</groupId>
- <artifactId>microemulator</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.sun.lwuit</groupId>
- <artifactId>lwuit</artifactId>
- <version>1.3</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-
- <properties>
- <j2me.midlet.vendor>${project.organization.name}</j2me.midlet.vendor>
- <j2me.midlet.name>${project.name}</j2me.midlet.name>
- <j2me.midlet.version>${project.version}</j2me.midlet.version>
- <j2me.midlet.configuration>CLDC-1.1</j2me.midlet.configuration>
- <j2me.midlet.profile>MIDP-2.0</j2me.midlet.profile>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.3</source>
- <target>1.1</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>com.pyx4me</groupId>
- <artifactId>j2me-maven-plugin</artifactId>
- <version>2.0.4</version>
- <executions>
- <execution>
- <goals>
- <goal>package</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <useWtkLibs>false</useWtkLibs>
- <proguardPreverify>true</proguardPreverify>
- <proguardInclude>${basedir}/proguard.conf</proguardInclude>
- <proguard>true</proguard>
- <obfuscate>true</obfuscate>
- <midlets>
- <MIDlet>
- <name>DHISMobile</name>
- <icon>/dhismobile-icon.png</icon>
- <class>org.hisp.dhis.mobile.DHISMobile</class>
- </MIDlet>
- </midlets>
- <libs>
- <lib>${env.WTK_HOME}/lib/jsr226.jar</lib>
- <lib>${env.WTK_HOME}/lib/jsr184.jar</lib>
- <lib>${env.WTK_HOME}/lib/jsr75.jar</lib>
- <lib>${env.WTK_HOME}/lib/mmapi.jar</lib>
- <lib>${settings.localRepository}/org/microemu/cldcapi11/${me2Version}/cldcapi11-${me2Version}.jar</lib>
- <lib>${settings.localRepository}/org/microemu/midpapi20/${me2Version}/midpapi20-${me2Version}.jar</lib>
- </libs>
- <dependencies>
- <dependency>
- <groupId>org.microemu</groupId>
- <artifactId>microemulator</artifactId>
- <exclude>true</exclude>
- </dependency>
- </dependencies>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.microemu</groupId>
- <artifactId>cldcapi11</artifactId>
- <version>${me2Version}</version>
- </dependency>
- <dependency>
- <groupId>org.microemu</groupId>
- <artifactId>midpapi20</artifactId>
- <version>${me2Version}</version>
- </dependency>
- </dependencies>
- </plugin>
-
- <!-- install jar in project site -->
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>site-copy-artifacts</id>
- <phase>site</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <copy overwrite="true"
- file="${project.build.directory}/${project.build.finalName}-me.jar"
- tofile="${project.build.directory}/site/${artifactId}.jar"/>
- <copy overwrite="true"
- file="${project.build.directory}/${project.build.finalName}-me.jad"
- tofile="${project.build.directory}/site/${artifactId}.jad"/>
- <replace value="http://pyx4me.com/snapshot/pyx4me/midlet-example/${artifactId}.jar" token="${project.build.finalName}-me.jar"
- dir="${project.build.directory}/site">
- <include name="${artifactId}.jad"></include>
- </replace>
-
- <!-- this is not part of the example, remove it when project used as template -->
- <copy overwrite="true"
- file="${project.build.directory}/${project.build.finalName}-src.zip"
- tofile="${project.build.directory}/site/${project.build.finalName}-src.zip"/>
- <copy overwrite="true"
- file="${project.build.directory}/${project.build.finalName}-src.tar.gz"
- tofile="${project.build.directory}/site/${project.build.finalName}-src.tar.gz"/>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
-
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java'
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/README'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/README 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/README 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-This is the documentation for the dhis-javame application. It uses the
-Light-weight User Interface Toolkit (LWUIT) for the user-interface
-components of the application and targets to run with a common UI on
-even the low-cost handsets.
-
-RecordStore Documentation:
- [1] appVersion
- [2] author
- [3] messageFormat-version
- [4] update-url
- [5] Phone#1:
- [6] Phone#2:
- [7] Phone#3:
- [8] --NA--
- [9] --NA--
- [10] true (if previous msg stored) | false (if no previous msg)
\ No newline at end of file
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile'
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DHISMobile.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DHISMobile.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DHISMobile.java 1970-01-01 00:00:00 +0000
@@ -1,197 +0,0 @@
-package org.hisp.dhis.mobile;
-
-import com.sun.lwuit.Command;
-import com.sun.lwuit.Dialog;
-import com.sun.lwuit.Display;
-import com.sun.lwuit.Form;
-import com.sun.lwuit.events.ActionEvent;
-import com.sun.lwuit.events.ActionListener;
-import com.sun.lwuit.impl.ImplementationFactory;
-import com.sun.lwuit.plaf.UIManager;
-import com.sun.lwuit.util.Resources;
-import java.io.InputStream;
-import javax.microedition.midlet.*;
-import javax.microedition.rms.RecordStore;
-import javax.microedition.rms.RecordStoreException;
-import uk.co.bluetrail.lwuit.MobrizImplementationFactory;
-
-public class DHISMobile extends MIDlet implements ActionListener {
-
- //<editor-fold defaultstate="collapsed" desc=" Declarations: Customizable Elements ">
- public static String logoPath = "/splash/dhislogo.png";
- //</editor-fold>
-
- //<editor-fold defaultstate="collapsed" desc=" Declarations: Program Flow ">
- private static String[][] dataElements = {{"Total No. of Pregnant Women", "No. Registered Within 1st Trimester", "No. of New Women Registered Under JSY", "No. of Women Received 3 ANC Checkup", "No. of Women Given TT1", "No. of Women Given TT2 / Booster", "No. of Women Given 100 IFA Tablets", "New Pregnant Women with Hypertension", "No. of Pregnant Women Having HB < 11"},{""},};
- private static final FormsListPage formListPage = new FormsListPage();
- private static final PeriodPage periodPage = new PeriodPage();
- private static final DatasetPage datasetPage = new DatasetPage(dataElements[0]);
- private static final SendPage sendPage = new SendPage();
- private static final SettingsPage settingsPage = new SettingsPage();
- public static final FormRunner[] PAGES = new FormRunner[]{
- formListPage, periodPage, datasetPage, sendPage, settingsPage};
- public static int pageFlowIndex = 0;
- public static int formID = 0;
- public static Form previous;
- //</editor-fold>
- //<editor-fold defaultstate="collapsed" desc=" Declarations: Editing Previous Report ">
- private boolean firstRun = false;
- private RecordStore dataStore = null;
- private boolean savedMsg = false;
- private boolean midletPaused = false;
- private boolean editingLastReport = false;
- //</editor-fold>
- //<editor-fold defaultstate="collapsed" desc=" Declaration: Version Management ">
- public static String appVersion = "v2.0";
- public static String branding = "DHIS Mobile";
- public static String lang = "";
- //</editor-fold>
- //<editor-fold defaultstate="collapsed" desc=" Declarations: Command Buttons ">
- private static final int EXIT_COMMAND = 1;
- private static final int NEXT_COMMAND = 2;
- private static final int BACK_COMMAND = 3;
- private static final int SETTINGS_COMMAND = 4;
- private static final int SAVE_COMMAND = 5;
- private static final int SEND_COMMAND = 6;
- public static final Command exitCommand = new Command("Exit", EXIT_COMMAND);
- public static final Command nextCommand = new Command("Next", NEXT_COMMAND);
- public static final Command backCommand = new Command("Back", BACK_COMMAND);
- public static final Command settingsCommand = new Command("Settings", SETTINGS_COMMAND);
- public static final Command saveCommand = new Command("Save", SAVE_COMMAND);
- public static final Command sendCommand = new Command("Send SMS", SEND_COMMAND);
- //</editor-fold>
-
- public DHISMobile() {
- }
-
- public void startApp() {
- try {
- ImplementationFactory.setInstance(new MobrizImplementationFactory());
- Display.init(this);
- InputStream stream = getClass().getResourceAsStream("/dhismobile.res");
- Resources theme = Resources.open(stream);
- UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
- //<editor-fold defaultstate="collapsed" desc=" Initialize Record Store ">
- new Thread(new Runnable() {
-
- public void run() {
- try {
- //<editor-fold defaultstate="collapsed" desc=" Check if store exists ">
- dataStore = RecordStore.openRecordStore("dataStore", true);
- if (dataStore.getNumRecords() == 0) {
- firstRun = true;
- } else {
- firstRun = false;
- }
- //</editor-fold>
- //<editor-fold defaultstate="collapsed" desc=" Create RecordStore with 90 rows ">
- if (firstRun) {
- for (int i = 0; i < 90; i++) {
- try {
- dataStore.addRecord("".getBytes(), 0, "".getBytes().length);
- } catch (RecordStoreException rsex) {
- rsex.printStackTrace();
- }
- }
- } //</editor-fold>
- //<editor-fold defaultstate="collapsed" desc=" Check if any previous msg Stored ">
- else {
- if (dataStore.getRecord(10) != null) {
- String checkSaved = new String(dataStore.getRecord(10));
- if (checkSaved.equals("true")) {
- savedMsg = true;
- }
- }
- }
- //</editor-fold>
- } catch (RecordStoreException ex) {
- ex.printStackTrace();
- }
- }
- }).start();
- //</editor-fold>
- showSplashScreen();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- /*
- * 1.) Shows Splash Screen in full screen
- * 2.) Sleeps for 3 seconds
- * 3.) Checks the edit previous report message
- * 4.) Displays the first screen in the PAGE Flow
- */
- private void showSplashScreen() {
- SplashScreen splash = new SplashScreen();
- splash.setFullScreenMode(true);
- getDisplay().setCurrent(splash);
- try {
- Thread.sleep(3000);
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
- if (savedMsg) {
- // will return true if the user clicks "YES"
- if (!Dialog.show("Question", "Do you want to edit your last submitted report?", "YES", "NO")) {
- editingLastReport = true;
- }
- }
- PAGES[pageFlowIndex].run(new Command[]{exitCommand, settingsCommand}, this);
- }
-
- private void showSettingsPage() {
- SettingsPage form = new SettingsPage();
- DHISMobile.previous = form.run(new Command[]{backCommand, saveCommand}, this);
- }
-
- public void pauseApp() {
- }
-
- public void destroyApp(boolean unconditional) {
- }
-
- public void exitMIDlet() {
- getDisplay().setCurrent(null);
- destroyApp(true);
- notifyDestroyed();
- }
-
- public javax.microedition.lcdui.Display getDisplay() {
- return javax.microedition.lcdui.Display.getDisplay(this);
- }
-
- public void actionPerformed(ActionEvent evt) {
- Command cmd = evt.getCommand();
- switch (cmd.getId()) {
- case EXIT_COMMAND:
- exitMIDlet();
- break;
- case NEXT_COMMAND:
- if (pageFlowIndex < (PAGES.length - 3)) {
- pageFlowIndex += 1;
- previous = PAGES[pageFlowIndex].run(new Command[]{backCommand, nextCommand}, this);
- } else if (pageFlowIndex == (PAGES.length - 3)) {
- pageFlowIndex += 1;
- previous = PAGES[pageFlowIndex].run(new Command[]{backCommand, settingsCommand, sendCommand}, this);
- }
- break;
- case BACK_COMMAND:
- if (Display.getInstance().getCurrent().getTitle().equals("Settings")) {
- previous.show();
- } else if (pageFlowIndex > 1) {
- pageFlowIndex -= 1;
- previous = PAGES[pageFlowIndex].run(new Command[]{backCommand, nextCommand}, this);
- } else if (pageFlowIndex == 1) {
- pageFlowIndex -= 1;
- previous = PAGES[pageFlowIndex].run(new Command[]{exitCommand, settingsCommand}, this);
- }
- break;
- case SETTINGS_COMMAND:
- showSettingsPage();
- break;
- case SAVE_COMMAND:
- break;
- }
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DatasetPage.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DatasetPage.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/DatasetPage.java 1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
-package org.hisp.dhis.mobile;
-
-import com.sun.lwuit.Container;
-import com.sun.lwuit.Form;
-import com.sun.lwuit.TextArea;
-import com.sun.lwuit.TextField;
-import com.sun.lwuit.events.ActionListener;
-import com.sun.lwuit.layouts.BoxLayout;
-import com.sun.lwuit.table.TableLayout;
-
-public class DatasetPage extends FormRunner {
-
- private String fieldArr[];
-
- public String getName() {
- return "ANC Form";
- }
-
- public DatasetPage(String[] fieldArr){
- this.fieldArr = fieldArr;
- }
-
- protected void execute(Form f, ActionListener commandListener) {
- f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
- for (int i = 0; i < fieldArr.length; i++) {
- Container con = new Container();
- TableLayout layout = new TableLayout(1, 2);
- con.setLayout(layout);
- TableLayout.Constraint constraint = layout.createConstraint();
- constraint.setWidthPercentage(70);
- TextArea t = new TextArea(1, 3);
- t.setGrowByContent(true);
- t.setText(fieldArr[i]);
- t.setFocusable(false);
- con.addComponent(constraint, t);
-
- TextField tf = new TextField(5);
- TableLayout.Constraint tfConst = layout.createConstraint();
- tfConst.setWidthPercentage(25);
- tf.setConstraint(TextField.NUMERIC);
- tf.setInputModeOrder(new String[]{"123"});
- tf.setUseSoftkeys(false);
- tf.setInputMode("123");
- tf.setMaxSize(3);
- if (i == 0) {
- tf.setNextFocusUp(tf);
- } else if (i == (fieldArr.length - 1)) {
- tf.setNextFocusDown(tf);
- } else {
- }
- con.addComponent(tfConst, tf);
- f.addComponent(con);
- }
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/FormRunner.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/FormRunner.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/FormRunner.java 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
-package org.hisp.dhis.mobile;
-
-import com.sun.lwuit.Command;
-import com.sun.lwuit.Display;
-import com.sun.lwuit.Form;
-import com.sun.lwuit.events.ActionListener;
-
-public abstract class FormRunner {
-
- public abstract String getName();
-
- public final Form run(final Command[] commands, ActionListener commandListener) {
- Form previous = Display.getInstance().getCurrent();
- System.gc();
- final Form form = new Form(getName());
- for (int i = 0; i < commands.length; i++) {
- if (commands[i].getCommandName().equals("Back")) {
- form.addCommand(commands[i]);
- form.setBackCommand(commands[i]);
- } else {
- form.addCommand(commands[i]);
- }
- }
- form.addCommandListener(commandListener);
- execute(form, commandListener);
- form.show();
-
- return previous;
- }
-
- /**
- * The Pages should place its UI into the given form
- */
- protected abstract void execute(Form f, ActionListener commandListener);
-
- public void cleanup() {
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/FormsListPage.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/FormsListPage.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/FormsListPage.java 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-package org.hisp.dhis.mobile;
-
-import com.sun.lwuit.Command;
-import com.sun.lwuit.Component;
-import com.sun.lwuit.Container;
-import com.sun.lwuit.Font;
-import com.sun.lwuit.Form;
-import com.sun.lwuit.Label;
-import com.sun.lwuit.List;
-import com.sun.lwuit.events.ActionEvent;
-import com.sun.lwuit.events.ActionListener;
-import com.sun.lwuit.layouts.BorderLayout;
-import com.sun.lwuit.list.ListCellRenderer;
-
-public class FormsListPage extends FormRunner {
-
- private String formNames[] = {"Sub-Center Form", "IDSP Form S", "IDSP Form P", "PHC MIES", "Patient-Data"};
-
- public String getName() {
- return "Select a Form";
- }
-
- protected void execute(final Form f, final ActionListener commandListener) {
- f.setLayout(new BorderLayout());
- f.setScrollable(false);
- final List formList = createList(formNames, new ButtonRenderer());
- formList.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent evt) {
- DHISMobile.formID = formList.getSelectedIndex() + 1;
- DHISMobile.pageFlowIndex += 1;
- DHISMobile.previous = DHISMobile.PAGES[DHISMobile.pageFlowIndex].run(new Command[]{DHISMobile.backCommand,
- DHISMobile.nextCommand}, commandListener);
- }
- });
- f.addComponent(BorderLayout.CENTER, formList);
- }
-
- private List createList(String[] names, ListCellRenderer renderer) {
- List list = new List(names);
- list.setListCellRenderer(renderer);
- return list;
- }
-
- class ButtonRenderer extends Container implements ListCellRenderer {
-
- public Component getListCellRendererComponent(List list, Object value, int index, boolean isSelected) {
- Label l = new Label(value.toString());
- if (isSelected) {
- l.setFocus(true);
- l.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM));
- l.getStyle().setBgTransparency(100);
- } else {
- l.setFocus(false);
- l.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM));
- l.getStyle().setBgTransparency(0);
- }
- return l;
- }
-
- public Component getListFocusComponent(List list) {
- return null;
- }
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/PeriodPage.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/PeriodPage.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/PeriodPage.java 1970-01-01 00:00:00 +0000
@@ -1,110 +0,0 @@
-package org.hisp.dhis.mobile;
-
-import com.sun.lwuit.ComboBox;
-import com.sun.lwuit.Component;
-import com.sun.lwuit.Container;
-import com.sun.lwuit.Form;
-import com.sun.lwuit.Label;
-import com.sun.lwuit.List;
-import com.sun.lwuit.events.ActionEvent;
-import com.sun.lwuit.events.ActionListener;
-import com.sun.lwuit.events.FocusListener;
-import com.sun.lwuit.layouts.BoxLayout;
-import com.sun.lwuit.list.ListCellRenderer;
-import java.util.Date;
-import uk.co.bluetrail.lwuit.MobrizDateField;
-
-public class PeriodPage extends FormRunner {
-
- private String fieldArr[] = {"Monthly", "Weekly", "Daily"};
- private String monthArr[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
- private String periodArr[] = new String[24];
-
- public PeriodPage() {
- java.util.Calendar now = java.util.Calendar.getInstance();
- int year = now.get(java.util.Calendar.YEAR);
- for (int i = 0; i < 24; i++) {
- int j = i;
- if (i < 12) {
- periodArr[i] = monthArr[j] + " " + year;
- } else {
- j = i - 12;
- periodArr[i] = monthArr[j] + " " + (year-1);
- }
- }
- }
-
- public String getName() {
- return "Reporting Period";
- }
-
- protected void execute(final Form f, ActionListener commandListener) {
- f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
- final ComboBox periodTypeCombo = createCombo(fieldArr, new PeriodTypeRenderer());
- final ComboBox monthCombo = createCombo(periodArr, new PeriodTypeRenderer());
- final MobrizDateField dateField = new MobrizDateField(new Date().getTime() + "",
- 10, MobrizDateField.DATE, "dmy");
- dateField.addFocusListener(new FocusListener() {
-
- public void focusGained(Component cmp) {
- dateField.getStyle().setBgColor(0x0000ff);
- dateField.getStyle().setFgColor(0xffffff);
- }
-
- public void focusLost(Component cmp) {
- dateField.getStyle().setBgColor(0x0000ff);
- dateField.getStyle().setFgColor(0x000000);
- }
- });
-
- periodTypeCombo.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent evt) {
- if (periodTypeCombo.getSelectedIndex() == 0) {
- f.removeComponent(dateField);
- if (!f.contains(monthCombo)) {
- f.addComponent(monthCombo);
- }
- } else if (periodTypeCombo.getSelectedIndex() == 1) {
- f.removeComponent(monthCombo);
- if (!f.contains(dateField)) {
- f.addComponent(dateField);
- }
- } else if (periodTypeCombo.getSelectedIndex() == 2) {
- f.removeComponent(monthCombo);
- if (!f.contains(dateField)) {
- f.addComponent(dateField);
- }
- }
- }
- });
- f.addComponent(periodTypeCombo);
- f.addComponent(monthCombo);
- }
-
- private ComboBox createCombo(String[] names, ListCellRenderer renderer) {
- ComboBox combo = new ComboBox(names);
- combo.setListCellRenderer(renderer);
- return combo;
- }
-
- class PeriodTypeRenderer extends Container implements ListCellRenderer {
-
- public Component getListCellRendererComponent(List list, Object value, int index, boolean isSelected) {
- Label l = new Label(value.toString());
- list.getStyle().setBgColor(0x0000ff);
- if (isSelected) {
- l.setFocus(true);
- l.getStyle().setFgColor(0xffffff);
- l.getStyle().setBgColor(0x000000);
- } else {
- l.setFocus(false);
- }
- return l;
- }
-
- public Component getListFocusComponent(List list) {
- return null;
- }
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SendPage.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SendPage.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SendPage.java 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
-package org.hisp.dhis.mobile;
-
-import com.sun.lwuit.Form;
-import com.sun.lwuit.events.ActionListener;
-
-
-public class SendPage extends FormRunner {
-
- public String getName() {
- return "Send SMS";
- }
-
- protected void execute(Form f, ActionListener commandListener) {
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SettingsPage.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SettingsPage.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SettingsPage.java 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
-package org.hisp.dhis.mobile;
-
-import com.sun.lwuit.Form;
-import com.sun.lwuit.Label;
-import com.sun.lwuit.TextField;
-import com.sun.lwuit.events.ActionListener;
-import com.sun.lwuit.layouts.BoxLayout;
-
-public class SettingsPage extends FormRunner {
-
- private String fieldArr[] = {"Enter phone #1:", "Enter phone #2:", "Enter phone #3:"};
-
- public String getName() {
- return "Settings";
- }
-
- protected void execute(Form f, ActionListener commandListener) {
- f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
- Label[] phoneLabel = new Label[fieldArr.length];
- PhoneField[] phoneFields = new PhoneField[fieldArr.length];
-
- for(int i=0;i<fieldArr.length;i++){
- phoneLabel[i] = new Label(fieldArr[i]);
- f.addComponent(phoneLabel[i]);
- phoneFields[i] = new PhoneField();
- f.addComponent(phoneFields[i]);
- }
- }
-
- class PhoneField extends TextField {
- public PhoneField() {
- super.setConstraint(TextField.PHONENUMBER);
- super.setInputModeOrder(new String[]{"123"});
- super.setInputMode("123");
- super.setMaxSize(10);
- }
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SplashScreen.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SplashScreen.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/org/hisp/dhis/mobile/SplashScreen.java 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
-package org.hisp.dhis.mobile;
-
-import java.io.IOException;
-import java.io.InputStream;
-import javax.microedition.lcdui.Canvas;
-import javax.microedition.lcdui.Font;
-import javax.microedition.lcdui.Graphics;
-import javax.microedition.lcdui.Image;
-
-public class SplashScreen extends Canvas {
-
- public SplashScreen() {
- this.showNotify();
- }
-
- protected void paint(Graphics g) {
- String label = DHISMobile.branding + " " + DHISMobile.appVersion + " (" + DHISMobile.lang + ")";
- g.setColor(0x000000);
- g.fillRect(0, 0, this.getWidth(), this.getHeight());
- try {
- InputStream stream = getClass().getResourceAsStream(DHISMobile.logoPath);
- Image img = Image.createImage(stream);
- g.drawImage(img, this.getWidth() / 2, this.getHeight() / 2, Graphics.VCENTER | Graphics.HCENTER);
- g.setColor(0xffffff);
- g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL));
- int labelX = this.getWidth() / 2;
- int labelY = this.getHeight() / 2 + (img.getHeight()/2) + g.getFont().getHeight();
- g.drawString(label, labelX, labelY, Graphics.BASELINE | Graphics.HCENTER);
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
-}
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit'
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/DateForm.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/DateForm.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/DateForm.java 1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-package uk.co.bluetrail.lwuit;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import javax.microedition.lcdui.DateField;
-import javax.microedition.lcdui.Form;
-
-/**
- * DateForm is the basic lcdui that is displayed when a user clicks on a MobrizDateField.
- *
- * @author Richard Spence, Bluetrail
- */
-public class DateForm extends Form {
-
- private DateField dateField;
-
- public DateForm(String dtAnswer, int constraint) {
- super("");
-
- if (constraint == MobrizDateField.TIME) {
- dateField = new DateField("", DateField.TIME);
- } else {
- dateField = new DateField("", DateField.DATE);
- }
-
- if (!dtAnswer.equals("")) {
- long dtLong = Long.parseLong(dtAnswer);
- Date dt = new Date();
- dt.setTime(dtLong);
- dateField.setDate(dt);
- } else {
- //set to now
- Calendar defTime = Calendar.getInstance();
- if (constraint == MobrizDateField.TIME) {
- defTime.setTime(new Date(0)); //make it the beginning of the epoch for times
- Calendar currentTime = Calendar.getInstance();
- currentTime.setTime(new Date());
- currentTime.set(Calendar.YEAR, defTime.get(Calendar.YEAR));
- currentTime.set(Calendar.MONTH, defTime.get(Calendar.MONTH));
- currentTime.set(Calendar.DATE, defTime.get(Calendar.DATE));
-
- Date dt = currentTime.getTime();
-
- dateField.setDate(dt);
- } else {
- Calendar currentTime = Calendar.getInstance();
- Date dt = currentTime.getTime();
-
- dateField.setDate(dt);
- }
- }
- append(dateField);
- }
-
- public String getDateText() {
- if (dateField.getDate() == null) {
- return "" + (dateField.getDate().getTime());
- } else {
- return "" + (dateField.getDate().getTime());
- }
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizDateField.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizDateField.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizDateField.java 1970-01-01 00:00:00 +0000
@@ -1,132 +0,0 @@
-package uk.co.bluetrail.lwuit;
-
-import java.util.Calendar;
-import java.util.Date;
-
-/*
- * Makes an editable date and time field from a text areas
- */
-public class MobrizDateField extends MobrizTextArea {
-
- public static final int DATE = 1001;
- public static final int TIME = 1002;
- private static int defaultMaxSize = 124;
- private int constraint;
- private long dateValue;
- private String dateValueString = "";
- private static String id = "MobrizDateField";
- private String format = "dmy";
-
- /*protected String getUIID() {
- return id;
- }
- */
- public MobrizDateField(String dtValue, int columns, int constraint, String format) {
- super(1, columns, constraint);
- this.constraint = constraint;
- if (dtValue == null || format == null) {
- throw new IllegalArgumentException();
- }
- setText(dtValue);
- this.format = format.toLowerCase();
- }
-
- public void setText(String text) {
- try {
- dateValue = Long.parseLong(text);
- dateValueString = dateValue + "";
- } catch (Exception e) {
- dateValueString = "";
- }
-
- if (constraint == TIME) {
- super.setText(this.getTimeString());
- } else {
- super.setText(this.getDateString());
- }
- }
-
- public long getDateValue() {
- return dateValue;
- }
-
- public String getTimeString() {
-
- if (this.dateValueString.equals("")) {
- return "";
- }
-
- try {
- Calendar currentTime = Calendar.getInstance();
- currentTime.setTime(new Date(dateValue));
-
- int h = currentTime.get(Calendar.HOUR_OF_DAY);
- int m = currentTime.get(Calendar.MINUTE);
-
- StringBuffer dt = new StringBuffer();
-
- if (h < 10) {
- dt.append('0');
- }
-
- dt.append(h);
- dt.append(':');
- if (m < 10) {
- dt.append('0');
- }
- dt.append(m);
- return dt.toString();
- } catch (Exception e) {
- return "";
- }
- }
-
- public String getDateString() {
- if (this.dateValueString.equals("")) {
- return "";
- }
-
- try {
- Calendar currentTime = Calendar.getInstance();
- currentTime.setTime(new Date(dateValue));
-
- int d = currentTime.get(Calendar.DAY_OF_MONTH);
- int m = currentTime.get(Calendar.MONTH) + 1;
- int y = currentTime.get(Calendar.YEAR);
-
- StringBuffer dt = new StringBuffer();
-
- for (int i = 0; i < 3; i++) {
- switch (format.charAt(i)) {
-
- case 'd':
- dt.append(stuff(d));
- break;
- case 'm':
- dt.append(stuff(m));
- break;
- case 'y':
- dt.append(y);
- }
- if (i == 0 || i == 1) {
- dt.append("/");
- }
- }
- return dt.toString();
- } catch (Exception e) {
- return "";
- }
- }
-
- private String stuff(int i) {
- if (i < 10) {
- return "0" + i;
- } else {
- return i + "";
- }
- }
-
- public String getDateValueString() {
- return this.dateValueString;
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizImplementationFactory.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizImplementationFactory.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizImplementationFactory.java 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-package uk.co.bluetrail.lwuit;
-
-import com.sun.lwuit.impl.ImplementationFactory;
-import com.sun.lwuit.impl.LWUITImplementation;
-
-public class MobrizImplementationFactory extends ImplementationFactory {
-
- /**
- * Factory method to create the implementation instance
- *
- * @return a newly created implementation instance
- */
- public LWUITImplementation createImplementation() {
- return new MobrizMidpImplementation();
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizMidpImplementation.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizMidpImplementation.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizMidpImplementation.java 1970-01-01 00:00:00 +0000
@@ -1,113 +0,0 @@
-package uk.co.bluetrail.lwuit;
-
-import javax.microedition.lcdui.Command;
-import javax.microedition.lcdui.CommandListener;
-import javax.microedition.lcdui.Displayable;
-import javax.microedition.midlet.MIDlet;
-import com.sun.lwuit.Component;
-import com.sun.lwuit.Display;
-
-import com.sun.lwuit.impl.midp.GameCanvasImplementation;
-import com.sun.lwuit.plaf.UIManager;
-
-/**
- * Extends GameCanvasImplementation to add native date editing for LWUIT.
- *
- */
-public class MobrizMidpImplementation extends GameCanvasImplementation {
-
- private static javax.microedition.lcdui.Display display;
- private WaitForEdit waitForEdit;
- private DateForm dateForm;
- private MobrizDateField currentTextComponent;
- /**
- * The command used for accepting a text field change
- */
- private static Command CONFIRM_COMMAND;
- /**
- * The command used for canceling a text field change
- */
- private static Command CANCEL_COMMAND;
-
- public void init(Object m) {
- super.init(m);
- display = javax.microedition.lcdui.Display.getDisplay((MIDlet) m);
- }
-
- public void editString(Component cmp, int maxSize, int constraint, final String text) {
-
- //process as normal if not a dateField
- if (constraint != MobrizDateField.TIME && constraint != MobrizDateField.DATE) {
- super.editString(cmp, maxSize, constraint, text);
- return;
- }
-
- //ok lets process as a datefield
- currentTextComponent = (MobrizDateField) cmp;
-
- UIManager m = UIManager.getInstance();
- CONFIRM_COMMAND = new Command(m.localize("ok", "OK"), Command.OK, 1);
- CANCEL_COMMAND = new Command(m.localize("cancel", "Cancel"), Command.CANCEL, 2);
- dateForm = new DateForm(currentTextComponent.getDateValueString(), constraint);
-
- dateForm.setCommandListener(new CommandListener() {
-
- public void commandAction(Command c, Displayable d) {
- if (d == dateForm) {
- if (c == CONFIRM_COMMAND) {
- String text2 = dateForm.getDateText();
- Display.getInstance().onEditingComplete(currentTextComponent, text2);
- }
-
- dateForm = null;
- waitForEdit.setDone(true);
-
- // we must return to the LWUIT thread otherwise there is a risk of the MIDP
- // thread blocking on dialog.show calls essentially breaking text editing in dialogs
- Display.getInstance().callSerially(new Runnable() {
-
- public void run() {
- if (currentTextComponent.getComponentForm() == Display.getInstance().getCurrent()) {
- currentTextComponent.getComponentForm().show();
- }
-
- }
- });
- }
- }
- });
-
- dateForm.addCommand(CONFIRM_COMMAND);
- dateForm.addCommand(CANCEL_COMMAND);
-
- display.setCurrent(dateForm);
- waitForEdit = new WaitForEdit();
- waitForEdit.setDone(false);
-
- Display.getInstance().invokeAndBlock(waitForEdit);
- }
-
- class WaitForEdit implements Runnable {
-
- private boolean done;
-
- public void run() {
- while (!done) {
- synchronized (getDisplayLock()) {
- try {
- getDisplayLock().wait(50);
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
- }
- }
- }
-
- public void setDone(boolean done) {
- this.done = done;
- synchronized (getDisplayLock()) {
- getDisplayLock().notify();
- }
- }
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizTextArea.java'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizTextArea.java 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/java/uk/co/bluetrail/lwuit/MobrizTextArea.java 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
-package uk.co.bluetrail.lwuit;
-
-import com.sun.lwuit.Display;
-import com.sun.lwuit.TextArea;
-
-/*
- * extents Text area so that when a alpha key is pressed you go in to edit mode.
- */
-public class MobrizTextArea extends TextArea {
-
- public MobrizTextArea(String defVal, int i, int j) {
- super(defVal, i, j);
- }
-
- public MobrizTextArea(int i, int i2, int any) {
- super(i, i2, any);
- }
-
- public void keyPressed(int keyCode) {
- super.keyPressed(keyCode);
- int action = com.sun.lwuit.Display.getInstance().getGameAction(keyCode);
- //edit the textarea if not a direction key
- switch (action) {
- case Display.GAME_UP:
- case Display.GAME_LEFT:
- case Display.GAME_RIGHT:
- case Display.GAME_DOWN:
- break;
- default:
- this.fireClicked();
- }
- }
-}
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources'
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/dhismobile-icon.png'
Binary files dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/dhismobile-icon.png 2010-10-14 10:44:34 +0000 and dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/dhismobile-icon.png 1970-01-01 00:00:00 +0000 differ
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/dhismobile.res'
Binary files dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/dhismobile.res 2010-10-14 10:44:34 +0000 and dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/dhismobile.res 1970-01-01 00:00:00 +0000 differ
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/splash'
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/splash/dhislogo.png'
Binary files dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/splash/dhislogo.png 2010-10-14 10:44:34 +0000 and dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/main/resources/splash/dhislogo.png 1970-01-01 00:00:00 +0000 differ
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/site'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javame_src/src/site/apt'
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm 2010-12-23 12:27:24 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm 2011-03-27 15:43:20 +0000
@@ -1,6 +1,5 @@
<h2>DHIS Mobile</h2>
<ul>
- <!--<li><a href = "createMobileApp.action">Create Mobile Application</a></li>-->
<li><a href = "receiveImport.action">Receive Data and Import</a></li>
<li><a href = "sendSMS.action">Send SMS</a></li>
<li><a href = "sendOta.action">Send Application via OTA</a></li>
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/splashUploadResponse.vm'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/splashUploadResponse.vm 2010-10-14 10:44:34 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/splashUploadResponse.vm 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-<table>
- <tr>
- #foreach($var in $splashImg)
- <td>
- <div style=" width: 96px; height: 120px; border: dotted; text-align: center;">
- <img style="margin-top: 30px" alt="" src="javame_src/src/main/resources/splash/$var" width="60" height="60"/> <br/>
- <input style="bottom: 5px" name="splash" type="radio" value="$var" />
- </div>
- </td>
- #end
- </tr>
- </table>
\ No newline at end of file