Author: ppitonak(a)redhat.com
Date: 2010-09-21 12:00:08 -0400 (Tue, 21 Sep 2010)
New Revision: 19287
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JStatusBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/instantAttributes.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/viewUsage.xhtml
Log:
* added a new action for creating errors to RichBean
* status' pages changed to use the new action
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JStatusBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JStatusBean.java 2010-09-21
15:57:55 UTC (rev 19286)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JStatusBean.java 2010-09-21
16:00:08 UTC (rev 19287)
@@ -24,12 +24,10 @@
import java.io.Serializable;
import javax.annotation.PostConstruct;
-import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
-import javax.faces.validator.ValidatorException;
-import org.richfaces.component.UIStatus;
+import org.richfaces.component.UIStatus;
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,7 +45,7 @@
private static final long serialVersionUID = -1L;
private static Logger logger;
private Attributes attributes;
-
+
private String facetStartValue = "START";
private String facetStopValue = "STOP";
private String facetErrorValue = "ERROR";
@@ -76,7 +74,7 @@
public void setAttributes(Attributes attributes) {
this.attributes = attributes;
}
-
+
public String getFacetStartValue() {
return facetStartValue;
}
@@ -102,17 +100,6 @@
}
/**
- * Action that causes an error. Suitable for testing 'onerror' attribute.
- *
- * @return method never returns any value
- * @throws ValidationException
- * thrown always
- */
- public String causeError() {
- throw new ValidatorException(new FacesMessage("Ajax request caused an
error."));
- }
-
- /**
* Action that creates a 2-second delay.
*
* @throws InterruptedException
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-09-21
15:57:55 UTC (rev 19286)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-09-21
16:00:08 UTC (rev 19287)
@@ -32,10 +32,12 @@
import javax.annotation.PostConstruct;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
+import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
+import javax.faces.validator.ValidatorException;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
@@ -64,17 +66,17 @@
private String component;
private Map<String, String> components; // [a4jCommandLink; A4J Command Link]
private String container;
-
+
public enum Skinning {
NONE, SKINNING, SKINNING_CLASSES
}
-
+
@PostConstruct
public void init() {
logger = LoggerFactory.getLogger(RichBean.class);
createSkinList();
createComponentsMap();
-
+
component = "none";
container = "plain";
skin = "blueSky";
@@ -174,7 +176,7 @@
public void setSkinning(String skinning) {
this.skinning = Skinning.valueOf(skinning);
}
-
+
public String getSkinningClasses() {
if (skinning == Skinning.SKINNING_CLASSES) {
return "enabled";
@@ -230,11 +232,11 @@
public String getComponent() {
return component;
}
-
+
public Set<String> getComponentList() {
return components.keySet();
}
-
+
/**
* @return the components
*/
@@ -243,7 +245,8 @@
}
/**
- * @param components the components to set
+ * @param components
+ * the components to set
*/
public void setComponents(Map<String, String> components) {
this.components = components;
@@ -305,7 +308,7 @@
public String invalidateSession() {
Object session =
FacesContext.getCurrentInstance().getExternalContext().getSession(true);
-
+
if (session == null) {
return "/index";
}
@@ -325,4 +328,15 @@
List<String> phases = (List<String>)
exp.getValue(ctx.getELContext());
phases.add(msg);
}
+
+ /**
+ * Action that causes an error. Suitable for testing 'onerror' attribute.
+ *
+ * @return method never returns any value
+ * @throws ValidationException
+ * thrown always
+ */
+ public String causeError() {
+ throw new ValidatorException(new FacesMessage("Ajax request caused an error.
This is intentional behavior."));
+ }
}
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/instantAttributes.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/instantAttributes.xhtml 2010-09-21
15:57:55 UTC (rev 19286)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/instantAttributes.xhtml 2010-09-21
16:00:08 UTC (rev 19287)
@@ -76,7 +76,7 @@
<br />
<a4j:commandButton id="button3"
value="Send Ajax Request Causing Error"
- action="#{a4jStatusBean.causeError}" />
+ action="#{richBean.causeError}" />
</h:form>
</ui:define>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml 2010-09-21
15:57:55 UTC (rev 19286)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml 2010-09-21
16:00:08 UTC (rev 19287)
@@ -89,7 +89,7 @@
<br/>
<a4j:commandButton id="button2" value="Send Ajax
Request"/>
<br/>
- <a4j:commandButton id="button3" value="Send Ajax Request
Causing Error" action="#{a4jStatusBean.causeError}"/>
+ <a4j:commandButton id="button3" value="Send Ajax Request
Causing Error" action="#{richBean.causeError}"/>
</ui:define>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/viewUsage.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/viewUsage.xhtml 2010-09-21
15:57:55 UTC (rev 19286)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/viewUsage.xhtml 2010-09-21
16:00:08 UTC (rev 19287)
@@ -83,7 +83,7 @@
<fieldset>
<legend>form3</legend>
<h:form id="form3">
- <a4j:commandButton id="button3" value="Send Ajax
Request Causing Error" action="#{a4jStatusBean.causeError}"/>
+ <a4j:commandButton id="button3" value="Send Ajax
Request Causing Error" action="#{richBean.causeError}"/>
</h:form>
</fieldset>
Show replies by date