R
- the resolution type which this field is based on (day, month, ...)public abstract class VAbstractCalendarPanel<R extends Enum<R>> extends FocusableFlexTable implements com.google.gwt.event.dom.client.KeyDownHandler, com.google.gwt.event.dom.client.KeyPressHandler, com.google.gwt.event.dom.client.MouseOutHandler, com.google.gwt.event.dom.client.MouseDownHandler, com.google.gwt.event.dom.client.MouseUpHandler, com.google.gwt.event.dom.client.BlurHandler, com.google.gwt.event.dom.client.FocusHandler, SubPartAware
Modifier and Type | Class and Description |
---|---|
static interface |
VAbstractCalendarPanel.FocusChangeListener
FocusChangeListener is notified when the panel changes its _focused_
value.
|
class |
VAbstractCalendarPanel.FocusedDate
Helper class to inform the screen reader that the user changed the
selected date.
|
static interface |
VAbstractCalendarPanel.FocusOutListener
Blur listener that listens to blur event from the panel.
|
static interface |
VAbstractCalendarPanel.SubmitListener |
com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter
com.google.gwt.user.client.ui.HTMLTable.Cell, com.google.gwt.user.client.ui.HTMLTable.CellFormatter, com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter, com.google.gwt.user.client.ui.HTMLTable.RowFormatter
Constructor and Description |
---|
VAbstractCalendarPanel() |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
acceptDayFocus()
Returns
true if current resolution assumes handling focus event
for day UI component. |
protected boolean |
contains(com.google.gwt.user.client.ui.Widget w,
com.google.gwt.dom.client.Element subElement)
Checks if subElement is inside the widget DOM hierarchy.
|
protected void |
doRenderCalendar(boolean updateDate)
Performs the rendering required by the
renderCalendar(boolean) . |
protected void |
doSetDate(Date currentDate,
boolean needRerender,
Runnable focusAction)
The actual implementation of the logic which sets the data of the Panel.
|
protected int |
getBackwardKey()
The key that selects the previous day in the calendar.
|
protected int |
getCloseKey()
Returns the key that closes the popup window if this is a VPopopCalendar.
|
Date |
getDate() |
protected VDateField<R> |
getDateField()
Returns the date field which this panel is attached to.
|
protected DateTimeService |
getDateTimeService()
Returns date time service for the widget.
|
protected int |
getForwardKey()
The key that selects the next day in the calendar.
|
protected int |
getNextKey()
The key that selects the next week in the calendar.
|
protected int |
getPreviousKey()
The key that selects the previous week in the calendar.
|
protected int |
getResetKey()
Returns the reset key which will reset the calendar to the previous
selection.
|
R |
getResolution() |
protected R |
getResolution(Predicate<R> filter)
Finds the resolution by the
filter . |
protected Stream<R> |
getResolutions()
Returns all available resolutions for the widget.
|
protected int |
getSelectKey()
Returns the select key which selects the value.
|
VAbstractCalendarPanel.SubmitListener |
getSubmitListener()
Returns the submit listener that listens to selection made from the
panel.
|
com.google.gwt.user.client.Element |
getSubPartElement(String subPart)
Locates an element inside a component using the identifier provided in
subPart . |
String |
getSubPartName(com.google.gwt.user.client.Element subElement)
Provides an identifier that identifies the element within the component.
|
protected boolean |
handleNavigation(int keycode,
boolean ctrl,
boolean shift)
Handles the keyboard navigation.
|
protected boolean |
handleNavigationDayMode(int keycode,
boolean ctrl,
boolean shift)
Handle keyboard navigation what the resolution is set to DAY.
|
protected boolean |
handleNavigationMonthMode(int keycode,
boolean ctrl,
boolean shift)
Handle the keyboard navigation when the resolution is set to MONTH.
|
protected boolean |
handleNavigationYearMode(int keycode,
boolean ctrl,
boolean shift)
Handles the keyboard navigation when the resolution is set to years.
|
protected abstract boolean |
isBelowMonth(R resolution)
Returns
true if the resolution representation is strictly
below month (day, hour, etc..). |
protected abstract boolean |
isDay(R resolution)
Returns
true if the provided resolution represents a day. |
protected boolean |
isEnabled()
Checks whether the widget is enabled.
|
boolean |
isInitialRenderDone()
Returns the value of initialRenderDone
|
protected abstract boolean |
isMonth(R resolution)
Returns
true if the provided resolution represents a
month. |
protected boolean |
isReadonly()
Checks whether the widget is not editable (read-only).
|
boolean |
isShowISOWeekNumbers()
Returns whether ISO 8601 week numbers should be shown in the value
selector or not.
|
protected boolean |
isYear(R resolution)
Returns
true if the provided resolution represents an
year. |
void |
onBlur(com.google.gwt.event.dom.client.BlurEvent event) |
protected void |
onDetach() |
void |
onFocus(com.google.gwt.event.dom.client.FocusEvent event) |
void |
onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event) |
void |
onKeyPress(com.google.gwt.event.dom.client.KeyPressEvent event) |
void |
onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event) |
void |
onMouseOut(com.google.gwt.event.dom.client.MouseOutEvent event) |
void |
onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event) |
protected boolean |
onTabOut(com.google.gwt.event.dom.client.DomEvent<?> event)
If true should be returned if the panel will not be used after this
event.
|
protected boolean |
onValueChange() |
void |
renderCalendar()
Updates the calendar and text field with the selected dates.
|
void |
renderCalendar(boolean updateDate)
For internal use only.
|
void |
setAssistiveLabelNextMonth(String label)
Set assistive label for the next month element.
|
void |
setAssistiveLabelNextYear(String label)
Set assistive label for the next year element.
|
void |
setAssistiveLabelPreviousMonth(String label)
Set assistive label for the previous month element.
|
void |
setAssistiveLabelPreviousYear(String label)
Set assistive label for the previous year element.
|
void |
setDate(Date currentDate)
Sets the data of the Panel.
|
void |
setDateStyles(Map<String,String> dateStyles)
Sets the style names for dates.
|
void |
setDateTimeService(DateTimeService dateTimeService) |
void |
setFocusChangeListener(VAbstractCalendarPanel.FocusChangeListener listener)
The given FocusChangeListener is notified when the focused date changes
by user either clicking on a new date or by using the keyboard.
|
void |
setFocusOutListener(VAbstractCalendarPanel.FocusOutListener listener)
A focus out listener is triggered when the panel loosed focus.
|
void |
setParentField(VDateField<R> parent) |
void |
setRangeEnd(String newRangeEnd)
Sets the end range for this component.
|
void |
setRangeStart(String newRangeStart)
Sets the start range for this component.
|
void |
setResolution(R resolution) |
void |
setShowISOWeekNumbers(boolean showISOWeekNumbers) |
void |
setStyleName(String style) |
void |
setStylePrimaryName(String style) |
void |
setSubmitListener(VAbstractCalendarPanel.SubmitListener submitListener)
The submit listener is called when the user selects a value from the
calendar either by clicking the day or selects it by keyboard.
|
void |
updateAssistiveLabels()
Updates assistive labels of the navigation elements.
|
addBlurHandler, addFocusHandler, addKeyDownHandler, addKeyPressHandler, focus, setFocus
addCell, getCellCount, getFlexCellFormatter, getRowCount, insertCell, insertRow, prepareCell, prepareRow, removeAllRows, removeCell, removeCells, removeRow
addClickHandler, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addTableListener, checkCellBounds, checkRowBounds, clear, clear, clearCell, createCell, getBodyElement, getCellForEvent, getCellFormatter, getCellPadding, getCellSpacing, getColumnFormatter, getDOMCellCount, getDOMCellCount, getDOMCellCount, getDOMRowCount, getDOMRowCount, getDOMRowCount, getEventTargetCell, getHTML, getRowFormatter, getText, getWidget, insertCells, internalClearCell, internalClearCell, isCellPresent, iterator, onEnsureDebugId, prepareColumn, remove, removeTableListener, setBorderWidth, setCellFormatter, setCellPadding, setCellSpacing, setColumnFormatter, setHTML, setHTML, setRowFormatter, setText, setWidget, setWidget
add, add, adopt, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
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, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public void setParentField(VDateField<R> parent)
protected abstract boolean acceptDayFocus()
true
if current resolution assumes handling focus event
for day UI component.true
if day focus events should be handled, false
otherwiseprotected abstract boolean isDay(R resolution)
true
if the provided resolution
represents a day.resolution
- the given resolutiontrue
if the resolution
represents a dayprotected abstract boolean isMonth(R resolution)
true
if the provided resolution
represents a
month.resolution
- the given resolutiontrue
if the resolution
represents a monthprotected boolean isYear(R resolution)
true
if the provided resolution
represents an
year.resolution
- the given resolutiontrue
if the resolution
represents a yearprotected abstract boolean isBelowMonth(R resolution)
true
if the resolution
representation is strictly
below month (day, hour, etc..).resolution
- the given resolutionresolution
is below the month resolutionprotected Stream<R> getResolutions()
protected R getResolution(Predicate<R> filter)
filter
.filter
- predicate to filter resolutionsfilter
protected boolean onValueChange()
public R getResolution()
public void setResolution(R resolution)
protected boolean isReadonly()
true
if the widget is read-onlyprotected boolean isEnabled()
true
is the widget is enabledpublic void setStyleName(String style)
setStyleName
in class com.google.gwt.user.client.ui.UIObject
public void setStylePrimaryName(String style)
setStylePrimaryName
in class com.google.gwt.user.client.ui.UIObject
public void setDateStyles(Map<String,String> dateStyles)
dateStyles
- the map of date string to style nameprotected DateTimeService getDateTimeService()
setDateTimeService(DateTimeService)
protected VDateField<R> getDateField()
public void setDateTimeService(DateTimeService dateTimeService)
public boolean isShowISOWeekNumbers()
public void setShowISOWeekNumbers(boolean showISOWeekNumbers)
public void renderCalendar()
public boolean isInitialRenderDone()
public void renderCalendar(boolean updateDate)
updateDate
- The value false prevents setting the selected date of the
calendar based on focusedDate. That can be used when only the
resolution of the calendar is changed and no date has been
selected.protected void doRenderCalendar(boolean updateDate)
renderCalendar(boolean)
.
Subclasses may override this method to provide a custom implementation
avoiding renderCalendar(boolean)
override. The latter method
contains a common logic which should not be overridden.updateDate
- The value false prevents setting the selected date of the
calendar based on focusedDate. That can be used when only the
resolution of the calendar is changed and no date has been
selected.public void onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event)
onKeyDown
in interface com.google.gwt.event.dom.client.KeyDownHandler
public void onKeyPress(com.google.gwt.event.dom.client.KeyPressEvent event)
onKeyPress
in interface com.google.gwt.event.dom.client.KeyPressHandler
protected boolean handleNavigationYearMode(int keycode, boolean ctrl, boolean shift)
keycode
- The keycode to processctrl
- Is ctrl pressed?shift
- is shift pressedprotected boolean handleNavigationMonthMode(int keycode, boolean ctrl, boolean shift)
keycode
- The keycode to handlectrl
- Was the ctrl key pressed?shift
- Was the shift key pressed?protected boolean handleNavigationDayMode(int keycode, boolean ctrl, boolean shift)
keycode
- The keycode to handlectrl
- Was the ctrl key pressed?shift
- Was the shift key pressed?protected boolean handleNavigation(int keycode, boolean ctrl, boolean shift)
keycode
- The key code that was pressedctrl
- Was the ctrl key pressedshift
- Was the shift key pressedprotected int getResetKey()
protected int getSelectKey()
protected int getCloseKey()
protected int getForwardKey()
protected int getBackwardKey()
protected int getNextKey()
protected int getPreviousKey()
public void onMouseOut(com.google.gwt.event.dom.client.MouseOutEvent event)
onMouseOut
in interface com.google.gwt.event.dom.client.MouseOutHandler
public void onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event)
onMouseDown
in interface com.google.gwt.event.dom.client.MouseDownHandler
public void onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event)
onMouseUp
in interface com.google.gwt.event.dom.client.MouseUpHandler
public void setDate(Date currentDate)
currentDate
- The date to setprotected void doSetDate(Date currentDate, boolean needRerender, Runnable focusAction)
setDate(Date)
just delegate a call to this method
providing additional config parameters.currentDate
- currentDate The date to setneedRerender
- if true
then calendar will be rerendered regardless of
internal logic, otherwise the decision will be made on the
internal state inside the methodfocusAction
- an additional action which will be executed in case
rerendering is not requiredpublic Date getDate()
protected boolean onTabOut(com.google.gwt.event.dom.client.DomEvent<?> event)
event
- public void setFocusOutListener(VAbstractCalendarPanel.FocusOutListener listener)
listener
- The listener to triggerpublic void setSubmitListener(VAbstractCalendarPanel.SubmitListener submitListener)
submitListener
- The listener to triggerpublic void setFocusChangeListener(VAbstractCalendarPanel.FocusChangeListener listener)
listener
- The FocusChangeListener to be notifiedpublic VAbstractCalendarPanel.SubmitListener getSubmitListener()
public void onBlur(com.google.gwt.event.dom.client.BlurEvent event)
onBlur
in interface com.google.gwt.event.dom.client.BlurHandler
public void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
onFocus
in interface com.google.gwt.event.dom.client.FocusHandler
public String getSubPartName(com.google.gwt.user.client.Element subElement)
SubPartAware
subElement
is a part of the component and must never be null.
Note!
getSubPartElement(getSubPartName(element)) == element
is not
always true. A component can choose to provide a more generic
identifier for any given element if the results of all interactions with
subElement
are the same as interactions with the element
identified by the return value. For example a button can return an
identifier for the root element even though a DIV inside the button was
passed as subElement
because interactions with the DIV and the
root button element produce the same result.
getSubPartName
in interface SubPartAware
subElement
- The element the identifier string should uniquely identifysubElement
or null
if no identifier could be provided.protected boolean contains(com.google.gwt.user.client.ui.Widget w, com.google.gwt.dom.client.Element subElement)
w
- subElement
- w
is a parent of subElement, false otherwise.public com.google.gwt.user.client.Element getSubPartElement(String subPart)
SubPartAware
subPart
. The subPart
identifier is component specific and
may be any string of characters, numbers, space characters and brackets.getSubPartElement
in interface SubPartAware
subPart
- The identifier for the element inside the componentprotected void onDetach()
onDetach
in class com.google.gwt.user.client.ui.Widget
public void setRangeStart(String newRangeStart)
newRangeStart
- - the allowed range's start datepublic void setRangeEnd(String newRangeEnd)
newRangeEnd
- - the allowed range's end datepublic void setAssistiveLabelPreviousYear(String label)
label
- the label to setpublic void setAssistiveLabelNextYear(String label)
label
- the label to setpublic void setAssistiveLabelPreviousMonth(String label)
label
- the label to setpublic void setAssistiveLabelNextMonth(String label)
label
- the label to setpublic void updateAssistiveLabels()
Copyright © 2018 Vaadin Ltd. All rights reserved.