public abstract class CalendarHeaderHandler extends Object
To install a custom implementation, register the class name of the custom
header handler with the key CalendarHeaderHandler.uiControllerID
, example:
UIManager.put(CalendarHeaderHandler.uiControllerID, "com.foo.bar.MagicHeaderHandler")
Basic navigation action should (will) be defined by the ui delegate itself (PENDING
JW: still incomplete in BasicMonthViewUI). This handler can modify/enhance
them as appropriate for its context.
PENDING JW: those icons ... who's responsible? Shouldn't we use any of the default arrows as defined in the laf anyway (are there any?)
Note: this is work-in-progress, be prepared to change if subclassing for custom requirements!
Modifier and Type | Field and Description |
---|---|
private JComponent |
calendarHeader |
private static Logger |
LOG |
protected Icon |
monthDownImage |
protected Icon |
monthUpImage |
protected JXMonthView |
monthView |
private PropertyChangeListener |
monthViewPropertyChangeListener |
static String |
uiControllerID |
Constructor and Description |
---|
CalendarHeaderHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
componentOrientationChanged()
Synchronizes internal state which depends on the month view's
componentOrientation.
|
protected abstract JComponent |
createCalendarHeader()
Creates and returns the component used as header in a zoomable monthView.
|
protected Font |
createDerivedFont()
Create a derived font used to when painting various pieces of the month
view component.
|
protected void |
fontChanged()
Synchronizes internal state which depends on the month view's font.
|
private Color |
getAsNotUIResource(Color color)
Returns a Color based on the param which is not of type UIResource.
|
private Font |
getAsNotUIResource(Font font)
Returns a Font based on the param which is not of type UIResource.
|
JComponent |
getHeaderComponent()
Returns a component to be used as header in a zoomable month view,
guaranteed to be not null.
|
private PropertyChangeListener |
getMonthViewPropertyChangeListener()
Returns the propertyChangelistener for the monthView.
|
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 |
installNavigationActions()
Installs and configures navigational actions.
|
private void |
installWrapper(String actionKey,
String newActionKey,
Icon icon)
Creates an life action wrapper around the action registered with
actionKey, sets its SMALL_ICON property to the given icon and installs
itself with the newActionKey.
|
protected void |
monthStringBackgroundChanged()
Synchronizes internal state which depends on the month view's
monthStringBackground.
|
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.
|
private void |
updateActionIcon(String previousKey,
Icon previous) |
private void |
updateMonthNavigationIcons(Icon previous,
Icon next) |
public static final String uiControllerID
protected JXMonthView monthView
private JComponent calendarHeader
protected Icon monthDownImage
protected Icon monthUpImage
private PropertyChangeListener monthViewPropertyChangeListener
public CalendarHeaderHandler()
public void install(JXMonthView monthView)
monthView
- the target month view to install to.public void uninstall(JXMonthView monthView)
monthView
- the target month view to install from.public JComponent getHeaderComponent()
protected void installListeners()
protected void uninstallListeners()
private PropertyChangeListener getMonthViewPropertyChangeListener()
protected void monthStringBackgroundChanged()
protected void fontChanged()
protected void componentOrientationChanged()
private void updateMonthNavigationIcons(Icon previous, Icon next)
previous
- the icon to use in the previousMonth actionnext
- the icon to use on the nextMonth actionprivate void updateActionIcon(String previousKey, Icon previous)
previousKey
- previous
- protected abstract JComponent createCalendarHeader()
protected void installNavigationActions()
This implementation creates and installs wrappers around the scrollToPrevious/-NextMonth actions installed by the ui and configures them with the appropriate next/previous icons.
private void installWrapper(String actionKey, String newActionKey, Icon icon)
actionKey
- the key of the action to wrap aroundnewActionKey
- the key of the wrapper actionicon
- the icon to use in the wrapper actionprivate Font getAsNotUIResource(Font font)
font
- the base fontprivate Color getAsNotUIResource(Color color)
color
- the base colorprotected Font createDerivedFont()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses