Author: akushunin
Date: 2007-09-19 04:33:05 -0400 (Wed, 19 Sep 2007)
New Revision: 2992
Modified:
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/resources/org/richfaces/renderkit/html/scripts/calendar.js
trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
RF-955 added mode for calendar
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2007-09-19 00:14:56 UTC (rev
2991)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2007-09-19 08:33:05 UTC (rev
2992)
@@ -127,15 +127,8 @@
<description>Defines date pattern</description>
<defaultvalue>"MMM d, yyyy"</defaultvalue>
</property>
+
<property>
- <name>scrollMode</name>
- <classname>java.lang.String</classname>
- <description>
- Valid values are "ajax" and "client"
- </description>
- <defaultvalue>"ajax"</defaultvalue>
- </property>
- <property>
<name>popup</name>
<classname>boolean</classname>
<description>
@@ -466,6 +459,12 @@
<classname>java.lang.String</classname>
<description>Defines disabled icon for the popup button element. The attribute
is ignored if the "buttonLabel" is set</description>
</property>
+ <property>
+ <name>mode</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>UICalendar.AJAX_MODE</defaultvalue>
+ <description>Valid values = ajax or client</description>
+ </property>
</component>
&listeners;
Modified: trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-09-19
00:14:56 UTC (rev 2991)
+++ trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-09-19
08:33:05 UTC (rev 2992)
@@ -64,6 +64,10 @@
private static final String COMPONENT_FAMILY = "org.richfaces.Calendar";
+ public static final String AJAX_MODE = "ajax";
+
+ public static final String CLIENT_MODE = "client";
+
private final static Log log = LogFactory.getLog(UICalendar.class);
public abstract Locale getLocale();
@@ -142,6 +146,10 @@
public abstract void setCurrentDateChangeListener(MethodBinding scrollerListener);
+ public abstract String getMode();
+
+ public abstract void setMode(String mode);
+
//TODO onclick add users onclick
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-09-19
00:14:56 UTC (rev 2991)
+++
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-09-19
08:33:05 UTC (rev 2992)
@@ -535,7 +535,7 @@
obj.richfacesComponent="richfaces:calendar";
obj.innerHTML =
htmlTextIFrame+htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar+htmlTextWeek+htmlControlsFooter+htmlFooterOptional+htmlTextFooter;
- this.submitFunction = this.params.submitFunction.bind(this);
+ if(this.params.submitFunction) this.submitFunction =
this.params.submitFunction.bind(this);
this.prepareEvents();
},
Modified: trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-09-19
00:14:56 UTC (rev 2991)
+++ trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-09-19
08:33:05 UTC (rev 2992)
@@ -20,10 +20,18 @@
<script
type="text/javascript">
new Calendar('#{clientId}', {
- submitFunction:
- <jsp:scriptlet>/*<![CDATA[*/
- writeSubmitFunction(context, component);
- /*]]>*/</jsp:scriptlet>,
+
+ <jsp:scriptlet>/*<![CDATA[*/
+ String mode = (String) component.getAttributes().get("mode");
+ if(org.richfaces.component.UICalendar.AJAX_MODE.equals(mode)){
+ /*]]>*/</jsp:scriptlet>
+
+ submitFunction: <jsp:scriptlet>/*<![CDATA[*/writeSubmitFunction(context,
component);/*]]>*/</jsp:scriptlet>,
+
+ <jsp:scriptlet>/*<![CDATA[*/
+ }
+ /*]]>*/</jsp:scriptlet>
+
dayListTableId: '#{clientId}Day',
weekNumberBarId: '#{clientId}WeekNum',
weekDayBarId: '#{clientId}WeekDay',