Author: dan.j.allen
Date: 2009-04-29 14:20:45 -0400 (Wed, 29 Apr 2009)
New Revision: 10726
Modified:
modules/trunk/mock/src/main/java/org/jboss/seam/mock/faces/MockFacesContext.java
Log:
add some additional JSF 2.0 method impl
Modified:
modules/trunk/mock/src/main/java/org/jboss/seam/mock/faces/MockFacesContext.java
===================================================================
---
modules/trunk/mock/src/main/java/org/jboss/seam/mock/faces/MockFacesContext.java 2009-04-29
18:20:16 UTC (rev 10725)
+++
modules/trunk/mock/src/main/java/org/jboss/seam/mock/faces/MockFacesContext.java 2009-04-29
18:20:45 UTC (rev 10726)
@@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -37,6 +38,7 @@
import javax.faces.application.ApplicationFactory;
import javax.faces.application.FacesMessage;
import javax.faces.application.FacesMessage.Severity;
+import javax.faces.component.UINamingContainer;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -64,6 +66,8 @@
*/
private final Map<String, List<FacesMessage>> messages = new
LinkedHashMap<String, List<FacesMessage>>();
+ private Map<Object, Object> attributes = new HashMap<Object, Object>();
+
private ExternalContext externalContext;
private ResponseWriter responseWriter;
@@ -78,17 +82,35 @@
private PhaseId currentPhaseId;
+ private boolean postback;
+
public MockFacesContext()
{
+ attributes.put(UINamingContainer.SEPARATOR_CHAR_PARAM_NAME, ':');
}
+ public MockFacesContext(boolean postback)
+ {
+ this();
+ this.postback = postback;
+ }
+
public MockFacesContext(Application application)
{
+ this();
this.application = application;
}
+ public MockFacesContext(Application application, boolean postback)
+ {
+ this();
+ this.application = application;
+ this.postback = postback;
+ }
+
public MockFacesContext(ExternalContext externalContext, Application application)
{
+ this();
this.externalContext = externalContext;
this.application = application;
}
@@ -97,8 +119,9 @@
// Application
public MockFacesContext(ExternalContext externalContext)
{
- application = ((ApplicationFactory)
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY)).getApplication();
- renderKitFactory = (RenderKitFactory)
FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ this();
+ this.application = ((ApplicationFactory)
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY)).getApplication();
+ this.renderKitFactory = (RenderKitFactory)
FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
this.externalContext = externalContext;
}
@@ -172,6 +195,12 @@
}
@Override
+ public Map<Object, Object> getAttributes()
+ {
+ return attributes;
+ }
+
+ @Override
public RenderKit getRenderKit()
{
if (getViewRoot() == null || getViewRoot().getRenderKitId() == null)
@@ -278,6 +307,17 @@
this.currentPhaseId = phaseId;
}
+ @Override
+ public boolean isPostback()
+ {
+ return postback;
+ }
+
+ public void setPostback(boolean postback)
+ {
+ this.postback = postback;
+ }
+
public MockFacesContext setCurrent()
{
setCurrentInstance(this);
Show replies by date