Class TemporalFieldPanel<T extends Temporal>

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
is.codion.swing.common.ui.component.text.TemporalFieldPanel<T>
Type Parameters:
T - the Temporal type supplied by this panel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public final class TemporalFieldPanel<T extends Temporal> extends JPanel
A panel for a TemporalField with button for displaying a calendar
See Also:
  • Method Details

    • temporalField

      public TemporalField<T> temporalField()
      Returns:
      the temporal input field
    • calendarButton

      public JButton calendarButton()
      Returns:
      the calendar button
    • optional

      public Optional<T> optional()
      Returns:
      the Temporal value currently being displayed, an empty Optional in case of an incomplete/unparseable date
    • getTemporal

      public T getTemporal()
      Returns:
      the Temporal value currently being displayed, null in case of an incomplete/unparseable date
    • setTemporal

      public void setTemporal(Temporal temporal)
      Sets the date in the input field, clears the field if date is null.
      Parameters:
      temporal - the temporal value to set
    • transferFocusOnEnter

      public void transferFocusOnEnter(boolean transferFocusOnEnter)
      Parameters:
      transferFocusOnEnter - specifies whether focus should be transferred on Enter
    • setEnabled

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class JComponent
    • setToolTipText

      public void setToolTipText(String text)
      Overrides:
      setToolTipText in class JComponent
    • supports

      public static <T extends Temporal> boolean supports(Class<T> temporalClass)
      Type Parameters:
      T - the temporal type
      Parameters:
      temporalClass - the temporal type
      Returns:
      true if TemporalFieldPanel supports the given type
    • builder

      public static <T extends Temporal> TemporalFieldPanel.Builder<T> builder(Class<T> valueClass)
      Type Parameters:
      T - the value type
      Parameters:
      valueClass - the value class
      Returns:
      a builder for a temporal component
    • builder

      public static <T extends Temporal> TemporalFieldPanel.Builder<T> builder(Class<T> valueClass, Value<T> linkedValue)
      Type Parameters:
      T - the value type
      Parameters:
      valueClass - the value class
      linkedValue - the value to link to the component
      Returns:
      a builder for a temporal component