← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3295: refactored charts in dashboard functionality

 

------------------------------------------------------------
revno: 3295
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-04-06 13:39:06 +0200
message:
  refactored charts in dashboard functionality
removed:
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DashboardChartsToDisplayManager.java
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DefaultDashboardChartsToDisplayManager.java
added:
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/UserSettingManager.java
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java
renamed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableDashboardChartsToDisplayAction.java => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableChartsInDashboardAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentDashboardChartsToDisplayAction.java => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentChartsInDashboardAction.java
modified:
  dhis-2/dhis-services/dhis-service-options/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-dashboard-integration/pom.xml
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userSettings.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableChartsInDashboardAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentChartsInDashboardAction.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
=== added file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/UserSettingManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/UserSettingManager.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/UserSettingManager.java	2011-04-06 11:39:06 +0000
@@ -0,0 +1,54 @@
+package org.hisp.dhis.options;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author mortenoh
+ */
+public interface UserSettingManager
+{
+    final String ID = UserSettingManager.class.getName();
+
+    static String KEY_CHARTS_IN_DASHBOARD = "keyChartsInDashboard";
+
+    static int DEFAULT_CHARTS_IN_DASHBOARD = 4;
+
+    static List<Integer> DASHBOARD_CHARTS_TO_DISPLAY = Arrays.asList( 4, 6, 8 );
+
+    public Serializable getUserSetting( String key );
+
+    public void saveUserSetting( String key, Serializable value );
+
+    public List<Integer> getChartsInDashboardOptions();
+
+    public Integer getChartsInDashboard();
+}

=== removed directory 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts'
=== removed file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DashboardChartsToDisplayManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DashboardChartsToDisplayManager.java	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DashboardChartsToDisplayManager.java	1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-package org.hisp.dhis.options.charts;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.List;
-
-/**
- * @author mortenoh
- */
-public interface DashboardChartsToDisplayManager
-{
-    static final String DASHBOARD_CHARTS_TO_DISPLAY_4 = "4";
-
-    static final String DASHBOARD_CHARTS_TO_DISPLAY_6 = "6";
-
-    static final String DASHBOARD_CHARTS_TO_DISPLAY_8 = "8";
-
-    public void setCurrentDashboardChartsToDisplay( String chartsToDisplay );
-
-    public String getCurrentDashboardChartsToDisplay();
-
-    public List<String> getDashboardChartsToDisplay();
-}

=== removed file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DefaultDashboardChartsToDisplayManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DefaultDashboardChartsToDisplayManager.java	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DefaultDashboardChartsToDisplayManager.java	1970-01-01 00:00:00 +0000
@@ -1,88 +0,0 @@
-package org.hisp.dhis.options.charts;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.user.NoCurrentUserException;
-import org.hisp.dhis.user.UserSettingService;
-
-/**
- * @author mortenoh
- */
-public class DefaultDashboardChartsToDisplayManager
-    implements DashboardChartsToDisplayManager
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private UserSettingService userSettingService;
-
-    public void setUserSettingService( UserSettingService userSettingService )
-    {
-        this.userSettingService = userSettingService;
-    }
-
-    // -------------------------------------------------------------------------
-    // DashboardChartsToDisplayManager implementation
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void setCurrentDashboardChartsToDisplay( String chartsToDisplay )
-    {
-        try
-        {
-            userSettingService.saveUserSetting( UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY, chartsToDisplay );
-        }
-        catch ( NoCurrentUserException e )
-        {
-        }
-    }
-
-    @Override
-    public String getCurrentDashboardChartsToDisplay()
-    {
-        return (String) userSettingService.getUserSetting( UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY,
-            DASHBOARD_CHARTS_TO_DISPLAY_4 );
-    }
-
-    @Override
-    public List<String> getDashboardChartsToDisplay()
-    {
-        List<String> list = new ArrayList<String>();
-
-        list.add( DASHBOARD_CHARTS_TO_DISPLAY_4 );
-        list.add( DASHBOARD_CHARTS_TO_DISPLAY_6 );
-        list.add( DASHBOARD_CHARTS_TO_DISPLAY_8 );
-
-        return list;
-    }
-
-}

