org.jdesktop.swingx.plaf.basic
Class SpinningCalendarHeaderHandler

java.lang.Object
  extended by org.jdesktop.swingx.plaf.basic.CalendarHeaderHandler
      extended by org.jdesktop.swingx.plaf.basic.SpinningCalendarHeaderHandler

public class SpinningCalendarHeaderHandler
extends CalendarHeaderHandler

Custom CalendarHeaderHandler which supports year-wise navigation.

The custom component used as header component of this implementation contains month-navigation buttons, a label with localized month text and a spinner for .. well ... spinning the years. There is minimal configuration control via the UIManager:

Note: this header is not used by default. To make it the per-application default register it with the UIManager, like

 UIManager.put(CalendarHeaderHandler.uiControllerID, 
      "org.jdesktop.swingx.plaf.basic.SpinningCalendarHeaderHandler");
 
 
PENDING JW: implement and bind actions for keyboard navigation. These are potentially different from navigation by mouse: need to move the selection along with the scrolling?


Nested Class Summary
protected static class SpinningCalendarHeaderHandler.SpinningCalendarHeader
          The custom header component controlled and configured by this handler.
 
Field Summary
static String ARROWS_SURROUND_MONTH
          Key for use in UIManager to control the position of the nextMonth arrow.
static String FOCUSABLE_SPINNER_TEXT
          Key for use in UIManager to control the focusable property of the year spinner.
 
Fields inherited from class org.jdesktop.swingx.plaf.basic.CalendarHeaderHandler
monthDownImage, monthUpImage, monthView, uiControllerID
 
Constructor Summary
SpinningCalendarHeaderHandler()
           
 
Method Summary
protected  SpinningCalendarHeaderHandler.SpinningCalendarHeader createCalendarHeader()
          Creates and returns the component used as header in a zoomable monthView.
protected  void firstDisplayedDayChanged()
          Updates internal state to monthView's firstDisplayedDay.
 SpinningCalendarHeaderHandler.SpinningCalendarHeader getHeaderComponent()
          Returns a component to be used as header in a zoomable month view, guaranteed to be not null.
 void install(JXMonthView monthView)
          Installs this handler to the given month view.
protected  void installListeners()
          Creates and registered listeners on the monthView as appropriate.
protected  void localeChanged()
          Updates internal state to monthView's locale.
 void uninstall(JXMonthView monthView)
          Uninstalls this handler from the given target month view.
protected  void uninstallListeners()
          Unregisters listeners which had been installed to the monthView.
protected  void updateFormatters()
          Updates the formatter of the month text to the JXMonthView's Locale.
 
Methods inherited from class org.jdesktop.swingx.plaf.basic.CalendarHeaderHandler
componentOrientationChanged, createDerivedFont, fontChanged, installNavigationActions, monthStringBackgroundChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARROWS_SURROUND_MONTH

public static final String ARROWS_SURROUND_MONTH
Key for use in UIManager to control the position of the nextMonth arrow.

See Also:
Constant Field Values

FOCUSABLE_SPINNER_TEXT

public static final String FOCUSABLE_SPINNER_TEXT
Key for use in UIManager to control the focusable property of the year spinner.

See Also:
Constant Field Values
Constructor Detail

SpinningCalendarHeaderHandler

public SpinningCalendarHeaderHandler()
Method Detail

install

public void install(JXMonthView monthView)
Installs this handler to the given month view.

Overridden to configure header specifics component after calling super.

Overrides:
install in class CalendarHeaderHandler
Parameters:
monthView - the target month view to install to.

uninstall

public void uninstall(JXMonthView monthView)
Uninstalls this handler from the given target month view.

Overridden to cleanup the specifics before calling super.

Overrides:
uninstall in class CalendarHeaderHandler
Parameters:
monthView - the target month view to install from.

getHeaderComponent

public SpinningCalendarHeaderHandler.SpinningCalendarHeader getHeaderComponent()
Returns a component to be used as header in a zoomable month view, guaranteed to be not null.

Convenience override to the type created.

Overrides:
getHeaderComponent in class CalendarHeaderHandler
Returns:
a component to be used as header in a zoomable JXMonthView

createCalendarHeader

protected SpinningCalendarHeaderHandler.SpinningCalendarHeader createCalendarHeader()
Creates and returns the component used as header in a zoomable monthView.

Implemented to create and configure the custom header component.

Specified by:
createCalendarHeader in class CalendarHeaderHandler
Returns:
the component used as header in a zoomable monthView, guaranteed to be not null.

installListeners

protected void installListeners()
Creates and registered listeners on the monthView as appropriate. This implementation registers a PropertyChangeListener which synchronizes internal state on changes of componentOrientation, font and monthStringBackground.

Overrides:
installListeners in class CalendarHeaderHandler

uninstallListeners

protected void uninstallListeners()
Unregisters listeners which had been installed to the monthView.

Overrides:
uninstallListeners in class CalendarHeaderHandler

updateFormatters

protected void updateFormatters()
Updates the formatter of the month text to the JXMonthView's Locale.


firstDisplayedDayChanged

protected void firstDisplayedDayChanged()
Updates internal state to monthView's firstDisplayedDay.


localeChanged

protected void localeChanged()
Updates internal state to monthView's locale.