org.jbpm.console.ng.gc.client.util
Class UTCDateBox
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
org.jbpm.console.ng.gc.client.util.UTCDateBox
- All Implemented Interfaces:
- com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasValueChangeHandlers<Long>, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.TakesValue<Long>, com.google.gwt.user.client.ui.HasEnabled, com.google.gwt.user.client.ui.HasText, com.google.gwt.user.client.ui.HasValue<Long>, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget
public class UTCDateBox
- extends com.google.gwt.user.client.ui.Composite
- implements com.google.gwt.user.client.ui.HasValue<Long>, com.google.gwt.event.logical.shared.HasValueChangeHandlers<Long>, com.google.gwt.user.client.ui.HasText, com.google.gwt.user.client.ui.HasEnabled
A wrapper around a DateBox that implements HasValue where the value is
the number of milliseconds since January 1, 1970, 00:00:00 GMT at midnight
on the day, month, and year selected. This avoids time zone conversion
issues encountered using the DateBox.
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.
| Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled |
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
DEBUG_ID_PREFIX |
|
Constructor Summary |
UTCDateBox()
Creates a new UTCDateBox with the medium date format for the
current locale. |
UTCDateBox(com.google.gwt.user.datepicker.client.DatePicker picker,
long date,
com.google.gwt.user.datepicker.client.DateBox.Format format)
Deprecated. Use UTCDateBox(DateTimeFormat)
instead. DatePicker and DateBox.Format are now
ignored. |
UTCDateBox(com.google.gwt.i18n.client.DateTimeFormat format)
Creates a new UTCDateBox with the specified date format. |
| Methods inherited from class com.google.gwt.user.client.ui.Composite |
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
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 |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
fireEvent |
DAY_IN_MS
public static final long DAY_IN_MS
- See Also:
- Constant Field Values
UTCDateBox
public UTCDateBox()
- Creates a new UTCDateBox with the medium date format for the
current locale.
UTCDateBox
public UTCDateBox(com.google.gwt.i18n.client.DateTimeFormat format)
- Creates a new UTCDateBox with the specified date format.
UTCDateBox
@Deprecated
public UTCDateBox(com.google.gwt.user.datepicker.client.DatePicker picker,
long date,
com.google.gwt.user.datepicker.client.DateBox.Format format)
- Deprecated. Use
UTCDateBox(DateTimeFormat)
instead. DatePicker and DateBox.Format are now
ignored.
- Creates a new UTCDateBox
getText
public String getText()
- Specified by:
getText in interface com.google.gwt.user.client.ui.HasText
setText
public void setText(String text)
- Specified by:
setText in interface com.google.gwt.user.client.ui.HasText
getValue
public Long getValue()
- Returns the date value specified by the DateBox measured in number of
milliseconds since January 1, 1970, 00:00:00 GMT. This time will always
correspond to midnight in GMT on the date selected.
- Specified by:
getValue in interface com.google.gwt.user.client.TakesValue<Long>- Specified by:
getValue in interface com.google.gwt.user.client.ui.HasValue<Long>
- Returns:
- The time selected or null if no value is specified by the
DateBox.
setValue
public void setValue(Long value)
- Sets the value in the DateBox.
- Specified by:
setValue in interface com.google.gwt.user.client.TakesValue<Long>- Specified by:
setValue in interface com.google.gwt.user.client.ui.HasValue<Long>
- Parameters:
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.
setValue
public void setValue(Long value,
boolean fireEvents)
- Sets the value in the DateBox.
- Specified by:
setValue in interface com.google.gwt.user.client.ui.HasValue<Long>
- Parameters:
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.
addValueChangeHandler
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<Long> handler)
- Specified by:
addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<Long>
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled in interface com.google.gwt.user.client.ui.HasEnabled
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabled in interface com.google.gwt.user.client.ui.HasEnabled
setVisibleLength
public void setVisibleLength(int length)
- Sets the visible length of the text input for this date box.
This will be ignored for HTML5 inputs.
setTabIndex
public void setTabIndex(int tabIndex)
- Sets the tabindex for this control.
getDateBox
public com.google.gwt.user.datepicker.client.DateBox getDateBox()
trimTimeToMidnight
public static final long trimTimeToMidnight(long time)
utc2date
public static final Date utc2date(Long time)
- Converts a time in UTC to a gwt Date object which is in the timezone of
the current browser.
- Returns:
- The Date corresponding to the time, adjusted for the timezone of
the current browser. null if the specified time is null or
represents a negative number.
date2utc
public static final Long date2utc(Date date)
- Converts a gwt Date in the timezone of the current browser to a time in
UTC.
- Returns:
- A Long corresponding to the number of milliseconds since January
1, 1970, 00:00:00 GMT or null if the specified Date is null.
getValueForToday
public static final Long getValueForToday()
timezoneOffsetMillis
public static final long timezoneOffsetMillis(Date date)
- Returns the timezone offset for the specified Date.
Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.