public class UTCDateBox extends Composite implements HasValue<Long>, HasValueChangeHandlers<Long>, HasText, HasEnabled
Note: In keeping with the behavior of the GWT DateBox, null is used to represent no value. This means that you should check for null when calling getValue(), just as you would for DateBox. With auto-boxing Long/long, this may seem strange but is consistent.
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
Modifier and Type | Field and Description |
---|---|
static long |
DAY_IN_MS |
DEBUG_ID_PREFIX
Constructor and Description |
---|
UTCDateBox()
Creates a new UTCDateBox with the medium date format for the
current locale.
|
UTCDateBox(DatePicker picker,
long date,
DateBox.Format format)
Deprecated.
Use
UTCDateBox(DateTimeFormat)
instead. DatePicker and DateBox.Format are now
ignored. |
UTCDateBox(DateTimeFormat format)
Creates a new UTCDateBox with the specified date format.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<Long> handler) |
static Long |
date2utc(Date date)
Converts a gwt Date in the timezone of the current browser to a time in
UTC.
|
DateBox |
getDateBox() |
String |
getText() |
Long |
getValue()
Returns the date value specified by the DateBox measured in number of
milliseconds since January 1, 1970, 00:00:00 GMT.
|
static Long |
getValueForToday() |
boolean |
isEnabled() |
void |
setEnabled(boolean enabled) |
void |
setTabIndex(int tabIndex)
Sets the tabindex for this control.
|
void |
setText(String text) |
void |
setValue(Long value)
Sets the value in the DateBox.
|
void |
setValue(Long value,
boolean fireEvents)
Sets the value in the DateBox.
|
void |
setVisibleLength(int length)
Sets the visible length of the text input for this date box.
|
static long |
timezoneOffsetMillis(Date date)
Returns the timezone offset for the specified Date.
|
static long |
trimTimeToMidnight(long time) |
static Date |
utc2date(Long time)
Converts a time in UTC to a gwt Date object which is in the timezone of
the current browser.
|
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, unsinkEvents
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
public static final long DAY_IN_MS
public UTCDateBox()
public UTCDateBox(DateTimeFormat format)
@Deprecated public UTCDateBox(DatePicker picker, long date, DateBox.Format format)
UTCDateBox(DateTimeFormat)
instead. DatePicker and DateBox.Format are now
ignored.public Long getValue()
public void setValue(Long value)
setValue
in interface TakesValue<Long>
setValue
in interface HasValue<Long>
value
- A time measured in the number of milliseconds since January 1,
1970, 00:00:00 GMT. This time should be at midnight in GMT for
the Date selected.
If value is null or represents a negative number, the DateBox will have no value.
public void setValue(Long value, boolean fireEvents)
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Long> handler)
addValueChangeHandler
in interface HasValueChangeHandlers<Long>
public boolean isEnabled()
isEnabled
in interface HasEnabled
public void setEnabled(boolean enabled)
setEnabled
in interface HasEnabled
public void setVisibleLength(int length)
public void setTabIndex(int tabIndex)
public DateBox getDateBox()
public static final long trimTimeToMidnight(long time)
public static final Date utc2date(Long time)
public static final Long date2utc(Date date)
public static final Long getValueForToday()
public static final long timezoneOffsetMillis(Date date)
Copyright © 2015. All Rights Reserved.