← Back to team overview

dhis-mobile-devs team mailing list archive

[Branch ~dhis-mobile-devs/dhis-mobile/lwuit-tracking] Rev 236: Find Instance

 

------------------------------------------------------------
revno: 236
committer: sherylyn.marie
branch nick: lwuit-tracking
timestamp: Wed 2014-09-10 21:20:33 +0800
message:
  Find Instance
  - improve highlighter navigation
  - add attributeIndex
  - remove minimum keyword length requirement
  - fixed "no match found" message
modified:
  src/org/hisp/dhis/mobile/connection/task/FindPatientTask.java
  src/org/hisp/dhis/mobile/view/FindBeneficiaryView.java


--
lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking
https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking

Your team DHIS mobile developers is subscribed to branch lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking/+edit-subscription
=== modified file 'src/org/hisp/dhis/mobile/connection/task/FindPatientTask.java'
--- src/org/hisp/dhis/mobile/connection/task/FindPatientTask.java	2014-09-10 10:14:12 +0000
+++ src/org/hisp/dhis/mobile/connection/task/FindPatientTask.java	2014-09-10 13:20:33 +0000
@@ -87,10 +87,11 @@
             e.printStackTrace();
 
             String message = null;
+            String searchString = keyWord.substring( keyWord.lastIndexOf( ':' ) + 1 );
 
             if ( e.getMessage().equalsIgnoreCase( "NO_BENEFICIARY_FOUND" ) )
             {
-                message = Text.NO_PERSON_FOUND() + ": " + keyWord;
+                message = Text.NO_PERSON_FOUND() + ": " + searchString;
                 nameBasedMIDlet.getNoMatchingView().prepareView();
                 nameBasedMIDlet.getNoMatchingView().getTxtNotification().setText( message );
                 nameBasedMIDlet.getNoMatchingView().getMainForm().show();
@@ -100,7 +101,7 @@
             {
                 message = "Your internet connection is currently unavailable. The search result you are about to see are from your local database. Click Next to continue or Back to go to the previous screen.";
                 nameBasedMIDlet.getWarningView().prepareView();
-                nameBasedMIDlet.getWarningView().setKeyword( keyWord );
+                nameBasedMIDlet.getWarningView().setKeyword( searchString );
                 nameBasedMIDlet.getWarningView().getTxtNotification().setText( message );
                 nameBasedMIDlet.getWarningView().getMainForm().show();
             }
@@ -115,15 +116,18 @@
                 message = e.getMessage();
                 nameBasedMIDlet.getAlertBoxView( message, "Warning" ).showView();
                 nameBasedMIDlet.getFindBeneficiaryView().showView();
-//                Vector patientInfos = new Vector();
-//                while ( message.length() > 0 )
-//                {
-//                    patientInfos.addElement( message.substring( 0, message.indexOf( "$" ) ) );
-//                    message = message.substring( message.indexOf( "$" ) + 1, message.length() );
-//                }
-//                nameBasedMIDlet.getPersonListView().setPatientInfos( patientInfos );
-//                patientInfos = null;
-//                nameBasedMIDlet.getPersonListView().showView();
+                // Vector patientInfos = new Vector();
+                // while ( message.length() > 0 )
+                // {
+                // patientInfos.addElement( message.substring( 0,
+                // message.indexOf( "$" ) ) );
+                // message = message.substring( message.indexOf( "$" ) + 1,
+                // message.length() );
+                // }
+                // nameBasedMIDlet.getPersonListView().setPatientInfos(
+                // patientInfos );
+                // patientInfos = null;
+                // nameBasedMIDlet.getPersonListView().showView();
             }
         }
     }

=== modified file 'src/org/hisp/dhis/mobile/view/FindBeneficiaryView.java'
--- src/org/hisp/dhis/mobile/view/FindBeneficiaryView.java	2014-09-10 10:14:12 +0000
+++ src/org/hisp/dhis/mobile/view/FindBeneficiaryView.java	2014-09-10 13:20:33 +0000
@@ -88,6 +88,8 @@
     private int programIndex = 0;
 
     private int orgUnitIndex = 0;
+    
+    private int attributeIndex = 0;
 
     private String keyword;
 
@@ -113,6 +115,7 @@
 
         TextArea txtSearchHint = new TextArea( Text.SEARCH_HINT() );
         txtSearchHint.setEditable( false );
+        txtSearchHint.setFocusable( false );
         mainForm.addComponent( txtSearchHint );
 
         mainForm.addComponent( getAttributeOptions() );
@@ -122,6 +125,7 @@
 
         TextArea txtSelectOrgUnit = new TextArea( Text.ORG_UNIT() );
         txtSelectOrgUnit.setEditable( false );
+        txtSelectOrgUnit.setFocusable( false );
         mainForm.addComponent( txtSelectOrgUnit );
         mainForm.addComponent( getOrgUnitOptions() );
 
@@ -209,14 +213,14 @@
                         getNotification().setText( "(*) : Required Field" );
                         getMainForm().show();
                     }
-                    else if ( keyword.length() < MINIMUM_KEYWORD_LENGTH )
-                    {
-                        prepareView();
-                        getNotification().setText(
-                            "Keyword must be at least " + MINIMUM_KEYWORD_LENGTH + " characters." );
-                        getMainForm().show();
-
-                    }
+//                    else if ( keyword.length() < MINIMUM_KEYWORD_LENGTH )
+//                    {
+//                        prepareView();
+//                        getNotification().setText(
+//                            "Keyword must be at least " + MINIMUM_KEYWORD_LENGTH + " characters." );
+//                        getMainForm().show();
+//
+//                    }
                     else
                     {
                         nameBasedMIDlet.getWaitingView().showView();
@@ -240,7 +244,7 @@
                                 .getSelectedIndex() - 1 ) );
                             ConnectionManager
                                 .setUrl( nameBasedMIDlet.getCurrentOrgUnit().getFindPatientInAdvancedUrl() );
-                            orgUnitIndex = orgUnitOptions.getSelectedIndex() + 1;
+                            orgUnitIndex = orgUnitOptions.getSelectedIndex();
                         }
 
                         // Program Selection
@@ -278,10 +282,12 @@
                         if ( attributeOptions.getSelectedItem().toString().equals( "All" ) )
                         {
                             query = "like:" + keyword;
+                            attributeIndex = 0;
                         }
                         else
                         {
                             query = attributeOptions.getSelectedItem().toString() + ":like:" + keyword;
+                            attributeIndex = attributeOptions.getSelectedIndex();
                         }
                         ConnectionManager.findPatientByName( query );
                         mainForm = null;
@@ -385,6 +391,7 @@
                     }
                 };
                 attributeOptions.addActionListener( ae );
+                attributeOptions.setSelectedIndex( attributeIndex );
             }
             catch ( Exception e )
             {