Search in sources :

Example 1 with WizardConfig

use of org.alfresco.web.config.WizardsConfigElement.WizardConfig in project acs-community-packaging by Alfresco.

the class AlfrescoNavigationHandler method getWizardConfig.

/**
 * Returns the wizard configuration object for the given wizard name.
 * If there is a node in the dispatch context a lookup is performed using
 * the node otherwise the global config section is used.
 *
 * @param name The name of wizard being launched
 * @param dispatchContext The node being acted upon
 * @return The WizardConfig for the wizard or null if no config could be found
 */
protected WizardConfig getWizardConfig(FacesContext context, String name, Node dispatchContext) {
    WizardConfig wizardConfig = null;
    ConfigService configSvc = Application.getConfigService(context);
    Config config = null;
    if (dispatchContext != null) {
        if (logger.isDebugEnabled())
            logger.debug("Using dispatch context for wizard lookup: " + dispatchContext.getType().toString());
        // use the node to perform the lookup (this will include the global section)
        config = configSvc.getConfig(dispatchContext);
    } else {
        if (logger.isDebugEnabled())
            logger.debug("Looking up wizard in global config");
        // just use the global
        config = configSvc.getGlobalConfig();
    }
    if (config != null) {
        WizardsConfigElement wizardsCfg = (WizardsConfigElement) config.getConfigElement(WizardsConfigElement.CONFIG_ELEMENT_ID);
        if (wizardsCfg != null) {
            wizardConfig = wizardsCfg.getWizard(name);
        }
    }
    return wizardConfig;
}
Also used : WizardsConfigElement(org.alfresco.web.config.WizardsConfigElement) ConfigService(org.springframework.extensions.config.ConfigService) WizardConfig(org.alfresco.web.config.WizardsConfigElement.WizardConfig) DialogConfig(org.alfresco.web.config.DialogsConfigElement.DialogConfig) Config(org.springframework.extensions.config.Config) WizardConfig(org.alfresco.web.config.WizardsConfigElement.WizardConfig)

Example 2 with WizardConfig

use of org.alfresco.web.config.WizardsConfigElement.WizardConfig in project acs-community-packaging by Alfresco.

the class AlfrescoNavigationHandler method handleWizardOpen.

/**
 * Opens a wizard
 *
 * @param context FacesContext
 * @param fromAction The fromAction
 * @param name The name of the wizard to open
 */
protected void handleWizardOpen(FacesContext context, String fromAction, String name) {
    if (logger.isDebugEnabled())
        logger.debug("Opening wizard '" + name + "'");
    // firstly add the current view to the stack so we know where to go back to
    addCurrentViewToStack(context);
    WizardConfig wizard = getWizardConfig(context, name, getDispatchContextNode(context));
    if (wizard != null) {
        if (logger.isDebugEnabled())
            logger.debug("Found config for wizard '" + name + "': " + wizard);
        // set the wizard manager up with the retrieved config
        WizardManager wizardManager = Application.getWizardManager();
        wizardManager.setCurrentWizard(wizard);
        // retrieve the container page and navigate to it
        goToView(context, getWizardContainer(context));
    } else {
        // logger.warn("Failed to find configuration for wizard '" + name + "'");
        // send the dialog name as the outcome to the original handler
        handleDispatch(context, fromAction, name);
    }
}
Also used : WizardManager(org.alfresco.web.bean.wizard.WizardManager) WizardConfig(org.alfresco.web.config.WizardsConfigElement.WizardConfig)

Aggregations

WizardConfig (org.alfresco.web.config.WizardsConfigElement.WizardConfig)2 WizardManager (org.alfresco.web.bean.wizard.WizardManager)1 DialogConfig (org.alfresco.web.config.DialogsConfigElement.DialogConfig)1 WizardsConfigElement (org.alfresco.web.config.WizardsConfigElement)1 Config (org.springframework.extensions.config.Config)1 ConfigService (org.springframework.extensions.config.ConfigService)1