. Dashboards impl checkpoint

- Dashboard configuration wizard - column editing based on layout selection
  - persistence of changes made in wizard

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3361 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-07-20 17:45:39 +00:00
parent e022ced825
commit 6cb76e8190
7 changed files with 383 additions and 66 deletions

View File

@@ -37,7 +37,7 @@ import org.apache.commons.logging.LogFactory;
*
* @author Kevin Roast
*/
public final class DashboardManager
public class DashboardManager
{
private static Log logger = LogFactory.getLog(DashboardManager.class);
@@ -115,41 +115,10 @@ public final class DashboardManager
return page;
}
/**
* Helper to get the DashDefinition as the zero based index, working from the left most column
* top-bottom then working left-right.
*
* @param index Zero based index from the left most column working top-bottom then left-right
*
* @return DashletDefinition if found or null if no dashlet at the specified index
*/
private static DashletDefinition getDashletDefinitionByIndex(PageConfig config, int index)
{
DashletDefinition def = null;
LayoutDefinition layoutDef = config.getCurrentPage().getLayoutDefinition();
List<Column> columns = config.getCurrentPage().getColumns();
int columnCount = columns.size();
int selectedColumn = index / layoutDef.ColumnLength;
if (selectedColumn < columnCount)
{
List<DashletDefinition> dashlets = columns.get(selectedColumn).getDashlets();
if (index % layoutDef.ColumnLength < dashlets.size())
{
def = dashlets.get(index % layoutDef.ColumnLength);
}
}
if (logger.isDebugEnabled())
logger.debug("Searching for dashlet at index: " + index +
" and found " + (def != null ? def.JSPPage : null));
return def;
}
/**
* @return the PageConfig for the current My Alfresco dashboard page
*/
private PageConfig getPageConfig()
public PageConfig getPageConfig()
{
if (this.pageConfig == null)
{
@@ -189,7 +158,7 @@ public final class DashboardManager
}
}
// persist the config for this user
// persist the initial config for this user
//PreferencesService.getPreferences().setValue(PREF_DASHBOARD, pageConfig.toXML());
}
@@ -199,6 +168,15 @@ public final class DashboardManager
return this.pageConfig;
}
/**
* Persist the supplied PageConfig for the current user
*/
public void savePageConfig(PageConfig config)
{
this.pageConfig = config;
PreferencesService.getPreferences().setValue(PREF_DASHBOARD, this.pageConfig.toXML());
}
/**
* @return The externally configured WebClient config element for the Dashboards
*/
@@ -210,6 +188,37 @@ public final class DashboardManager
return config;
}
/**
* Helper to get the DashDefinition as the zero based index, working from the left most column
* top-bottom then working left-right.
*
* @param index Zero based index from the left most column working top-bottom then left-right
*
* @return DashletDefinition if found or null if no dashlet at the specified index
*/
private static DashletDefinition getDashletDefinitionByIndex(PageConfig config, int index)
{
DashletDefinition def = null;
LayoutDefinition layoutDef = config.getCurrentPage().getLayoutDefinition();
List<Column> columns = config.getCurrentPage().getColumns();
int columnCount = columns.size();
int selectedColumn = index / layoutDef.ColumnLength;
if (selectedColumn < columnCount)
{
List<DashletDefinition> dashlets = columns.get(selectedColumn).getDashlets();
if (index % layoutDef.ColumnLength < dashlets.size())
{
def = dashlets.get(index % layoutDef.ColumnLength);
}
}
if (logger.isDebugEnabled())
logger.debug("Searching for dashlet at index: " + index +
" and found " + (def != null ? def.JSPPage : null));
return def;
}
/**
* Dashlet rendering list.