Author: tmjee Date: Fri Jul 28 23:58:23 2006 New Revision: 426759 URL: http://svn.apache.org/viewvc?rev=426759&view=rev Log: WW-1318 WW-1397 WW-1398
- rework the datepicker javadoc - improvement on struts2 DropdownContainer widget such that it could be extended to support other dropdown components like TimePicker - created a dropdown datepicker component using dojo's datepicker widget Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TimePicker.java (with props) struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TimePickerModel.java (with props) struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java (with props) struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DateTimeUtil.js (with props) struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownDatePicker.js (with props) struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownTimePicker.js (with props) struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.css (with props) struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.html (with props) struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/timeIcon.gif (with props) struts/struts2/trunk/core/src/main/resources/template/simple/timepicker.ftl struts/struts2/trunk/core/src/main/resources/template/xhtml/timepicker.ftl Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DatePicker.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropdownContainer.js struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/__package__.js struts/struts2/trunk/core/src/main/resources/template/simple/datepicker.ftl struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/DatePickerTagTest.java struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-1.txt struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-2.txt Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DatePicker.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DatePicker.java?rev=426759&r1=426758&r2=426759&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DatePicker.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DatePicker.java Fri Jul 28 23:58:23 2006 @@ -17,78 +17,80 @@ */ package org.apache.struts2.components; -import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.util.OgnlValueStack; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.Locale; /** * <!-- START SNIPPET: javadoc --> * * Renders datepicker element.</p> + * Format supported by this component are:- + * <table border="1"> + * <tr> + * <td>Format</td> + * <td>Description</td> + * </tr> + * <tr> + * <td>#dd</td> + * <td>Display day in two digits format</td> + * </tr> + * <tr> + * <td>#d</td> + * <td>Try to display day in one digit format, if cannot use 2 digit format</td> + * </tr> + * <tr> + * <td>#MM</td> + * <td>Display month in two digits format</td> + * </tr> + * <tr> + * <td>#M</td> + * <td>Try to display month in one digits format, if cannot use 2 digit format</td> + * </tr> + * <tr> + * <td>#yyyy</td> + * <td>Display year in four digits format</td> + * </tr> + * <tr> + * <td>#yy</td> + * <td>Display the last two digits of the yaer</td> + * </tr> + * <tr> + * <td>#y</td> + * <td>Display the last digits of the year</td> + * </tr> + * </table> * - * <b>Important:</b> Be sure to set the id attributes if not used within a <a:form /> tag, as it takes care of - * setting the id for you, being required to copy selected date to text input element.</p> - * - * Following a reference for the format parameter (copied from jscalendar documentation): - * <table border=0><tr><td valign=top ></td></tr> - * <tr><td valign=top ><tt>%a</tt> </td><td valign=top >abbreviated weekday name </td></tr> - * <tr><td valign=top ><tt>%A</tt> </td><td valign=top >full weekday name </td></tr> - * <tr><td valign=top ><tt>%b</tt> </td><td valign=top >abbreviated month name </td></tr> - * <tr><td valign=top ><tt>%B</tt> </td><td valign=top >full month name </td></tr> - * <tr><td valign=top ><tt>%C</tt> </td><td valign=top >century number </td></tr> - * <tr><td valign=top ><tt>%d</tt> </td><td valign=top >the day of the month ( 00 .. 31 ) </td></tr> - * <tr><td valign=top ><tt>%e</tt> </td><td valign=top >the day of the month ( 0 .. 31 ) </td></tr> - * <tr><td valign=top ><tt>%H</tt> </td><td valign=top >hour ( 00 .. 23 ) </td></tr> - * <tr><td valign=top ><tt>%I</tt> </td><td valign=top >hour ( 01 .. 12 ) </td></tr> - * <tr><td valign=top ><tt>%j</tt> </td><td valign=top >day of the year ( 000 .. 366 ) </td></tr> - * <tr><td valign=top ><tt>%k</tt> </td><td valign=top >hour ( 0 .. 23 ) </td></tr> - * <tr><td valign=top ><tt>%l</tt> </td><td valign=top >hour ( 1 .. 12 ) </td></tr> - * <tr><td valign=top ><tt>%m</tt> </td><td valign=top >month ( 01 .. 12 ) </td></tr> - * <tr><td valign=top ><tt>%M</tt> </td><td valign=top >minute ( 00 .. 59 ) </td></tr> - * <tr><td valign=top ><tt>%n</tt> </td><td valign=top >a newline character </td></tr> - * <tr><td valign=top ><tt>%p</tt> </td><td valign=top >``PM'' or ``AM'' </td></tr> - * <tr><td valign=top ><tt>%P</tt> </td><td valign=top >``pm'' or ``am'' </td></tr> - * <tr><td valign=top ><tt>%S</tt> </td><td valign=top >second ( 00 .. 59 ) </td></tr> - * <tr><td valign=top ><tt>%s</tt> </td><td valign=top >number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC) </td></tr> - * <tr><td valign=top ><tt>%t</tt> </td><td valign=top >a tab character </td></tr> - * <tr><td valign=top ><tt>%U, %W, %V</tt> </td><td valign=top >the week number</td></tr> - * <tr><td valign=top ><tt>%u</tt> </td><td valign=top >the day of the week ( 1 .. 7, 1 = MON )</td></tr> - * <tr><td valign=top ><tt>%w</tt> </td><td valign=top >the day of the week ( 0 .. 6, 0 = SUN )</td></tr> - * <tr><td valign=top ><tt>%y</tt> </td><td valign=top >year without the century ( 00 .. 99 )</td></tr> - * <tr><td valign=top ><tt>%Y</tt> </td><td valign=top >year including the century ( ex. 1979 )</td></tr> - * <tr><td valign=top ><tt>%%</tt> </td><td valign=top >a literal <tt>%</tt> character - * </td></tr></table><p> + * <p/> * * <!-- END SNIPPET: javadoc --> * - * <p/> <b>Examples</b> + * <b>Examples</b> * * <pre> * <!-- START SNIPPET: expl1 --> - * Date in application's locale format: - * <a:datepicker name="order.date" id="order.date" /> - * Date in german locale, with german texts: - * <a:datepicker name="delivery.date" id="delivery.date" template="datepicker_js.ftl" language="de" /> - * Date in german locale, with german texts and custom date format, including time: - * <a:datepicker name="invoice.date" id="invoice.date" template="datepicker_js.ftl" language="de" format="%d. %b &Y %H:%M" showstime="true" /> + * + * Example 1: + * <a:datepicker name="order.date" label="Order Date" /> + * Example 2: + * <a:datepicker name="delivery.date" label="Delivery Date" format="#yyyy-#MM-#dd" /> + * * <!-- END SNIPPET: expl1 --> * </pre> * <p/> * * <!-- START SNIPPET: expldesc2 --> * - * If you use this jscalendar based datepicker widget, you might want to use one of the standard stylesheets provided - * with jscalendar (all distribution stylesheets are included in struts jar). The easiest way to do so is to place the - * <a:head/> tag in the head of your html page, as it takes care of including calendar css. - * Otherwise, to manually activate the calendar-blue style, include the following in your stylesheet definition: + * The css could be changed by using the following :- * * <!-- END SNIPPET: expldesc2 --> + * * <pre> * <!-- START SNIPPET: expl2 --> - * <link href="<a:url value="/struts/jscalendar/calendar-blue.css" />" rel="stylesheet" type="text/css" media="all"/> + * + * <a:datepicker name="birthday" label="Birthday" templateCss="...." /> + * * <!-- END SNIPPET: expl2 --> * </pre> * @@ -99,10 +101,11 @@ final public static String TEMPLATE = "datepicker"; - protected String language; protected String format; - protected String showstime; - protected String singleclick; + protected String dateIconPath; + protected String templatePath; + protected String templateCssPath; + protected String size; public DatePicker(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) { super(stack, request, response); @@ -115,38 +118,21 @@ public void evaluateParams() { super.evaluateParams(); - if (language != null) { - addParameter("language", findString(language)); - } else { - final Locale locale = (Locale) getStack().getContext().get(ActionContext.LOCALE); - if (locale != null) { - addParameter("language", locale.getLanguage()); - } else { - addParameter("language", Locale.getDefault().getLanguage()); - } - - } - if (format != null) { addParameter("format", findString(format)); } - - if (showstime != null) { - addParameter("showstime", findString(showstime)); + if (dateIconPath != null) { + addParameter("dateIconPath", dateIconPath); } - - if (singleclick != null) { - addParameter("singleclick", findString(singleclick)); + if (templatePath != null) { + addParameter("templatePath", templatePath); + } + if (templateCssPath != null) { + addParameter("templateCssPath", templateCssPath); + } + if (size != null) { + addParameter("size", findValue(size, Integer.class)); } - - } - - /** - * The language to use for the widget texts and localization presets. - * @a2.tagattribute required="false" type="String" default="The language of the current Locale" - */ - public void setLanguage(String language) { - this.language = language; } /** @@ -156,21 +142,36 @@ public void setFormat(String format) { this.format = format; } - + /** - * Whether time selector is to be shown. Valid values are "true", "false", "24" and "12". - * @a2.tagattribute required="false" type="String" default="false" + * The date picker icon path + * @a2.tagattribute required="false" type="String" default="/struts/dojo/struts/widgets/dateIcon.gif" */ - public void setShowstime(String showstime) { - this.showstime = showstime; + public void setDateIconPath(String dateIconPath) { + this.dateIconPath = dateIconPath; } - + /** - * Whether to use selected value after single or double click. - * @a2.tagattribute required="false" type="Boolean" default="true" + * The datepicker template path. + * @a2.tagattribute required="false" type="String" */ - public void setSingleclick(String singleclick) { - this.singleclick = singleclick; + public void setTemplatePath(String templatePath) { + this.templatePath = templatePath; + } + + /** + * The datepicker template css path. + * @a2.tagattribute required="false" type="String" + */ + public void setTemplateCssPath(String templateCssPath) { + this.templateCssPath = templateCssPath; + } + + /** + * The datepicker text field size. + * @a2.tagattribute required="false" type="String" + */ + public void setSize(String size) { + this.size = size; } - } Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TimePicker.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TimePicker.java?rev=426759&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TimePicker.java (added) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TimePicker.java Fri Jul 28 23:58:23 2006 @@ -0,0 +1,106 @@ +/* + * $Id: DatePicker.java 424152 2006-07-21 01:04:41Z husted $ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.components; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.opensymphony.xwork2.util.OgnlValueStack; + +/** + * @version $Date$ $Id$ + */ +public class TimePicker extends TextField { + + final public static String TEMPLATE = "timepicker"; + + protected String format; + protected String templatePath; + protected String templateCssPath; + protected String timeIconPath; + protected String size; + + public TimePicker(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) { + super(stack, request, response); + } + + protected void evaluateExtraParams() { + super.evaluateExtraParams(); + + if (format != null) { + addParameter("format", findString(format)); + } + if (timeIconPath != null) { + addParameter("timeIconPath", timeIconPath); + } + if (templatePath != null) { + addParameter("templatePath", templatePath); + } + if (templateCssPath != null) { + addParameter("templateCssPath", templateCssPath); + } + if (size != null) { + addParameter("size", findValue(size, Integer.class)); + } + } + + protected String getDefaultTemplate() { + return TEMPLATE; + } + + /** + * The format to use for time field. + * @a2.tagattribute required="false" type="String" default="Dateformat specified by language preset (%Y/%m/%d for en)" + */ + public void setFormat(String format) { + this.format = format; + } + + /** + * The time picker icon path + * @a2.tagattribute required="false" type="String" default="/struts/dojo/struts/widgets/dateIcon.gif" + */ + public void setTimeIconPath(String timeIconPath) { + this.timeIconPath = timeIconPath; + } + + /** + * The time picker template path. + * @a2.tagattribute required="false" type="String" + */ + public void setTemplatePath(String templatePath) { + this.templatePath = templatePath; + } + + /** + * The time picker template css path. + * @a2.tagattribute required="false" type="String" + */ + public void setTemplateCssPath(String templateCssPath) { + this.templateCssPath = templateCssPath; + } + + /** + * The time picker text field size. + * @a2.tagattribute required="false" type="String" + */ + public void setSize(String size) { + this.size = size; + } + +} Propchange: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/TimePicker.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java?rev=426759&r1=426758&r2=426759&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java Fri Jul 28 23:58:23 2006 @@ -77,6 +77,7 @@ protected IfModel ifModel; protected ElseModel elseModel; protected ElseIfModel elseIfModel; + protected TimePickerModel timePickerModel; public StrutsModels(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) { @@ -451,5 +452,12 @@ elseIfModel = new ElseIfModel(stack, req, res); } return elseIfModel; + } + + public TimePickerModel getTimepicker() { + if (timePickerModel == null) { + timePickerModel = new TimePickerModel(stack, req, res); + } + return timePickerModel; } } Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TimePickerModel.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TimePickerModel.java?rev=426759&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TimePickerModel.java (added) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TimePickerModel.java Fri Jul 28 23:58:23 2006 @@ -0,0 +1,21 @@ +package org.apache.struts2.views.freemarker.tags; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts2.components.Component; +import org.apache.struts2.components.TimePicker; + +import com.opensymphony.xwork2.util.OgnlValueStack; + +public class TimePickerModel extends TagModel { + + public TimePickerModel(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack, req, res); + } + + protected Component getBean() { + return new TimePicker(stack, req, res); + } + +} Propchange: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/tags/TimePickerModel.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java?rev=426759&r1=426758&r2=426759&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java Fri Jul 28 23:58:23 2006 @@ -31,10 +31,11 @@ private static final long serialVersionUID = 4054114507143447232L; - protected String language; protected String format; - protected String showstime; - protected String singleclick; + protected String dateIconPath; + protected String templatePath; + protected String templateCssPath; + public Component getBean(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new DatePicker(stack, req, res); @@ -44,25 +45,26 @@ super.populateParams(); final DatePicker datePicker = (DatePicker) component; - datePicker.setLanguage(language); datePicker.setFormat(format); - datePicker.setShowstime(showstime); - datePicker.setSingleclick(singleclick); - } - - public void setLanguage(String language) { - this.language = language; + datePicker.setDateIconPath(dateIconPath); + datePicker.setTemplatePath(templatePath); + datePicker.setTemplateCssPath(templateCssPath); } public void setFormat(String format) { this.format = format; } - - public void setShowstime(String showstime) { - this.showstime = showstime; + + public void setDateIconPath(String dateIconPath) { + this.dateIconPath = dateIconPath; + } + + public void setTemplatePath(String templatePath) { + this.templatePath = templatePath; + } + + public void setTemplateCssPath(String templateCsspath) { + this.templateCssPath = templateCssPath; } - public void setSingleclick(String singleclick) { - this.singleclick = singleclick; - } } Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java?rev=426759&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java (added) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java Fri Jul 28 23:58:23 2006 @@ -0,0 +1,69 @@ +/* + * $Id: DatePicker.java 424152 2006-07-21 01:04:41Z husted $ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.views.jsp.ui; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts2.components.Component; +import org.apache.struts2.components.TimePicker; + +import com.opensymphony.xwork2.util.OgnlValueStack; + +/** + * @version $Date$ $Id$ + */ +public class TimePickerTag extends TextFieldTag { + + private static final long serialVersionUID = 3527737048468381376L; + + protected String format; + protected String timeIconPath; + protected String templatePath; + protected String templateCssPath; + + public Component getBean(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new TimePicker(stack, req, res); + } + + protected void populateParams() { + super.populateParams(); + + final TimePicker timePicker = (TimePicker) component; + timePicker.setFormat(format); + timePicker.setTimeIconPath(timeIconPath); + timePicker.setTemplatePath(templatePath); + timePicker.setTemplateCssPath(templateCssPath); + } + + public void setFormat(String format) { + this.format = format; + } + + public void setTimeIconPath(String timeIconPath) { + this.timeIconPath = timeIconPath; + } + + public void setTemplatePath(String templatePath) { + this.templatePath = templatePath; + } + + public void setTemplateCssPath(String templateCssPath) { + this.templateCssPath = templateCssPath; + } +} Propchange: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java ------------------------------------------------------------------------------ svn:eol-style = native Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DateTimeUtil.js URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DateTimeUtil.js?rev=426759&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DateTimeUtil.js (added) +++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DateTimeUtil.js Fri Jul 28 23:58:23 2006 @@ -0,0 +1,249 @@ +/* + * Struts2 + * ======= + * + * This is a simple DateTimeUtil used by Struts2 DatePicker and TimePicker. + * Its a pretty crude one, and there's lots of room for improvement. Please + * feel free to improve it if you like. + * + * It's main methods are :- + * - struts.widgets.DateTimeUtil.parseDate(date, format); + * - struts.widgets.DateTimeUtil.parseTime(date, format); + * - struts.widgets.DateTimeUtil.parseDateTime(date, format); + * + * which parse the 'date' string using the 'format' specifed and return a + * js Date object. If not parsing is possible, it will just return the current + * date as a Date object. + * + * version $Date$ $Id$ + */ +dojo.provide("struts.widgets.DateTimeUtil"); + +struts.widgets.DateTimeUtil.parseDate = function(date, format) { + var _d = new Date(); + struts.widgets.DateTimeUtil.tryToParseForDay(_d, date, format); + struts.widgets.DateTimeUtil.tryToParseForMonth(_d, date, format); + struts.widgets.DateTimeUtil.tryToParseForYear(_d, date, format); + return _d; +} + +struts.widgets.DateTimeUtil.parseTime = function(date, format) { + var _d = new Date(); + struts.widgets.DateTimeUtil.tryToParseForHours(_d, date, format); + struts.widgets.DateTimeUtil.tryToParseForMinutes(_d, date, format); + return _d; +} + +struts.widgets.DateTimeUtil.parseDateTime = function(date, format) { + var _d = new date(); + struts.widgets.DateTimeUtil.tryToParseForDay(_d, date, format); + struts.widgets.DateTimeUtil.tryToParseForMonth(_d, date, format); + struts.widgets.DateTimeUtil.tryToParseForYear(_d, date, format); + struts.widgets.DateTimeUtil.tryToParseForHours(_d, date, format); + struts.widgets.DateTimeUtil.tryToPraseForMinutes(_d, date, format); + return _d; +} + + +struts.widgets.DateTimeUtil.tryToParseForDay = function(dateObj, date, format) { + var tmp = format; + var _function; + + if (tmp.indexOf("#dd") > -1) { + tmp = tmp.replace(/#dd/g, "(\\d+)"); + _function = function(dateObject, day) { + dateObject.setDate(day); + } + } + else if (tmp.indexOf("#d") > -1) { + tmp = tmp.replace(/#d/g, "(\\d+)"); + _function = function(dateObject, day) { + dateObject.setDate(day); + } + } + + if (tmp.indexOf("#M") > -1) { + tmp = tmp.replace(/#MMMM/g, "\\w+"); + tmp = tmp.replace(/#MMM/g, "\\w+"); + tmp = tmp.replace(/#MM/g, "\\w+"); + tmp = tmp.replace(/#M/g, "\\w+"); + } + + if (tmp.indexOf("#y") > -1) { + tmp = tmp.replace(/#yyyy/g, "\\w+"); + tmp = tmp.replace(/#yy/g, "\\w+"); + tmp = tmp.replace(/#y/g, "\\w+"); + } + + var regexp = tmp; + var rg = new RegExp("\\b"+regexp+"\\b", "g"); + var r = rg.exec(date); + if (r && r.length >= 1 && _function) { + _function(dateObj, r[1]); + } +} + + +struts.widgets.DateTimeUtil.tryToParseForMonth = function(dateObj, date, format) { + var tmp = format; + var _function; + + if (tmp.indexOf("#MM") > -1) { + tmp = tmp.replace(/#MM/g, "(\\d+)"); + _function = function(dateObject, month) { + dateObject.setMonth(month - 1); + } + } + else if (tmp.indexOf("#M") > -1) { + tmp = tmp.replace(/#M/g, "(\\d+)"); + _function = function(dateObject, month) { + dateObject.setDate(month - 1); + } + } + + if (tmp.indexOf("#d") > -1) { + tmp = tmp.replace(/#dddd/g, "\\w+"); + tmp = tmp.replace(/#ddd/g, "\\w+"); + tmp = tmp.replace(/#dd/g, "\\w+"); + tmp = tmp.replace(/#d/g, "\\w+"); + } + + if (tmp.indexOf("#y") > -1) { + tmp = tmp.replace(/#yyyy/g, "\\w+"); + tmp = tmp.replace(/#yy/g, "\\w+"); + tmp = tmp.replace(/#y/g, "\\w+"); + } + + var regexp = tmp; + var rg = new RegExp("\\b"+regexp+"\\b", "g"); + var r = rg.exec(date); + if (r && r.length >= 1 && _function) { + _function(dateObj, r[1]); + } +} + + +struts.widgets.DateTimeUtil.tryToParseForYear = function(dateObj, date, format) { + var tmp = format; + var _function; + + if (tmp.indexOf("#yyyy") > -1) { + tmp = tmp.replace(/#yyyy/g, "(\\d+)"); + _function = function(dateObject, year) { + dateObject.setYear(year); + } + } + else if (tmp.indexOf("#yy") > -1) { + tmp = tmp.replace(/#yy/g, "(\\d+)"); + _function = function(dateObject, year) { + var _d = new Date(); + var _y = _d.getFullYear().substring(0, 2)+''+year; + dateObject.setYear(_y); + } + } + else if (tmp.indexOf("#y") > -1) { + tmp = tmp.replace(/#y/g, "(\\d+)"); + _function = function(dateObject, year) { + var _d = new Date(); + var _y = _d.getFullYear().substring(0, 3)+''+year; + dateObject.setYear(_y); + } + } + + if (tmp.indexOf("#d") > -1) { + tmp = tmp.replace(/#dddd/g, "\\w+"); + tmp = tmp.replace(/#ddd/g, "\\w+"); + tmp = tmp.replace(/#dd/g, "\\w+"); + tmp = tmp.replace(/#d/g, "\\w+"); + } + + if (tmp.indexOf("#M") > -1) { + tmp = tmp.replace(/#MMMM/g, "\\w+"); + tmp = tmp.replace(/#MMM/g, "\\w+"); + tmp = tmp.replace(/#MM/g, "\\w+"); + tmp = tmp.replace(/#M/g, "\\w+"); + } + + var regexp = tmp; + var rg = new RegExp("\\b"+regexp+"\\b", "g"); + var r = rg.exec(date); + if (r && r.length >= 1 && _function) { + _function(dateObj, r[1]); + } +} + + +struts.widgets.DateTimeUtil.tryToParseForHours = function(dateObj, date, format) { + var tmp = format; + var _function; + + if (tmp.indexOf("#h") > -1) { + tmp = tmp.replace(/#hh/g, "(\\d+)"); + tmp = tmp.replace(/#h/g, "(\\d+)"); + _function = function(dateObj, hour) { + dateObj.setHours(hour); + } + } + if (tmp.indexOf("#H") > -1) { + tmp = tmp.replace(/#HH/g, "(\\d+)"); + tmp = tmp.replace(/#H/g, "(\\d+)"); + _function = function(dateObj, hour) { + dateObj.setHours(hour); + } + } + if (tmp.indexOf("#m") > -1) { + tmp = tmp.replace(/#mm/g, "\\w+"); + tmp = tmp.replace(/#m/g, "\\w+"); + } + if (tmp.indexOf("#T") > -1) { + tmp = tmp.replace(/#TT/g, "\\w+"); + tmp = tmp.replace(/#T/g, "\\w+"); + } + if (tmp.indexOf("#t") > -1) { + tmp = tmp.replace(/#tt/g, "\\w+"); + tmp = tmp.replace(/#t/g, "\\w+"); + } + var regexp = tmp; + var rg = new RegExp("\\b"+tmp+"\\b", "g"); + var r = rg.exec(date); + if (r && r.length >= 1 && _function) { + _function(dateObj, r[1]); + } +} + +struts.widgets.DateTimeUtil.tryToParseForMinutes = function(dateObj, date, format) { + var tmp = format; + var _function; + + if (tmp.indexOf("#m") > -1) { + tmp = tmp.replace(/#mm/g, "(\\d+)"); + tmp = tmp.replace(/#m/g, "(\\d+)"); + _function = function(dateObj, minutes) { + dateObj.setMinutes(minutes); + } + } + if (tmp.indexOf("#H") > -1) { + tmp = tmp.replace(/#HH/g, "\\w+"); + tmp = tmp.replace(/#H/g, "\\w+"); + } + if (tmp.indexOf("#h") > -1) { + tmp = tmp.replace(/#hh/g, "\\w+"); + tmp = tmp.replace(/#h/g, "\\w+"); + } + if (tmp.indexOf("#T") > -1) { + tmp = tmp.replace(/#TT/g, "\\w+"); + tmp = tmp.replace(/#T/g, "\\w+"); + } + if (tmp.indexOf("#t") > -1) { + tmp = tmp.replace(/#tt/g, "\\w+"); + tmp = tmp.replace(/#t/g, "\\w+"); + } + var regexp = tmp; + var rg = new RegExp("\\b"+tmp+"\\b", "g"); + var r = rg.exec(date); + if (r && r.length >= 1 && _function) { + _function(dateObj, r[1]); + } +} + + Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DateTimeUtil.js ------------------------------------------------------------------------------ svn:eol-style = native Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownDatePicker.js URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownDatePicker.js?rev=426759&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownDatePicker.js (added) +++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownDatePicker.js Fri Jul 28 23:58:23 2006 @@ -0,0 +1,54 @@ +dojo.provide("struts.widgets.DropDownDatePicker"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.HtmlWidget"); +dojo.require("dojo.widget.DatePicker"); +dojo.require("dojo.event.*"); +dojo.require("dojo.html"); +dojo.require("struts.widgets.DropdownContainer"); +dojo.require("struts.widgets.DateTimeUtil"); + +struts.widgets.DropDownDatePicker = function () { + struts.widgets.DropdownContainer.call(this); + this.widgetType = "DropDownDatePicker"; + + this.initUI = function() { + var properties = { + widgetContainerId: this.widgetId + } + + this.subWidgetRef = dojo.widget.createWidget("DatePicker", properties, this.subWidgetNode); + dojo.event.connect(this.subWidgetRef, "onSetDate", this, "onPopulate"); + dojo.event.connect(this.valueInputNode, "onkeyup", this, "onInputChange"); + this.onUpdateDate = function(evt) { + this.storedDate = evt.storedDate; + } + this.onInputChange(); + } + + this.onPopulate = function() { + this.valueInputNode.value = dojo.date.toString(this.subWidgetRef.date, this.dateFormat); + } + + this.onInputChange = function(){ + //var test = new Date(this.valueInputNode.value); + var test = struts.widgets.DateTimeUtil.parseDate(this.valueInputNode.value, this.dateFormat); + this.subWidgetRef.date = test; + this.subWidgetRef.setDate(dojo.widget.DatePicker.util.toRfcDate(test)); + this.subWidgetRef.initUI(); + //this.onPopulate(); + } +} + +dojo.inherits(struts.widgets.DropDownDatePicker, struts.widgets.DropdownContainer); +dojo.widget.tags.addParseTreeHandler("dojo:dropdowndatepicker"); +dojo.lang.extend(struts.widgets.DropDownDatePicker, { + + // default attributes + dateFormat: "#MM/#dd/#yyyy", + iconPath: "/struts/dojo/struts/widgets/dateIcon.gif", + iconAlt: "date", + iconTitle: "Select a date", + inputWidth:"7em" + +}); + Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownDatePicker.js ------------------------------------------------------------------------------ svn:eol-style = native Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownTimePicker.js URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownTimePicker.js?rev=426759&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownTimePicker.js (added) +++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownTimePicker.js Fri Jul 28 23:58:23 2006 @@ -0,0 +1,46 @@ +dojo.provide("struts.widgets.DropDownTimePicker"); +dojo.require("struts.widgets.DropdownContainer"); +dojo.require("dojo.widget.html.TimePicker"); +dojo.require("struts.widgets.DateTimeUtil"); + +struts.widgets.DropDownTimePicker = function() { + struts.widgets.DropdownContainer.call(this); + this.widgetType = "DropDownTimePicker"; + var timeFormat = "#hh:#mm #TT"; + + this.initUI = function() { + var properties = { + widgetContainerId: this.widgetId + } + + this.subWidgetRef = dojo.widget.createWidget("TimePicker", properties, this.subWidgetNode); + dojo.event.connect(this.subWidgetRef, "onSetTime", this, "onPopulate"); + dojo.event.connect(this.valueInputNode, "onkeyup", this, "onInputChange"); + this.onInputChange(); + } + + this.onPopulate = function() { + this.valueInputNode.value = dojo.date.toString(this.subWidgetRef.time, this.timeFormat); + } + + this.onInputChange = function(){ + if (this.valueInputNode.value && this.valueInputNode.value.toString().length > 0) { + var test = struts.widgets.DateTimeUtil.parseTime(this.valueInputNode.value, this.timeFormat); + // test.setTime(this.valueInputNode.value); + this.subWidgetRef.time = test; + this.subWidgetRef.setDateTime(dojo.widget.TimePicker.util.toRfcDateTime(test)); + this.subWidgetRef.initUI(); + //this.onPopulate(); + } + } +} + +dojo.inherits(struts.widgets.DropDownTimePicker, struts.widgets.DropdownContainer); +dojo.widget.tags.addParseTreeHandler("dojo:dropdowntimepicker"); +dojo.lang.extend(struts.widgets.DropDownTimePicker, { + timeFormat: "#hh:#mm #TT", + iconPath: "/struts/dojo/struts/widgets/timeIcon.gif", + iconAlt: "time", + iconTitle: "Select a time", + inputWidth:"7em" +}); Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropDownTimePicker.js ------------------------------------------------------------------------------ svn:eol-style = native Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropdownContainer.js URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropdownContainer.js?rev=426759&r1=426758&r2=426759&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropdownContainer.js (original) +++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/DropdownContainer.js Fri Jul 28 23:58:23 2006 @@ -4,13 +4,21 @@ dojo.require("dojo.widget.DatePicker"); dojo.require("dojo.event.*"); dojo.require("dojo.html"); + struts.widgets.DropdownContainer = function(){ // this is just an interface that gets mixed in dojo.widget.HtmlWidget.call(this); this.widgetType = "DropdownContainer"; - this.templateString = '<div><input type="text" value="" style="vertical-align:middle;" dojoAttachPoint="valueInputNode" /><img src="" alt="" dojoAttachPoint="containerDropdownNode" dojoAttachEvent="onclick: onDropdown;" style="vertical-align:middle; cursor:pointer; cursor:hand;" /><div dojoAttachPoint="subWidgetContainerNode" style="display:none;position:absolute;width:12em;background-color:#fff;"><div dojoAttachPoint="subWidgetNode" class="subWidgetContainer"></div></div></div>'; - this.templateCssPath = ""; + this.iconPath; + this.iconAlt; + this.iconTitle; + this.value; + + this.templatePath = dojo.uri.dojoUri("struts/widgets/dropdowncontainer.html"); + this.templateCssPath = dojo.uri.dojoUri("struts/widgets/dropdowncontainer.css"); + //this.templateString = '<div><input type="text" value="" style="vertical-align:middle;" dojoAttachPoint="valueInputNode" /><img src="" alt="" dojoAttachPoint="containerDropdownNode" dojoAttachEvent="onclick: onDropdown;" style="vertical-align:middle; cursor:pointer; cursor:hand;" /><div dojoAttachPoint="subWidgetContainerNode" style="display:none;position:absolute;width:12em;background-color:#fff;"><div dojoAttachPoint="subWidgetNode" class="subWidgetContainer"></div></div></div>'; + //this.templateCssPath = ""; this.fillInTemplate = function(args, frag) { try { @@ -20,27 +28,31 @@ this.domNode.removeChild(this.valueInputNode); this.valueInputNode = txt } catch (e) {alert("ex:"+e);} + + + this.subWidgetContainerNode.style.left = ""; + this.subWidgetContainerNode.style.top = ""; + + this.valueInputNode.style.width = this.inputWidth; + if (this.value) { + this.valueInputNode.value = this.value; + } + + this.containerDropdownNode.src = this.iconPath; + this.containerDropdownNode.alt = this.iconAlt; + this.containerDropdownNode.title = this.iconTitle; + this.initUI(); - } this.initUI = function() { - this.subWidgetContainerNode.style.left = ""; - this.subWidgetContainerNode.style.top = ""; - var properties = { - widgetContainerId: this.widgetId - } - - //this.valueInputNode.style.width = this.inputWidth; - this.containerDropdownNode.src = this.dateIconPath; - this.containerDropdownNode.alt = "date"; - this.containerDropdownNode.title = "select a date"; - this.subWidgetRef = dojo.widget.createWidget("DatePicker", properties, this.subWidgetNode); - dojo.event.connect(this.subWidgetRef, "onSetDate", this, "onPopulate"); - dojo.event.connect(this.valueInputNode, "onkeyup", this, "onInputChange"); - this.onUpdateDate = function(evt) { - this.storedDate = evt.storedDate; - } + // subclass should overrides this to init the UI in this container + } + + this.onPopulate = function() { + } + + this.onInputChange = function(){ } this.onDropdown = function(evt) { @@ -54,26 +66,10 @@ this.onHide = function(evt) { this.show(false); } - - this.onPopulate = function() { - this.valueInputNode.value = dojo.date.toString(this.subWidgetRef.date, this.dateFormat); - } - - this.onInputChange = function(){ - var test = new Date(this.valueInputNode.value); - this.subWidgetRef.date = test; - this.subWidgetRef.setDate(dojo.widget.DatePicker.util.toRfcDate(test)); - this.subWidgetRef.initUI(); - //this.onPopulate(); - } } dojo.inherits(struts.widgets.DropdownContainer, dojo.widget.HtmlWidget); dojo.widget.tags.addParseTreeHandler("dojo:dropdowncontainer"); dojo.lang.extend(struts.widgets.DropdownContainer, { - - // default attributes - dateFormat:"#MM/#dd/#yyyy", - dateIconPath:"/struts/dojo/struts/widgets/dateIcon.gif", - //inputWidth:"7em" + }); Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/__package__.js URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/__package__.js?rev=426759&r1=426758&r2=426759&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/__package__.js (original) +++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/__package__.js Fri Jul 28 23:58:23 2006 @@ -4,6 +4,9 @@ dojo.hostenv.conditionalLoadModule({ browser: [ "struts.widgets.DropdownContainer", + "struts.widgets.DropDownDatePicker", + "struts.widgets.DropDownTimePicker", + "struts.widgets.DateTimeUtil" ] }); dojo.hostenv.moduleLoaded("struts.widgets.*"); Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.css URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.css?rev=426759&view=auto ============================================================================== (empty) Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.css ------------------------------------------------------------------------------ svn:eol-style = native Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.html?rev=426759&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.html (added) +++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.html Fri Jul 28 23:58:23 2006 @@ -0,0 +1,18 @@ + +<div> + <input type="text" + value="" + style="vertical-align:middle;" + dojoAttachPoint="valueInputNode" /> + <img src="" + alt="" + dojoAttachPoint="containerDropdownNode" + dojoAttachEvent="onclick: onDropdown;" + style="vertical-align:middle; cursor:pointer; cursor:hand;" /> + <div dojoAttachPoint="subWidgetContainerNode" + style="display:none;position:absolute;width:12em;background-color:#fff;"> + <div dojoAttachPoint="subWidgetNode" + class="subWidgetContainer"> + </div> + </div> +</div> Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/dropdowncontainer.html ------------------------------------------------------------------------------ svn:eol-style = native Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/timeIcon.gif URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/timeIcon.gif?rev=426759&view=auto ============================================================================== Binary file - no diff available. Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/timeIcon.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: struts/struts2/trunk/core/src/main/resources/template/simple/datepicker.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/datepicker.ftl?rev=426759&r1=426758&r2=426759&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/datepicker.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/datepicker.ftl Fri Jul 28 23:58:23 2006 @@ -6,6 +6,7 @@ <#if parameters.readonly?exists> <#include "/${parameters.templateDir}/simple/text.ftl" /> <#else> +<#-- <div dojoType="dropdowncontainer" dateIconPath="<@saf.url includeParams='none' value='/struts/dojo/struts/widgets/dateIcon.gif' encode='false'/>" <#if parameters.format?exists> @@ -25,6 +26,31 @@ </#if> <#if parameters.get("size")?exists> inputWidth="${parameters.get("size")?html}" + </#if> + > + <#include "/${parameters.templateDir}/simple/text.ftl" /> + </div> +--> + <div dojoType="dropdowndatepicker" + <#if parameters.format?exists> + dateFormat="${parameters.format}" + </#if> + <#if parameters.dateIconPath?exists> + iconPath="${parameters.dateIconPath}" + <#else> + iconPath="<@saf.url includeParams='none' value='/struts/dojo/struts/widgets/dateIcon.gif' encode='false' includeParams="none" />" + </#if> + <#if parameters.nameValue?exists> + value="${parameters.nameValue?html}" + </#if> + <#if parameters.templatePath?exists> + templatePath="${parameters.templatePath}" + </#if> + <#if parameters.templateCssPath?exists> + templateCssPath="${parameters.templateCssPath}" + </#if> + <#if parameters.get("size")?exists> + inputWidth="${parameters.get("size")?string?html}" </#if> > <#include "/${parameters.templateDir}/simple/text.ftl" /> Added: struts/struts2/trunk/core/src/main/resources/template/simple/timepicker.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/timepicker.ftl?rev=426759&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/timepicker.ftl (added) +++ struts/struts2/trunk/core/src/main/resources/template/simple/timepicker.ftl Fri Jul 28 23:58:23 2006 @@ -0,0 +1,33 @@ +<script type="text/javascript"> + dojo.require("struts.widgets.*"); +</script> + +<#if parameters.readonly?exists> + <#include "/${parameters.templateDir}/simple/text.ftl" /> +<#else> + <div dojoType="dropdowntimepicker" + useDefaultTime="false" + <#if parameters.format?exists> + timeFormat="${parameters.format}" + </#if> + <#if parameters.nameValue?exists> + value="${parameters.nameValue?html}" + </#if> + <#if parameters.timeIconPath?exists> + iconPath="${parameters.timeIconPath}" + <#else> + iconPath="<@saf.url includeParams='none' value='/struts/dojo/struts/widgets/timeIcon.gif' encode='false' includeParams="none" />" + </#if> + <#if parameters.templatePath?exists> + templatePath="${parameters.templatePath}" + </#if> + <#if parameters.templateCssPath?exists> + templateCssPath="${parameters.templateCssPath}" + </#if> + <#if parameters.get("size")?exists> + inputWidth="${parameters.get("size")?string?html}" + </#if> + > + <#include "/${parameters.templateDir}/simple/text.ftl" /> + </div> +</#if> \ No newline at end of file Added: struts/struts2/trunk/core/src/main/resources/template/xhtml/timepicker.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/xhtml/timepicker.ftl?rev=426759&view=auto ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/xhtml/timepicker.ftl (added) +++ struts/struts2/trunk/core/src/main/resources/template/xhtml/timepicker.ftl Fri Jul 28 23:58:23 2006 @@ -0,0 +1,3 @@ +<#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" /> +<#include "/${parameters.templateDir}/simple/timepicker.ftl" /> +<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /> Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/DatePickerTagTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/DatePickerTagTest.java?rev=426759&r1=426758&r2=426759&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/DatePickerTagTest.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/DatePickerTagTest.java Fri Jul 28 23:58:23 2006 @@ -40,7 +40,6 @@ public void testLocaleInStack() throws Exception { stack.getContext().put(ActionContext.LOCALE, Locale.FRANCE); - tag.setLanguage(null); tag.doStartTag(); tag.doEndTag(); Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-1.txt?rev=426759&r1=426758&r2=426759&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-1.txt (original) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-1.txt Fri Jul 28 23:58:23 2006 @@ -6,8 +6,8 @@ dojo.require("struts.widgets.*"); </script> - <div dojoType="dropdowncontainer" - dateIconPath="/struts/dojo/struts/widgets/dateIcon.gif" + <div dojoType="dropdowndatepicker" + iconPath="/struts/dojo/struts/widgets/dateIcon.gif" > <input type="text" name="" id=""/> </div> Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-2.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-2.txt?rev=426759&r1=426758&r2=426759&view=diff ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-2.txt (original) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/DatePickerTagTest-2.txt Fri Jul 28 23:58:23 2006 @@ -6,8 +6,8 @@ dojo.require("struts.widgets.*"); </script> - <div dojoType="dropdowncontainer" - dateIconPath="/struts/dojo/struts/widgets/dateIcon.gif" + <div dojoType="dropdowndatepicker" + iconPath="/struts/dojo/struts/widgets/dateIcon.gif" > <input type="text" name="" id=""/> </div>