You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/09/21 14:21:57 UTC
svn commit: r448528 -
/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java
Author: weber
Date: Thu Sep 21 05:21:55 2006
New Revision: 448528
URL: http://svn.apache.org/viewvc?view=rev&rev=448528
Log:
TOBAGO-132 (javascript error in DatePicker)
Modified:
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java?view=diff&rev=448528&r1=448527&r2=448528
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java Thu Sep 21 05:21:55 2006
@@ -50,12 +50,19 @@
private static final Log LOG = LogFactory.getLog(CalendarRenderer.class);
+ private static final String[] scripts = {
+ "script/calendar.js",
+ "script/dateConverter.js"
+ };
+
+
public void encodeEndTobago(FacesContext facesContext,
UIComponent component) throws IOException {
UIOutput output = (UIOutput) component;
UIPage page = ComponentUtil.findPage(output);
- page.getScriptFiles().add("script/calendar.js");
- page.getScriptFiles().add("script/dateConverter.js");
+ for (String script : scripts) {
+ page.getScriptFiles().add(script);
+ }
String id = output.getClientId(facesContext);
@@ -214,15 +221,13 @@
writeInputHidden(writer, id + ":fieldId", "");
- HtmlRendererUtil.startJavascript(writer);
- writer.writeText("document.calendar = new Object();", null);
-
- if (dateTextBoxId != null) {
- writer.writeText(
- "initCalendarParse('" + id + "', '" + dateTextBoxId + "');", null);
- }
- HtmlRendererUtil.endJavascript(writer);
+ String[] cmd = {
+ "document.calendar = new Object();",
+ "initCalendarParse('" + id + "', '" + dateTextBoxId + "');"
+ };
+ HtmlRendererUtil.writeScriptLoader(facesContext, scripts, cmd);
}
+
private void writeInputHidden(TobagoResponseWriter writer,
String id, Object value) throws IOException {
writeInputHidden(writer, null, id, value);