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 ofTimeSelectorIFwhich 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)StringgetRange()StringgetSelectedDate()intgetSelectedDateIndex()StringgetSelectedDateTime()StringgetSelectedDateTimeRange()StringgetSelectedTime()booleanhasMultipleTimes()booleanisContinuous()voidpopulateDates(List<String> availableDatetimes)Populate the available datesvoidpopulateTimes(List<String> availableTimes)Populate the available times.booleanselectDate(String dateString)Choose a specified datebooleanselectDateTime(String timeString)Choose a specified datetimevoidselectRange(String currentRange)Sets the range (i.e.voidsetContinuous(boolean continuous)Sets whether thisTimeSelectorIFneeds to represent discrete or continous timevoidsetEnabled(boolean enabled)Enable/disable the widgetvoidsetId(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:TimeSelectorIFSets the ID of the layer which this time selector applies to- Specified by:
setIdin interfaceTimeSelectorIF
-
populateDates
public void populateDates(List<String> availableDatetimes)
Description copied from interface:TimeSelectorIFPopulate the available dates- Specified by:
populateDatesin interfaceTimeSelectorIF- Parameters:
availableDatetimes- The available dates, as aListofStrings
-
populateTimes
public void populateTimes(List<String> availableTimes)
Description copied from interface:TimeSelectorIFPopulate the available times. This may change as the date changes- Specified by:
populateTimesin interfaceTimeSelectorIF- Parameters:
availableTimes- The available times, as aListofStrings
-
getSelectedDate
public String getSelectedDate()
- Specified by:
getSelectedDatein interfaceTimeSelectorIF- Returns:
- A
Stringrepresentation of the currently selected date
-
getSelectedDateTime
public String getSelectedDateTime()
- Specified by:
getSelectedDateTimein interfaceTimeSelectorIF- Returns:
- A
Stringrepresentation of the currently selected datetime
-
getSelectedDateTimeRange
public String getSelectedDateTimeRange()
- Specified by:
getSelectedDateTimeRangein interfaceTimeSelectorIF- Returns:
- A
Stringrepresentation of the currently selected datetime range. This may benullif isContinous() returns false
-
getSelectedTime
public String getSelectedTime()
- Specified by:
getSelectedTimein interfaceTimeSelectorIF- Returns:
- A
Stringrepresentation of the currently selected time
-
selectDate
public boolean selectDate(String dateString)
Description copied from interface:TimeSelectorIFChoose a specified date- Specified by:
selectDatein interfaceTimeSelectorIF- Parameters:
dateString- The desired date- Returns:
trueif the operation was successfull
-
selectDateTime
public boolean selectDateTime(String timeString)
Description copied from interface:TimeSelectorIFChoose a specified datetime- Specified by:
selectDateTimein interfaceTimeSelectorIF- Parameters:
timeString- The desired datetime- Returns:
trueif the operation was successfull
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:TimeSelectorIFEnable/disable the widget- Specified by:
setEnabledin interfaceTimeSelectorIF- Parameters:
enabled-trueto enable the widget,falseto disable it
-
hasMultipleTimes
public boolean hasMultipleTimes()
- Specified by:
hasMultipleTimesin interfaceTimeSelectorIF- Returns:
trueif this time selector can represent multiple datetimes
-
setContinuous
public void setContinuous(boolean continuous)
Description copied from interface:TimeSelectorIFSets whether thisTimeSelectorIFneeds to represent discrete or continous time- Specified by:
setContinuousin interfaceTimeSelectorIF
-
getDatesInRange
public static List<String> getDatesInRange(String startDateTimeStr, String endDateTimeStr)
-
isContinuous
public boolean isContinuous()
- Specified by:
isContinuousin interfaceTimeSelectorIF- Returns:
trueif thisTimeSelectorIFis currently representing a continuous time range,falseif it is a discrete one
-
getAvailableDates
public List<String> getAvailableDates()
Description copied from interface:TimeSelectorIFReturn the available dates- Specified by:
getAvailableDatesin interfaceTimeSelectorIF- Returns:
- A
ListofStrings representing the available dates
-
getAvailableTimes
public List<String> getAvailableTimes()
Description copied from interface:TimeSelectorIFReturn the available times- Specified by:
getAvailableTimesin interfaceTimeSelectorIF- Returns:
- A
ListofStrings representing the available times for the selected date
-
selectRange
public void selectRange(String currentRange)
Description copied from interface:TimeSelectorIFSets the range (i.e. +/- how much) for a continuous axis- Specified by:
selectRangein interfaceTimeSelectorIF
-
getRange
public String getRange()
- Specified by:
getRangein 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
-
-