mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. 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:
@@ -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.
|
||||
|
Reference in New Issue
Block a user