Class TimeSelector
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Panel
-
- com.google.gwt.user.client.ui.ComplexPanel
-
- com.google.gwt.user.client.ui.CellPanel
-
- com.google.gwt.user.client.ui.HorizontalPanel
-
- uk.ac.rdg.resc.godiva.client.widgets.BaseSelector
-
- uk.ac.rdg.resc.godiva.client.widgets.TimeSelector
-
- All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers
,com.google.gwt.event.shared.HasHandlers
,com.google.gwt.user.client.EventListener
,com.google.gwt.user.client.ui.HasAlignment
,com.google.gwt.user.client.ui.HasHorizontalAlignment
,com.google.gwt.user.client.ui.HasVerticalAlignment
,com.google.gwt.user.client.ui.HasVisibility
,com.google.gwt.user.client.ui.HasWidgets
,com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
,com.google.gwt.user.client.ui.IndexedPanel
,com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
,com.google.gwt.user.client.ui.InsertPanel
,com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
,com.google.gwt.user.client.ui.IsWidget
,Iterable<com.google.gwt.user.client.ui.Widget>
,TimeSelectorIF
public class TimeSelector extends BaseSelector implements TimeSelectorIF
Implementation ofTimeSelectorIF
which presents dates and times (and ranges where applicable) as separate drop-down boxes- Author:
- Guy Griffiths
-
-
Nested Class Summary
-
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
-
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
com.google.gwt.user.client.ui.HasHorizontalAlignment.AutoHorizontalAlignmentConstant, com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant
-
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment
com.google.gwt.user.client.ui.HasVerticalAlignment.VerticalAlignmentConstant
-
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
-
-
Field Summary
Fields Modifier and Type Field Description protected static String[]
allTimes
-
Fields inherited from class uk.ac.rdg.resc.godiva.client.widgets.BaseSelector
label
-
-
Constructor Summary
Constructors Constructor Description TimeSelector(String id, String label, TimeDateSelectionHandler handler)
TimeSelector(String id, TimeDateSelectionHandler handler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getAvailableDates()
Return the available datesList<String>
getAvailableTimes()
Return the available timesstatic List<String>
getDatesInRange(String startDateTimeStr, String endDateTimeStr)
String
getRange()
String
getSelectedDate()
int
getSelectedDateIndex()
String
getSelectedDateTime()
String
getSelectedDateTimeRange()
String
getSelectedTime()
boolean
hasMultipleTimes()
boolean
isContinuous()
void
populateDates(List<String> availableDatetimes)
Populate the available datesvoid
populateTimes(List<String> availableTimes)
Populate the available times.boolean
selectDate(String dateString)
Choose a specified dateboolean
selectDateTime(String timeString)
Choose a specified datetimevoid
selectRange(String currentRange)
Sets the range (i.e.void
setContinuous(boolean continuous)
Sets whether thisTimeSelectorIF
needs to represent discrete or continous timevoid
setEnabled(boolean enabled)
Enable/disable the widgetvoid
setId(String id)
Sets the ID of the layer which this time selector applies to-
Methods inherited from class uk.ac.rdg.resc.godiva.client.widgets.BaseSelector
setTitle
-
Methods inherited from class com.google.gwt.user.client.ui.HorizontalPanel
add, getHorizontalAlignment, getVerticalAlignment, insert, insert, onEnsureDebugId, remove, setHorizontalAlignment, setVerticalAlignment
-
Methods inherited from class com.google.gwt.user.client.ui.CellPanel
getBody, getSpacing, getTable, setBorderWidth, setCellHeight, setCellHeight, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellWidth, setCellWidth, setSpacing
-
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove
-
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
-
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, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel
getWidget, getWidgetCount, getWidgetIndex, remove
-
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndex
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
allTimes
protected static final String[] allTimes
-
-
Constructor Detail
-
TimeSelector
public TimeSelector(String id, TimeDateSelectionHandler handler)
-
TimeSelector
public TimeSelector(String id, String label, TimeDateSelectionHandler handler)
-
-
Method Detail
-
setId
public void setId(String id)
Description copied from interface:TimeSelectorIF
Sets the ID of the layer which this time selector applies to- Specified by:
setId
in interfaceTimeSelectorIF
-
populateDates
public void populateDates(List<String> availableDatetimes)
Description copied from interface:TimeSelectorIF
Populate the available dates- Specified by:
populateDates
in interfaceTimeSelectorIF
- Parameters:
availableDatetimes
- The available dates, as aList
ofString
s
-
populateTimes
public void populateTimes(List<String> availableTimes)
Description copied from interface:TimeSelectorIF
Populate the available times. This may change as the date changes- Specified by:
populateTimes
in interfaceTimeSelectorIF
- Parameters:
availableTimes
- The available times, as aList
ofString
s
-
getSelectedDate
public String getSelectedDate()
- Specified by:
getSelectedDate
in interfaceTimeSelectorIF
- Returns:
- A
String
representation of the currently selected date
-
getSelectedDateTime
public String getSelectedDateTime()
- Specified by:
getSelectedDateTime
in interfaceTimeSelectorIF
- Returns:
- A
String
representation of the currently selected datetime
-
getSelectedDateTimeRange
public String getSelectedDateTimeRange()
- Specified by:
getSelectedDateTimeRange
in interfaceTimeSelectorIF
- Returns:
- A
String
representation of the currently selected datetime range. This may benull
if isContinous() returns false
-
getSelectedTime
public String getSelectedTime()
- Specified by:
getSelectedTime
in interfaceTimeSelectorIF
- Returns:
- A
String
representation of the currently selected time
-
selectDate
public boolean selectDate(String dateString)
Description copied from interface:TimeSelectorIF
Choose a specified date- Specified by:
selectDate
in interfaceTimeSelectorIF
- Parameters:
dateString
- The desired date- Returns:
true
if the operation was successfull
-
selectDateTime
public boolean selectDateTime(String timeString)
Description copied from interface:TimeSelectorIF
Choose a specified datetime- Specified by:
selectDateTime
in interfaceTimeSelectorIF
- Parameters:
timeString
- The desired datetime- Returns:
true
if the operation was successfull
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:TimeSelectorIF
Enable/disable the widget- Specified by:
setEnabled
in interfaceTimeSelectorIF
- Parameters:
enabled
-true
to enable the widget,false
to disable it
-
hasMultipleTimes
public boolean hasMultipleTimes()
- Specified by:
hasMultipleTimes
in interfaceTimeSelectorIF
- Returns:
true
if this time selector can represent multiple datetimes
-
setContinuous
public void setContinuous(boolean continuous)
Description copied from interface:TimeSelectorIF
Sets whether thisTimeSelectorIF
needs to represent discrete or continous time- Specified by:
setContinuous
in interfaceTimeSelectorIF
-
getDatesInRange
public static List<String> getDatesInRange(String startDateTimeStr, String endDateTimeStr)
-
isContinuous
public boolean isContinuous()
- Specified by:
isContinuous
in interfaceTimeSelectorIF
- Returns:
true
if thisTimeSelectorIF
is currently representing a continuous time range,false
if it is a discrete one
-
getAvailableDates
public List<String> getAvailableDates()
Description copied from interface:TimeSelectorIF
Return the available dates- Specified by:
getAvailableDates
in interfaceTimeSelectorIF
- Returns:
- A
List
ofString
s representing the available dates
-
getAvailableTimes
public List<String> getAvailableTimes()
Description copied from interface:TimeSelectorIF
Return the available times- Specified by:
getAvailableTimes
in interfaceTimeSelectorIF
- Returns:
- A
List
ofString
s representing the available times for the selected date
-
selectRange
public void selectRange(String currentRange)
Description copied from interface:TimeSelectorIF
Sets the range (i.e. +/- how much) for a continuous axis- Specified by:
selectRange
in interfaceTimeSelectorIF
-
getRange
public String getRange()
- Specified by:
getRange
in interfaceTimeSelectorIF
- Returns:
- The currently selected range (i.e. +/- how much) for a continuous axis
-
getSelectedDateIndex
public int getSelectedDateIndex()
- Returns:
- The index of the selected date. Used in
StartEndTimePopup
-
-