public class DateLabel extends Label implements IGenericComponent<Date>
java.util.Date
object and that uses Joda time to format
values.
You can provide a date pattern in two of the constructors. When not provided,
DateTimeFormat.shortDate()
will be used.
A special option is applyTimeZoneDifference which is an option that says whether to correct for the difference between the client's time zone and server's time zone. This is true by default.
DateTime
,
DateTimeFormat
,
DateTimeZone
,
Serialized FormENABLE, 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 |
---|
DateLabel(String id,
DateConverter converter)
Construct with a converter.
|
DateLabel(String id,
IModel<Date> model,
DateConverter converter)
Construct with a converter.
|
Modifier and Type | Method and Description |
---|---|
protected IConverter<?> |
createConverter(Class<?> type)
Returns the specialized converter.
|
static DateLabel |
forDatePattern(String id,
IModel<Date> model,
String datePattern)
Creates a new DateLabel defaulting to using a short date pattern
|
static DateLabel |
forDatePattern(String id,
String datePattern)
Creates a new DateLabel defaulting to using a short date pattern
|
static DateLabel |
forDateStyle(String id,
IModel<Date> model,
String dateStyle)
Creates a new DateLabel defaulting to using a short date pattern
|
static DateLabel |
forDateStyle(String id,
String dateStyle)
Creates a new DateLabel defaulting to using a short date pattern
|
static DateLabel |
forShortStyle(String id)
Creates a new DateLabel defaulting to using a short date pattern
|
static DateLabel |
forShortStyle(String id,
IModel<Date> model)
Creates a new DateLabel defaulting to using a short date pattern
|
String |
getAfter() |
String |
getBefore() |
IModel<Date> |
getModel()
Typesafe getter for the model
|
Date |
getModelObject()
Typesafe getter for the model's object
|
void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Processes the body.
|
void |
setAfter(String after) |
void |
setBefore(String before) |
void |
setModel(IModel<Date> model)
Typesafe setter for the model
|
void |
setModelObject(Date object)
Typesafe setter for the model object
|
static DateLabel |
withConverter(String id,
DateConverter converter)
Creates a new DateLabel using the provided converter.
|
static DateLabel |
withConverter(String id,
IModel<Date> model,
DateConverter converter)
Creates a new DateLabel using the provided converter.
|
onComponentTag
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession, onRender
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterfaceAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, get, 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, internalInitialize, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onAfterRenderChildren, onBeforeRender, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModel, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, toString, toString, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
public DateLabel(String id, DateConverter converter)
id
- The component idconverter
- The converter to usepublic DateLabel(String id, IModel<Date> model, DateConverter converter)
id
- The component idmodel
- The modelconverter
- The converter to usepublic static DateLabel 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.TextField
public static DateLabel 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.TextField
public static DateLabel forDateStyle(String id, IModel<Date> model, String dateStyle)
id
- The id of the text fieldmodel
- The modeldateStyle
- style to use in case no pattern is provided. Must be two characters from the set
{"S", "M", "L", "F", "-"}. Must be not null. See
DateTimeFormat.forStyle(String)
for options.TextField
public static DateLabel forDateStyle(String id, String dateStyle)
id
- The id of the text fielddateStyle
- style to use in case no pattern is provided. Must be two characters from the set
{"S", "M", "L", "F", "-"}. Must be not null. See
DateTimeFormat.forStyle(String)
for options.TextField
public static DateLabel forShortStyle(String id)
id
- The id of the text fieldTextField
public static DateLabel forShortStyle(String id, IModel<Date> model)
id
- The id of the text fieldmodel
- The modelTextField
public static DateLabel withConverter(String id, DateConverter converter)
id
- The id of the text fieldconverter
- the date converterTextField
public static DateLabel withConverter(String id, IModel<Date> model, DateConverter converter)
id
- The id of the text fieldmodel
- The modelconverter
- the date converterTextField
public String getAfter()
public String getBefore()
protected IConverter<?> createConverter(Class<?> type)
createConverter
in class Component
type
- The type to convert topublic void setAfter(String after)
after
- append to labelpublic void setBefore(String before)
before
- prepend to labelpublic void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
onComponentTagBody
in class Label
markupStream
- The markup streamopenTag
- The open tag for the bodypublic IModel<Date> getModel()
IGenericComponent
getModel
in interface IGenericComponent<Date>
public void setModel(IModel<Date> model)
IGenericComponent
setModel
in interface IGenericComponent<Date>
model
- the new modelpublic void setModelObject(Date object)
IGenericComponent
setModelObject
in interface IGenericComponent<Date>
object
- the new model objectpublic Date getModelObject()
IGenericComponent
getModelObject
in interface IGenericComponent<Date>
Copyright © 2006–2021 Apache Software Foundation. All rights reserved.