Class FWDatePopUpButton

All Implemented Interfaces:
ActionListener, ImageObserver, ItemSelectable, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, ChangeListener, PopupMenuListener, SwingConstants
Direct Known Subclasses:
FWGraphPanelDatePopUpButton

public class FWDatePopUpButton extends JButton implements PopupMenuListener, ActionListener, PropertyChangeListener, ChangeListener
Button that shows a calendar popup (month and year spinners and a day calendar) to choose a date between a minimum and a maximum. Registered change listeners are notified when the popup is closed; the chosen date is available via getValue().
See Also:
  • Field Details

    • iValue

      protected net.simplace.core.date.FWFormattedDate iValue
    • iMinValue

      protected net.simplace.core.date.FWFormattedDate iMinValue
    • iMaxValue

      protected net.simplace.core.date.FWFormattedDate iMaxValue
  • Constructor Details

    • FWDatePopUpButton

      public FWDatePopUpButton(net.simplace.core.date.FWFormattedDate aMinValue, net.simplace.core.date.FWFormattedDate aMaxValue, net.simplace.core.date.FWFormattedDate aValue, net.simplace.core.FWObservable aObservable, Map<String,Object> aFormComponentParameterMap)
      Creates the button and its popup.
      Parameters:
      aMinValue - first selectable date
      aMaxValue - last selectable date
      aValue - date selected initially (copied)
      aObservable - parameters of the functionality
      aFormComponentParameterMap - parameters of the containing form component
  • Method Details

    • propertyChange

      public void propertyChange(PropertyChangeEvent aEvent)
      Closes the popup when the button is removed from its ancestor.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      aEvent - the property change event
    • closePopup

      public void closePopup()
      closes popup of the button
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
      Returns:
      fixed size 24 x 23
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
      Returns:
      the preferred size
    • actionPerformed

      public void actionPerformed(ActionEvent aActionEvent)
      Shows the popup below the button, or above it if there is not enough space in the window.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      aActionEvent - the button event
    • stateChanged

      public void stateChanged(ChangeEvent e)
      This event handler gets called if either the subcontrols or the FWFormattedDate have changed: a changed control updates the value, a changed value updates the selectable months and days.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - the change event
    • popupMenuCanceled

      public void popupMenuCanceled(PopupMenuEvent aPopupMenuEvent)
      Notifies the listeners of the chosen date when the popup is closed.
      Specified by:
      popupMenuCanceled in interface PopupMenuListener
      Parameters:
      aPopupMenuEvent - the popup event
    • popupMenuWillBecomeInvisible

      public void popupMenuWillBecomeInvisible(PopupMenuEvent aPopupMenuEvent)
      Specified by:
      popupMenuWillBecomeInvisible in interface PopupMenuListener
      Parameters:
      aPopupMenuEvent - the popup event
    • popupMenuWillBecomeVisible

      public void popupMenuWillBecomeVisible(PopupMenuEvent aPopupMenuEvent)
      Does nothing.
      Specified by:
      popupMenuWillBecomeVisible in interface PopupMenuListener
      Parameters:
      aPopupMenuEvent - the popup event
    • paint

      public void paint(Graphics aGraphics)
      Shows the icon, or "..." if the button is too small for it.
      Overrides:
      paint in class JComponent
      Parameters:
      aGraphics - the graphics context
    • setEnabled

      public void setEnabled(boolean aValue)
      Enables or disables the button; a disabled button does not open the popup.
      Overrides:
      setEnabled in class AbstractButton
      Parameters:
      aValue - true to enable
    • isPopupVisible

      public boolean isPopupVisible()
      .
      Returns:
      Returns if the popup is visible
    • getPopupMenu

      public JPopupMenu getPopupMenu()
      .
      Returns:
      Returns the popup menu instance
    • getValue

      public net.simplace.core.date.FWFormattedDate getValue()
      Returns:
      a copy of the chosen date