=== added file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/setting/DefaultUserSettingManager.java	2011-04-06 11:39:06 +0000
@@ -0,0 +1,93 @@
+package org.hisp.dhis.options.setting;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.hisp.dhis.options.UserSettingManager;
+import org.hisp.dhis.user.NoCurrentUserException;
+import org.hisp.dhis.user.UserSettingService;
+
+public class DefaultUserSettingManager
+    implements UserSettingManager
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private UserSettingService userSettingService;
+
+    public void setUserSettingService( UserSettingService userSettingService )
+    {
+        this.userSettingService = userSettingService;
+    }
+
+    // -------------------------------------------------------------------------
+    // UserSettingManager implementation
+    // -------------------------------------------------------------------------
+
+    public Serializable getUserSetting( String key )
+    {
+        try
+        {
+            return userSettingService.getUserSetting( key );
+        }
+        catch ( NoCurrentUserException e )
+        {
+        }
+
+        return null;
+    }
+    
+    public void saveUserSetting( String key, Serializable value )
+    {
+        try
+        {
+            userSettingService.saveUserSetting( key, value );
+        }
+        catch ( NoCurrentUserException e )
+        {
+        }
+    }
+
+    // -------------------------------------------------------------------------
+    // Specific methods
+    // -------------------------------------------------------------------------
+
+    public List<Integer> getChartsInDashboardOptions()
+    {
+        return DASHBOARD_CHARTS_TO_DISPLAY;
+    }
+
+    public Integer getChartsInDashboard()
+    {
+        return (Integer) userSettingService.getUserSetting( UserSettingManager.KEY_CHARTS_IN_DASHBOARD,
+            UserSettingManager.DEFAULT_CHARTS_IN_DASHBOARD );
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-options/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-options/src/main/resources/META-INF/dhis/beans.xml	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/resources/META-INF/dhis/beans.xml	2011-04-06 11:39:06 +0000
@@ -219,10 +219,10 @@
   <bean id="org.hisp.dhis.options.help.HelpManager"
 	class="org.hisp.dhis.options.help.DefaultHelpManager"/>
 
-  <bean id="org.hisp.dhis.options.charts.DashboardChartsToDisplayManager"
-	class="org.hisp.dhis.options.charts.DefaultDashboardChartsToDisplayManager">
-	<property name="userSettingService"
+  <bean id="org.hisp.dhis.options.UserSettingManager"
+    class="org.hisp.dhis.options.setting.DefaultUserSettingManager"> 
+    <property name="userSettingService"
       ref="org.hisp.dhis.user.UserSettingService"/>
   </bean>
-  
+
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java	2011-04-06 11:39:06 +0000
@@ -30,7 +30,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.hisp.dhis.user.UserSettingService;
+import org.hisp.dhis.options.UserSettingManager;
 
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.interceptor.Interceptor;
@@ -45,11 +45,11 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private UserSettingService userSettingService;
+    private UserSettingManager userSettingManager;
 
-    public void setUserSettingService( UserSettingService userSettingService )
+    public void setUserSettingManager( UserSettingManager userSettingManager )
     {
-        this.userSettingService = userSettingService;
+        this.userSettingManager = userSettingManager;
     }
 
     // -------------------------------------------------------------------------
@@ -71,10 +71,7 @@
     {
         Map<String, Object> map = new HashMap<String, Object>();
 
-        Integer chartsToDisplay = Integer.valueOf( (String) userSettingService.getUserSetting(
-            UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY, "4" ) );
-
-        map.put( UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY, chartsToDisplay );
+        map.put( UserSettingManager.KEY_CHARTS_IN_DASHBOARD, userSettingManager.getChartsInDashboard() );
 
         invocation.getStack().push( map );
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-04-06 11:39:06 +0000
@@ -479,7 +479,7 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.interceptor.UserSettingInterceptor" class="org.hisp.dhis.interceptor.UserSettingInterceptor">
-	    <property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
+	    <property name="userSettingManager" ref="org.hisp.dhis.options.UserSettingManager" />
 	</bean>
 
 	<bean id="org.hisp.dhis.useraccount.action.GetCurrentUserAction" class="org.hisp.dhis.useraccount.action.GetCurrentUserAction" scope="prototype">

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/pom.xml'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/pom.xml	2011-03-02 00:23:51 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/pom.xml	2011-04-06 11:39:06 +0000
@@ -36,6 +36,10 @@
     </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-options</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-core</artifactId>
     </dependency>
     <dependency>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2011-04-06 11:39:06 +0000
@@ -37,7 +37,7 @@
 import org.hisp.dhis.chart.ChartService;
 import org.hisp.dhis.chart.comparator.ChartTitleComparator;
 import org.hisp.dhis.dashboard.DashboardManager;
-import org.hisp.dhis.user.UserSettingService;
+import org.hisp.dhis.options.UserSettingManager;
 
 import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
@@ -67,6 +67,13 @@
         this.chartService = chartService;
     }
 
+    private UserSettingManager userSettingManager;
+
+    public void setUserSettingManager( UserSettingManager userSettingManager )
+    {
+        this.userSettingManager = userSettingManager;
+    }
+    
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -96,7 +103,7 @@
     {
         return chartAreas;
     }
-    
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -113,13 +120,13 @@
 
         Collections.sort( charts, new ChartTitleComparator() );
 
-        Object keyDashboardChartsToDisplay = ActionContext.getContext().getActionInvocation().getStack()
-            .findString( UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY );
-
-        Integer dashboardChartsCount = keyDashboardChartsToDisplay != null ? Integer
-            .valueOf( (String) keyDashboardChartsToDisplay ) : 4;
-
-        for ( int i = 1; i <= dashboardChartsCount; i++ )
+        Object sessionChartsInDashboard = ActionContext.getContext().getActionInvocation().getStack()
+            .findString( UserSettingManager.KEY_CHARTS_IN_DASHBOARD );
+
+        Integer chartsInDashboardCount = sessionChartsInDashboard != null ? Integer
+            .valueOf( (String) sessionChartsInDashboard ) : UserSettingManager.DEFAULT_CHARTS_IN_DASHBOARD;
+
+        for ( int i = 1; i <= chartsInDashboardCount; i++ )
         {
             chartAreas.add( content.get( "chartArea" + i ) );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml	2011-04-01 19:47:09 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml	2011-04-06 11:39:06 +0000
@@ -10,9 +10,10 @@
     class="org.hisp.dhis.dashboard.action.ProvideContentAction"
     scope="prototype">
     <property name="manager" ref="org.hisp.dhis.dashboard.DashboardManager"/>
+    <property name="userSettingManager" ref="org.hisp.dhis.options.UserSettingManager" />
     <property name="chartService" ref="org.hisp.dhis.chart.ChartService"/>
   </bean>
-  
+
   <bean id="org.hisp.dhis.dashboard.action.SetAreaItemAction"
     class="org.hisp.dhis.dashboard.action.SetAreaItemAction"
     scope="prototype">

=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableDashboardChartsToDisplayAction.java' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableChartsInDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableDashboardChartsToDisplayAction.java	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableChartsInDashboardAction.java	2011-04-06 11:39:06 +0000
@@ -29,42 +29,41 @@
 
 import java.util.List;
 
-import org.hisp.dhis.options.charts.DashboardChartsToDisplayManager;
+import org.hisp.dhis.options.UserSettingManager;
 
 import com.opensymphony.xwork2.Action;
 
-public class GetAvailableDashboardChartsToDisplayAction
+public class GetAvailableChartsInDashboardAction
     implements Action
 {
-    private DashboardChartsToDisplayManager dashboardChartsToDisplayManager;
-
-    public void setDashboardChartsToDisplayManager( DashboardChartsToDisplayManager dashboardChartsToDisplayManager )
-    {
-        this.dashboardChartsToDisplayManager = dashboardChartsToDisplayManager;
-    }
-
-    private String currentDashboardChartsToDisplay;
-
-    public String getCurrentDashboardChartsToDisplay()
-    {
-        return currentDashboardChartsToDisplay;
-    }
-
-    private List<String> dashboardChartsToDisplay;
-
-    public List<String> getDashboardChartsToDisplay()
-    {
-        return dashboardChartsToDisplay;
+    private UserSettingManager userSettingManager;
+
+    public void setUserSettingManager( UserSettingManager userSettingManager )
+    {
+        this.userSettingManager = userSettingManager;
+    }
+
+    private Integer chartsInDashboard;
+
+    public Integer getChartsInDashboard()
+    {
+        return chartsInDashboard;
+    }
+
+    private List<Integer> chartsInDashboardOptions;
+
+    public List<Integer> getChartsInDashboardOptions()
+    {
+        return chartsInDashboardOptions;
     }
 
     @Override
     public String execute()
         throws Exception
     {
-        dashboardChartsToDisplay = dashboardChartsToDisplayManager.getDashboardChartsToDisplay();
-
-        currentDashboardChartsToDisplay = dashboardChartsToDisplayManager.getCurrentDashboardChartsToDisplay();
-
+        chartsInDashboard = userSettingManager.getChartsInDashboard();
+        chartsInDashboardOptions = userSettingManager.getChartsInDashboardOptions();
+        
         return SUCCESS;
     }
 }

=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentDashboardChartsToDisplayAction.java' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentChartsInDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentDashboardChartsToDisplayAction.java	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentChartsInDashboardAction.java	2011-04-06 11:39:06 +0000
@@ -27,32 +27,32 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.options.charts.DashboardChartsToDisplayManager;
+import org.hisp.dhis.options.UserSettingManager;
 
 import com.opensymphony.xwork2.Action;
 
-public class SetCurrentDashboardChartsToDisplayAction
+public class SetCurrentChartsInDashboardAction
     implements Action
 {
-    private DashboardChartsToDisplayManager dashboardChartsToDisplayManager;
+    private UserSettingManager userSettingManager;
 
-    public void setDashboardChartsToDisplayManager( DashboardChartsToDisplayManager dashboardChartsToDisplayManager )
+    public void setUserSettingManager( UserSettingManager userSettingManager )
     {
-        this.dashboardChartsToDisplayManager = dashboardChartsToDisplayManager;
+        this.userSettingManager = userSettingManager;
     }
 
-    private String currentDashboardChartsToDisplay;
+    private Integer chartsInDashboard;
 
-    public void setCurrentDashboardChartsToDisplay( String currentDashboardChartsToDisplay )
+    public void setChartsInDashboard( Integer chartsInDashboard )
     {
-        this.currentDashboardChartsToDisplay = currentDashboardChartsToDisplay;
+        this.chartsInDashboard = chartsInDashboard;
     }
 
     @Override
     public String execute()
         throws Exception
     {
-        dashboardChartsToDisplayManager.setCurrentDashboardChartsToDisplay( currentDashboardChartsToDisplay );
+        userSettingManager.saveUserSetting( UserSettingManager.KEY_CHARTS_IN_DASHBOARD, chartsInDashboard );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2011-04-06 11:39:06 +0000
@@ -63,11 +63,11 @@
     </property>
   </bean>
 
-  <bean id="org.hisp.dhis.settings.action.user.GetAvailableDashboardChartsToDisplayAction"
-    class="org.hisp.dhis.settings.action.user.GetAvailableDashboardChartsToDisplayAction" 
+  <bean id="org.hisp.dhis.settings.action.user.GetAvailableChartsInDashboardAction"
+    class="org.hisp.dhis.settings.action.user.GetAvailableChartsInDashboardAction" 
     scope="prototype">
-    <property name="dashboardChartsToDisplayManager">
-      <ref bean="org.hisp.dhis.options.charts.DashboardChartsToDisplayManager"/>
+    <property name="userSettingManager">
+      <ref bean="org.hisp.dhis.options.UserSettingManager"/>
     </property>
   </bean>
 
@@ -122,11 +122,11 @@
     </property>
   </bean>
 
-  <bean id="org.hisp.dhis.settings.action.user.SetCurrentDashboardChartsToDisplayAction"
-    class="org.hisp.dhis.settings.action.user.SetCurrentDashboardChartsToDisplayAction" 
+  <bean id="org.hisp.dhis.settings.action.user.SetCurrentChartsInDashboardAction"
+    class="org.hisp.dhis.settings.action.user.SetCurrentChartsInDashboardAction" 
     scope="prototype">
-    <property name="dashboardChartsToDisplayManager">
-      <ref bean="org.hisp.dhis.options.charts.DashboardChartsToDisplayManager"/>
+    <property name="userSettingManager">
+      <ref bean="org.hisp.dhis.options.UserSettingManager"/>
     </property>
   </bean>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml	2011-04-06 11:39:06 +0000
@@ -39,10 +39,10 @@
     </action>
 
     <action name="getAvailableSortOrders" class="org.hisp.dhis.settings.action.user.GetAvailableSortOrdersAction">
-      <result name="success" type="chain">getAvailableDashboardChartsToDisplay</result>
+      <result name="success" type="chain">getAvailableChartsInDashboard</result>
     </action>
 
-    <action name="getAvailableDashboardChartsToDisplay" class="org.hisp.dhis.settings.action.user.GetAvailableDashboardChartsToDisplayAction">
+    <action name="getAvailableChartsInDashboard" class="org.hisp.dhis.settings.action.user.GetAvailableChartsInDashboardAction">
       <result name="success" type="chain">getAvailableDisplayProperties</result>
     </action>
 
@@ -72,7 +72,7 @@
       <result name="success" type="redirect">userSettings.action</result>
     </action>
 
-    <action name="setCurrentDashboardChartsToDisplay" class="org.hisp.dhis.settings.action.user.SetCurrentDashboardChartsToDisplayAction">
+    <action name="setCurrentChartsInDashboard" class="org.hisp.dhis.settings.action.user.SetCurrentChartsInDashboardAction">
       <result name="success" type="redirect">userSettings.action</result>
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userSettings.vm	2011-04-05 18:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userSettings.vm	2011-04-06 11:39:06 +0000
@@ -35,10 +35,10 @@
 		window.location.href = "setCurrentStyle.action?currentStyle=" + style;
 	}
 
-	function dashboardChartsToDisplayChanged( list )
+	function chartsInDashboardDisplayChanged( list )
 	{
 		var listValue = list.options[list.selectedIndex].value;
-		window.location.href = "setCurrentDashboardChartsToDisplay.action?currentDashboardChartsToDisplay=" + listValue;
+		window.location.href = "setCurrentChartsInDashboard.action?chartsInDashboard=" + listValue;
 	}
 </script>
 
@@ -87,9 +87,9 @@
 
 <h4>$i18n.getString( "dashboard_charts_to_display" )</h4>
 
-<select onchange="dashboardChartsToDisplayChanged( this )" style="min-width:250px">
-#foreach( $charts in $dashboardChartsToDisplay )
-	<option value="$charts" #if($charts == $currentDashboardChartsToDisplay) selected="selected"#end>$charts</option>
+<select onchange="chartsInDashboardDisplayChanged( this )" style="min-width:250px">
+#foreach( $charts in $chartsInDashboardOptions )
+	<option value="$charts" #if($charts == $chartsInDashboard) selected="selected"#end>$charts</option>
 #end
 </select>