Author: akushunin
Date: 2007-07-19 08:04:54 -0400 (Thu, 19 Jul 2007)
New Revision: 1696
Modified:
branches/3.0.2/sandbox/calendar/src/main/java/org/richfaces/component/UICalendar.java
Log:
Added exceptions handling.
Added ValueChangeEvent to broadcast method.
Modified:
branches/3.0.2/sandbox/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
---
branches/3.0.2/sandbox/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-19
11:39:50 UTC (rev 1695)
+++
branches/3.0.2/sandbox/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-19
12:04:54 UTC (rev 1696)
@@ -35,7 +35,6 @@
import java.util.TimeZone;
import javax.faces.application.FacesMessage;
-//import javax.faces.component.MessageFactory;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.UIViewRoot;
@@ -47,11 +46,13 @@
import javax.faces.el.ValueBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.render.Renderer;
import org.ajax4jsf.framework.ajax.AjaxChildrenEncoder;
import org.ajax4jsf.framework.ajax.AjaxContext;
import org.ajax4jsf.framework.ajax.AjaxEvent;
+import org.ajax4jsf.framework.util.message.Messages;
import org.richfaces.renderkit.CalendarDataModelItemAdaptor;
import org.richfaces.renderkit.CalendarRendererBase;
import org.richfaces.renderkit.CurrentDateChangeEvent;
@@ -124,10 +125,11 @@
return;
}else{ setCurrentDate(currentDate);}
}catch (Exception e) {
-//TODO Add Exceptionhandling String messageStr = e.getMessage();
-// FacesMessage message = MessageFactory.getMessage(context, CONVERSION_MESSAGE_ID);
-// message.setSeverity(FacesMessage.SEVERITY_ERROR);
-// context.addMessage(getClientId(context), message);
+
+ String messageString = e.getMessage();
+ FacesMessage message = new FacesMessage(messageString);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
}
}
@@ -204,14 +206,20 @@
CurrentDateChangeEvent newDateChangeEvent = new CurrentDateChangeEvent(this,
currentDate);
newDateChangeEvent.queue();
} catch (Exception e) {
- //TODO Add Exception Handling
+ String messageString = e.getMessage();
+ FacesMessage message = new FacesMessage(messageString);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ facesContext.addMessage(getClientId(facesContext), message);
}
+
}
else{
Date currentDate1 = dateChangeEvent.getCurrentDate();
Date currentDate2 = getCurrentDate();
if(!currentDate1.equals(currentDate2)){
updateCurrentDate(facesContext, currentDate1);
+ ValueChangeEvent changeEvent = new
ValueChangeEvent(this,currentDate2,currentDate1);
+ changeEvent.queue();
//TODO Add ValueChange Events for currentDate
}
Show replies by date