Author: akushunin
Date: 2007-10-11 09:15:05 -0400 (Thu, 11 Oct 2007)
New Revision: 3327
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/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
RF-1093
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2007-10-11 12:35:21 UTC (rev
3326)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2007-10-11 13:15:05 UTC (rev
3327)
@@ -472,6 +472,39 @@
</description>
<defaultvalue>0</defaultvalue>
</property>
+
+ <property>
+ <name>cellWidth</name>
+ <classname>int</classname>
+ <description>
+ attribute to set fixed cells width
+ </description>
+ </property>
+
+ <property>
+ <name>cellHeight</name>
+ <classname>int</classname>
+ <description>
+ attribute to set fixed cells height
+ </description>
+ </property>
+
+ <property>
+ <name>dayStyleClass</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Should be binded to some JS function that will provide style classes
+ for special sets of days highlighting.
+ </description>
+ </property>
+
+ <property>
+ <name>isDayEnabled</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Should be binded to some JS function that returns day state.
+ </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-10-11
12:35:21 UTC (rev 3326)
+++ trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-10-11
13:15:05 UTC (rev 3327)
@@ -158,12 +158,27 @@
public abstract int getVerticalOffset();
public abstract void setVerticalOffset(int verticalOffset);
-
+
public abstract int getHorizontalOffset();
public abstract void setHorizontalOffset(int horizontalOffset);
+ public abstract String getDayStyleClass();
+ public abstract void setDayStyleClass(String DayStyleClass);
+
+ public abstract String getIsDayEnabled();
+
+ public abstract void setIsDayEnabled(String isDayEnabled);
+
+ public abstract int getCellHeight();
+
+ public abstract void setCellHeight(int cellHeight);
+
+ public abstract int getCellWidth();
+
+ public abstract void setCellWidth(int cellWidth);
+
// TODO onclick add users onclick
// currentDate processing -------------------------------------------------
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-10-11
12:35:21 UTC (rev 3326)
+++
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-10-11
13:15:05 UTC (rev 3327)
@@ -149,12 +149,44 @@
throws IOException {
}
-
+
+ public void writeDayStyleClass(FacesContext context, UIComponent component) throws
IOException{
+
+ UICalendar calendar = (UICalendar) component;
+ String dayStyleClass = (String)
calendar.getAttributes().get("dayStyleClass");
+ if(dayStyleClass!=null && dayStyleClass.length()!=0){
+ ResponseWriter writer = context.getResponseWriter();
+ writer.writeText("dayStyleClass: "+dayStyleClass+", ", null);
+ //getUtils().writeAttribute(writer,
"dayStyleClass",dayStyleClass+',');
+ }
+
+ }
+ public void writeIsDayEnabled(FacesContext context, UIComponent component)throws
IOException{
+ UICalendar calendar = (UICalendar) component;
+ String isDayEnabled = (String)
calendar.getAttributes().get("isDayEnabled");
+ if(isDayEnabled!=null && isDayEnabled.length()!=0){
+ ResponseWriter writer = context.getResponseWriter();
+ writer.writeText("isDayEnabled: "+isDayEnabled+", ", null);
+ }
+ }
+
public void writeMarkupScriptBody(FacesContext context,
UIComponent component, boolean children) throws IOException {
writeScriptBody(context, component, children);
}
-
+
+ public void writeOptionalFacetMarkupScriptBody(FacesContext context,
+ UIComponent component, String facetName) throws IOException{
+
+ UIComponent facet = component.getFacet(facetName);
+ if (facet != null && facet.isRendered()) {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.writeText(", " + facetName + MARKUP_SUFFIX + ":
"+"[new E('b',{},", null);
+ writeMarkupScriptBody(context, facet, false);
+ writer.writeText(")]",null);
+ }
+ }
+
public void writeFacetMarkupScriptBody(FacesContext context,
UIComponent component, String facetName) throws IOException {
Modified: trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-10-11
12:35:21 UTC (rev 3326)
+++ trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-10-11
13:15:05 UTC (rev 3327)
@@ -17,8 +17,7 @@
style="z-index: #{component.attributes['zindex']};
#{component.attributes['style']}"
class="rich-calendar-popup #{component.attributes['styleClass']}"
x:passThruWithExclusions="value,name,type,id,styleClass,class,style">
- <script
- type="text/javascript">
+ <script type="text/javascript">
new Calendar('#{clientId}', {
<jsp:scriptlet>/*<![CDATA[*/
@@ -49,6 +48,10 @@
ajaxSingle: #{component.attributes['ajaxSingle']},
verticalOffset:'#{component.verticalOffset}',
horizontalOffset: '#{component.horizontalOffset}',
+ cellHeight:'#{component.cellHeight}',
+ cellWidth:'#{component.cellWidth}',
+ <f:call name="writeDayStyleClass"/>
+ <f:call name="writeIsDayEnabled"/>
<f:call name="writeSymbols" />,
firstWeekDay: #{this:getFirstWeekDay(context, component)},
minDaysInFirstWeek: #{this:getMinDaysInFirstWeek(context, component)}
@@ -61,7 +64,19 @@
<f:call name="writeEventHandlerFunction"><f:parameter
value="oncollapse" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter
value="oncurrentdateselect" /></f:call>
- <jsp:scriptlet> /*<![CDATA[*/
+
+
+ <jsp:scriptlet>/*<![CDATA[*/
+ if (component.getChildCount() != 0) {
+ /*]]>*/</jsp:scriptlet>
+ ,dayListMarkup:
+ <jsp:scriptlet>/*<![CDATA[*/
+ writeMarkupScriptBody(context, component, true);
+ }
+ /*]]>*/</jsp:scriptlet>
+
+
+ <jsp:scriptlet> /*<![CDATA[*/
if (component.getFacet("optionalHeader")!= null&&
component.getFacet("optionalHeader").isRendered()){
/*]]>*/ </jsp:scriptlet>
,headerOptionalMarkup: [new E('b',{},
@@ -84,20 +99,11 @@
<jsp:scriptlet> /*<![CDATA[*/
}
/*]]>*/ </jsp:scriptlet>
-
- <jsp:scriptlet>/*<![CDATA[*/
- if (component.getChildCount() != 0) {
- /*]]>*/</jsp:scriptlet>
- ,dayListMarkup:
- <jsp:scriptlet>/*<![CDATA[*/
- writeMarkupScriptBody(context, component, true);
- }
- /*]]>*/</jsp:scriptlet>
<f:call name="writeFacetMarkupScriptBody"><f:parameter
value="weekDay" /></f:call>
<f:call name="writeFacetMarkupScriptBody"><f:parameter
value="weekNumber" /></f:call>
<f:call name="writeFacetMarkupScriptBody"><f:parameter
value="header" /></f:call>
- <f:call name="writeFacetMarkupScriptBody"><f:parameter
value="footer" /></f:call>
+ <f:call name="writeFacetMarkupScriptBody"><f:parameter
value="footer" /></f:call>
}).load(
<jsp:scriptlet>/*<![CDATA[*/
@@ -108,8 +114,7 @@
<f:call name="addPopupToAjaxRendered" />
- <span id="#{clientId}Popup">
- <jsp:scriptlet>
+ <span id="#{clientId}Popup"> <jsp:scriptlet>
<![CDATA[
boolean popup = getUtils().isBooleanAttribute(component, "popup");
if (!popup) {
@@ -136,13 +141,14 @@
variables.setVariable("disabled",new Boolean(disabled));
]]>
- </jsp:scriptlet>
- <f:resource name="org.richfaces.renderkit.html.iconimages.CalendarIcon"
var="icon"/>
- <f:resource name="org.richfaces.renderkit.html.iconimages.DisabledCalendarIcon"
var="disabledIcon"/>
- <input id="#{clientId}InputDate" name="#{clientId}InputDate"
+ </jsp:scriptlet> <f:resource
+ name="org.richfaces.renderkit.html.iconimages.CalendarIcon"
var="icon" />
+ <f:resource
+ name="org.richfaces.renderkit.html.iconimages.DisabledCalendarIcon"
+ var="disabledIcon" /> <input id="#{clientId}InputDate"
+ name="#{clientId}InputDate"
value="#{this:getInputValue(context,component)}" type="#{type}"
- readonly="#{manualInput}"
- disabled="#{disabled}"
+ readonly="#{manualInput}" disabled="#{disabled}"
accesskey="#{component.attributes['accesskey']}"
maxlength="#{component.attributes['maxlength']}"
onchange="#{component.attributes['oninputchange']}"
@@ -156,8 +162,7 @@
size="#{component.attributes['inputSize']}"
style="vertical-align: middle;
#{component.attributes['inputStyle']}"
class="rich-calendar-input #{component.attributes['inputClass']}"
- tabindex="#{component.attributes['tabindex']}"> </input>
- <jsp:scriptlet>
+ tabindex="#{component.attributes['tabindex']}"> </input>
<jsp:scriptlet>
<![CDATA[
String buttonIcon = org.richfaces.component.util.ViewUtil.getResourceURL((String)
component.getAttributes().get("buttonIcon"),context);
String buttonIconDisabled =
org.richfaces.component.util.ViewUtil.getResourceURL((String)
component.getAttributes().get("buttonIconDisabled"),context);
@@ -167,14 +172,12 @@
variables.setVariable("buttonIcon",buttonIcon);
if(buttonLabel==null || buttonLabel.length()==0){
]]>
- </jsp:scriptlet>
- <img id="#{clientId}PopupButton" class="rich-calendar-button
#{component.attributes['buttonClass']}"
- accesskey="#{component.attributes['accesskey']}"
- name="#{clientId}"
+ </jsp:scriptlet> <img id="#{clientId}PopupButton"
+ class="rich-calendar-button #{component.attributes['buttonClass']}"
+ accesskey="#{component.attributes['accesskey']}"
name="#{clientId}"
style="vertical-align: middle"
tabindex="#{component.attributes['tabindex']}">
-
- <jsp:scriptlet>
+ <jsp:scriptlet>
<![CDATA[
if(!disabled){
@@ -197,33 +200,23 @@
}
}
]]>
- </jsp:scriptlet>
-
- </img>
- <jsp:scriptlet>
+ </jsp:scriptlet> </img> <jsp:scriptlet>
<![CDATA[
}
else{
]]>
</jsp:scriptlet>
- <button
- type="button"
- id="#{clientId}PopupButton"
- name="#{clientId}"
+ <button type="button" id="#{clientId}PopupButton"
name="#{clientId}"
onclick="$('#{clientId}').component.doSwitch();return true;
#{component.attributes['oninputclick']}"
style="vertical-align: middle"
class="rich-calendar-button #{component.attributes['buttonClass']}"
- tabindex="#{component.attributes['tabindex']}"
- disabled="#{disabled}">
- #{buttonLabel}
- </button>
- <jsp:scriptlet>
+ tabindex="#{component.attributes['tabindex']}"
disabled="#{disabled}">
+ #{buttonLabel}</button>
+ <jsp:scriptlet>
<![CDATA[
}
]]>
- </jsp:scriptlet>
-
- <jsp:scriptlet>
+ </jsp:scriptlet> <jsp:scriptlet>
<![CDATA[
}
]]>