Package org.ametys.core.ui
Class RibbonConfigurationManager
- java.lang.Object
-
- org.ametys.core.ui.RibbonConfigurationManager
-
public class RibbonConfigurationManager extends Object
This class handles the ribbon configuration needed for client side display.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRibbonConfigurationManager.CONTROLSIZESize constants for controlsstatic classRibbonConfigurationManager.LAYOUTALIGNSize constants for controls
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>_controlsReferencesThe controls referenced by the ribbonprivate boolean_initializedprivate static org.slf4j.Logger_loggerprivate static Pattern_PLUGINNAMEPATTERNprotected SourceResolver_resolverThe excalibur source resolverprotected RibbonConfiguration_ribbonConfigThe ribbon configuration, as read from the configuration sourceprotected RibbonControlsManager_ribbonControlManagerThe ribbon controls managerprotected RibbonImportManager_ribbonImportManagerThe ribbon import managerprotected RibbonManager_ribbonManagerThe ribbon control managerprotected RibbonManagerCache_ribbonManagerCacheThe ribbon manager Cacheprotected RibbonTabsManager_ribbonTabManagerThe ribbon tab extension pointprotected SAXClientSideElementHelper_saxClientSideElementHelperThe sax clientside element helperprotected Set<String>_tabsReferencesThe tabs referenced by the ribbon
-
Constructor Summary
Constructors Constructor Description RibbonConfigurationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_checkLayoutsConsistency(List<Layout> layoutsBuffer, GroupSize group)private void_checkLayoutsMerge(List<Layout> layoutsBuffer, int elementsPerLayout, Layout layout, List<Element> elements, int layoutSize, GroupSize group)private Layout_checkLayoutsOverflow(RibbonConfigurationManager.CONTROLSIZE size, int elementsPerLayout, Layout layout, List<Element> elements, int currentSize)private void_checkTabConsistency(Map<Tab,List<Group>> tabGroups)private void_checkTabConsistency(GroupSize group)private void_configure(RibbonConfigurationSource ribbonConfigurationSource, ClientSideElementDependenciesManager dependenciesManager, String workspaceName)private void_configureExcluded(Configuration configuration, Map<String,Map<String,Object>> imports, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excluded, String workspaceName)private void_configureExcludeFromImports(String url, Map<String,Map<String,Object>> imports, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excluded)private void_configureExcludeFromImports(Configuration configuration, Map<String,Map<String,Object>> imports, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excluded)private void_configureImport(ClientSideElementDependenciesManager dependenciesManager, Map<String,Long> importValidity, String url, Map<String,Map<String,Object>> imports, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excludedList)private void_configureRibbon(Configuration configuration, ClientSideElementDependenciesManager dependenciesManager, Map<String,Map<String,Object>> imports, Map<String,Long> importValidity, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excludedList, String url)private void_configureRibbonMenu(Configuration configuration, RibbonMenu ribbonMenu, List<RibbonExclude> excludedList, Map<String,Object> properties, String url)private void_configureTabOrder(Map<String,Tab> labelMapping)private void_configureTabOverride(Map<String,Tab> labelMapping)private Group_createGroupForUser(Group ribbonGroup, Map<String,Object> contextualParameters)Create a contextualised group for the current user, based on the ribbon configuration groupprivate void_generateGroupSizes(List<Element> largeElements, List<Element> groupSizeElements, boolean generateSmallSize, int groupTotalSize)private Map<Tab,List<Group>>_generateTabGroups(Map<String,Object> contextualParameters)Generate the tab groups for the current user and contextual parameters, based on the ribbon configured tab list _tabs.private List<ClientSideElement>_getMenuControls(MenuClientSideElement menu)private boolean_isFileExcluded(Map<String,Object> properties, List<RibbonExclude> excludedList, String url)private boolean_isTabExcluded(Tab tab, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excludedList)private void_lazyInitialize()Check that the configuration was correctprivate void_lazyInitialize(List<Element> elements)private void_lazyInitialize(GroupSize groupSize)private void_processControlRefsQueue(List<ControlRef> controlsQueue, List<Element> groupSizeElements, int groupTotalSize, boolean generateSmallSize)private void_removeExcludedControls(List<Element> elements, List<String> excludedList)private void_removeExcludedControls(Tab tab, List<String> excludedList)private List<Element>_resolveReferences(Map<String,Object> contextualParameters, List<Element> elements)Resolve all the controls references into the real ids for the contextual parameters, and the current user rights.private void_saxReferencedControl(MenuClientSideElement menu, ContentHandler handler, Map<String,Object> contextualParameters)voidconfigure(RibbonManager ribbonManager, ClientSideElementDependenciesManager dependenciesManager, RibbonConfigurationSource config, String workspaceName)Configure the manager after being setup, to read and load the ribbons filesList<ClientSideElement>getControls()Retrieve the list of controls referenced by the ribbonList<ClientSideElement>getTabs()Retrieve the list of tabs referenced by the ribbonvoidsaxRibbonDefinition(ContentHandler handler, Map<String,Object> contextualParameters)Sax the the initial configuration of the ribbon.voidsetup(RibbonControlsManager ribbonControlManager, RibbonTabsManager ribbonTabManager, RibbonImportManager ribbonImportManager, SAXClientSideElementHelper saxClientSideElementHelper, SourceResolver resolver, RibbonManagerCache ribbonManagerCache)Setup the ribbon configuration manager with the required components.
-
-
-
Field Detail
-
_logger
private static org.slf4j.Logger _logger
-
_PLUGINNAMEPATTERN
private static Pattern _PLUGINNAMEPATTERN
-
_ribbonManager
protected RibbonManager _ribbonManager
The ribbon control manager
-
_ribbonTabManager
protected RibbonTabsManager _ribbonTabManager
The ribbon tab extension point
-
_saxClientSideElementHelper
protected SAXClientSideElementHelper _saxClientSideElementHelper
The sax clientside element helper
-
_resolver
protected SourceResolver _resolver
The excalibur source resolver
-
_ribbonConfig
protected RibbonConfiguration _ribbonConfig
The ribbon configuration, as read from the configuration source
-
_controlsReferences
protected Set<String> _controlsReferences
The controls referenced by the ribbon
-
_tabsReferences
protected Set<String> _tabsReferences
The tabs referenced by the ribbon
-
_ribbonControlManager
protected RibbonControlsManager _ribbonControlManager
The ribbon controls manager
-
_ribbonImportManager
protected RibbonImportManager _ribbonImportManager
The ribbon import manager
-
_ribbonManagerCache
protected RibbonManagerCache _ribbonManagerCache
The ribbon manager Cache
-
_initialized
private boolean _initialized
-
-
Constructor Detail
-
RibbonConfigurationManager
public RibbonConfigurationManager()
-
-
Method Detail
-
setup
public void setup(RibbonControlsManager ribbonControlManager, RibbonTabsManager ribbonTabManager, RibbonImportManager ribbonImportManager, SAXClientSideElementHelper saxClientSideElementHelper, SourceResolver resolver, RibbonManagerCache ribbonManagerCache)
Setup the ribbon configuration manager with the required components.- Parameters:
ribbonControlManager- The ribbon control managerribbonTabManager- the ribbon tab managerribbonImportManager- The ribbon import managersaxClientSideElementHelper- the helper to SAX client side elementresolver- the excalibur source resolverribbonManagerCache- The ribbon manager cache helper
-
configure
public void configure(RibbonManager ribbonManager, ClientSideElementDependenciesManager dependenciesManager, RibbonConfigurationSource config, String workspaceName)
Configure the manager after being setup, to read and load the ribbons files- Parameters:
ribbonManager- The ribbon manager for this configdependenciesManager- The dependencies managerconfig- the ribbon configurationworkspaceName- The current workspace name- Throws:
RuntimeException- if an error occurred
-
_configure
private void _configure(RibbonConfigurationSource ribbonConfigurationSource, ClientSideElementDependenciesManager dependenciesManager, String workspaceName) throws Exception
- Throws:
Exception
-
_configureExcluded
private void _configureExcluded(Configuration configuration, Map<String,Map<String,Object>> imports, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excluded, String workspaceName) throws ConfigurationException
- Throws:
ConfigurationException
-
_configureExcludeFromImports
private void _configureExcludeFromImports(String url, Map<String,Map<String,Object>> imports, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excluded) throws ConfigurationException
- Throws:
ConfigurationException
-
_configureExcludeFromImports
private void _configureExcludeFromImports(Configuration configuration, Map<String,Map<String,Object>> imports, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excluded) throws ConfigurationException
- Throws:
ConfigurationException
-
_configureRibbon
private void _configureRibbon(Configuration configuration, ClientSideElementDependenciesManager dependenciesManager, Map<String,Map<String,Object>> imports, Map<String,Long> importValidity, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excludedList, String url) throws ConfigurationException
- Throws:
ConfigurationException
-
_configureRibbonMenu
private void _configureRibbonMenu(Configuration configuration, RibbonMenu ribbonMenu, List<RibbonExclude> excludedList, Map<String,Object> properties, String url) throws ConfigurationException
- Throws:
ConfigurationException
-
_configureImport
private void _configureImport(ClientSideElementDependenciesManager dependenciesManager, Map<String,Long> importValidity, String url, Map<String,Map<String,Object>> imports, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excludedList) throws ConfigurationException
- Throws:
ConfigurationException
-
_isFileExcluded
private boolean _isFileExcluded(Map<String,Object> properties, List<RibbonExclude> excludedList, String url)
-
_isTabExcluded
private boolean _isTabExcluded(Tab tab, Map<RibbonExclude.EXCLUDETYPE,List<RibbonExclude>> excludedList)
-
_removeExcludedControls
private void _removeExcludedControls(Tab tab, List<String> excludedList)
-
_removeExcludedControls
private void _removeExcludedControls(List<Element> elements, List<String> excludedList)
-
_configureTabOverride
private void _configureTabOverride(Map<String,Tab> labelMapping)
-
_configureTabOrder
private void _configureTabOrder(Map<String,Tab> labelMapping)
-
_lazyInitialize
private void _lazyInitialize()
Check that the configuration was correct- Throws:
IllegalStateException- if an item does not exist
-
_lazyInitialize
private void _lazyInitialize(GroupSize groupSize)
-
_lazyInitialize
private void _lazyInitialize(List<Element> elements)
-
getControls
public List<ClientSideElement> getControls()
Retrieve the list of controls referenced by the ribbon- Returns:
- The list of controls
-
getTabs
public List<ClientSideElement> getTabs()
Retrieve the list of tabs referenced by the ribbon- Returns:
- The list of tabs
-
_getMenuControls
private List<ClientSideElement> _getMenuControls(MenuClientSideElement menu)
-
saxRibbonDefinition
public void saxRibbonDefinition(ContentHandler handler, Map<String,Object> contextualParameters) throws SAXException
Sax the the initial configuration of the ribbon.- Parameters:
handler- The content handler where to saxcontextualParameters- Contextuals parameters transmitted by the environment.- Throws:
SAXException- if an error occurs
-
_generateTabGroups
private Map<Tab,List<Group>> _generateTabGroups(Map<String,Object> contextualParameters)
Generate the tab groups for the current user and contextual parameters, based on the ribbon configured tab list _tabs.- Parameters:
contextualParameters- The contextual parameters- Returns:
- The list of groups for the current user, mapped by tab
-
_checkTabConsistency
private void _checkTabConsistency(Map<Tab,List<Group>> tabGroups)
-
_checkTabConsistency
private void _checkTabConsistency(GroupSize group)
-
_checkLayoutsConsistency
private void _checkLayoutsConsistency(List<Layout> layoutsBuffer, GroupSize group)
-
_checkLayoutsOverflow
private Layout _checkLayoutsOverflow(RibbonConfigurationManager.CONTROLSIZE size, int elementsPerLayout, Layout layout, List<Element> elements, int currentSize)
-
_checkLayoutsMerge
private void _checkLayoutsMerge(List<Layout> layoutsBuffer, int elementsPerLayout, Layout layout, List<Element> elements, int layoutSize, GroupSize group)
-
_createGroupForUser
private Group _createGroupForUser(Group ribbonGroup, Map<String,Object> contextualParameters)
Create a contextualised group for the current user, based on the ribbon configuration group- Parameters:
ribbonGroup- The group form the initial ribbon configurationcontextualParameters- The contextual parameters- Returns:
- The group for the current user
-
_resolveReferences
private List<Element> _resolveReferences(Map<String,Object> contextualParameters, List<Element> elements)
Resolve all the controls references into the real ids for the contextual parameters, and the current user rights.- Parameters:
contextualParameters- The contextual parameterselements- The elements to resolve- Returns:
- The list of resolved elements
-
_generateGroupSizes
private void _generateGroupSizes(List<Element> largeElements, List<Element> groupSizeElements, boolean generateSmallSize, int groupTotalSize)
-
_processControlRefsQueue
private void _processControlRefsQueue(List<ControlRef> controlsQueue, List<Element> groupSizeElements, int groupTotalSize, boolean generateSmallSize)
-
_saxReferencedControl
private void _saxReferencedControl(MenuClientSideElement menu, ContentHandler handler, Map<String,Object> contextualParameters) throws SAXException
- Throws:
SAXException
-
-