Class DateTimeControl

All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, com.globalmentor.model.MutableValued<Date>, com.globalmentor.model.Valued<Date>, io.clogr.Clogged, Component, CompositeComponent, Control, InputFocusableComponent, LayoutComponent, LayoutControl, ValueControl<Date>, ValuedComponent<Date>, Displayable, Enableable, InfoModel, LabelModel, Model, PresentationModel, ValueModel<Date>, DepictedObject

public class DateTimeControl extends AbstractLayoutValueControl<Date>
Control that allows selection of a date and/or a time, providing separate inputs for date and time with the option of a calendar popup. This implementation always represents the date and time in terms of the current session's time zone. This implementation does not allow smaller than one-second precision.
Author:
Garret Wilson
  • Field Details

    • updateDateControlsPropertyChangeListener

      protected final com.globalmentor.beans.GenericPropertyChangeListener<?> updateDateControlsPropertyChangeListener
      The property change listener that updates the date controls when a property changes.
    • updateValuePropertyChangeListener

      protected final com.globalmentor.beans.GenericPropertyChangeListener<?> updateValuePropertyChangeListener
      The property change listener that updates the value when a property changes.
  • Constructor Details

    • DateTimeControl

      public DateTimeControl()
      Default constructor with a default data model.
    • DateTimeControl

      public DateTimeControl(ValueModel<Date> valueModel)
      Value model constructor.
      Parameters:
      valueModel - The component value model.
      Throws:
      NullPointerException - if the given value model is null.
  • Method Details

    • getDateControl

      protected TextControl<Date> getDateControl()
      Returns:
      The control containing the date.
    • getCalendarButton

      protected ToolButton getCalendarButton()
      Returns:
      The button allowing selection of the date.
    • getTimeControl

      public TextControl<Date> getTimeControl()
      Returns:
      The control containing the date.
    • hasTime

      public boolean hasTime()
      Returns:
      Whether the current value represented in the control has a specified time component.
    • enabledPropertyChange

      protected void enabledPropertyChange(boolean oldValue, boolean newValue)
      Called when the enabled property changes. Child versions should call this version. This version clears any notifications and updates the valid status.

      This version updates the enabled status of the child controls.

      Overrides:
      enabledPropertyChange in class AbstractLayoutControl
      Parameters:
      oldValue - The old value of the property.
      newValue - The new value of the property.
      See Also:
    • updateDateControls

      protected void updateDateControls()
      Updates the controls representing the date. This implementation updates the calendars on the calendar panel.