Author: akushunin
Date: 2007-11-05 10:45:57 -0500 (Mon, 05 Nov 2007)
New Revision: 3762
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
Log:
Calendar refactoring
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2007-11-05 15:33:44 UTC (rev
3761)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2007-11-05 15:45:57 UTC (rev
3762)
@@ -463,7 +463,7 @@
<property>
<name>cellWidth</name>
- <classname>int</classname>
+ <classname>java.lang.String</classname>
<description>
attribute to set fixed cells width
</description>
@@ -471,7 +471,7 @@
<property>
<name>cellHeight</name>
- <classname>int</classname>
+ <classname>java.lang.String</classname>
<description>
attribute to set fixed cells height
</description>
Modified: trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-11-05
15:33:44 UTC (rev 3761)
+++ trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-11-05
15:45:57 UTC (rev 3762)
@@ -171,13 +171,13 @@
public abstract void setIsDayEnabled(String isDayEnabled);
- public abstract int getCellHeight();
+ public abstract String getCellHeight();
- public abstract void setCellHeight(int cellHeight);
+ public abstract void setCellHeight(String cellHeight);
- public abstract int getCellWidth();
+ public abstract String getCellWidth();
- public abstract void setCellWidth(int cellWidth);
+ public abstract void setCellWidth(String cellWidth);
// TODO onclick add users onclick
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-11-05
15:33:44 UTC (rev 3761)
+++
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-11-05
15:45:57 UTC (rev 3762)
@@ -207,42 +207,48 @@
public void dayCellClass(FacesContext context, UIComponent component)
throws IOException {
// if cellWidth/Height is set send dayCellClass to script
- Integer cellwidth = (Integer) component.getAttributes()
- .get("cellWidth");
- Integer cellheight = (Integer) component.getAttributes().get(
- "cellHeight");
+ String cellwidth = (String) component.getAttributes().get("cellWidth");
+ String cellheight = (String) component.getAttributes()
+ .get("cellHeight");
ResponseWriter writer = context.getResponseWriter();
String clientId = component.getClientId(context);
- String divStyle="";
- if (cellwidth != null && cellwidth.intValue() > 0){
- divStyle = divStyle + "width:"+ cellwidth.toString() + "px;";
- }
- if(cellheight != null
- && cellheight.intValue() > 0){
- divStyle = divStyle +"height:"+ cellheight.toString() + "px;";
+ String divStyle = "";
+ if (cellwidth != null && cellwidth.length() != 0) {
+ if (cellwidth.contains("px") || cellwidth.contains("%")) {
+ divStyle = divStyle + "width:" + cellwidth + ";";
+ } else {
+ divStyle = divStyle + "width:" + cellwidth + "px;";
+ }
}
-
- if(divStyle.length()!=0){
+ if (cellheight != null && cellheight.length() != 0) {
+ if (cellheight.contains("px") || cellheight.contains("%")) {
+ divStyle = divStyle + "height:" + cellheight.toString() + ";";
+ } else {
+ divStyle = divStyle + "height:" + cellheight.toString() + "px;";
+ }
+ }
+
+ if (divStyle.length() != 0) {
writer.startElement("style", component);
getUtils().writeAttribute(writer, "type", "text/css");
- writer.writeText("." + clientId.replace(':', '_') +
"DayCell{"+divStyle+"}", null);
+ writer.writeText("." + clientId.replace(':', '_') +
"DayCell{"
+ + divStyle + "}", null);
writer.endElement("style");
}
}
- public void writeDayCellClass(FacesContext context, UIComponent component)
+ public void writeDayCellClass(FacesContext context, UIComponent component)
throws IOException {
- Integer cellwidth = (Integer) component.getAttributes()
- .get("cellWidth");
- Integer cellheight = (Integer) component.getAttributes().get(
- "cellHeight");
+ String cellwidth = (String) component.getAttributes().get("cellWidth");
+ String cellheight = (String) component.getAttributes()
+ .get("cellHeight");
ResponseWriter writer = context.getResponseWriter();
- if (cellwidth != null && cellwidth.intValue() > 0 || cellheight != null
- && cellheight.intValue() > 0) {
-
+ if (cellwidth != null && cellwidth.length() != 0 || cellheight != null
+ && cellheight.length() != 0) {
String clientId = component.getClientId(context);
- writer.writeText(",\n dayCellClass: '" + clientId.replace(':',
'_') + "DayCell'", null);
+ writer.writeText(",\n dayCellClass: '" + clientId.replace(':',
'_')
+ + "DayCell'", null);
}
}
Show replies by date