Author: amarkhel
Date: 2010-12-10 09:08:47 -0500 (Fri, 10 Dec 2010)
New Revision: 20496
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
Log:
https://issues.jboss.org/browse/RF-9916 calendar datamodel: add all the methods from 3.3.x
back
Optimization AJAX response from server: excluding default values
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-10
14:04:18 UTC (rev 20495)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-10
14:08:47 UTC (rev 20496)
@@ -552,7 +552,7 @@
HashMap<String, Object> args = new HashMap<String,
Object>();
args.put("startDate", formatStartDate(preloadDateRange[0]));
- args.put("days", calendarDataModelItems);
+ args.put("days",
deleteEmptyPropeties(calendarDataModelItems));
return args;
}
}
@@ -568,6 +568,23 @@
return hashDate;
}
+ public ArrayList<Object> deleteEmptyPropeties(CalendarDataModelItem[]
calendarDataModelItems) {
+ ArrayList<Object> hashItems = new ArrayList<Object>();
+ for (CalendarDataModelItem item : calendarDataModelItems) {
+ HashMap<String, Object> itemPropertiesMap = new HashMap<String,
Object>();
+ if (null != item) {
+ if (!item.isEnabled()) {
+ itemPropertiesMap.put("enabled", item.isEnabled());
+ }
+ if (null != item.getStyleClass() &&
!item.getStyleClass().equalsIgnoreCase("")) {
+ itemPropertiesMap.put("styleClass", item.getStyleClass());
+ }
+ }
+ hashItems.add(itemPropertiesMap);
+ }
+ return hashItems;
+ }
+
public Date[] getPreloadDateRange() {
FacesContext facesContext = FacesContext.getCurrentInstance();