← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3559: Minor fix

 

------------------------------------------------------------
revno: 3559
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-05-10 13:24:17 +0200
message:
  Minor fix
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.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 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2011-05-10 09:48:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2011-05-10 11:24:17 +0000
@@ -187,49 +187,25 @@
 
                 if ( dataElement != null )
                 {
-                    displayValue = "[ " + dataElement.getShortName() + " " + optionComboName + " ]";
-
-                    if ( inputHtml.contains( EMPTY_VALUE_TAG ) )
-                    {
-                        inputHtml = inputHtml.replace( EMPTY_VALUE_TAG, "value=\"" + displayValue + "\"" );
-                    }
-                    else
-                    {
-                        inputHtml += " value=\"" + displayValue + "\"";
-                    }
-
+                    displayValue = "value=\"[ " + dataElement.getShortName() + " " + optionComboName + " ]\"";
+
+                    inputHtml = inputHtml.contains( EMPTY_VALUE_TAG ) ? inputHtml.replace( EMPTY_VALUE_TAG, displayValue ) : inputHtml + " " + displayValue;
+                    
                     StringBuilder title = new StringBuilder( "title=\"[ " ).append( dataElement.getId() ).append( " - " ).
                         append( dataElement.getShortName() ).append( " - " ).append( optionComboId ).append( " - " ).
                         append( optionComboName ).append( " - " ).append( dataElement.getType() ).append( " ]\"" );
                     
-                    if ( inputHtml.contains( EMPTY_TITLE_TAG ) )
-                    {
-                        inputHtml = inputHtml.replace( EMPTY_TITLE_TAG, title );
-                    }
-                    else
-                    {
-                        inputHtml += " " + title;
-                    }
+                    inputHtml = inputHtml.contains( EMPTY_TITLE_TAG ) ? inputHtml.replace( EMPTY_TITLE_TAG, title ) : " " + title;                    
                 }
                 else
                 {
-                    if ( inputHtml.contains( EMPTY_VALUE_TAG ) )
-                    {
-                        inputHtml = inputHtml.replace( EMPTY_VALUE_TAG, "value=\"" + displayValue + "\"" );
-                    }
-                    else
-                    {
-                        inputHtml += " value=\"" + displayValue + "\"";
-                    }
-
-                    if ( inputHtml.contains( EMPTY_TITLE_TAG ) )
-                    {
-                        inputHtml = inputHtml.replace( EMPTY_TITLE_TAG, "title=\"" + displayValue + "\"" );
-                    }
-                    else
-                    {
-                        inputHtml += " title=\"" + displayValue + "\"";
-                    }
+                    String displayNotExisting = "value=\"" + displayValue + "\"";
+                    
+                    inputHtml = inputHtml.contains( EMPTY_VALUE_TAG ) ? inputHtml.replace( EMPTY_VALUE_TAG, displayNotExisting ) : inputHtml + displayNotExisting;
+                    
+                    displayNotExisting = "title=\"" + displayValue + "\"";
+                    
+                    inputHtml = inputHtml.contains( EMPTY_TITLE_TAG ) ? inputHtml.replace( EMPTY_TITLE_TAG, displayNotExisting ) : inputHtml + displayNotExisting;
                 }
 
                 inputMatcher.appendReplacement( sb, inputHtml );