[seam-commits] Seam SVN: r12201 - in modules/faces/trunk/src/main/java: org/jboss/seam/faces and 3 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Mar 15 16:29:43 EDT 2010
Author: lincolnthree
Date: 2010-03-15 16:29:42 -0400 (Mon, 15 Mar 2010)
New Revision: 12201
Modified:
modules/faces/trunk/src/main/java/javax/faces/bean/FlashScoped.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/SeamFacesException.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedExtension.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedContext.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedExtension.java
modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java
Log:
* Applied Seam code style formatting
Modified: modules/faces/trunk/src/main/java/javax/faces/bean/FlashScoped.java
===================================================================
--- modules/faces/trunk/src/main/java/javax/faces/bean/FlashScoped.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/javax/faces/bean/FlashScoped.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -20,6 +20,7 @@
@Documented
@Target(ElementType.TYPE)
@Retention(value = RetentionPolicy.RUNTIME)
-public @interface FlashScoped {
+public @interface FlashScoped
+{
}
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/SeamFacesException.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/SeamFacesException.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/SeamFacesException.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -6,17 +6,18 @@
package org.jboss.seam.faces;
/**
- *
- * @author lbaxter
+ *
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
*/
-public class SeamFacesException extends RuntimeException{
+public class SeamFacesException extends RuntimeException
+{
- public SeamFacesException(String string)
- {
- }
+ public SeamFacesException(String string)
+ {
+ }
- public SeamFacesException()
- {
- }
+ public SeamFacesException()
+ {
+ }
}
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -34,111 +34,140 @@
* holder.
*/
package org.jboss.seam.faces.component;
-
+
import java.io.Serializable;
-
+
import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
import javax.faces.el.MethodBinding;
-
+
import javax.el.MethodExpression;
import javax.el.MethodInfo;
import javax.el.ELException;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
-
+
import java.util.Arrays;
import java.lang.reflect.Method;
-
+
/**
- * <p>Wrap a MethodExpression instance and expose it as a MethodBinding</p>
- *
+ * <p>
+ * Wrap a MethodExpression instance and expose it as a MethodBinding
+ * </p>
+ *
*/
-class MethodBindingMethodExpressionAdapter extends MethodBinding implements StateHolder,
- Serializable {
-
+class MethodBindingMethodExpressionAdapter extends MethodBinding implements StateHolder, Serializable
+{
+
private static final long serialVersionUID = 7334926223014401689L;
private MethodExpression methodExpression = null;
private boolean tranzient;
-
- public MethodBindingMethodExpressionAdapter() {
+
+ public MethodBindingMethodExpressionAdapter()
+ {
} // for StateHolder
-
- MethodBindingMethodExpressionAdapter(MethodExpression methodExpression) {
+
+ MethodBindingMethodExpressionAdapter(MethodExpression methodExpression)
+ {
this.methodExpression = methodExpression;
}
-
+
@Override
- public Object invoke(FacesContext context, Object params[])
- throws javax.faces.el.EvaluationException, javax.faces.el.MethodNotFoundException {
+ public Object invoke(FacesContext context, Object params[]) throws javax.faces.el.EvaluationException, javax.faces.el.MethodNotFoundException
+ {
assert (null != methodExpression);
- if (context == null) {
+ if (context == null)
+ {
throw new NullPointerException("FacesConext -> null");
}
-
+
Object result = null;
- try {
- result = methodExpression.invoke(context.getELContext(),
- params);
- } catch (javax.el.MethodNotFoundException e) {
+ try
+ {
+ result = methodExpression.invoke(context.getELContext(), params);
+ }
+ catch (javax.el.MethodNotFoundException e)
+ {
throw new javax.faces.el.MethodNotFoundException(e);
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new EvaluationException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
Throwable cause = e.getCause();
- if (cause == null) {
+ if (cause == null)
+ {
cause = e;
}
throw new EvaluationException(cause);
- } catch (NullPointerException e) {
+ }
+ catch (NullPointerException e)
+ {
throw new javax.faces.el.MethodNotFoundException(e);
}
return result;
}
-
+
@Override
- public Class getType(FacesContext context) throws javax.faces.el.MethodNotFoundException {
+ public Class getType(FacesContext context) throws javax.faces.el.MethodNotFoundException
+ {
assert (null != methodExpression);
- if (context == null) {
+ if (context == null)
+ {
throw new NullPointerException("FacesConext -> null");
}
Class result = null;
- if (context == null) {
+ if (context == null)
+ {
throw new NullPointerException();
}
-
- try {
- MethodInfo mi =
- methodExpression.getMethodInfo(context.getELContext());
+
+ try
+ {
+ MethodInfo mi = methodExpression.getMethodInfo(context.getELContext());
result = mi.getReturnType();
- } catch (javax.el.PropertyNotFoundException e) {
+ }
+ catch (javax.el.PropertyNotFoundException e)
+ {
throw new javax.faces.el.MethodNotFoundException(e);
- } catch (javax.el.MethodNotFoundException e) {
+ }
+ catch (javax.el.MethodNotFoundException e)
+ {
throw new javax.faces.el.MethodNotFoundException(e);
- } catch (ELException e) {
+ }
+ catch (ELException e)
+ {
throw new javax.faces.el.MethodNotFoundException(e);
}
return result;
}
-
+
@Override
- public String getExpressionString() {
+ public String getExpressionString()
+ {
assert (null != methodExpression);
return methodExpression.getExpressionString();
}
-
+
@Override
- public boolean equals(Object other) {
- if (this == other) {
+ public boolean equals(Object other)
+ {
+ if (this == other)
+ {
return true;
}
- if (other instanceof MethodBindingMethodExpressionAdapter) {
+ if (other instanceof MethodBindingMethodExpressionAdapter)
+ {
return methodExpression.equals(((MethodBindingMethodExpressionAdapter) other).getWrapped());
- } else if (other instanceof MethodBinding) {
+ }
+ else if (other instanceof MethodBinding)
+ {
MethodBinding binding = (MethodBinding) other;
-
+
// We'll need to do a little leg work to determine
// if the MethodBinding is equivalent to the
// wrapped MethodExpression
@@ -147,148 +176,174 @@
String target = expr.substring(0, idx).substring(2);
String t = expr.substring(idx + 1);
String method = t.substring(0, (t.length() - 1));
-
+
FacesContext context = FacesContext.getCurrentInstance();
ELContext elContext = context.getELContext();
MethodInfo controlInfo = methodExpression.getMethodInfo(elContext);
-
+
// ensure the method names are the same
- if (!controlInfo.getName().equals(method)) {
+ if (!controlInfo.getName().equals(method))
+ {
return false;
}
-
+
// Using the target, create an expression and evaluate
// it.
ExpressionFactory factory = context.getApplication().getExpressionFactory();
- ValueExpression ve = factory.createValueExpression(elContext,
- "#{" + target + '}',
- Object.class);
- if (ve == null) {
+ ValueExpression ve = factory.createValueExpression(elContext, "#{" + target + '}', Object.class);
+ if (ve == null)
+ {
return false;
}
-
+
Object result = ve.getValue(elContext);
-
- if (result == null) {
+
+ if (result == null)
+ {
return false;
}
-
+
// Get all of the methods with the matching name and try
// to find a match based on controlInfo's return and parameter
// types
Class type = binding.getType(context);
Method[] methods = result.getClass().getMethods();
- for (Method meth : methods) {
- if (meth.getName().equals(method)
- && type.equals(controlInfo.getReturnType())
- && Arrays.equals(meth.getParameterTypes(),
- controlInfo.getParamTypes())) {
+ for (Method meth : methods)
+ {
+ if (meth.getName().equals(method) && type.equals(controlInfo.getReturnType()) && Arrays.equals(meth.getParameterTypes(), controlInfo.getParamTypes()))
+ {
return true;
}
}
}
-
+
return false;
-
+
}
-
+
@Override
- public int hashCode() {
+ public int hashCode()
+ {
assert (null != methodExpression);
-
+
return methodExpression.hashCode();
}
-
- public boolean isTransient() {
+
+ public boolean isTransient()
+ {
return this.tranzient;
}
-
- public void setTransient(boolean tranzient) {
+
+ public void setTransient(boolean tranzient)
+ {
this.tranzient = tranzient;
}
-
- public Object saveState(FacesContext context) {
- if (context == null) {
+
+ public Object saveState(FacesContext context)
+ {
+ if (context == null)
+ {
throw new NullPointerException();
}
Object result = null;
- if (!tranzient) {
- if (methodExpression instanceof StateHolder) {
+ if (!tranzient)
+ {
+ if (methodExpression instanceof StateHolder)
+ {
Object[] stateStruct = new Object[2];
-
+
// save the actual state of our wrapped methodExpression
stateStruct[0] = ((StateHolder) methodExpression).saveState(context);
// save the class name of the methodExpression impl
stateStruct[1] = methodExpression.getClass().getName();
-
+
result = stateStruct;
- } else {
+ }
+ else
+ {
result = methodExpression;
}
}
-
+
return result;
-
+
}
-
- public void restoreState(FacesContext context, Object state) {
- if (context == null) {
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ if (context == null)
+ {
throw new NullPointerException();
}
// if we have state
- if (null == state) {
+ if (null == state)
+ {
return;
}
-
- if (!(state instanceof MethodExpression)) {
+
+ if (!(state instanceof MethodExpression))
+ {
Object[] stateStruct = (Object[]) state;
Object savedState = stateStruct[0];
String className = stateStruct[1].toString();
MethodExpression result = null;
-
+
Class toRestoreClass = null;
- if (null != className) {
- try {
+ if (null != className)
+ {
+ try
+ {
toRestoreClass = loadClass(className, this);
- } catch (ClassNotFoundException e) {
+ }
+ catch (ClassNotFoundException e)
+ {
throw new IllegalStateException(e.getMessage());
}
-
- if (null != toRestoreClass) {
- try {
- result =
- (MethodExpression) toRestoreClass.newInstance();
- } catch (InstantiationException e) {
+
+ if (null != toRestoreClass)
+ {
+ try
+ {
+ result = (MethodExpression) toRestoreClass.newInstance();
+ }
+ catch (InstantiationException e)
+ {
throw new IllegalStateException(e.getMessage());
- } catch (IllegalAccessException a) {
+ }
+ catch (IllegalAccessException a)
+ {
throw new IllegalStateException(a.getMessage());
}
}
-
- if (null != result && null != savedState) {
+
+ if (null != result && null != savedState)
+ {
// don't need to check transient, since that was
// done on the saving side.
((StateHolder) result).restoreState(context, savedState);
}
methodExpression = result;
}
- } else {
+ }
+ else
+ {
methodExpression = (MethodExpression) state;
}
}
-
- public MethodExpression getWrapped() {
+
+ public MethodExpression getWrapped()
+ {
return methodExpression;
}
-
+
//
// Helper methods for StateHolder
//
- private static Class loadClass(String name,
- Object fallbackClass) throws ClassNotFoundException {
- ClassLoader loader =
- Thread.currentThread().getContextClassLoader();
- if (loader == null) {
+ private static Class loadClass(String name, Object fallbackClass) throws ClassNotFoundException
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null)
+ {
loader = fallbackClass.getClass().getClassLoader();
}
return Class.forName(name, true, loader);
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -26,72 +26,89 @@
import javax.faces.webapp.FacesServlet;
/**
- * <p><strong>UIViewAction</strong> is an {@link ActionSource2} {@link
- * UIComponent} that specifies an application-specific command (or
- * action)--defined as an EL method expression--to be invoked during one of the
- * JSF lifecycle phases that proceeds view rendering. This component must be
- * declared as a child of the {@link ViewMetadata} facet of the {@link
- * UIViewRoot} so that it gets incorporated into the JSF lifecycle on both
- * non-faces (initial) requests and faces (postback) requests.</p>
- *
- * <p>The purpose of this component is to provide a light-weight
- * front-controller solution for executing code upon the loading of a JSF view
- * to support the integration of system services, content retrieval, view
- * management, and navigation. This functionality is especially useful for
- * non-faces (initial) requests.</p>
- *
- * <p>The {@link UIViewAction} component is closely tied to the {@link
- * UIViewParameter} component. The {@link UIViewParameter} component binds a
- * request parameter to a model property. Most of the time, this binding is used
- * to populate the model with data that supports the method being invoked by a
- * {@link UIViewAction} component, much like form inputs populate the model with
- * data to support the method being invoked by a {@link UICommand}
- * component.</p>
- *
- * <p>When the <literal>decode()</literal> method of the {@link UIViewAction} is
+ * <p>
+ * <strong>UIViewAction</strong> is an {@link ActionSource2} {@link UIComponent}
+ * that specifies an application-specific command (or action)--defined as an EL
+ * method expression--to be invoked during one of the JSF lifecycle phases that
+ * proceeds view rendering. This component must be declared as a child of the
+ * {@link ViewMetadata} facet of the {@link UIViewRoot} so that it gets
+ * incorporated into the JSF lifecycle on both non-faces (initial) requests and
+ * faces (postback) requests.
+ * </p>
+ *
+ * <p>
+ * The purpose of this component is to provide a light-weight front-controller
+ * solution for executing code upon the loading of a JSF view to support the
+ * integration of system services, content retrieval, view management, and
+ * navigation. This functionality is especially useful for non-faces (initial)
+ * requests.
+ * </p>
+ *
+ * <p>
+ * The {@link UIViewAction} component is closely tied to the
+ * {@link UIViewParameter} component. The {@link UIViewParameter} component
+ * binds a request parameter to a model property. Most of the time, this binding
+ * is used to populate the model with data that supports the method being
+ * invoked by a {@link UIViewAction} component, much like form inputs populate
+ * the model with data to support the method being invoked by a
+ * {@link UICommand} component.
+ * </p>
+ *
+ * <p>
+ * When the <literal>decode()</literal> method of the {@link UIViewAction} is
* invoked, it will queue an {@link ActionEvent} to be broadcast to all
* interested listeners when the <literal>broadcast()</literal> method is
- * invoked.</p>
- *
- * <p>If the value of the component's <literal>immediate</literal> attribute is
+ * invoked.
+ * </p>
+ *
+ * <p>
+ * If the value of the component's <literal>immediate</literal> attribute is
* <literal>true</literal>, the action will be invoked during the Apply Request
* Values JSF lifecycle phase. Otherwise, the action will be invoked during the
- * Invoke Application phase, the default behavior. The phase cannot be
- * set explicitly in the <literal>phase</literal> attribute, which takes
- * precedence over the <literal>immediate</literal> attribute.</p>
- *
- * <p>The invocation of the action is normally suppressed (meaning the {@link
- * ActionEvent} is not queued) on a faces request. It can be enabled by setting
- * the component's <literal>onPostback</literal> attribute to <literal>true</literal>.
- * Execution of the method can be subject to a required condition for all requests by
- * assigning an EL value expression of expected type boolean to the component's
- * <literal>if</literal> attribute, which must evaluate to
- * <literal>true</literal> for the action to be invoked.</p>
- *
- * <p>The {@link NavigationHandler} is consulted after the action is invoked to
+ * Invoke Application phase, the default behavior. The phase cannot be set
+ * explicitly in the <literal>phase</literal> attribute, which takes precedence
+ * over the <literal>immediate</literal> attribute.
+ * </p>
+ *
+ * <p>
+ * The invocation of the action is normally suppressed (meaning the
+ * {@link ActionEvent} is not queued) on a faces request. It can be enabled by
+ * setting the component's <literal>onPostback</literal> attribute to
+ * <literal>true</literal>. Execution of the method can be subject to a required
+ * condition for all requests by assigning an EL value expression of expected
+ * type boolean to the component's <literal>if</literal> attribute, which must
+ * evaluate to <literal>true</literal> for the action to be invoked.
+ * </p>
+ *
+ * <p>
+ * The {@link NavigationHandler} is consulted after the action is invoked to
* carry out the navigation case that matches the action signature and outcome.
* If a navigation case is matched, or the response is marked complete by the
* action, subsequent {@link UIViewAction} components associated with the
- * current view are short-circuited. The lifecycle then advances
- * appropriately.</p>
- *
- * <p>It's important to note that the full component tree is not built before
- * the UIViewAction components are processed on an non-faces (initial) request.
+ * current view are short-circuited. The lifecycle then advances appropriately.
+ * </p>
+ *
+ * <p>
+ * It's important to note that the full component tree is not built before the
+ * UIViewAction components are processed on an non-faces (initial) request.
* Rather, the component tree only contains the {@link ViewMetadata}, an
* important part of the optimization of this component and what sets it apart
- * from a {@link PreRenderViewEvent} listener.</p>
- *
+ * from a {@link PreRenderViewEvent} listener.
+ * </p>
+ *
* @author Dan Allen
* @author Andy Schwartz
- *
+ *
* @see UIViewParameter
*/
@FacesComponent(
- // tagName = "viewAction",
- // namespace = "http://jboss.org/seam/faces",
- // (see https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=594)
- value = UIViewAction.COMPONENT_TYPE)
-public class UIViewAction extends UIComponentBase implements ActionSource2 {
+// tagName = "viewAction",
+// namespace = "http://jboss.org/seam/faces",
+// (see
+// https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=594)
+value = UIViewAction.COMPONENT_TYPE)
+public class UIViewAction extends UIComponentBase implements ActionSource2
+{
// ------------------------------------------------------ Manifest Constants
@@ -112,20 +129,24 @@
/**
* Properties that are tracked by state saving.
*/
- enum PropertyKeys {
+ enum PropertyKeys
+ {
onPostback, actionExpression, immediate, phase, ifAttr("if");
private String name;
- PropertyKeys() {
+ PropertyKeys()
+ {
}
- PropertyKeys(String name) {
+ PropertyKeys(String name)
+ {
this.name = name;
}
@Override
- public String toString() {
+ public String toString()
+ {
return name != null ? name : super.toString();
}
}
@@ -136,27 +157,31 @@
* Create a new {@link UIViewAction} instance with default property values.
* </p>
*/
- public UIViewAction() {
+ public UIViewAction()
+ {
super();
setRendererType(null);
}
// -------------------------------------------------------------- Properties
@Override
- public String getFamily() {
+ public String getFamily()
+ {
return COMPONENT_FAMILY;
}
/**
* {@inheritDoc}
- *
+ *
* @deprecated This has been replaced by {@link #getActionExpression}.
*/
- public MethodBinding getAction() {
+ public MethodBinding getAction()
+ {
MethodBinding result = null;
MethodExpression me;
- if (null != (me = getActionExpression())) {
+ if (null != (me = getActionExpression()))
+ {
result = new MethodBindingMethodExpressionAdapter(me);
}
return result;
@@ -164,29 +189,33 @@
/**
* {@inheritDoc}
- *
- * @deprecated This has been replaced by {@link #setActionExpression(javax.el.MethodExpression)}.
+ *
+ * @deprecated This has been replaced by
+ * {@link #setActionExpression(javax.el.MethodExpression)}.
* @throws UnsupportedOperationException if called
*/
- public void setAction(MethodBinding action) {
+ public void setAction(MethodBinding action)
+ {
throw new UnsupportedOperationException("Not supported.");
}
/**
* Action listeners are not supported by the {@link UIViewAction} component.
- *
+ *
* @throws UnsupportedOperationException if called
*/
- public MethodBinding getActionListener() {
+ public MethodBinding getActionListener()
+ {
throw new UnsupportedOperationException("Not supported.");
}
/**
* Action listeners are not supported by the {@link UIViewAction} component.
- *
+ *
* @throws UnsupportedOperationException if called
*/
- public void setActionListener(MethodBinding actionListener) {
+ public void setActionListener(MethodBinding actionListener)
+ {
throw new UnsupportedOperationException("Not supported.");
}
@@ -197,33 +226,40 @@
* Values phase. If the value of this attribute is <literal>true</literal>,
* the default, the action will be invoked in the Invoke Application Phase.
*/
- public boolean isImmediate() {
+ public boolean isImmediate()
+ {
return (Boolean) getStateHelper().eval(PropertyKeys.immediate, false);
}
/**
- * Sets the immediate flag, which controls the JSF lifecycle in which
- * the action is invoked.
+ * Sets the immediate flag, which controls the JSF lifecycle in which the
+ * action is invoked.
*/
- public void setImmediate(boolean immediate) {
+ public void setImmediate(boolean immediate)
+ {
getStateHelper().put(PropertyKeys.immediate, immediate);
}
/**
- * <p>Returns the name of the phase in which the action is to be queued. Only
- * the following phases are supported (case does not matter):</p>
+ * <p>
+ * Returns the name of the phase in which the action is to be queued. Only
+ * the following phases are supported (case does not matter):
+ * </p>
* <ul>
* <li>APPLY_REQUEST_VALUES</li>
* <li>PROCESS_VALIDATIONS</li>
* <li>UPDATE_MODEL_VALUES</li>
* <li>INVOKE_APPLICATION</li>
* </ul>
- * <p>If the phase is set, it takes precedence over the
- * immediate flag.</p>
+ * <p>
+ * If the phase is set, it takes precedence over the immediate flag.
+ * </p>
*/
- public String getPhase() {
+ public String getPhase()
+ {
String phase = (String) getStateHelper().eval(PropertyKeys.phase);
- if (phase != null) {
+ if (phase != null)
+ {
phase = phase.toUpperCase();
}
return phase;
@@ -232,66 +268,85 @@
/**
* Set the name of the phase in which the action is to be queued.
*/
- public void setPhase(String phase) {
+ public void setPhase(String phase)
+ {
getStateHelper().put(PropertyKeys.phase, phase);
}
- public PhaseId getPhaseId() {
+ public PhaseId getPhaseId()
+ {
String phase = getPhase();
- if (phase == null) {
+ if (phase == null)
+ {
return null;
}
- if ("APPLY_REQUEST_VALUES".equals(phase)) {
+ if ("APPLY_REQUEST_VALUES".equals(phase))
+ {
return PhaseId.APPLY_REQUEST_VALUES;
- } else if ("PROCESS_VALIDATIONS".equals(phase)) {
+ }
+ else if ("PROCESS_VALIDATIONS".equals(phase))
+ {
return PhaseId.PROCESS_VALIDATIONS;
- } else if ("UPDATE_MODEL_VALUES".equals(phase)) {
+ }
+ else if ("UPDATE_MODEL_VALUES".equals(phase))
+ {
return PhaseId.UPDATE_MODEL_VALUES;
- } else if ("INVOKE_APPLICATION".equals(phase)) {
+ }
+ else if ("INVOKE_APPLICATION".equals(phase))
+ {
return PhaseId.INVOKE_APPLICATION;
- } else if ("ANY_PHASE".equals(phase) || "RESTORE_VIEW".equals(phase) || "RENDER_REPONSE".equals(phase)) {
+ }
+ else if ("ANY_PHASE".equals(phase) || "RESTORE_VIEW".equals(phase) || "RENDER_REPONSE".equals(phase))
+ {
throw new FacesException("View actions cannot be executed in specified phase: [" + phase + "]");
- } else {
+ }
+ else
+ {
throw new FacesException("Not a valid phase [" + phase + "]");
}
}
/**
* Action listeners are not supported by the {@link UIViewAction} component.
- *
+ *
* @throws UnsupportedOperationException if called
*/
- public void addActionListener(ActionListener listener) {
+ public void addActionListener(ActionListener listener)
+ {
throw new UnsupportedOperationException("Not supported.");
}
/**
* Action listeners are not supported by the {@link UIViewAction} component.
*/
- public ActionListener[] getActionListeners() {
+ public ActionListener[] getActionListeners()
+ {
return new ActionListener[0];
}
/**
* Action listeners are not supported by the {@link UIViewAction} component.
- *
+ *
* @throws UnsupportedOperationException if called
*/
- public void removeActionListener(ActionListener listener) {
+ public void removeActionListener(ActionListener listener)
+ {
throw new UnsupportedOperationException("Not supported.");
}
/**
* Returns the action, represented as an EL method expression, to invoke.
*/
- public MethodExpression getActionExpression() {
+ public MethodExpression getActionExpression()
+ {
return (MethodExpression) getStateHelper().get(PropertyKeys.actionExpression);
}
/**
* Sets the action, represented as an EL method expression, to invoke.
*/
- public void setActionExpression(MethodExpression actionExpression) {
+ public void setActionExpression(MethodExpression actionExpression)
+ {
getStateHelper().put(PropertyKeys.actionExpression, actionExpression);
}
@@ -299,15 +354,17 @@
* Returns a boolean value that controls whether the action is invoked during
* faces (postback) request.
*/
- public boolean isOnPostback() {
+ public boolean isOnPostback()
+ {
return (Boolean) getStateHelper().eval(PropertyKeys.onPostback, false);
}
/**
- * Set the bookean flag that controls whether the action is invoked during
- * a faces (postback) request.
+ * Set the bookean flag that controls whether the action is invoked during a
+ * faces (postback) request.
*/
- public void setOnPostback(boolean onPostback) {
+ public void setOnPostback(boolean onPostback)
+ {
getStateHelper().put(PropertyKeys.onPostback, onPostback);
}
@@ -315,7 +372,8 @@
* Returns a condition, represented as an EL value expression, that must
* evaluate to true for the action to be invoked.
*/
- public boolean isIf() {
+ public boolean isIf()
+ {
return (Boolean) getStateHelper().eval(PropertyKeys.ifAttr, true);
}
@@ -323,68 +381,81 @@
* Sets the condition, represented as an EL value expression, that must
* evaluate to true for the action to be invoked.
*/
- public void setIf(boolean condition) {
+ public void setIf(boolean condition)
+ {
getStateHelper().put(PropertyKeys.ifAttr, condition);
}
// ----------------------------------------------------- UIComponent Methods
/**
- * <p>In addition to to the default {@link UIComponent#broadcast} processing,
- * pass the {@link ActionEvent} being broadcast to the default {@link
- * ActionListener} registered on the {@link
- * javax.faces.application.Application}.</p>
- *
+ * <p>
+ * In addition to to the default {@link UIComponent#broadcast} processing,
+ * pass the {@link ActionEvent} being broadcast to the default
+ * {@link ActionListener} registered on the
+ * {@link javax.faces.application.Application}.
+ * </p>
+ *
* @param event {@link FacesEvent} to be broadcast
- *
+ *
* @throws AbortProcessingException Signal the JavaServer Faces
- * implementation that no further processing on the current event
- * should be performed
- * @throws IllegalArgumentException if the implementation class
- * of this {@link FacesEvent} is not supported by this component
- * @throws NullPointerException if <code>event</code> is
- * <code>null</code>
+ * implementation that no further processing on the current event
+ * should be performed
+ * @throws IllegalArgumentException if the implementation class of this
+ * {@link FacesEvent} is not supported by this component
+ * @throws NullPointerException if <code>event</code> is <code>null</code>
*/
@Override
- public void broadcast(FacesEvent event) throws AbortProcessingException {
+ public void broadcast(FacesEvent event) throws AbortProcessingException
+ {
super.broadcast(event);
FacesContext context = getFacesContext();
- // OPEN QUESTION: should we consider a navigation to the same view as a no-op navigation?
+ // OPEN QUESTION: should we consider a navigation to the same view as a
+ // no-op navigation?
- // only proceed if the response has not been marked complete and navigation to another view has not occurred
- if (event instanceof ActionEvent && !context.getResponseComplete()
- && context.getViewRoot() == getViewRootOf(event)) {
+ // only proceed if the response has not been marked complete and
+ // navigation to another view has not occurred
+ if (event instanceof ActionEvent && !context.getResponseComplete() && context.getViewRoot() == getViewRootOf(event))
+ {
ActionListener listener = context.getApplication().getActionListener();
- if (listener != null) {
+ if (listener != null)
+ {
UIViewRoot viewRootBefore = context.getViewRoot();
InstrumentedFacesContext instrumentedContext = new InstrumentedFacesContext(context);
- // defer the call to renderResponse() that happens in ActionListener#processAction(ActionEvent)
+ // defer the call to renderResponse() that happens in
+ // ActionListener#processAction(ActionEvent)
instrumentedContext.disableRenderResponseControl().set();
listener.processAction((ActionEvent) event);
instrumentedContext.restore();
// if the response is marked complete, the story is over
- if (!context.getResponseComplete()) {
+ if (!context.getResponseComplete())
+ {
UIViewRoot viewRootAfter = context.getViewRoot();
- // if the view id changed as a result of navigation, then execute the JSF lifecycle for the new view id
- if (viewRootBefore != viewRootAfter) {
+ // if the view id changed as a result of navigation, then execute
+ // the JSF lifecycle for the new view id
+ if (viewRootBefore != viewRootAfter)
+ {
/*
- // execute the JSF lifecycle by dispatching a forward request
- // this approach is problematic because it throws a wrench in the event broadcasting
- try {
- context.getExternalContext().dispatch(context.getApplication()
- .getViewHandler().getActionURL(context, viewRootAfter.getViewId())
- .substring(context.getExternalContext().getRequestContextPath().length()));
- // kill this lifecycle execution
- context.responseComplete();
- } catch (IOException e) {
- throw new FacesException("Dispatch to viewId failed: " + viewRootAfter.getViewId(), e);
- }
- */
+ * // execute the JSF lifecycle by dispatching a forward
+ * request // this approach is problematic because it throws a
+ * wrench in the event broadcasting try {
+ * context.getExternalContext
+ * ().dispatch(context.getApplication()
+ * .getViewHandler().getActionURL(context,
+ * viewRootAfter.getViewId())
+ * .substring(context.getExternalContext
+ * ().getRequestContextPath().length())); // kill this
+ * lifecycle execution context.responseComplete(); } catch
+ * (IOException e) { throw new
+ * FacesException("Dispatch to viewId failed: " +
+ * viewRootAfter.getViewId(), e); }
+ */
// manually execute the JSF lifecycle on the new view id
- // certain tweaks have to be made to the FacesContext to allow us to reset the lifecycle
+ // certain tweaks have to be made to the FacesContext to allow
+ // us to reset the lifecycle
Lifecycle lifecycle = getLifecycle(context);
instrumentedContext = new InstrumentedFacesContext(context);
instrumentedContext.pushViewIntoRequestMap().clearViewRoot().clearPostback().set();
@@ -392,12 +463,15 @@
instrumentedContext.restore();
/*
- Another approach would be to register a phase listener in the
- decode() method for the phase in which the action is set to
- invoke. The phase listener would performs a servlet forward
- if a non-redirect navigation occurs after the phase.
- */
- } else {
+ * Another approach would be to register a phase listener in
+ * the decode() method for the phase in which the action is
+ * set to invoke. The phase listener would performs a servlet
+ * forward if a non-redirect navigation occurs after the
+ * phase.
+ */
+ }
+ else
+ {
// apply the deferred call (relevant when immediate is true)
context.renderResponse();
}
@@ -412,85 +486,103 @@
* evaluated value of the postback attribute is false, take no action. If the
* evaluated value of the if attribute is false, take no action. If both
* conditions pass, proceed with creating an {@link ActionEvent}.
- *
+ *
* Set the phaseId in which the queued {@link ActionEvent} should be
* broadcast by assigning the appropriate value to the phaseId property of
* the {@link ActionEvent} according to the evaluated value of the immediate
* attribute. If the value is <literal>true</literal>, set the phaseId to
* {@link PhaseId#APPLY_REQUEST_VALUES}. Otherwise, set the phaseId to to
* {@link PhaseId#INVOKE_APPLICATION}.
- *
+ *
* Finally, queue the event by calling <literal>queueEvent()</literal> and
* passing the {@link ActionEvent} just created.
*/
@Override
- public void decode(FacesContext context) {
- if (context == null) {
+ public void decode(FacesContext context)
+ {
+ if (context == null)
+ {
throw new NullPointerException();
}
- if ((context.isPostback() && !isOnPostback()) || !isIf()) {
+ if ((context.isPostback() && !isOnPostback()) || !isIf())
+ {
return;
}
ActionEvent e = new ActionEvent(this);
PhaseId phaseId = getPhaseId();
- if (phaseId != null) {
+ if (phaseId != null)
+ {
e.setPhaseId(phaseId);
- } else if (isImmediate()) {
+ }
+ else if (isImmediate())
+ {
e.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else {
+ }
+ else
+ {
e.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
queueEvent(e);
}
- private UIViewRoot getViewRootOf(FacesEvent e) {
+ private UIViewRoot getViewRootOf(FacesEvent e)
+ {
UIComponent c = e.getComponent();
- do {
- if (c instanceof UIViewRoot) {
+ do
+ {
+ if (c instanceof UIViewRoot)
+ {
return (UIViewRoot) c;
}
c = c.getParent();
- } while (c != null);
+ }
+ while (c != null);
return null;
}
- private Lifecycle getLifecycle(FacesContext context) {
- LifecycleFactory lifecycleFactory = (LifecycleFactory)
- FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
- String lifecycleId = context.getExternalContext()
- .getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR);
- if (lifecycleId == null) {
+ private Lifecycle getLifecycle(FacesContext context)
+ {
+ LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+ String lifecycleId = context.getExternalContext().getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR);
+ if (lifecycleId == null)
+ {
lifecycleId = LifecycleFactory.DEFAULT_LIFECYCLE;
}
return lifecycleFactory.getLifecycle(lifecycleId);
}
/**
- * A FacesContext delegator that gives us the necessary controls over the FacesContext
- * to allow the execution of the lifecycle to accomodate the UIViewAction sequence.
+ * A FacesContext delegator that gives us the necessary controls over the
+ * FacesContext to allow the execution of the lifecycle to accomodate the
+ * UIViewAction sequence.
*/
- private class InstrumentedFacesContext extends FacesContextWrapper {
+ private class InstrumentedFacesContext extends FacesContextWrapper
+ {
private FacesContext wrapped;
private boolean viewRootCleared = false;
private boolean renderedResponseControlDisabled = false;
private Boolean postback = null;
- public InstrumentedFacesContext(FacesContext wrapped) {
+ public InstrumentedFacesContext(FacesContext wrapped)
+ {
this.wrapped = wrapped;
}
@Override
- public FacesContext getWrapped() {
+ public FacesContext getWrapped()
+ {
return wrapped;
}
@Override
- public UIViewRoot getViewRoot() {
- if (viewRootCleared) {
+ public UIViewRoot getViewRoot()
+ {
+ if (viewRootCleared)
+ {
return null;
}
@@ -498,51 +590,62 @@
}
@Override
- public void setViewRoot(UIViewRoot viewRoot) {
+ public void setViewRoot(UIViewRoot viewRoot)
+ {
viewRootCleared = false;
wrapped.setViewRoot(viewRoot);
}
@Override
- public boolean isPostback() {
+ public boolean isPostback()
+ {
return postback == null ? wrapped.isPostback() : postback;
}
@Override
- public void renderResponse() {
- if (!renderedResponseControlDisabled) {
+ public void renderResponse()
+ {
+ if (!renderedResponseControlDisabled)
+ {
wrapped.renderResponse();
}
}
/**
- * Make it look like we have dispatched a request using the include method.
+ * Make it look like we have dispatched a request using the include
+ * method.
*/
- public InstrumentedFacesContext pushViewIntoRequestMap() {
+ public InstrumentedFacesContext pushViewIntoRequestMap()
+ {
getExternalContext().getRequestMap().put("javax.servlet.include.servlet_path", wrapped.getViewRoot().getViewId());
return this;
}
- public InstrumentedFacesContext clearPostback() {
+ public InstrumentedFacesContext clearPostback()
+ {
postback = false;
return this;
}
- public InstrumentedFacesContext clearViewRoot() {
+ public InstrumentedFacesContext clearViewRoot()
+ {
viewRootCleared = true;
return this;
}
- public InstrumentedFacesContext disableRenderResponseControl() {
+ public InstrumentedFacesContext disableRenderResponseControl()
+ {
renderedResponseControlDisabled = true;
return this;
}
- public void set() {
+ public void set()
+ {
setCurrentInstance(this);
}
- public void restore() {
+ public void restore()
+ {
setCurrentInstance(wrapped);
}
}
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -6,20 +6,26 @@
import javax.faces.context.FacesContext;
/**
- * <p>A producer which retrieves the current JSF FacesContext by calling
- * {@link FacesContext#getCurrentInstance}, thus allowing it to be
- * injected.</p>
+ * <p>
+ * A producer which retrieves the current JSF FacesContext by calling
+ * {@link FacesContext#getCurrentInstance}, thus allowing it to be injected.
+ * </p>
*
- * <p>QUESTION should we return null if there is no current phase id? (seems to be a common check)</p>
- * <p>QUESTION is it correct to use a @RequestScoped producer? If it is @Dependent, then a developer could unknowingly bind it to a wider-scoped bean</p>
+ * <p>
+ * QUESTION should we return null if there is no current phase id? (seems to be
+ * a common check)
+ * </p>
+ * <p>
+ * QUESTION is it correct to use a @RequestScoped producer? If it is @Dependent,
+ * then a developer could unknowingly bind it to a wider-scoped bean
+ * </p>
*
* @author Gavin King
- * @author Dan Allen
+ * @author Dan Allen
*/
public class FacesContextProducer
{
- public
- @Produces
+ public @Produces
@RequestScoped
FacesContext getFacesContext()
{
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -18,7 +18,7 @@
import javax.faces.event.PhaseListener;
/**
- * This class provides the contexts lifecycle for the new JSF2 Flash Context
+ * This class provides the lifecycle for the new JSF 2 Flash Context
*
* @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
*/
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedExtension.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedExtension.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedExtension.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -12,21 +12,21 @@
import javax.faces.bean.FlashScoped;
/**
- * An extension to provide @FlashScoped CDI / JSF2 integration.
+ * An extension to provide @FlashScoped CDI / JSF 2 integration.
*
* @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
*/
public class FlashScopedExtension implements Extension
{
- public void addScope(@Observes final BeforeBeanDiscovery event)
- {
- event.addScope(FlashScoped.class, true, true);
- }
+ public void addScope(@Observes final BeforeBeanDiscovery event)
+ {
+ event.addScope(FlashScoped.class, true, true);
+ }
- public void registerContext(@Observes final AfterBeanDiscovery event)
- {
- event.addContext(new FlashScopedContext());
- }
+ public void registerContext(@Observes final AfterBeanDiscovery event)
+ {
+ event.addContext(new FlashScopedContext());
+ }
}
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedContext.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedContext.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedContext.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -40,174 +40,172 @@
public class ViewScopedContext implements Context, SystemEventListener
{
- private final static String COMPONENT_MAP_NAME = "org.jboss.seam.faces.viewscope.componentInstanceMap";
- private final static String CREATIONAL_MAP_NAME = "org.jboss.seam.faces.viewscope.creationalInstanceMap";
+ private final static String COMPONENT_MAP_NAME = "org.jboss.seam.faces.viewscope.componentInstanceMap";
+ private final static String CREATIONAL_MAP_NAME = "org.jboss.seam.faces.viewscope.creationalInstanceMap";
- private boolean isJsfSubscribed = false;
+ private boolean isJsfSubscribed = false;
- @SuppressWarnings("unchecked")
- public <T> T get(final Contextual<T> component)
- {
- assertActive();
+ @SuppressWarnings("unchecked")
+ public <T> T get(final Contextual<T> component)
+ {
+ assertActive();
- if (!isJsfSubscribed)
- {
- FacesContext.getCurrentInstance().getApplication().subscribeToEvent(PreDestroyViewMapEvent.class, this);
- isJsfSubscribed = true;
- }
+ if (!isJsfSubscribed)
+ {
+ FacesContext.getCurrentInstance().getApplication().subscribeToEvent(PreDestroyViewMapEvent.class, this);
+ isJsfSubscribed = true;
+ }
- T instance = (T) getComponentInstanceMap().get(component);
+ T instance = (T) getComponentInstanceMap().get(component);
- return instance;
- }
+ return instance;
+ }
- @SuppressWarnings("unchecked")
- public <T> T get(final Contextual<T> component, final CreationalContext<T> creationalContext)
- {
- assertActive();
+ @SuppressWarnings("unchecked")
+ public <T> T get(final Contextual<T> component, final CreationalContext<T> creationalContext)
+ {
+ assertActive();
- T instance = get(component);
- if (instance == null)
- {
- if (creationalContext != null)
- {
- Map<Contextual<?>, Object> componentInstanceMap = getComponentInstanceMap();
- Map<Contextual<?>, CreationalContext<?>> creationalContextMap = getCreationalInstanceMap();
+ T instance = get(component);
+ if (instance == null)
+ {
+ if (creationalContext != null)
+ {
+ Map<Contextual<?>, Object> componentInstanceMap = getComponentInstanceMap();
+ Map<Contextual<?>, CreationalContext<?>> creationalContextMap = getCreationalInstanceMap();
- synchronized (componentInstanceMap)
- {
- instance = (T) componentInstanceMap.get(component);
- if (instance == null)
- {
- instance = component.create(creationalContext);
- if (instance != null)
- {
- componentInstanceMap.put(component, instance);
- creationalContextMap.put(component, creationalContext);
- }
- }
- }
+ synchronized (componentInstanceMap)
+ {
+ instance = (T) componentInstanceMap.get(component);
+ if (instance == null)
+ {
+ instance = component.create(creationalContext);
+ if (instance != null)
+ {
+ componentInstanceMap.put(component, instance);
+ creationalContextMap.put(component, creationalContext);
+ }
+ }
}
- }
+ }
+ }
- return instance;
- }
+ return instance;
+ }
- public Class<? extends Annotation> getScope()
- {
- return ViewScoped.class;
- }
+ public Class<? extends Annotation> getScope()
+ {
+ return ViewScoped.class;
+ }
- public boolean isActive()
- {
- return getViewRoot() != null;
- }
+ public boolean isActive()
+ {
+ return getViewRoot() != null;
+ }
- private void assertActive()
- {
- if (!isActive())
- {
- throw new ContextNotActiveException(
- "Seam context with scope annotation @ViewScoped is not active with respect to the current thread");
- }
- }
+ private void assertActive()
+ {
+ if (!isActive())
+ {
+ throw new ContextNotActiveException("Seam context with scope annotation @ViewScoped is not active with respect to the current thread");
+ }
+ }
- public boolean isListenerForSource(final Object source)
- {
- if (source instanceof UIViewRoot)
- {
- return true;
- }
+ public boolean isListenerForSource(final Object source)
+ {
+ if (source instanceof UIViewRoot)
+ {
+ return true;
+ }
- return false;
- }
+ return false;
+ }
- /**
- * We get PreDestroyViewMapEvent events from the JSF servlet and destroy our
- * contextual instances. This should (theoretically!) also get fired if the
- * webapp closes, so there should be no need to manually track all view
- * scopes and destroy them at a shutdown.
- *
- * @see javax.faces.event.SystemEventListener#processEvent(javax.faces.event.SystemEvent)
- */
- @SuppressWarnings("unchecked")
- public void processEvent(final SystemEvent event)
- {
- if (event instanceof PreDestroyViewMapEvent)
- {
- Map<Contextual<?>, Object> componentInstanceMap = getComponentInstanceMap();
- Map<Contextual<?>, CreationalContext<?>> creationalContextMap = getCreationalInstanceMap();
+ /**
+ * We get PreDestroyViewMapEvent events from the JSF servlet and destroy our
+ * contextual instances. This should (theoretically!) also get fired if the
+ * webapp closes, so there should be no need to manually track all view
+ * scopes and destroy them at a shutdown.
+ *
+ * @see javax.faces.event.SystemEventListener#processEvent(javax.faces.event.SystemEvent)
+ */
+ @SuppressWarnings("unchecked")
+ public void processEvent(final SystemEvent event)
+ {
+ if (event instanceof PreDestroyViewMapEvent)
+ {
+ Map<Contextual<?>, Object> componentInstanceMap = getComponentInstanceMap();
+ Map<Contextual<?>, CreationalContext<?>> creationalContextMap = getCreationalInstanceMap();
- if (componentInstanceMap != null)
+ if (componentInstanceMap != null)
+ {
+ for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
{
- for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
- {
- /*
- * No way to inform the compiler of type <T> information, so
- * it has to be abandoned here :(
- */
- Contextual contextual = componentEntry.getKey();
- Object instance = componentEntry.getValue();
- CreationalContext creational = creationalContextMap.get(contextual);
+ /*
+ * No way to inform the compiler of type <T> information, so it
+ * has to be abandoned here :(
+ */
+ Contextual contextual = componentEntry.getKey();
+ Object instance = componentEntry.getValue();
+ CreationalContext creational = creationalContextMap.get(contextual);
- contextual.destroy(instance, creational);
- }
+ contextual.destroy(instance, creational);
}
- }
- }
+ }
+ }
+ }
- protected UIViewRoot getViewRoot()
- {
- FacesContext context = FacesContext.getCurrentInstance();
+ protected UIViewRoot getViewRoot()
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
- if (context != null)
- {
- return context.getViewRoot();
- }
+ if (context != null)
+ {
+ return context.getViewRoot();
+ }
- return null;
- }
+ return null;
+ }
- protected Map<String, Object> getViewMap()
- {
- UIViewRoot viewRoot = getViewRoot();
+ protected Map<String, Object> getViewMap()
+ {
+ UIViewRoot viewRoot = getViewRoot();
- if (viewRoot != null)
- {
- return viewRoot.getViewMap(true);
- }
+ if (viewRoot != null)
+ {
+ return viewRoot.getViewMap(true);
+ }
- return null;
- }
+ return null;
+ }
- @SuppressWarnings("unchecked")
- private Map<Contextual<?>, Object> getComponentInstanceMap()
- {
- Map<String, Object> viewMap = getViewMap();
- Map<Contextual<?>, Object> map = (ConcurrentHashMap<Contextual<?>, Object>) viewMap.get(COMPONENT_MAP_NAME);
+ @SuppressWarnings("unchecked")
+ private Map<Contextual<?>, Object> getComponentInstanceMap()
+ {
+ Map<String, Object> viewMap = getViewMap();
+ Map<Contextual<?>, Object> map = (ConcurrentHashMap<Contextual<?>, Object>) viewMap.get(COMPONENT_MAP_NAME);
- if (map == null)
- {
- map = new ConcurrentHashMap<Contextual<?>, Object>();
- viewMap.put(COMPONENT_MAP_NAME, map);
- }
+ if (map == null)
+ {
+ map = new ConcurrentHashMap<Contextual<?>, Object>();
+ viewMap.put(COMPONENT_MAP_NAME, map);
+ }
- return map;
- }
+ return map;
+ }
- @SuppressWarnings("unchecked")
- private Map<Contextual<?>, CreationalContext<?>> getCreationalInstanceMap()
- {
- Map<String, Object> viewMap = getViewMap();
- Map<Contextual<?>, CreationalContext<?>> map = (Map<Contextual<?>, CreationalContext<?>>) viewMap
- .get(CREATIONAL_MAP_NAME);
+ @SuppressWarnings("unchecked")
+ private Map<Contextual<?>, CreationalContext<?>> getCreationalInstanceMap()
+ {
+ Map<String, Object> viewMap = getViewMap();
+ Map<Contextual<?>, CreationalContext<?>> map = (Map<Contextual<?>, CreationalContext<?>>) viewMap.get(CREATIONAL_MAP_NAME);
- if (map == null)
- {
- map = new ConcurrentHashMap<Contextual<?>, CreationalContext<?>>();
- viewMap.put(CREATIONAL_MAP_NAME, map);
- }
+ if (map == null)
+ {
+ map = new ConcurrentHashMap<Contextual<?>, CreationalContext<?>>();
+ viewMap.put(CREATIONAL_MAP_NAME, map);
+ }
- return map;
- }
+ return map;
+ }
}
\ No newline at end of file
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedExtension.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedExtension.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedExtension.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -12,21 +12,21 @@
import javax.faces.bean.ViewScoped;
/**
- * An extension to provide @ViewScoped CDI / JSF2 integration.
+ * An extension to provide @ViewScoped CDI / JSF 2 integration.
*
* @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
*/
public class ViewScopedExtension implements Extension
{
- public void addScope(@Observes final BeforeBeanDiscovery event)
- {
- event.addScope(ViewScoped.class, true, true);
- }
+ public void addScope(@Observes final BeforeBeanDiscovery event)
+ {
+ event.addScope(ViewScoped.class, true, true);
+ }
- public void registerContext(@Observes final AfterBeanDiscovery event)
- {
- event.addContext(new ViewScopedContext());
- }
+ public void registerContext(@Observes final AfterBeanDiscovery event)
+ {
+ event.addContext(new ViewScopedContext());
+ }
}
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java 2010-03-13 18:41:27 UTC (rev 12200)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/international/FacesLocaleResolver.java 2010-03-15 20:29:42 UTC (rev 12201)
@@ -6,25 +6,25 @@
import javax.inject.Inject;
import javax.faces.context.FacesContext;
-
/**
- * A specialized version of the LocaleProducer that returns
- * the Locale associated with the current UIViewRoot or,
- * if the UIViewRoot has not been established, uses the
- * ViewHandler to calculate the Locale.
+ * A specialized version of the LocaleProducer that returns the Locale
+ * associated with the current UIViewRoot or, if the UIViewRoot has not been
+ * established, uses the ViewHandler to calculate the Locale.
*
* @author Dan Allen
*/
public class FacesLocaleResolver // extends LocaleResolver
{
- @Inject FacesContext facesContext;
-
+ @Inject
+ FacesContext facesContext;
+
public boolean isActive()
{
return facesContext != null && facesContext.getCurrentPhaseId() != null;
}
-
- public @Produces Locale getLocale()
+
+ public @Produces
+ Locale getLocale()
{
if (facesContext.getViewRoot() != null)
{
More information about the seam-commits
mailing list