← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20165: Data entry form, using enum for style

 

------------------------------------------------------------
revno: 20165
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-15 13:43:48 +0200
message:
  Data entry form, using enum for style
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayDensity.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataentryform/hibernate/DataEntryForm.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.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-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayDensity.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayDensity.java	2015-09-15 10:40:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DisplayDensity.java	2015-09-15 11:43:48 +0000
@@ -33,5 +33,5 @@
  */
 public enum DisplayDensity
 {
-    COMFORTABLE, NORMAL, COMPACT;
+    COMFORTABLE, NORMAL, COMPACT, NONE;
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java	2015-09-15 11:43:48 +0000
@@ -31,6 +31,7 @@
 import java.io.Serializable;
 import java.util.regex.Pattern;
 
+import org.hisp.dhis.common.DisplayDensity;
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.common.ImportableObject;
 import org.hisp.dhis.common.view.DetailedView;
@@ -48,11 +49,6 @@
 public class DataEntryForm
     implements Serializable, ImportableObject
 {
-    public static final String STYLE_COMFORTABLE = "comfortable";
-    public static final String STYLE_REGULAR = "regular";
-    public static final String STYLE_COMPACT = "compact";
-    public static final String STYLE_NONE = "none";
-
     public static final int CURRENT_FORMAT = 2;
 
     /**
@@ -77,7 +73,7 @@
     /**
      * The display style to use to render the form.
      */
-    private String style;
+    private DisplayDensity style;
 
     /**
      * HTML Code of DataEntryForm
@@ -108,7 +104,7 @@
         this.htmlCode = htmlCode;
     }
 
-    public DataEntryForm( String name, String style, String htmlCode )
+    public DataEntryForm( String name, DisplayDensity style, String htmlCode )
     {
         this.name = name;
         this.style = style;
@@ -197,12 +193,12 @@
     @JsonProperty
     @JsonView({ DetailedView.class, ExportView.class })
     @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
-    public String getStyle()
+    public DisplayDensity getStyle()
     {
         return style;
     }
 
-    public void setStyle( String style )
+    public void setStyle( DisplayDensity style )
     {
         this.style = style;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-15 11:21:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-15 11:43:48 +0000
@@ -967,6 +967,11 @@
         executeSql( "update eventchart set type='PIE' where type='pie'" );
         executeSql( "update eventchart set type='RADAR' where type='radar'" );
         executeSql( "update eventchart set type='GAUGE' where type='gauge'" );
+        
+        executeSql( "update dataentryform set style='COMFORTABLE' where style='comfortable'" );
+        executeSql( "update dataentryform set style='NORMAL' where style='regular'" );
+        executeSql( "update dataentryform set style='COMPACT' where style='compact'" );
+        executeSql( "update dataentryform set style='NONE' where style='none'" );
     }
     
     private void upgradeAggregationType( String table )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties	2015-09-10 16:35:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties	2015-09-15 11:43:48 +0000
@@ -219,6 +219,7 @@
 no_of_days=No of days
 variables=Variables
 open=Open
+normal=Normal
 
 #-- Relative periods -----------------------------------------------------------#
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataentryform/hibernate/DataEntryForm.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataentryform/hibernate/DataEntryForm.hbm.xml	2015-05-03 14:12:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataentryform/hibernate/DataEntryForm.hbm.xml	2015-09-15 11:43:48 +0000
@@ -14,8 +14,13 @@
 
     <property name="name" not-null="true" unique="true" length="160" />
 
-    <property name="style" length="40" />
-
+    <property name="style" length="40">
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.common.DisplayDensity</param>
+        <param name="type">12</param>
+      </type>
+	</property>
+	
     <property name="htmlCode" column="htmlcode" type="text" />
     
     <property name="format" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml	2015-09-15 11:21:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml	2015-09-15 11:43:48 +0000
@@ -108,7 +108,7 @@
       <type name="org.hibernate.type.EnumType">
         <param name="enumClass">org.hisp.dhis.chart.ChartType</param>
         <param name="type">12</param>
-      </type> 
+      </type>
 	</property>
 	
     <list name="columnDimensions" table="eventchart_columns">

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2015-09-15 11:21:39 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2015-09-15 11:43:48 +0000
@@ -25,7 +25,7 @@
       <type name="org.hibernate.type.EnumType">
         <param name="enumClass">org.hisp.dhis.chart.ChartType</param>
         <param name="type">12</param>
-      </type> 
+      </type>
 	</property>
 	
     <property name="series" />

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java	2015-09-14 17:57:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataSetController.java	2015-09-15 11:43:48 +0000
@@ -42,6 +42,7 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
+import org.hisp.dhis.common.DisplayDensity;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
@@ -257,7 +258,7 @@
 
         if ( form == null )
         {
-            form = new DataEntryForm( dataSet.getName(), DataEntryForm.STYLE_REGULAR, formContent );
+            form = new DataEntryForm( dataSet.getName(), DisplayDensity.NORMAL, formContent );
             dataEntryFormService.addDataEntryForm( form );
             dataSet.setDataEntryForm( form );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css	2015-06-02 18:23:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css	2015-09-15 11:43:48 +0000
@@ -676,25 +676,25 @@
   background-color: #e0e0e0;
 }
 
-.cde-regular td, .cde-regular th 
+.cde-NORMAL td, .cde-NORMAL th 
 {
   padding: 12px;
   border: 1px solid #c0c0c0;
 }
 
-.cde-comfortable td, .cde-comfortable th 
+.cde-COMFORTABLE td, .cde-COMFORTABLE th 
 {
   padding: 18px;
   border: 1px solid #c0c0c0;
 }
 
-.cde-compact td, .cde-compact th 
+.cde-COMPACT td, .cde-COMPACT th 
 {
   padding: 5px;
   border: 1px solid #c0c0c0;
 }
 
-.cde-none
+.cde-NONE
 {
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java	2015-09-15 11:43:48 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.DisplayDensity;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
 import org.hisp.dhis.dataset.DataSet;
@@ -78,9 +79,9 @@
         this.nameField = nameField;
     }
 
-    private String style;
+    private DisplayDensity style;
     
-    public void setStyle( String style )
+    public void setStyle( DisplayDensity style )
     {
         this.style = style;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java	2015-09-15 11:43:48 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.DisplayDensity;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
 import org.hisp.dhis.dataset.DataSet;
@@ -78,9 +79,9 @@
         this.nameField = nameField;
     }
 
-    private String style;
+    private DisplayDensity style;
     
-    public void setStyle( String style )
+    public void setStyle( DisplayDensity style )
     {
         this.style = style;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2014-06-26 21:14:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2015-09-15 11:43:48 +0000
@@ -67,10 +67,10 @@
         <td><label>$i18n.getString( "style" )</label></td>
         <td>
         <select id="style" name="style" style="width:30em">
-          <option value="regular"#if( !$dataEntryForm.style || "regular" == $dataEntryForm.style ) selected=selected#end>$i18n.getString( "regular" )</option>
-          <option value="comfortable"#if( "comfortable" == $dataEntryForm.style ) selected=selected#end>$i18n.getString( "comfortable" )</option>
-          <option value="compact"#if( "compact" == $dataEntryForm.style ) selected=selected#end>$i18n.getString( "compact" )</option>
-          <option value="none"#if( "none" == $dataEntryForm.style ) selected=selected#end>$i18n.getString( "none" )</option>
+          <option value="NORMAL"#if( "NORMAL" == $dataEntryForm.style ) selected=selected#end>$i18n.getString( "normal" )</option>
+          <option value="COMFORTABLE"#if( "COMFORTABLE" == $dataEntryForm.style ) selected=selected#end>$i18n.getString( "comfortable" )</option>
+          <option value="COMPACT"#if( "COMPACT" == $dataEntryForm.style ) selected=selected#end>$i18n.getString( "compact" )</option>
+          <option value="NONE"#if( "NONE" == $dataEntryForm.style ) selected=selected#end>$i18n.getString( "none" )</option>
         </select>
         </td>
       </tr>