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.

It is possible to customize the user-visible formatting with either the 'formatLength' (long, short, medium or full) or 'displayFormat' attributes. By defaulty current locale will be used.

Syntax supported by 'displayFormat' is (http://www.unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns):-
Format Description
d Day of the month
D Day of year
M Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or 5 for the narrow name.
h Hour [1-12].
H Hour [0-23].
m Minute. Use one or two for zero padding.
s Second. Use one or two for zero padding.

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 the format used.

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 String RFC3339_FORMAT
           
private static String RFC3339_PATTERN
           
protected  String startDate
           
protected  String staticDisplay
           
static String TEMPLATE
           
protected  String templateCssPath
           
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 setTemplateCssPath(String templateCssPath)
           
 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, ensureAttributeSafelyNotEscaped, 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, 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

RFC3339_FORMAT

private static final String RFC3339_FORMAT
See Also:
Constant Field Values

RFC3339_PATTERN

private static final String RFC3339_PATTERN
See Also:
Constant Field Values

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

templateCssPath

protected String templateCssPath
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)

setTemplateCssPath

public void setTemplateCssPath(String templateCssPath)

format

private String format(Object obj)


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