Author: akushunin
Date: 2007-10-31 09:29:40 -0400 (Wed, 31 Oct 2007)
New Revision: 3633
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
Calendar refactoring
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-31
12:30:12 UTC (rev 3632)
+++
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-10-31
13:29:40 UTC (rev 3633)
@@ -151,7 +151,7 @@
}
- public void writeStyles(FacesContext context, UIComponent component)
+ public void writeClass(FacesContext context, UIComponent component)
throws IOException {
UICalendar calendar = (UICalendar) component;
@@ -171,8 +171,6 @@
if (dayStyleClass != null && dayStyleClass.length() != 0) {
ResponseWriter writer = context.getResponseWriter();
writer.writeText("dayStyleClass: " + dayStyleClass + ", ", null);
- // getUtils().writeAttribute(writer,
- // "dayStyleClass",dayStyleClass+',');
}
}
@@ -206,7 +204,7 @@
}
}
- public void writeDivBody(FacesContext context, UIComponent component)
+ public void writeDayCellClass(FacesContext context, UIComponent component)
throws IOException {
// if cellWidth/Height is set send dayCellClass to script
Integer cellwidth = (Integer) component.getAttributes()
@@ -214,21 +212,37 @@
Integer cellheight = (Integer) component.getAttributes().get(
"cellHeight");
ResponseWriter writer = context.getResponseWriter();
- if (cellwidth != null && cellwidth > 0 || cellheight != null
- && cellheight > 0) {
+ if (cellwidth != null && cellwidth.intValue() > 0 || cellheight != null
+ && cellheight.intValue() > 0) {
String clientId = component.getClientId(context);
- String divStyle = "<style> ." + clientId + "DayCell{width:
"
- + cellwidth + "px; height:" + cellheight + "px;
}<style/>";
- writer.writeText(", dayCellClass: " + divStyle, null);
+
+ String divStyle = "." + clientId + "DayCell{width: "
+ + cellwidth.toString() + "px; height:"
+ + cellheight.toString() + "px; }<style/>";
+ writer.writeText(divStyle, null);
}
+ }
- if (component.getChildCount() != 0) {
+ public void dayCellClass(FacesContext context, UIComponent component)
+ throws IOException {
- writer.writeText(",dayListMarkup: ", null);
- writeMarkupScriptBody(context, component, true);
+ Integer cellwidth = (Integer) component.getAttributes()
+ .get("cellWidth");
+ Integer cellheight = (Integer) component.getAttributes().get(
+ "cellHeight");
+ ResponseWriter writer = context.getResponseWriter();
+ if (cellwidth != null && cellwidth.intValue() > 0 || cellheight != null
+ && cellheight.intValue() > 0) {
+ String clientId = component.getClientId(context);
+ writer.writeText("dayCellClass: " + clientId + "DayCell,", null);
}
+
+ if (component.getChildCount() != 0) {
+ writer.writeText("dayListMarkup: ", null);
+ writeMarkupScriptBody(context, component, true);
+ }
}
public void writeFacetMarkupScriptBody(FacesContext context,
Modified: trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-10-31
12:30:12 UTC (rev 3632)
+++ trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-10-31
13:29:40 UTC (rev 3633)
@@ -114,7 +114,10 @@
<![CDATA[
}
]]>
- </jsp:scriptlet> </span>
+ </jsp:scriptlet> </span>
+ <style type="text/css">
+ <f:call name="writeDayCellClass" />
+ </style>
<script type="text/javascript">
new Calendar('#{clientId}', {
@@ -146,10 +149,10 @@
ajaxSingle: #{component.attributes['ajaxSingle']},
verticalOffset:'#{component.verticalOffset}',
horizontalOffset: '#{component.horizontalOffset}',
- style:'z-index: #{component.attributes['zindex']};
#{component.attributes['style']}'
+ style:'z-index: #{component.attributes["zindex"]};
#{component.attributes["style"]}',
- <f:call name="writeStyles"/>
- <f:call name="writeDayStyleClass"/>
+ <f:call name="writeClass"/>
+ <f:call name="dayCellClass"/>
<f:call name="writeIsDayEnabled"/>
<f:call name="writeSymbols" />,
firstWeekDay: #{this:getFirstWeekDay(context, component)},
@@ -163,7 +166,6 @@
<f:call name="writeEventHandlerFunction"><f:parameter
value="oncollapse" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter
value="oncurrentdateselect" /></f:call>
- <f:call name="writeDivBody"></f:call>
<f:call name="writeOptionalFacetMarkupScriptBody"><f:parameter
value="optionalHeader" /></f:call>
<f:call name="writeOptionalFacetMarkupScriptBody"><f:parameter
value="optionalFooter" /></f:call>