public class SpinningCalendarHeaderHandler extends CalendarHeaderHandler
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:
ARROWS_SURROUNDS_MONTH
.
FOCUSABLE_SPINNER_TEXT
.
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?Modifier and Type | Class and Description |
---|---|
protected static class |
SpinningCalendarHeaderHandler.SpinningCalendarHeader
The custom header component controlled and configured by this handler.
|
private class |
SpinningCalendarHeaderHandler.YearSpinnerModel
Thin-layer implementation of a SpinnerModel which is actually backed by
this controller.
|
Modifier and Type | Field and Description |
---|---|
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.
|
private static Logger |
LOG |
private PropertyChangeListener |
monthPropertyListener
listener for property changes of the JXMonthView.
|
private FormatStringValue |
monthStringValue
converter for month text.
|
private SpinnerModel |
yearSpinnerModel
the spinner model for year-wise navigation.
|
monthDownImage, monthUpImage, monthView, uiControllerID
Constructor and Description |
---|
SpinningCalendarHeaderHandler() |
Modifier and Type | Method and Description |
---|---|
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.
|
private int |
getNextYear()
Returns the next year of the monthView.
|
private int |
getPreviousYear()
Returns the previous year of the monthView.
|
private PropertyChangeListener |
getPropertyChangeListener()
Returns the property change listener for use on the monthView.
|
private int |
getYear()
Returns the current year of the monthView.
|
private SpinnerModel |
getYearSpinnerModel() |
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.
|
private boolean |
setYear(Object value)
Sets the current year of the monthView to the given value.
|
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.
|
componentOrientationChanged, createDerivedFont, fontChanged, installNavigationActions, monthStringBackgroundChanged
public static final String ARROWS_SURROUND_MONTH
public static final String FOCUSABLE_SPINNER_TEXT
private SpinnerModel yearSpinnerModel
private PropertyChangeListener monthPropertyListener
private FormatStringValue monthStringValue
public SpinningCalendarHeaderHandler()
public void install(JXMonthView monthView)
Overridden to configure header specifics component after calling super.
install
in class CalendarHeaderHandler
monthView
- the target month view to install to.public void uninstall(JXMonthView monthView)
Overridden to cleanup the specifics before calling super.
uninstall
in class CalendarHeaderHandler
monthView
- the target month view to install from.public SpinningCalendarHeaderHandler.SpinningCalendarHeader getHeaderComponent()
Convenience override to the type created.
getHeaderComponent
in class CalendarHeaderHandler
protected SpinningCalendarHeaderHandler.SpinningCalendarHeader createCalendarHeader()
Implemented to create and configure the custom header component.
createCalendarHeader
in class CalendarHeaderHandler
protected void installListeners()
installListeners
in class CalendarHeaderHandler
protected void uninstallListeners()
uninstallListeners
in class CalendarHeaderHandler
protected void updateFormatters()
protected void firstDisplayedDayChanged()
protected void localeChanged()
private PropertyChangeListener getPropertyChangeListener()
private int getYear()
private int getPreviousYear()
PENDING JW: check against lower bound. return the previous year of the monthView.
private int getNextYear()
PENDING JW: check against upper bound. return the next year of the monthView.
private boolean setYear(Object value)
value
- the new value of the year.private SpinnerModel getYearSpinnerModel()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses