Author: akushunin
Date: 2007-10-02 10:57:41 -0400 (Tue, 02 Oct 2007)
New Revision: 3195
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java
trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarDataModelImpl.java
trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarDataModelItemImpl.java
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
RF-1031
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java
===================================================================
---
trunk/framework/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java 2007-10-02
14:52:30 UTC (rev 3194)
+++
trunk/framework/api/src/main/java/org/richfaces/model/CalendarDataModelItem.java 2007-10-02
14:57:41 UTC (rev 3195)
@@ -55,5 +55,14 @@
/**
*@return tool tip data that will be used in �batch� tooltip loading mode.
**/
- public Object getToolTip();
+ public Object getToolTip();
+
+ /**
+ *@return day of the month on which data must be shown.
+ **/
+ public int getDay();
+
}
+
+
+
Modified:
trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarDataModelImpl.java
===================================================================
---
trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarDataModelImpl.java 2007-10-02
14:52:30 UTC (rev 3194)
+++
trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarDataModelImpl.java 2007-10-02
14:57:41 UTC (rev 3195)
@@ -22,6 +22,7 @@
package org.richfaces;
import java.text.DateFormat;
+import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
@@ -63,8 +64,10 @@
data.put("enLabel", enFormatter.format(date));
data.put("frLabel", frFormatter.format(date));
data.put("deLabel", deFormatter.format(date));
+ /*Calendar c = Calendar.getInstance();
+ c.setTime(date);
+ item.setDay(c.get(Calendar.DAY_OF_MONTH));*/
-
if (new Random().nextInt(10) > 5) {
item.setEnabled(true);
} else {
Modified:
trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarDataModelItemImpl.java
===================================================================
---
trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarDataModelItemImpl.java 2007-10-02
14:52:30 UTC (rev 3194)
+++
trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarDataModelItemImpl.java 2007-10-02
14:57:41 UTC (rev 3195)
@@ -33,8 +33,18 @@
private Object data;
private String styleClass;
private Object toolTip;
+ private int day;
private boolean enabled = true;
+
+ public int getDay() {
+ return day;
+ }
+
+ public void setDay(int day) {
+ this.day = day;
+ }
+
/* (non-Javadoc)
* @see org.richfaces.component.CalendarDataModelItem#getData()
*/
@@ -97,5 +107,5 @@
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
-
+
}
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
---
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-10-02
14:52:30 UTC (rev 3194)
+++
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-10-02
14:57:41 UTC (rev 3195)
@@ -941,13 +941,16 @@
if (this.daysData &&
this.daysData.index[currentYear+'-'+currentMonth]!=undefined)
{
var idx = this.daysData.index[currentYear+'-'+currentMonth];
- var firstDay = this.daysData.days[idx].day;
- while (dayCounter<firstDay)
+ if (this.daysData.startDate.getFullYear()==currentYear &&
this.daysData.startDate.getMonth()==currentMonth)
{
- this.days.push({day:dayCounter, isWeekend:this.isWeekend(p%7), _month:month});
+ var firstDay = firstDay=(this.daysData.days[idx].day ? this.daysData.days[idx].day :
this.daysData.startDate.getDate());
+ while (dayCounter<firstDay)
+ {
+ this.days.push({day:dayCounter, isWeekend:this.isWeekend(p%7), _month:month});
- dayCounter++;
- p++;
+ dayCounter++;
+ p++;
+ }
}
var len = this.daysData.days.length;
Show replies by date