public class CmsDateBox extends com.google.gwt.user.client.ui.Composite implements com.google.gwt.user.client.ui.HasValue<java.util.Date>, I_CmsFormWidget, I_CmsHasInit, com.google.gwt.event.dom.client.HasKeyPressHandlers
限定符和类型 | 类和说明 |
---|---|
protected class |
CmsDateBox.CloseEventPreviewHandler
Drag and drop event preview handler.
|
protected class |
CmsDateBox.CmsDateBoxHandler
This inner class implements the handler for the date box widget.
|
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
I_CmsFormWidget.FieldType
限定符和类型 | 字段和说明 |
---|---|
protected CmsRadioButton |
m_am
The am radio button.
|
protected CmsRadioButtonGroup |
m_ampmGroup
The radio button group for am/pm selection.
|
protected I_CmsAutoHider |
m_autoHideParent
The auto hide parent.
|
protected CmsTextBox |
m_box
The input field to show the result of picking a date.
|
protected com.google.gwt.user.client.ui.FlowPanel |
m_dateTimePanel
The panel for the date time picker.
|
protected com.google.gwt.user.datepicker.client.DatePicker |
m_picker
The gwt date picker.
|
protected CmsRadioButton |
m_pm
The pm radio button.
|
protected com.google.gwt.event.shared.HandlerRegistration |
m_previewHandlerRegistration
Event preview handler registration.
|
protected CmsTextBox |
m_time
The text box to input the time.
|
protected com.google.gwt.user.client.ui.FlowPanel |
m_timeField
The panel for the time selection.
|
static java.lang.String |
WIDGET_TYPE
The widget type identifier for this widget.
|
构造器和说明 |
---|
CmsDateBox()
Create a new date box widget with the date time picker.
|
限定符和类型 | 方法和说明 |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<java.util.Date> handler) |
protected void |
executeTimeAction()
Updates the updates the close behavior and sets the value of the date box to the value from the picker.
|
protected void |
fireChange(java.util.Date newValue)
Fires the value change event if needed.
|
java.lang.String |
getApparentValue()
Returns the "apparent value", i.e. either the real value if available, or else the ghost value if available, or null otherwise.
|
I_CmsFormWidget.FieldType |
getFieldType()
Returns the type of data this widget produces.
|
java.lang.Object |
getFormValue()
Gets the selected/entered value from the widget.
|
java.lang.String |
getFormValueAsString()
Returns the value of the date box as String in form of a long.
|
CmsTextBox |
getTextField()
Returns the text box of this widget.
|
java.util.Date |
getValue() |
java.lang.String |
getValueAsFormatedString()
Returns the date value as formated String or an empty String if the date value is null.
|
boolean |
hasErrors()
Returns
true if the box and the time input fields don't have any errors. |
protected void |
hidePopup()
Hides the date time popup.
|
static void |
initClass()
Initializes this class.
|
boolean |
isEnabled()
Returns
true if this widget is enabled. |
boolean |
isValideDateBox()
Checks if the String in the date box input field is a valid date format.
|
protected void |
onAmPmClick()
If the am or pm radio button is clicked update the date box from the date time picker.
|
protected void |
onDateBoxBlur()
The date box on blur action.
|
protected void |
onDateBoxClick()
The date box on click action.
|
protected void |
onDateBoxKeyPress(com.google.gwt.event.dom.client.KeyPressEvent event)
The date box on key down action.
|
protected void |
onFocusTimeBox()
Adds the preview handler.
|
protected void |
onPickerValueChanged()
If the value of the picker changes, the value of the date time picker should be updated.
|
protected void |
onTimeBlur()
If the time field loses the focus the entered time should be checked.
|
void |
onTimeClick()
Updates the date box when the user has clicked on the time field.
|
protected void |
onTimeKeyPressed(com.google.gwt.event.dom.client.KeyPressEvent event)
If the user presses enter in the time field the value of the
picker should be updated and the the popup should be closed.
|
protected void |
previewNativeEvent(com.google.gwt.user.client.Event.NativePreviewEvent event)
Blurs the time box if the user clicks outside of it.
|
void |
reset()
Resets the widget to its default state.
|
void |
setAutoHideParent(I_CmsAutoHider autoHideParent)
Call this when auto hiding parents are shown.
|
void |
setDateOnly(boolean dateOnly)
Sets the value if the date only should be shown.
|
void |
setEnabled(boolean enabled)
Enables or disables the widget.
|
void |
setErrorMessage(java.lang.String errorMessage)
Sets the error message for this widget.
|
void |
setFormValueAsString(java.lang.String value)
Expects the value as String in form of a long.
|
void |
setInitialDate(java.util.Date initialDate)
Sets the initial date shown, when the date picker is opened and no date was set before.
|
void |
setName(java.lang.String name)
Sets the name of the input field.
|
void |
setValue(java.util.Date value) |
void |
setValue(java.util.Date value,
boolean fireEvents) |
protected void |
updateCloseBehavior()
Updates the auto hide partner from the parent widget.
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
public static final java.lang.String WIDGET_TYPE
@UiField protected CmsRadioButton m_am
protected CmsRadioButtonGroup m_ampmGroup
protected I_CmsAutoHider m_autoHideParent
@UiField protected CmsTextBox m_box
@UiField protected com.google.gwt.user.client.ui.FlowPanel m_dateTimePanel
@UiField protected com.google.gwt.user.datepicker.client.DatePicker m_picker
@UiField protected CmsRadioButton m_pm
protected com.google.gwt.event.shared.HandlerRegistration m_previewHandlerRegistration
@UiField protected CmsTextBox m_time
@UiField protected com.google.gwt.user.client.ui.FlowPanel m_timeField
public static void initClass()
public com.google.gwt.event.shared.HandlerRegistration addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler handler)
addKeyPressHandler
在接口中 com.google.gwt.event.dom.client.HasKeyPressHandlers
HasKeyPressHandlers.addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler)
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<java.util.Date> handler)
addValueChangeHandler
在接口中 com.google.gwt.event.logical.shared.HasValueChangeHandlers<java.util.Date>
HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)
public java.lang.String getApparentValue()
I_CmsFormWidget
getApparentValue
在接口中 I_CmsFormWidget
I_CmsFormWidget.getApparentValue()
public I_CmsFormWidget.FieldType getFieldType()
I_CmsFormWidget
getFieldType
在接口中 I_CmsFormWidget
I_CmsFormWidget.getFieldType()
public java.lang.Object getFormValue()
I_CmsFormWidget
getFormValue
在接口中 I_CmsFormWidget
I_CmsFormWidget.getFormValue()
public java.lang.String getFormValueAsString()
getFormValueAsString
在接口中 I_CmsFormWidget
I_CmsFormWidget.getFormValueAsString()
public CmsTextBox getTextField()
public java.util.Date getValue()
getValue
在接口中 com.google.gwt.user.client.TakesValue<java.util.Date>
getValue
在接口中 com.google.gwt.user.client.ui.HasValue<java.util.Date>
HasValue.getValue()
public java.lang.String getValueAsFormatedString()
public boolean hasErrors()
true
if the box and the time input fields don't have any errors.true
if the box and the time input fields don't have any errorspublic boolean isEnabled()
I_CmsFormWidget
true
if this widget is enabled.isEnabled
在接口中 I_CmsFormWidget
true
if this widget is enabledI_CmsFormWidget.isEnabled()
public boolean isValideDateBox()
true
if the String in the date box input field is a valid date formatpublic void onTimeClick()
public void reset()
I_CmsFormWidget
reset
在接口中 I_CmsFormWidget
I_CmsFormWidget.reset()
public void setAutoHideParent(I_CmsAutoHider autoHideParent)
I_CmsFormWidget
setAutoHideParent
在接口中 I_CmsFormWidget
autoHideParent
- the auto hide parentI_CmsFormWidget.setAutoHideParent(org.opencms.gwt.client.ui.I_CmsAutoHider)
public void setDateOnly(boolean dateOnly)
dateOnly
- if the date only should be shownpublic void setEnabled(boolean enabled)
I_CmsFormWidget
setEnabled
在接口中 I_CmsFormWidget
enabled
- if true, the widget will be enabled, else disabledI_CmsFormWidget.setEnabled(boolean)
public void setErrorMessage(java.lang.String errorMessage)
I_CmsFormWidget
If the error message is null, no error message will be displayed.
setErrorMessage
在接口中 I_CmsFormWidget
errorMessage
- an error message or nullI_CmsFormWidget.setErrorMessage(java.lang.String)
public void setFormValueAsString(java.lang.String value)
setFormValueAsString
在接口中 I_CmsFormWidget
value
- the new value of the widgetI_CmsFormWidget.setFormValueAsString(java.lang.String)
public void setInitialDate(java.util.Date initialDate)
initialDate
- the initial datepublic void setName(java.lang.String name)
name
- of the input fieldpublic void setValue(java.util.Date value)
setValue
在接口中 com.google.gwt.user.client.TakesValue<java.util.Date>
setValue
在接口中 com.google.gwt.user.client.ui.HasValue<java.util.Date>
HasValue.setValue(java.lang.Object)
public void setValue(java.util.Date value, boolean fireEvents)
setValue
在接口中 com.google.gwt.user.client.ui.HasValue<java.util.Date>
HasValue.setValue(java.lang.Object, boolean)
protected void executeTimeAction()
protected void fireChange(java.util.Date newValue)
newValue
- the new valueprotected void hidePopup()
protected void onAmPmClick()
protected void onDateBoxBlur()
If the date box loses the focus the date time picker should be updated from the date box value.
protected void onDateBoxClick()
If the date box is clicked the time date picker should be shown.
protected void onDateBoxKeyPress(com.google.gwt.event.dom.client.KeyPressEvent event)
event
- the key down eventprotected void onFocusTimeBox()
protected void onPickerValueChanged()
protected void onTimeBlur()
protected void onTimeKeyPressed(com.google.gwt.event.dom.client.KeyPressEvent event)
In any other case the popup should be prevented to being closed.
event
- the key pressed eventprotected void previewNativeEvent(com.google.gwt.user.client.Event.NativePreviewEvent event)
event
- the native preview eventprotected void updateCloseBehavior()
If there is any invalid user input the parent widget should not be closed automatically.