org.apache.struts2.components
Class DateTimePicker

java.lang.Object
  extended by org.apache.struts2.components.Component
      extended by org.apache.struts2.components.UIBean
          extended by org.apache.struts2.components.DateTimePicker

public class DateTimePicker
extends UIBean

Renders a date/time picker in a dropdown container.

A stand-alone DateTimePicker widget that makes it easy to select a date/time, or increment by week, month, and/or year.

Dates attributes passed in the `RFC 3339` format: Renders date/time picker element.

Format supported by this component are:-
Format Description
#dd Display day in two digits format
#d Try to display day in one digit format, if cannot use 2 digit format
#MM Display month in two digits format
#M Try to display month in one digits format, if cannot use 2 digit format
#yyyy Display year in four digits format
#yy Display the last two digits of the yaer
#y Display the last digits of the year

It is possible to customize the user-visible formatting with either the formatLength or displayFormat attributes. The value sent to the server is typically a locale-independent value in a hidden field as defined by the name attribute. RFC3339 representation is used by default, but other options are available with saveFormat

Examples

 

 Example 1:
     <s:datetimepicker name="order.date" label="Order Date" />
 Example 2:
     <s:datetimepicker name="delivery.date" label="Delivery Date" format="#yyyy-#MM-#dd"  />

 
 

The css could be changed by using the following :-

 

 <s:datetimepicker name="birthday" label="Birthday" templateCss="...." />

 
 


Field Summary
protected  String adjustWeeks
           
protected  String dayWidth
           
protected  String displayFormat
           
protected  String displayWeeks
           
protected  String endDate
           
protected  String formatLength
           
protected  String iconPath
           
protected  String language
           
protected static Log LOG
           
private static SimpleDateFormat RFC3399_FORMAT
           
protected  String startDate
           
protected  String staticDisplay
           
static String TEMPLATE
           
protected  String toggleDuration
           
protected  String toggleType
           
protected  String type
           
protected  String weekStartsOn
           
 
Fields inherited from class org.apache.struts2.components.UIBean
accesskey, cssClass, cssStyle, defaultTemplateDir, defaultUITheme, disabled, key, label, labelPosition, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, value
 
Fields inherited from class org.apache.struts2.components.Component
actionMapper, COMPONENT_STACK, id, parameters, stack
 
Constructor Summary
DateTimePicker(ValueStack stack, HttpServletRequest request, HttpServletResponse response)
           
 
Method Summary
 void evaluateParams()
           
private  String format(Object obj)
           
protected  String getDefaultTemplate()
          A contract that requires each concrete UI Tag to specify which template should be used as a default.
 void setAdjustWeeks(String adjustWeeks)
           
 void setDayWidth(String dayWidth)
           
 void setDisplayFormat(String displayFormat)
           
 void setDisplayWeeks(String displayWeeks)
           
 void setEndDate(String endDate)
           
 void setFormatLength(String formatLength)
           
 void setIconPath(String iconPath)
           
 void setLanguage(String language)
           
 void setStartDate(String startDate)
           
 void setStaticDisplay(String staticDisplay)
           
 void setToggleDuration(String toggleDuration)
           
 void setToggleType(String toggleType)
           
 void setType(String type)
           
 void setWeekStartsOn(String weekStartsOn)
           
 
Methods inherited from class org.apache.struts2.components.UIBean
addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, end, escape, evaluateExtraParams, evaluateNameValue, getTemplate, getTemplateDir, getTheme, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssClass, setCssStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setKey, setLabel, setLabelposition, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTheme, setTitle, setTooltip, setTooltipConfig, setValue
 
Methods inherited from class org.apache.struts2.components.Component
addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setActionMapper, setId, start, toString, usesBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE

public static final String TEMPLATE
See Also:
Constant Field Values

RFC3399_FORMAT

private static final SimpleDateFormat RFC3399_FORMAT

LOG

protected static final Log LOG

iconPath

protected String iconPath

formatLength

protected String formatLength

displayFormat

protected String displayFormat

toggleType

protected String toggleType

toggleDuration

protected String toggleDuration

type

protected String type

displayWeeks

protected String displayWeeks

adjustWeeks

protected String adjustWeeks

startDate

protected String startDate

endDate

protected String endDate

weekStartsOn

protected String weekStartsOn

staticDisplay

protected String staticDisplay

dayWidth

protected String dayWidth

language

protected String language
Constructor Detail

DateTimePicker

public DateTimePicker(ValueStack stack,
                      HttpServletRequest request,
                      HttpServletResponse response)
Method Detail

getDefaultTemplate

protected String getDefaultTemplate()
Description copied from class: UIBean
A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.

Specified by:
getDefaultTemplate in class UIBean
Returns:
The name of the template to be used as the default.

evaluateParams

public void evaluateParams()
Overrides:
evaluateParams in class UIBean

setAdjustWeeks

public void setAdjustWeeks(String adjustWeeks)

setDayWidth

public void setDayWidth(String dayWidth)

setDisplayWeeks

public void setDisplayWeeks(String displayWeeks)

setEndDate

public void setEndDate(String endDate)

setStartDate

public void setStartDate(String startDate)

setStaticDisplay

public void setStaticDisplay(String staticDisplay)

setWeekStartsOn

public void setWeekStartsOn(String weekStartsOn)

setLanguage

public void setLanguage(String language)

setDisplayFormat

public void setDisplayFormat(String displayFormat)

setFormatLength

public void setFormatLength(String formatLength)

setIconPath

public void setIconPath(String iconPath)

setToggleDuration

public void setToggleDuration(String toggleDuration)

setType

public void setType(String type)

setToggleType

public void setToggleType(String toggleType)

format

private String format(Object obj)


Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.