|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Component org.apache.wicket.MarkupContainer org.apache.wicket.markup.html.WebMarkupContainer org.apache.wicket.markup.html.form.LabeledWebMarkupContainer org.apache.wicket.markup.html.form.FormComponent<T> org.apache.wicket.markup.html.form.FormComponentPanel<java.util.Date> org.apache.wicket.extensions.yui.calendar.DateTimeField
public class DateTimeField
Works on a Date
object. Displays a date field and a DatePicker
, a field
for hours and a field for minutes, and an AM/PM field. The format (12h/24h) of the hours field
depends on the time format of this DateTimeField
's Locale
, as does the visibility
of the AM/PM field (see use12HourFormat()
).
for a variant with just the date field and date picker
,
Serialized FormNested Class Summary | |
---|---|
static class |
DateTimeField.AM_PM
Enumerated type for different ways of handling the render part of requests. |
Field Summary | |
---|---|
protected static java.lang.String |
AM_OR_PM_CHOICE
|
protected static java.lang.String |
DATE
|
protected static java.lang.String |
HOURS
|
protected static java.lang.String |
MINUTES
|
Fields inherited from class org.apache.wicket.markup.html.form.FormComponent |
---|
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, VALUE_SEPARATOR |
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
DateTimeField(java.lang.String id)
Construct. |
|
DateTimeField(java.lang.String id,
IModel<java.util.Date> model)
Construct. |
Method Summary | |
---|---|
static java.util.Date |
changeTimeZone(java.util.Date date,
java.util.TimeZone zone)
Change a date in another timezone |
protected void |
configure(java.util.Map<java.lang.String,java.lang.Object> widgetProperties)
Gives overriding classes the option of adding (or even changing/ removing) configuration properties for the javascript widget. |
protected void |
convertInput()
Sets the converted input, which is an instance of Date , possibly null. |
DateTimeField.AM_PM |
getAmOrPm()
Gets the amOrPm model object of the drop down choice. |
protected java.util.TimeZone |
getClientTimeZone()
Gets the client's time zone. |
java.util.Date |
getDate()
Gets the date model object for the date TextField. |
protected DateTextField |
getDateTextField()
|
java.lang.Integer |
getHours()
Gets the hours model object for the TextField |
java.lang.String |
getInput()
Gets the request parameter for this component as a string. |
java.lang.Integer |
getMinutes()
Gets the minutes model object for the TextField |
protected DatePicker |
newDatePicker()
The DatePicker that gets added to the DateTimeField component. |
protected DateTextField |
newDateTextField(java.lang.String id,
PropertyModel<java.util.Date> dateFieldModel)
create a new DateTextField instance to be added to this panel. |
protected void |
onBeforeRender()
Called just before a component is rendered. |
void |
setAmOrPm(DateTimeField.AM_PM amOrPm)
Sets the amOrPm model object associated with the drop down choice. |
void |
setDate(java.util.Date date)
Sets the date model object associated with the date TextField. |
void |
setHours(java.lang.Integer hours)
Sets hours. |
void |
setMinutes(java.lang.Integer minutes)
Sets minutes. |
protected boolean |
use12HourFormat()
Checks whether the current Locale uses the 12h or 24h time format. |
Methods inherited from class org.apache.wicket.markup.html.form.FormComponentPanel |
---|
checkRequired, newMarkupSourcingStrategy, onComponentTag |
Methods inherited from class org.apache.wicket.markup.html.form.FormComponent |
---|
add, add, clearInput, convertValue, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getForm, getInputAsArray, getInputName, getModel, getModelObject, getModelValue, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, onDetach, onDisabled, onInvalid, onValid, processChildren, processInput, remove, setConvertedInput, setLabel, setModel, setModelObject, setModelValue, setRequired, setType, shouldTrimInput, trim, updateCollectionModel, updateModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrder |
Methods inherited from class org.apache.wicket.markup.html.form.LabeledWebMarkupContainer |
---|
getLabel, setLabelInternal |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String DATE
protected static final java.lang.String HOURS
protected static final java.lang.String MINUTES
protected static final java.lang.String AM_OR_PM_CHOICE
Constructor Detail |
---|
public DateTimeField(java.lang.String id)
id
- public DateTimeField(java.lang.String id, IModel<java.util.Date> model)
id
- model
- Method Detail |
---|
protected final DateTextField getDateTextField()
public final DateTimeField.AM_PM getAmOrPm()
public final java.util.Date getDate()
public final java.lang.Integer getHours()
public final java.lang.Integer getMinutes()
protected void configure(java.util.Map<java.lang.String,java.lang.Object> widgetProperties)
#localize(Map)
manually if you like localized strings to be added.
widgetProperties
- the current widget propertiespublic java.lang.String getInput()
FormComponent
getInput
in class FormComponent<java.util.Date>
public final void setAmOrPm(DateTimeField.AM_PM amOrPm)
amOrPm
- amOrPmpublic final void setDate(java.util.Date date)
date
- datepublic final void setHours(java.lang.Integer hours)
hours
- hourspublic final void setMinutes(java.lang.Integer minutes)
minutes
- minutesprotected java.util.TimeZone getClientTimeZone()
protected void convertInput()
Date
, possibly null. It combines
the inputs of the nested date, hours, minutes and am/pm fields and constructs a date from it.
Note that overriding this method is a better option than overriding FormComponent.updateModel()
like the first versions of this class did. The reason for that is that this method can be
used by form validators without having to depend on the actual model being updated, and this
method is called by the default implementation of FormComponent.updateModel()
anyway (so we don't
have to override that anymore).
convertInput
in class FormComponent<java.util.Date>
IConverterLocator
,
Application.newConverterLocator()
protected DateTextField newDateTextField(java.lang.String id, PropertyModel<java.util.Date> dateFieldModel)
DateTextField
instance to be added to this panel.
id
- the component iddateFieldModel
- model that should be used by the DateTextField
protected void onBeforeRender()
Component
NOTE: If you override this, you *must* call super.onBeforeRender() within
your implementation.
Because this method is responsible for cascading Component.onBeforeRender()
call to its
children it is strongly recommended that super call is made at the end of the override.
onBeforeRender
in class Component
Component.onBeforeRender()
public static java.util.Date changeTimeZone(java.util.Date date, java.util.TimeZone zone)
date
- The input date.zone
- The target timezone.
protected boolean use12HourFormat()
Locale
uses the 12h or 24h time format. This method can be
overridden to e.g. always use 24h format.
Locale
uses the 12h format.protected DatePicker newDatePicker()
DatePicker
instance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |