Author: pyaschenko
Date: 2008-04-22 10:56:39 -0400 (Tue, 22 Apr 2008)
New Revision: 8070
Modified:
trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java
trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
trunk/ui/calendar/src/main/config/component/calendar.xml
trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
http://jira.jboss.com/jira/browse/RF-3106
http://jira.jboss.com/jira/browse/RF-3107
Modified: trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java
===================================================================
--- trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java 2008-04-22
14:54:36 UTC (rev 8069)
+++ trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java 2008-04-22
14:56:39 UTC (rev 8070)
@@ -57,6 +57,7 @@
private String todayControlMode;
private boolean showHeader;
private boolean showFooter;
+ private boolean resetTimeOnDateSelect;
private int counter;
@@ -110,6 +111,7 @@
boundary = "inactive";
disabled = false;
todayControlMode = "select";
+ resetTimeOnDateSelect = false;
}
@@ -274,4 +276,12 @@
public void setShowFooter(boolean showFooter) {
this.showFooter = showFooter;
}
+
+ public boolean isResetTimeOnDateSelect() {
+ return resetTimeOnDateSelect;
+ }
+
+ public void setResetTimeOnDateSelect(boolean resetTimeOnDateSelect) {
+ this.resetTimeOnDateSelect = resetTimeOnDateSelect;
+ }
}
\ No newline at end of file
Modified: trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
===================================================================
--- trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp 2008-04-22 14:54:36
UTC (rev 8069)
+++ trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp 2008-04-22 14:56:39
UTC (rev 8070)
@@ -49,10 +49,6 @@
<calendar:calendar cellWidth="5" cellHeight="5"/>
<calendar:calendar cellWidth="40" cellHeight="40"
popup="#{calendarBean.popup}"/>
<calendar:calendar
- onchanged = "alert('changed:'+this.value);"
- ontimeselected = "alert('time
selectED:'+event.rich.date.toString());"
- ondateselected = "alert('date
selectED:'+event.rich.date.toString());"
- ondateselect = "alert('date
select:'+event.rich.date.toString());"
id="calendar"
dataModel="#{calendarDataModel}"
locale="#{calendarBean.locale}"
@@ -81,7 +77,8 @@
cellWidth="50"
mode="ajax"
showApplyButton="#{calendarBean.showApplyButton}"
- todayControlMode="#{calendarBean.todayControlMode}">
+ todayControlMode="#{calendarBean.todayControlMode}"
+ resetTimeOnDateSelect="#{calendarBean.resetTimeOnDateSelect}">
<f:facet name="optionalHeader">
<h:outputText value="optionalHeader Facet" />
</f:facet>
@@ -169,6 +166,9 @@
<h:selectBooleanCheckbox value="#{calendarBean.disabled}"
onclick="submit()">
</h:selectBooleanCheckbox>
+ <h:outputText value="resetTimeOnDateSelect:"></h:outputText>
+ <h:selectBooleanCheckbox value="#{calendarBean.resetTimeOnDateSelect}"
onclick="submit()">
+ </h:selectBooleanCheckbox>
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2008-04-22 14:54:36 UTC (rev
8069)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2008-04-22 14:56:39 UTC (rev
8070)
@@ -122,7 +122,7 @@
<classname>java.lang.Object</classname>
<description>Defines time that will be used:
1) to set time when the value is empty
- 2) to set time when date changes and flag "resetTimeOnDateChange" is
true </description>
+ 2) to set time when date changes and flag "resetTimeOnDateSelect" is
true </description>
<defaultvalue>getDefaultValueOfDefaultTime()</defaultvalue>
</property>
Modified: trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2008-04-22
14:54:36 UTC (rev 8069)
+++ trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2008-04-22
14:56:39 UTC (rev 8070)
@@ -323,11 +323,11 @@
Calendar calendar = getCalendar();
calendar.setTime(date);
- result.append(HOURS_VALUE).append(":");
+ result.append("{").append(HOURS_VALUE).append(":");
result.append(calendar.get(Calendar.HOUR_OF_DAY));
result.append(",");
result.append(MINUTES_VALUE).append(":");
- result.append(calendar.get(Calendar.MINUTE));
+ result.append(calendar.get(Calendar.MINUTE)).append("}");
return result.toString();
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-04-22
14:54:36 UTC (rev 8069)
+++
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-04-22
14:56:39 UTC (rev 8070)
@@ -167,7 +167,7 @@
* @return hours and minutes from "defaultTime" attribute
*/
public String getPreparedDefaultTime(UICalendar calendar) {
- return calendar.getPreparedDefaultTime();
+ return calendar.getPreparedDefaultTime();
}
/**
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 2008-04-22
14:54:36 UTC (rev 8069)
+++
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-04-22
14:56:39 UTC (rev 8070)
@@ -1333,13 +1333,14 @@
date.setDate(daydata.day);
if (this.timeType)
{
- if (this.selectedDate)
+ if (this.selectedDate && !this.params.resetTimeOnDateSelect)
{
date.setHours(this.selectedDate.getHours());
date.setMinutes(this.selectedDate.getMinutes());
} else
{
- date.setHours(12);
+ date.setHours(this.params.defaultTime.hours);
+ date.setMinutes(this.params.defaultTime.minutes);
}
}
@@ -1356,13 +1357,14 @@
var date = new Date(daydata.date);
if (this.timeType)
{
- if (this.selectedDate)
+ if (this.selectedDate && !this.params.resetTimeOnDateSelect)
{
date.setHours(this.selectedDate.getHours());
date.setMinutes(this.selectedDate.getMinutes());
} else
{
- date.setHours(12);
+ date.setHours(this.params.defaultTime.hours);
+ date.setMinutes(this.params.defaultTime.minutes);
}
}
@@ -1840,13 +1842,14 @@
var date = new Date(today.getFullYear(), today.getMonth(), today.getDate());
if (this.timeType)
{
- if (this.selectedDate)
+ if (this.selectedDate && !this.params.resetTimeOnDateSelect)
{
date.setHours(this.selectedDate.getHours());
date.setMinutes(this.selectedDate.getMinutes());
} else
{
- date.setHours(12);
+ date.setHours(this.params.defaultTime.hours);
+ date.setMinutes(this.params.defaultTime.minutes);
}
}
if (daydata.enabled && this.selectDate(date,true) &&
!this.showApplyButton)
@@ -1888,8 +1891,8 @@
var isDateChanged = false;
if ( (oldSelectedDate - newSelectedDate) && (oldSelectedDate!=null ||
newSelectedDate!=null) )
{
- isDateChanged = true
- flag = this.invokeEvent("dateselect", eventData.element, eventData.event,
date)
+ isDateChanged = true;
+ flag = this.invokeEvent("dateselect", eventData.element, eventData.event,
date);
}
if (flag)
Modified: trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-04-22
14:54:36 UTC (rev 8069)
+++ trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-04-22
14:56:39 UTC (rev 8070)
@@ -189,8 +189,8 @@
showWeeksBar:#{component.attributes['showWeeksBar']},
showWeekDaysBar:#{component.attributes['showWeekDaysBar']},
showApplyButton:#{component.attributes['showApplyButton']},
- resetTimeOnDateChange:#{component.attributes['resetTimeOnDateChange']} ,
- defaultTime: #{this:getPreparedDefaultTime(component)}
+ resetTimeOnDateSelect:#{component.attributes['resetTimeOnDateSelect']},
+ defaultTime:#{this:getPreparedDefaultTime(component)}
<f:call name="writeLabels" />