Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts2.dojo.components
Class DateTimePicker

    java.lang.Object
      org.apache.struts2.components.Component
          org.apache.struts2.components.UIBean
              org.apache.struts2.dojo.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.
y | Year
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 a locale-independent value, in a hidden field as defined by the name attribute. The value will be formatted conforming to RFC3 339 (yyyy-MM-dd'T'HH:mm:ss)

The following formats(in order) will be used to parse the values of the attributes 'value', 'startDate' and 'endDate':

- SimpleDateFormat built using RFC 3339 (yyyy-MM-dd'T'HH:mm:ss)
- SimpleDateFormat.getTimeInstance(DateFormat.SHORT)
- SimpleDateFormat.getDateInstance(DateFormat.SHORT)
- SimpleDateFormat.getDateInstance(DateFormat.MEDIUM)
- SimpleDateFormat.getDateInstance(DateFormat.FULL)
- SimpleDateFormat.getDateInstance(DateFormat.LONG)
- SimpleDateFormat built using the value of the 'displayFormat' attribute(if any)

Examples

       <sx:datetimepicker name="order.date" label="Order Date" />
       <sx:datetimepicker name="delivery.date" label="Delivery Date" displayFormat="yyyy-MM-dd"  />
       <sx:datetimepicker name="delivery.date" label="Delivery Date" value="%{date}"  />
       <sx:datetimepicker name="delivery.date" label="Delivery Date" value="%{'2007-01-01'}"  />
       <sx:datetimepicker name="order.date" label="Order Date" value="%{'today'}"/>

<sx:datetimepicker id="picker" label="Order Date" /> <script type="text/javascript"> function setValue() { var picker = dojo.widget.byId("picker"); //string value picker.setValue('2007-01-01'); //Date value picker.setValue(new Date()); } function showValue() { var picker = dojo.widget.byId("picker"); //string value var stringValue = picker.getValue(); alert(stringValue); //date value var dateValue = picker.getDate(); alert(dateValue); } </script> <sx:datetimepicker id="picker" label="Order Date" valueNotifyTopics="/value"/> <script type="text/javascript"> dojo.event.topic.subscribe("/value", function(textEntered, date, widget){ alert('value changed'); //textEntered: String enetered in the textbox //date: JavaScript Date object with the value selected //widet: widget that published the topic }); </script>

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 com.opensymphony.xwork2.util.logging.Logger` | `LOG`
`protected String` | `startDate`
`protected String` | `staticDisplay`
`static String` | `TEMPLATE`
`protected String` | `templateCssPath`
`protected String` | `toggleDuration`
`protected String` | `toggleType`
`protected String` | `type`
`protected String` | `valueNotifyTopics`
`protected String` | `weekStartsOn`

Fields inherited from class org.apache.struts2.components.UIBean
`accesskey, cssClass, cssErrorClass, cssErrorStyle, cssStyle, defaultTemplateDir, defaultUITheme, disabled, dynamicAttributes, errorPosition, id, javascriptTooltip, key, label, labelPosition, labelSeparator, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, requiredLabel, requiredPosition, response, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, tooltipCssClass, tooltipDelay, tooltipIconPath, uiThemeExpansionToken, value`

Fields inherited from class org.apache.struts2.components.Component
`actionMapper, COMPONENT_STACK, devMode, parameters, stack, standardAttributesMap, throwExceptionOnELFailure`

Constructor Summary
`DateTimePicker(com.opensymphony.xwork2.util.ValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)`

Method Summary
`void` | `evaluateParams()`
`protected String` | `getDefaultTemplate()`
`String` | `getTheme()`
`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` | `setTheme(String theme)`
`void` | `setToggleDuration(String toggleDuration)`
`void` | `setToggleType(String toggleType)`
`void` | `setType(String type)`
`void` | `setValue(String arg0)`
`void` | `setValueNotifyTopics(String valueNotifyTopics)`
`void` | `setWeekStartsOn(String weekStartsOn)`

Methods inherited from class org.apache.struts2.components.UIBean
`addFormParameter, buildTemplateName, copyParams, enableAncestorFormCustomOnsubmit, end, ensureAttributeSafelyNotEscaped, escape, evaluateExtraParams, evaluateNameValue, getId, getTemplate, getTemplateDir, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setClass, setCssClass, setCssErrorClass, setCssErrorStyle, setCssStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setDynamicAttributes, setErrorPosition, setId, setJavascriptTooltip, setKey, setLabel, setLabelposition, setLabelSeparator, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequiredLabel, setRequiredPosition, setStyle, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTitle, setTooltip, setTooltipConfig, setTooltipCssClass, setTooltipDelay, setTooltipIconPath, setUIThemeExpansionToken`

Methods inherited from class org.apache.struts2.components.Component
`addAllParameters, addParameter, altSyntax, completeExpressionIfAltSyntax, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findStringIfAltSyntax, findValue, findValue, findValue, getComponentStack, getParameters, getStack, getStandardAttributes, isValidTagAttribute, popComponentStack, setActionMapper, setDevMode, setThrowExceptionsOnELFailure, setUrlHelper, start, stripExpressionIfAltSyntax, 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

### LOG

    protected static final com.opensymphony.xwork2.util.logging.Logger 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

### valueNotifyTopics

    protected String valueNotifyTopics

Constructor Detail

### DateTimePicker

    public DateTimePicker(com.opensymphony.xwork2.util.ValueStack stack,
                          javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)

Method Detail

### getDefaultTemplate

    protected String getDefaultTemplate()

  Specified by:
    `getDefaultTemplate` in class `UIBean`

### evaluateParams

    public void evaluateParams()

  Overrides:
    `evaluateParams` in class `UIBean`

### setTheme

    public void setTheme(String theme)

  Overrides:
    `setTheme` in class `UIBean`

### getTheme

    public String getTheme()

  Overrides:
    `getTheme` 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)

### setValue

    public void setValue(String arg0)

  Overrides:
    `setValue` in class `UIBean`

### setValueNotifyTopics

    public void setValueNotifyTopics(String valueNotifyTopics)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000–2017 Apache Software Foundation. All rights reserved.