public class DateTextField extends TextField<Date> implements AbstractTextComponent.ITextFormatProvider
java.util.Date
object and that uses Joda time to
parse and format values.
You should use on of the factory methods to construct the kind you want or use the public constructor and pass in the converter to use.
This component tries to apply the time zone difference between the client and server. See the
date converter
of this package for more
information on that.
StyleDateConverter
,
DateTime
,
DateTimeFormat
,
DateTimeZone
,
Serialized FormAbstractTextComponent.ITextFormatProvider
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, VALUE_SEPARATOR
ENABLE, FLAG_AFTER_RENDERING, FLAG_INITIALIZED, FLAG_PREPARED_FOR_RENDER, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RENDERING, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING
Constructor and Description |
---|
DateTextField(String id,
DateConverter converter)
Construct with a converter, and a null model.
|
DateTextField(String id,
IModel<Date> model,
DateConverter converter)
Construct with a converter.
|
Modifier and Type | Method and Description |
---|---|
protected IConverter<?> |
createConverter(Class<?> clazz)
Factory method for converters to be used by this component,
returns
null by default. |
static DateTextField |
forDatePattern(String id,
IModel<Date> model,
String datePattern)
Creates a new DateTextField defaulting to using a short date pattern
|
static DateTextField |
forDatePattern(String id,
String datePattern)
Creates a new DateTextField defaulting to using a short date pattern
|
static DateTextField |
forDateStyle(String id,
IModel<Date> model,
String dateStyle)
Creates a new DateTextField using the provided date style.
|
static DateTextField |
forDateStyle(String id,
String dateStyle)
Creates a new DateTextField using the provided date style.
|
static DateTextField |
forShortStyle(String id)
Creates a new DateTextField defaulting to using a short date pattern
|
static DateTextField |
forShortStyle(String id,
IModel<Date> model,
boolean applyTimeZoneDifference)
Creates a new DateTextField defaulting to using a short date pattern
|
String |
getTextFormat()
Gets the pattern for printing output and parsing input.
|
static DateTextField |
withConverter(String id,
DateConverter converter)
Creates a new DateTextField using the provided converter.
|
static DateTextField |
withConverter(String id,
IModel<Date> model,
DateConverter converter)
Creates a new DateTextField using the provided converter.
|
getInputTypes, onComponentTag
convertInput, getConvertEmptyInputStringToNull, isInputNullable, onBeforeRender, setConvertEmptyInputStringToNull
add, add, checkRequired, clearInput, convertValue, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getForm, getInput, getInputAsArray, getInputName, getModel, getModelObject, getModelValue, getParameterValues, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isMultiPart, isRequired, isValid, newValidatable, newValidationError, onDetach, onDisabled, onInvalid, onRequired, onValid, processChildren, processInput, remove, reportRequiredError, setConvertedInput, setLabel, setModel, setModelObject, setModelValue, setRequired, setType, shouldTrimInput, trim, updateAutoLabels, updateCollectionModel, updateModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrder
getLabel
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onAfterRenderChildren, onComponentTagBody, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterfaceAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalPrepareForRender, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
public DateTextField(String id, IModel<Date> model, DateConverter converter)
id
- The component idmodel
- The modelconverter
- The converter to usepublic DateTextField(String id, DateConverter converter)
id
- The component idconverter
- The converter to usepublic static DateTextField forDatePattern(String id, IModel<Date> model, String datePattern)
id
- The id of the text fieldmodel
- The modeldatePattern
- The pattern to use. Must be not null. See SimpleDateFormat
for available
patterns.public static DateTextField forDatePattern(String id, String datePattern)
id
- The id of the text fielddatePattern
- The pattern to use. Must be not null. See SimpleDateFormat
for available
patterns.public static DateTextField forDateStyle(String id, IModel<Date> model, String dateStyle)
id
- The id of the text fieldmodel
- The modeldateStyle
- Date style to use. The first character is the date style, and the second character
is the time style. Specify a character of 'S' for short style, 'M' for medium, 'L'
for long, and 'F' for full. A date or time may be ommitted by specifying a style
character '-'. See DateTimeFormat.forStyle(String)
.public static DateTextField forDateStyle(String id, String dateStyle)
id
- The id of the text fielddateStyle
- Date style to use. The first character is the date style, and the second character
is the time style. Specify a character of 'S' for short style, 'M' for medium, 'L'
for long, and 'F' for full. A date or time may be ommitted by specifying a style
character '-'. See DateTimeFormat.forStyle(String)
.public static DateTextField forShortStyle(String id)
id
- The id of the text fieldpublic static DateTextField forShortStyle(String id, IModel<Date> model, boolean applyTimeZoneDifference)
id
- The id of the text fieldmodel
- The modelapplyTimeZoneDifference
- Whether to apply the time zone difference between client and serverpublic static DateTextField withConverter(String id, DateConverter converter)
id
- The id of the text fieldconverter
- the date converterpublic static DateTextField withConverter(String id, IModel<Date> model, DateConverter converter)
id
- The id of the text fieldmodel
- The modelconverter
- the date converterprotected IConverter<?> createConverter(Class<?> clazz)
Component
null
by default.createConverter
in class Component
clazz
- The type to convert toComponent.createConverter(java.lang.Class)
public final String getTextFormat()
AbstractTextComponent.ITextFormatProvider
getTextFormat
in interface AbstractTextComponent.ITextFormatProvider
AbstractTextComponent.ITextFormatProvider.getTextFormat()
Copyright © 2006–2021 Apache Software Foundation. All rights reserved.