Search in sources :

Example 1 with DialogConfig

use of org.alfresco.web.config.DialogsConfigElement.DialogConfig in project acs-community-packaging by Alfresco.

the class AlfrescoNavigationHandler method getDialogConfig.

/**
 * Returns the dialog configuration object for the given dialog 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 dialog being launched
 * @param dispatchContext The node being acted upon
 * @return The DialogConfig for the dialog or null if no config could be found
 */
protected DialogConfig getDialogConfig(FacesContext context, String name, Node dispatchContext) {
    DialogConfig dialogConfig = null;
    ConfigService configSvc = Application.getConfigService(context);
    Config config = null;
    if (dispatchContext != null) {
        if (logger.isDebugEnabled())
            logger.debug("Using dispatch context for dialog 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 dialog in global config");
        // just use the global
        config = configSvc.getGlobalConfig();
    }
    if (config != null) {
        DialogsConfigElement dialogsCfg = (DialogsConfigElement) config.getConfigElement(DialogsConfigElement.CONFIG_ELEMENT_ID);
        if (dialogsCfg != null) {
            dialogConfig = dialogsCfg.getDialog(name);
        }
    }
    return dialogConfig;
}
Also used : DialogConfig(org.alfresco.web.config.DialogsConfigElement.DialogConfig) 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) DialogsConfigElement(org.alfresco.web.config.DialogsConfigElement)

Example 2 with DialogConfig

use of org.alfresco.web.config.DialogsConfigElement.DialogConfig in project acs-community-packaging by Alfresco.

the class AlfrescoNavigationHandler method handleDialogOpen.

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

Aggregations

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