package org.alfresco.web.app;
import java.util.ArrayList;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
import javax.faces.el.VariableResolver;
import org.springframework.extensions.config.Config;
import org.springframework.extensions.config.ConfigService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.jsf.DelegatingVariableResolver;
/**
* JSF VariableResolver that first delegates to the Spring JSF variable
* resolver. The sole purpose of this variable resolver is to look out
* for the Container
variable. If this variable is encountered
* the current viewId is examined. If the current viewId matches a
* configured dialog or wizard container the appropriate manager object is
* returned i.e. DialogManager or WizardManager.
*
*
Configure this resolver in your faces-config.xml
file as follows:
*
*
* <application> * ... * <variable-resolver>org.alfresco.web.app.AlfrescoVariableResolver</variable-resolver> * </application>* * @see org.alfresco.web.bean.dialog.DialogManager * @see org.alfresco.web.bean.wizard.WizardManager * @author gavinc */ public class AlfrescoVariableResolver extends DelegatingVariableResolver { protected List
* This implementation will first delegate to the Spring variable resolver.
* If the variable is not found by the Spring resolver and the variable name
* is Container
the current viewId is examined.
* If the current viewId matches a configured dialog or wizard container
* the appropriate manager object is returned i.e. DialogManager or WizardManager.
*
* @param context FacesContext
* @param name The name of the variable to resolve
*/
public Object resolveVariable(FacesContext context, String name)
throws EvaluationException
{
Object variable = super.resolveVariable(context, name);
if (variable == null)
{
// if the variable was not resolved see if the name is "Container"
if (name.equals(CONTAINER))
{
// get the current view id and the configured dialog and wizard
// container pages
String viewId = context.getViewRoot().getViewId();
List