Author: abelevich
Date: 2007-07-19 15:35:43 -0400 (Thu, 19 Jul 2007)
New Revision: 1708
Added:
trunk/sandbox/samples/rich-message-demo/src/main/java/
trunk/sandbox/samples/rich-message-demo/src/main/java/org/
trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/
trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/
trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java
Log:
Added:
trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java
===================================================================
---
trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java
(rev 0)
+++
trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java 2007-07-19
19:35:43 UTC (rev 1708)
@@ -0,0 +1,58 @@
+package org.richfaces.demo;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+public class SelectValidator implements Validator {
+
+ public SelectValidator() {
+ }
+
+ public void validate(FacesContext context, UIComponent component, Object value) throws
ValidatorException {
+ System.out.println("SelectValidator.validate()");
+
+ String selectedValue = (String) value;
+ String clientId = component.getClientId(context);
+
+ if(selectedValue.equals("warn")){
+
+ FacesMessage message = new FacesMessage();
+ message.setSummary("warning SUMMARY");
+ message.setDetail("warning DETAIL");
+ message.setSeverity(FacesMessage.SEVERITY_WARN);
+ context.addMessage(clientId, message);
+
+
+ }else if(selectedValue.equals("error")){
+
+ FacesMessage message = new FacesMessage();
+ message.setSummary("error SUMMARY");
+ message.setDetail("error DETAIL");
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+
+ context.addMessage(clientId, message);
+
+ }else if(selectedValue.equals("info")){
+
+ FacesMessage message = new FacesMessage();
+ message.setSummary("info SUMMARY");
+ message.setDetail("info DETAIL");
+ message.setSeverity(FacesMessage.SEVERITY_INFO);
+
+ context.addMessage(clientId, message);
+
+ }else if(selectedValue.equals("fatal")){
+
+ FacesMessage message = new FacesMessage();
+ message.setSummary("fatal SUMMARY");
+ message.setDetail("fatal DETAIL");
+ message.setSeverity(FacesMessage.SEVERITY_FATAL);
+
+ context.addMessage(clientId, message);
+ }
+ }
+
+}
Show replies by date