public class CalendarPopup extends BorderedPanelGuiImpl
Modifier and Type | Class and Description |
---|---|
static class |
CalendarPopup.CalendarLookAndFeelResolver
Calendar look and feel resolver.
|
(package private) class |
CalendarPopup.CalendarMonthModel
Represents the model for the calendar popup.
|
static class |
CalendarPopup.CalendarOwnerContainer
Represents the calendar owner container.
|
Modifier and Type | Field and Description |
---|---|
private GuiColorResolver |
bodyColorResolver
Body color resolver
|
private ButtonFactory |
buttonFactory
GUI widgets factory
|
private BorderedPanelGuiImpl |
calendarHeaderPanel
Calendar header panel with buttons and month and year title
|
private TextCell |
calendarTitle
Calendar title
|
private CoordinatesConversion |
cc
Coordinate converter
|
private BorderedPanelGuiImpl |
currentDatePanel
The calendar current date panel
|
private java.util.function.Consumer<java.time.LocalDateTime> |
dateTimeConsumer
The consumer of the selected date time
|
private BorderedPanelGuiImpl |
daysInMonthPanel
The calendar days panel
|
private GuiFontResolver |
fontResolver
Font resolver
|
private GuiDriver |
gd
Screen driver
|
private CalendarPopup.CalendarMonthModel |
model
The calendar model
|
private ButtonGuiImpl |
nextMonthButton
The button to select the next month that is the month after the selected one
|
private java.lang.Runnable |
onHideCallback
The callback executed when hide() is executed
|
private AbstractContainer<GuiOutputManager> |
owner
The parent container
|
private OverlayWindow |
ownerWindow
The calendar owner window
|
private ButtonGuiImpl |
previousMonthButton
The button to select the previous month that is the month before the selected one
|
private GuiOutputManager |
screen
Output manager
|
private java.time.LocalDateTime |
selectedDateTime
The selected date and time
|
private GuiColorResolver |
titleColorResolver
Title color resolver for calendar header
|
private BorderedPanelGuiImpl |
titlePanel
Title panel with calendar title
|
private GuiColorResolver |
trailingColorResolver
Trailing days and selected day color resolver
|
private BorderedPanelGuiImpl |
weekHeadersPanel
The days of week header panel
|
border
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
CalendarPopup(CalendarPopup.CalendarOwnerContainer calendarOwner,
CalendarPopup.CalendarLookAndFeelResolver lookAndFeelResolver,
java.time.chrono.Chronology chrono,
java.util.Locale locale,
java.time.LocalDateTime selectedDateTime)
Creates the calendar panel with calendar header control panel with two buttons, the days
of week static panel, the days of month control panel to select the date and the current
date panel at the bottom to display the today date.
|
Modifier and Type | Method and Description |
---|---|
Widget<GuiOutputManager> |
currentFocus()
Returns the widget that has the current focus.
|
Widget<GuiOutputManager> |
defaultFocus()
Returns the widget that has the current focus by default.
|
Dimension |
dimension()
Calculates the size of this widget in character units.
|
Widget<GuiOutputManager> |
findMouseSource(NativePoint point)
Overwrites the standard findMouseSource in order to delegate mouse clicks to this
parent widget.
|
private Dimension |
getAvailableSize(Dimension size)
Calculates the available area.
|
private void |
handleKeyEvent(KeyInput event)
Handles UP, DOWN, LEFT and RIGHT keys.
|
double |
height()
Returns the height of this widget.
|
void |
hide()
Hide this widget and remove it.
|
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
void |
mouseClicked(java.awt.event.MouseEvent event)
Handles the date selection.
|
void |
processKeyEvent(KeyInput event)
Handles UP, DOWN, LEFT and RIGHT keys.
|
Point |
screenLocation()
Calculates the location of the calendar popup relative to the parent window.
|
private void |
setContinuosPeriodOfDays(java.time.LocalDate start,
java.time.LocalDate end,
double cellWidth,
double cellHeight,
ColorRgb prefBgColor,
ColorRgb prefFgColor)
Sets up the continuous calendar area given by its days period, its cell's size and
the preferred foreground and background colors.
|
void |
show()
Show widget.
|
private void |
updateCalendarView()
Updates the calendar view according to the changed calendar model.
|
private void |
updateDaysInMonth()
Updates the calendar content according to the calendar model.
|
private void |
updateDisplayedDateTimeValue()
Updates the displayed date/time value according to the calendar model changes.
|
double |
width()
Returns the width of this widget.
|
draw, drawPanel, getId, is3DBorder, isRMBEntrySupported, set3DBorder, setColorResolver, setCustomDraw, setId, setOptionalDraw
border, insets, isTransparent, setBorder, setTransparent
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, cycleFocus, deregisterSelectedWidget, destroy, detach, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, firstFocus, focus, focusTraversable, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, reflectAncestorChange, reflectLocationChange, registerSelectedWidget, remove, removeContainerStateListener, repaint, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setTabItemList, setWidth, startSizeChange, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList, widgetStateChanged
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, config, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, unregisterWidgetStateListener, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
widgetsAsList
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, config, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hidden, highlighted, ignoreEnable, initialHeight, initialWidth, isCurrent, isDirectManipulable, isDirectManipulationActive, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isRealized, isRepaintDisabled, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unregisterWidgetStateListener, validateDisplayValue, window
private final GuiDriver gd
private final GuiOutputManager screen
private final ButtonFactory buttonFactory
private final CoordinatesConversion cc
private final AbstractContainer<GuiOutputManager> owner
private final java.util.function.Consumer<java.time.LocalDateTime> dateTimeConsumer
private final java.lang.Runnable onHideCallback
private final GuiColorResolver bodyColorResolver
private final GuiColorResolver titleColorResolver
private final GuiColorResolver trailingColorResolver
private final GuiFontResolver fontResolver
private java.time.LocalDateTime selectedDateTime
private BorderedPanelGuiImpl calendarHeaderPanel
private ButtonGuiImpl previousMonthButton
private TextCell calendarTitle
private BorderedPanelGuiImpl titlePanel
private ButtonGuiImpl nextMonthButton
private BorderedPanelGuiImpl weekHeadersPanel
private CalendarPopup.CalendarMonthModel model
private BorderedPanelGuiImpl daysInMonthPanel
private BorderedPanelGuiImpl currentDatePanel
private OverlayWindow ownerWindow
public CalendarPopup(CalendarPopup.CalendarOwnerContainer calendarOwner, CalendarPopup.CalendarLookAndFeelResolver lookAndFeelResolver, java.time.chrono.Chronology chrono, java.util.Locale locale, java.time.LocalDateTime selectedDateTime)
calendarOwner
- The calendar owner containerlookAndFeelResolver
- The calendar color and font resolverschrono
- The calendar systemlocale
- The current localeselectedDateTime
- The current selected date and timepublic Dimension dimension()
dimension
in interface Widget<GuiOutputManager>
dimension
in class AbstractContainer<GuiOutputManager>
private Dimension getAvailableSize(Dimension size)
size
- The given sizepublic double height()
height
in interface Widget<GuiOutputManager>
height
in class AbstractContainer<GuiOutputManager>
public double width()
width
in interface Widget<GuiOutputManager>
width
in class AbstractContainer<GuiOutputManager>
public void show()
show
in interface Widget<GuiOutputManager>
show
in class AbstractWidget<GuiOutputManager>
public void hide()
hide
in interface Widget<GuiOutputManager>
hide
in class AbstractWidget<GuiOutputManager>
private void setContinuosPeriodOfDays(java.time.LocalDate start, java.time.LocalDate end, double cellWidth, double cellHeight, ColorRgb prefBgColor, ColorRgb prefFgColor)
start
- The first day of the given periodend
- The last day of the given periodcellWidth
- The cell's width in character unitscellHeight
- The cell's height in character unitsprefBgColor
- The preferred background colorprefFgColor
- The preferred foreground colorprivate void updateDaysInMonth()
public Point screenLocation()
screenLocation
in interface Widget<GuiOutputManager>
screenLocation
in class AbstractWidget<GuiOutputManager>
protected int[] mouseActions()
mouseActions
in class AbstractWidget<GuiOutputManager>
public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class AbstractWidget<GuiOutputManager>
event
- The mouse eventpublic Widget<GuiOutputManager> findMouseSource(NativePoint point)
findMouseSource
in interface Widget<GuiOutputManager>
findMouseSource
in class AbstractContainer<GuiOutputManager>
point
- The physical point within this containerprivate void updateDisplayedDateTimeValue()
private void updateCalendarView()
private void handleKeyEvent(KeyInput event)
event
- The key input eventpublic Widget<GuiOutputManager> currentFocus()
currentFocus
in interface Container<GuiOutputManager>
currentFocus
in class AbstractContainer<GuiOutputManager>
public Widget<GuiOutputManager> defaultFocus()
defaultFocus
in interface Container<GuiOutputManager>
defaultFocus
in class AbstractContainer<GuiOutputManager>
public void processKeyEvent(KeyInput event)
processKeyEvent
in interface Widget<GuiOutputManager>
processKeyEvent
in class AbstractContainer<GuiOutputManager>
event
- The key input event