edu.mayo.bsi.ngsportal.client
Class DatePickerButton

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.FocusWidget
              extended by com.google.gwt.user.client.ui.ButtonBase
                  extended by com.google.gwt.user.client.ui.CustomButton
                      extended by com.google.gwt.user.client.ui.PushButton
                          extended by edu.mayo.bsi.ngsportal.client.DatePickerButton
All Implemented Interfaces:
com.google.gwt.event.dom.client.FocusHandler, com.google.gwt.event.dom.client.HasAllDragAndDropHandlers, com.google.gwt.event.dom.client.HasAllFocusHandlers, com.google.gwt.event.dom.client.HasAllGestureHandlers, com.google.gwt.event.dom.client.HasAllKeyHandlers, com.google.gwt.event.dom.client.HasAllMouseHandlers, com.google.gwt.event.dom.client.HasAllTouchHandlers, com.google.gwt.event.dom.client.HasBlurHandlers, com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.dom.client.HasDoubleClickHandlers, com.google.gwt.event.dom.client.HasDragEndHandlers, com.google.gwt.event.dom.client.HasDragEnterHandlers, com.google.gwt.event.dom.client.HasDragHandlers, com.google.gwt.event.dom.client.HasDragLeaveHandlers, com.google.gwt.event.dom.client.HasDragOverHandlers, com.google.gwt.event.dom.client.HasDragStartHandlers, com.google.gwt.event.dom.client.HasDropHandlers, com.google.gwt.event.dom.client.HasFocusHandlers, com.google.gwt.event.dom.client.HasGestureChangeHandlers, com.google.gwt.event.dom.client.HasGestureEndHandlers, com.google.gwt.event.dom.client.HasGestureStartHandlers, com.google.gwt.event.dom.client.HasKeyDownHandlers, com.google.gwt.event.dom.client.HasKeyPressHandlers, com.google.gwt.event.dom.client.HasKeyUpHandlers, com.google.gwt.event.dom.client.HasMouseDownHandlers, com.google.gwt.event.dom.client.HasMouseMoveHandlers, com.google.gwt.event.dom.client.HasMouseOutHandlers, com.google.gwt.event.dom.client.HasMouseOverHandlers, com.google.gwt.event.dom.client.HasMouseUpHandlers, com.google.gwt.event.dom.client.HasMouseWheelHandlers, com.google.gwt.event.dom.client.HasTouchCancelHandlers, com.google.gwt.event.dom.client.HasTouchEndHandlers, com.google.gwt.event.dom.client.HasTouchMoveHandlers, com.google.gwt.event.dom.client.HasTouchStartHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.ValueChangeHandler<Date>, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.safehtml.client.HasSafeHtml, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.Focusable, com.google.gwt.user.client.ui.HasEnabled, com.google.gwt.user.client.ui.HasFocus, com.google.gwt.user.client.ui.HasHTML, com.google.gwt.user.client.ui.HasText, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsWidget, com.google.gwt.user.client.ui.PopupPanel.PositionCallback, com.google.gwt.user.client.ui.SourcesClickEvents, com.google.gwt.user.client.ui.SourcesFocusEvents, com.google.gwt.user.client.ui.SourcesKeyboardEvents, com.google.gwt.user.client.ui.SourcesMouseEvents

public class DatePickerButton
extends com.google.gwt.user.client.ui.PushButton
implements com.google.gwt.event.logical.shared.ValueChangeHandler<Date>, com.google.gwt.user.client.ui.PopupPanel.PositionCallback, com.google.gwt.event.dom.client.FocusHandler

Author:
Greg Dougherty

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.CustomButton
com.google.gwt.user.client.ui.CustomButton.Face
 
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
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
DatePickerButton(com.google.gwt.user.client.ui.TextBox ourBox, boolean isStart)
          Create a DatePickerButton with an attached TextBox
 
Method Summary
 void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
          Whenever focus changes, make sure the dates are valid
 void onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent<Date> event)
           
static Date parseDate(com.google.gwt.user.client.ui.TextBox dateBox, boolean isStartDate)
          Date parser, made public so get the same answer no matter who needs it.
 void setOtherPicker(DatePickerButton otherPicker)
           
 void setPosition(int offsetWidth, int offsetHeight)
           
static void setupImage(NGSPortalResources piResources)
          Tells the class how to get to the resources bundle so it can get the image for its buttons.
 
Methods inherited from class com.google.gwt.user.client.ui.CustomButton
getDownDisabledFace, getDownFace, getDownHoveringFace, getHTML, getTabIndex, getText, getUpDisabledFace, getUpFace, getUpHoveringFace, onBrowserEvent, setAccessKey, setEnabled, setFocus, setHTML, setHTML, setTabIndex, setText
 
Methods inherited from class com.google.gwt.user.client.ui.FocusWidget
addBlurHandler, addClickHandler, addClickListener, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addFocusHandler, addFocusListener, addGestureChangeHandler, addGestureEndHandler, addGestureStartHandler, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler, isEnabled, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, fireEvent, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

DatePickerButton

public DatePickerButton(com.google.gwt.user.client.ui.TextBox ourBox,
                        boolean isStart)
Create a DatePickerButton with an attached TextBox

Parameters:
ourBox - The text box it shares data with
isStart - true if this is the start date, false if it's the end date. This matters because the Start Date shouldn't be after today's date, whereas the End data can be.
Method Detail

setupImage

public static void setupImage(NGSPortalResources piResources)
Tells the class how to get to the resources bundle so it can get the image for its buttons.

Parameters:
piResources - The resources bundle

parseDate

public static final Date parseDate(com.google.gwt.user.client.ui.TextBox dateBox,
                                   boolean isStartDate)
Date parser, made public so get the same answer no matter who needs it. If a valid string is passed in, try parsing it. Start with month/day, then try month/day/two digit year (dates range from 80 years before present to 20 years after). After that go through the GWT provided short / medium / long date formats.

Parameters:
dateBox - The TextBox with the text to parse
isStartDate - If true, and a Month / Day date, will set the date to today, or some time within the last year, since can't have any reports that were analyzed tomorrow
Returns:
A Date matching the contents of dateText, or null if not a valid date

onValueChange

public void onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent<Date> event)
Specified by:
onValueChange in interface com.google.gwt.event.logical.shared.ValueChangeHandler<Date>

setPosition

public void setPosition(int offsetWidth,
                        int offsetHeight)
Specified by:
setPosition in interface com.google.gwt.user.client.ui.PopupPanel.PositionCallback

setOtherPicker

public final void setOtherPicker(DatePickerButton otherPicker)
Parameters:
otherPicker - the Picker paired to this picker

onFocus

public void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
Whenever focus changes, make sure the dates are valid

Specified by:
onFocus in interface com.google.gwt.event.dom.client.FocusHandler
Parameters:
event - Utterly worthless focus "event" object