Refine search
/** * Returns the requested object configured in the faces-config or from library. */ public static Object resolveVariable(final FacesContext context, final String variable) { final Application application = context.getApplication(); final VariableResolver variableResolver = application.getVariableResolver(); return variableResolver.resolveVariable(context, variable); }
/** {@inheritDoc} */ public Object getValue(FacesContext context) throws EvaluationException, PropertyNotFoundException { if (context == null) { throw new NullPointerException(); } List names = parse(ref); // Resolve the variable name VariableResolver vr = application().getVariableResolver(); String name = (String) names.get(0); Object base = vr.resolveVariable(context, name); if (names.size() < 2) { return (base); } // Resolve the property names PropertyResolver pr = application().getPropertyResolver(); for (int i = 1; i < names.size(); i++) { base = pr.getValue(base, (String) names.get(i)); } // Return the resolved value return (base); }
@Override public Object resolveVariable(FacesContext facesContext, String name) throws EvaluationException { return delegate.resolveVariable(facesContext, name); } }
/** * <p>Returns the "@managed-bean-name" the view controller is registered under. The * assumed mapping will be the same as in core Shale.</p> * * @param context faces context * @param viewId name of the page * @return default managed bean name associated with the view */ protected String getManagedBeanName(FacesContext context, String viewId) { String managedBeanName = null; Object mapper = context.getApplication().getVariableResolver() .resolveVariable(context, VIEW_MAPPER); // is there a view controller mapper if (mapper != null) { StringBuffer el = new StringBuffer(); el.append("#{").append(VIEW_MAPPER).append(".mapViewId").append("}"); MethodBinding mb = context.getApplication() .createMethodBinding(el.toString(), new Class[] {String.class}); managedBeanName = (String) mb.invoke(context, new Object[] {viewId}); } return managedBeanName; }
public Object resolveVariable(FacesContext context, String name) throws EvaluationException { if (context == null) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "context"); throw new NullPointerException(message); } if (name == null) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "name"); throw new NullPointerException(message); } Object result; if (delegate != null) { result = delegate.resolveVariable(context, name); } else { try { result = context.getApplication().getELResolver().getValue(context.getELContext(), null, name); } catch (ELException elex) { throw new EvaluationException(elex); } } return result; }
/** {@inheritDoc} */ public Class getType(FacesContext context) throws PropertyNotFoundException { if (context == null) { throw new NullPointerException(); } List names = parse(ref); // Resolve the variable name VariableResolver vr = application().getVariableResolver(); String name = (String) names.get(0); Object base = vr.resolveVariable(context, name); if (names.size() < 2) { return base.getClass(); } // Resolve the property names PropertyResolver pr = application().getPropertyResolver(); for (int i = 1; i < names.size() - 1; i++) { base = pr.getValue(base, (String) names.get(i)); } // Return the type of the final property return pr.getType(base, (String) names.get(names.size() - 1)); }
public Object resolveVariable(FacesContext facesContext, String name) throws EvaluationException { return delegate.resolveVariable(facesContext, name); } }
@Override public Object resolveVariable(FacesContext context, String name) throws EvaluationException { if (context == null) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "context"); throw new NullPointerException(message); } if (name == null) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "name"); throw new NullPointerException(message); } Object result; if (delegate != null) { result = delegate.resolveVariable(context, name); } else { try { result = context.getApplication().getELResolver().getValue(context.getELContext(), null, name); } catch (ELException elex) { throw new EvaluationException(elex); } } return result; }
public static Object resolveVariable(FacesContext context, String name) { if (context == null) { context = FacesContext.getCurrentInstance(); } return context.getApplication().getVariableResolver().resolveVariable( context, name); }
/** {@inheritDoc} */ public boolean isReadOnly(FacesContext context) throws PropertyNotFoundException { if (context == null) { throw new NullPointerException(); } List names = parse(ref); // Resolve the variable name VariableResolver vr = application().getVariableResolver(); String name = (String) names.get(0); Object base = vr.resolveVariable(context, name); if (names.size() < 2) { return true; } // Resolve the property names PropertyResolver pr = application().getPropertyResolver(); for (int i = 1; i < names.size() - 1; i++) { base = pr.getValue(base, (String) names.get(i)); } // Return the read only state of the final property return pr.isReadOnly(base, (String) names.get(names.size() - 1)); }
@Override public Object resolveVariable(FacesContext facesContext, String name) throws EvaluationException { return delegate.resolveVariable(facesContext, name); } }
public Object resolveVariable(FacesContext context, String name) throws EvaluationException { if (context == null) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "context"); throw new NullPointerException(message); } if (name == null) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "name"); throw new NullPointerException(message); } Object result; if (delegate != null) { result = delegate.resolveVariable(context, name); } else { try { result = context.getApplication().getELResolver().getValue(context.getELContext(), null, name); } catch (ELException elex) { throw new EvaluationException(elex); } } return result; }
/** * <p>Return the <code>ViewControllerCallbacks</code> instance to be used * to forward prerender and preprocess callbacks to our view controller, * whether or not it implements the <code>ViewController</code> interface * (it may not if it is using the <code>@View</code> annotation from the * shale-tiger module).</p> * * @param context <code>FacesContext</code> for the current request */ private ViewControllerCallbacks getViewControllerCallbacks(FacesContext context) { ViewControllerCallbacks vcb = (ViewControllerCallbacks) context.getApplication().getVariableResolver().resolveVariable (context, FacesConstants.VIEW_CALLBACKS); return vcb; }
/** {@inheritDoc} */ public Class getType(FacesContext context) throws PropertyNotFoundException { if (context == null) { throw new NullPointerException(); } List names = parse(ref); // Resolve the variable name VariableResolver vr = application().getVariableResolver(); String name = (String) names.get(0); Object base = vr.resolveVariable(context, name); if (names.size() < 2) { return base.getClass(); } // Resolve the property names PropertyResolver pr = application().getPropertyResolver(); for (int i = 1; i < names.size() - 1; i++) { base = pr.getValue(base, (String) names.get(i)); } // Return the type of the final property return pr.getType(base, (String) names.get(names.size() - 1)); }
private static Map getScopeMap(FacesContext context, VariableResolver resolver, String key, String[] scopes) { for (int i = 0; i < scopes.length; i++) { Map scopeMap = (Map) resolver.resolveVariable(context, scopes[i]); if (scopeMap.get(key) != null) { return scopeMap; } } return null; } }
@Override public Object resolveVariable(FacesContext context, String name) throws EvaluationException { if (context == null) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "context"); throw new NullPointerException(message); } if (name == null) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "name"); throw new NullPointerException(message); } Object result; if (delegate != null) { result = delegate.resolveVariable(context, name); } else { try { result = context.getApplication().getELResolver().getValue(context.getELContext(), null, name); } catch (ELException elex) { throw new EvaluationException(elex); } } return result; }
/** * Override this method in order to customise the bean instance. */ protected static Converter createConverter(String beanName) { FacesContext facesContext = FacesContext.getCurrentInstance(); Application application = facesContext.getApplication(); Object converter = application.getVariableResolver().resolveVariable(facesContext, beanName); return (Converter) converter; } }
/** {@inheritDoc} */ public Class getType(FacesContext context) throws PropertyNotFoundException { if (context == null) { throw new NullPointerException(); } List names = parse(ref); // Resolve the variable name VariableResolver vr = application().getVariableResolver(); String name = (String) names.get(0); Object base = vr.resolveVariable(context, name); if (names.size() < 2) { return base.getClass(); } // Resolve the property names PropertyResolver pr = application().getPropertyResolver(); for (int i = 1; i < names.size() - 1; i++) { base = pr.getValue(base, (String) names.get(i)); } // Return the type of the final property return pr.getType(base, (String) names.get(names.size() - 1)); }
/** * See javadoc for VariableResolver. * * @see javax.faces.el.VariableResolver#resolveVariable(javax.faces.context.FacesContext, java.lang.String) */ public Object resolveVariable(FacesContext facesContext, String name) throws EvaluationException { if (isSeamPresent && SEAM_CONVERSATION_EL_IDENTIFIER.equals(name)) { return ConversationScope.getConversationCache(); } return delegate.resolveVariable(facesContext, name); }
/** * Override this method in order to customise the bean instance. */ protected static Converter createConverter(String beanName) throws JspException { FacesContext facesContext = FacesContext.getCurrentInstance(); Application application = facesContext.getApplication(); Object converter = application.getVariableResolver().resolveVariable(facesContext, beanName); return (Converter) converter; } }