JDatePicker v4.3

com.standbysoft.component.date.swing.plaf.basic
Class AbstractMonthViewUI

java.lang.Object
  extended byjavax.swing.plaf.ComponentUI
      extended bycom.standbysoft.component.date.swing.plaf.DateUI
          extended bycom.standbysoft.component.date.swing.plaf.basic.AbstractMonthViewUI
Direct Known Subclasses:
BasicMonthViewUI

public abstract class AbstractMonthViewUI
extends DateUI

Defines the general structure that is used by subclasses to implement the actual UI delegate for JMonthView.

Such a delegate uses a month, a today button, a none button, two month scrolling buttons (next, previous) and two year scrolling buttons (next, previous). Of all these components, only the month is required, the other are optional.

This UI delegate can be configured using two client properties:

JMonthView.monthUI specifies what UI delegate will be used by the JMonth components of the JMonthView. This UI delegate builds the JMonthView from several JMonth components and this property is useful to reach those hidden JMonth components.

To change the UI delegate for the JMonth components just do the following:

 	JMonthView monthView = new JMonthView();
 	monthView.putClientProperty("JMonthView.monthUI", MyMonthUI.class.getName());
 

JMonth.isWeekLabelsHighlighted specifies whether selected weeks or week days will be highlighted. By default, this property is not set.

 	JMonthView monthView = new JMonthView();
 	monthView.putClientProperty("JMonth.isWeekLabelsHighlighted", Boolean.TRUE);
 

See Also:
How to Configure UI Delegates, BasicMonthUI

Nested Class Summary
static class AbstractMonthViewUI.CalendarLayout
          This layout manager is used to arrange components of a JMonthView.
 
Field Summary
protected  JMonthView monthView
          JMonthView component for which this UI delegate is installed.
protected  javax.swing.JButton nextMonthButton
          Button that scroll to the next month.
protected  javax.swing.JButton nextYearButton
          Button that scrolls to the next year.
protected  javax.swing.JComponent noneComponent
          Component that controls the selection of no date.
protected  javax.swing.JButton previousMonthButton
          Button that scroll to the previous month.
protected  javax.swing.JButton previousYearButton
          Button that scrolls to the previous year.
protected  javax.swing.JComponent todayComponent
          Component that displays the today date.
 
Constructor Summary
AbstractMonthViewUI()
           
 
Method Summary
protected  java.lang.Object[] createDefaults()
          Creates a list of default values for some of the properties of JMonthView.
protected  java.awt.LayoutManager createLayout()
          Creates a LayoutManager that manages the month and year scrolling buttons, the actual months of the monthView, the today and none labels.
protected abstract  JMonth createMonth()
          Creates the component that represents the calendar month.
protected abstract  javax.swing.JButton createNextMonthButton()
          Creates the button that scrolls the month in view to the next one.
protected abstract  javax.swing.JButton createNextYearButton()
          Creates the button that scrolls the month in view to the next year.
protected abstract  javax.swing.JComponent createNoneComponent()
          Creates the component that is used to reset all selected dates.
protected abstract  javax.swing.JButton createPreviousMonthButton()
          Creates the button that scrolls the month in view to the previous one.
protected abstract  javax.swing.JButton createPreviousYearButton()
          Creates the button that scrolls the month in view to the previous year.
protected abstract  javax.swing.JComponent createTodayComponent()
          Creates the component that represents the today date.
protected  void initializeDefaults()
          Registers the default values created for some of the properties of JMonthView with the UIManager.
protected  void installComponents()
          Installs all the components needed by JMonthView to implement its behavior.
protected  void installDefaults()
          Installs the default font and colors on the JMonthView component.
protected  void installKeyboardActions()
          Installs the keyboard actions available for the JMonthView.
protected  void installListeners()
          Attaches listeners to the JMonth component.
 void installUI(javax.swing.JComponent c)
          Registers all the UI stuff needed to make the specified component work.
protected  void uninstallComponents()
           
protected  void uninstallKeyboardActions()
           
protected  void uninstallListeners()
          Uninstalls all registered listeners.
 void uninstallUI(javax.swing.JComponent c)
           
protected abstract  void updateDateSelectionModel()
          Updates the selection model for the components of the calendar.
protected abstract  void updateDatesOrientation()
          Updates how the dates of the month are displayed.
protected abstract  void updateDisplayToday()
          Specifies whether the calendar displays the today button or not.
protected abstract  void updateEnabled()
          Updates the enabled state of the children components based on the enabled state of the JMonthView.
protected abstract  void updateFont()
          Updates the font for the JMonthView components.
protected abstract  void updateForeground()
          Updates the foreground color of the calendar.
protected abstract  void updateGridColor()
          Updates the grid color of the calendar.
protected abstract  void updateHorizontalLinesVisible()
          Specifies whether the calendar horizontal grid lines are visible or not.
protected abstract  void updateLocale()
          Updates the locale for the JMonthView components.
protected abstract  void updateMonthBackground()
          Updates the background color of the calendar.
protected abstract  void updateMonthModel()
          Updates the month model for the components of the calendar.
protected abstract  void updateMonthUI()
          Updates the UI delegate used by all the JMonth objects from the JMonthView.
protected abstract  void updateNoneButtonVisible()
          Specifies whether the calendar displays the none button or not.
protected abstract  void updateRenderer()
          Updates the date renderer for the JMonthView components.
protected abstract  void updateRowsColumns()
          Updates the row/column arrangement of the months of the calendar.
protected abstract  void updateTimeZone()
          Updates the time zone for the months of the calendar.
protected abstract  void updateTitleBackground()
          Updates the title background color of the calendar.
protected abstract  void updateTitleForeground()
          Updates the title foreground color of the calendar.
protected abstract  void updateToggleDateSelectionEnabled()
          Updates the toggle date selection flag for the components of the calendar.
protected abstract  void updateTrailingForeground()
          Updates the trailing foreground color of the calendar.
protected abstract  void updateTrailingNextEnabled()
          Updates the state of the trailing dates for the last month
protected abstract  void updateTrailingPreviousEnabled()
          Updates the state of the trailing dates for the first month
protected abstract  void updateVerticalLinesVisible()
          Specifies whether the calendar vertical grid lines are visible or not.
protected abstract  void updateWeekLabelsHighlight()
          Updates the client property that enables the highlighting of the selected days of week or weeks.
protected abstract  void updateWeekModel()
          Updates the week model for the components of the calendar.
protected abstract  void updateWeekNamesVisible()
          Specifies whether the calendar displays the week names or not.
protected abstract  void updateWeekNumbersVisible()
          Specifies whether the calendar displays the week numbers or not.
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, paint, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

monthView

protected JMonthView monthView
JMonthView component for which this UI delegate is installed.


previousYearButton

protected javax.swing.JButton previousYearButton
Button that scrolls to the previous year.

See Also:
createPreviousYearButton()

nextYearButton

protected javax.swing.JButton nextYearButton
Button that scrolls to the next year.

See Also:
createNextYearButton()

previousMonthButton

protected javax.swing.JButton previousMonthButton
Button that scroll to the previous month.

See Also:
createPreviousMonthButton()

nextMonthButton

protected javax.swing.JButton nextMonthButton
Button that scroll to the next month.

See Also:
createNextMonthButton()

todayComponent

protected javax.swing.JComponent todayComponent
Component that displays the today date.

See Also:
createTodayComponent()

noneComponent

protected javax.swing.JComponent noneComponent
Component that controls the selection of no date.

See Also:
createNoneComponent()
Constructor Detail

AbstractMonthViewUI

public AbstractMonthViewUI()
Method Detail

createDefaults

protected java.lang.Object[] createDefaults()

Creates a list of default values for some of the properties of JMonthView. These values are instances of objects that implement the UIResource interface. For instance, default fonts are created using the FontUIResource class while colors using the ColorUIResource class.

The list is structured as follows: [key1, value1, key2, value2, ...] where the keys identify the properties and the values indicate the default values for these properties.

The keys returned in the list by this method are:

  1. MonthView.font
  2. MonthView.gridColor
  3. MonthView.titleBackground
  4. MonthView.titleForeground
  5. MonthView.foreground
  6. MonthView.trailingForeground
  7. MonthView.monthBackground
  8. MonthView.dateRenderer
    1. Returns:
      a list of default values for some of the properties of JMonthView
      See Also:
      initializeDefaults(), installDefaults()

initializeDefaults

protected void initializeDefaults()

Registers the default values created for some of the properties of JMonthView with the UIManager.

See Also:
installDefaults()

installUI

public void installUI(javax.swing.JComponent c)
Registers all the UI stuff needed to make the specified component work. In other words, this is the place where the component's look and feel is created.

See Also:
installDefaults(), installComponents(), installListeners(), installKeyboardActions()

installDefaults

protected void installDefaults()
Installs the default font and colors on the JMonthView component.


installComponents

protected void installComponents()
Installs all the components needed by JMonthView to implement its behavior. This implementation uses a title and an actual month for this.

See Also:
createLayout(), createPreviousMonthButton(), createNextMonthButton(), createTodayComponent(), createNoneComponent(), createMonth()

createLayout

protected java.awt.LayoutManager createLayout()
Creates a LayoutManager that manages the month and year scrolling buttons, the actual months of the monthView, the today and none labels. These children must be added with a constraint that identifies their role: "Previous", "Next", "Previous_Year", "Next_Year", "Today", "None" and "Month". The default layout manager can handle the absence of any of these children.

Returns:
a LayoutManager for the JMonthView components.
See Also:
installComponents()

createPreviousMonthButton

protected abstract javax.swing.JButton createPreviousMonthButton()

Creates the button that scrolls the month in view to the previous one.

You can override it to create a different button. If null is returned, then this component is ignored and it is not added to JMonthView.

Returns:
button that navigates to the previous month.

createNextMonthButton

protected abstract javax.swing.JButton createNextMonthButton()

Creates the button that scrolls the month in view to the next one.

You can override it to create a different button. If null is returned, then this component is ignored and it is not added to JMonthView.

Returns:
button that navigates to the next month.

createPreviousYearButton

protected abstract javax.swing.JButton createPreviousYearButton()

Creates the button that scrolls the month in view to the previous year.

You can override it to create a different button. If null is returned, then this component is ignored and it is not added to JMonthView.

Returns:
button that navigates to the previous year.

createNextYearButton

protected abstract javax.swing.JButton createNextYearButton()

Creates the button that scrolls the month in view to the next year.

You can override it to create a different button. If null is returned, then this component is ignored and it is not added to JMonthView.

Returns:
button that navigates to the next year.

createTodayComponent

protected abstract javax.swing.JComponent createTodayComponent()

Creates the component that represents the today date.

You can override it to create a different component. If null is returned, then this component is ignored and it is not added to JMonthView.

Returns:
the component that represents the today date.

createNoneComponent

protected abstract javax.swing.JComponent createNoneComponent()

Creates the component that is used to reset all selected dates.

You can override it to create a different component. If null is returned, then this component is ignored and it is not added to JMonthView.

Returns:
the component that reset all selected dates.

createMonth

protected abstract JMonth createMonth()

Creates the component that represents the calendar month.

Returns:
the component that represents the month.

installListeners

protected void installListeners()
Attaches listeners to the JMonth component.


installKeyboardActions

protected void installKeyboardActions()
Installs the keyboard actions available for the JMonthView.


uninstallUI

public void uninstallUI(javax.swing.JComponent c)

uninstallListeners

protected void uninstallListeners()
Uninstalls all registered listeners.


uninstallComponents

protected void uninstallComponents()

uninstallKeyboardActions

protected void uninstallKeyboardActions()

updateFont

protected abstract void updateFont()
Updates the font for the JMonthView components.


updateLocale

protected abstract void updateLocale()
Updates the locale for the JMonthView components.


updateEnabled

protected abstract void updateEnabled()
Updates the enabled state of the children components based on the enabled state of the JMonthView.


updateRenderer

protected abstract void updateRenderer()
Updates the date renderer for the JMonthView components.


updateMonthBackground

protected abstract void updateMonthBackground()
Updates the background color of the calendar.


updateForeground

protected abstract void updateForeground()
Updates the foreground color of the calendar.


updateTitleBackground

protected abstract void updateTitleBackground()
Updates the title background color of the calendar.


updateTitleForeground

protected abstract void updateTitleForeground()
Updates the title foreground color of the calendar.


updateTrailingForeground

protected abstract void updateTrailingForeground()
Updates the trailing foreground color of the calendar.


updateTrailingNextEnabled

protected abstract void updateTrailingNextEnabled()
Updates the state of the trailing dates for the last month


updateTrailingPreviousEnabled

protected abstract void updateTrailingPreviousEnabled()
Updates the state of the trailing dates for the first month


updateGridColor

protected abstract void updateGridColor()
Updates the grid color of the calendar.


updateWeekNumbersVisible

protected abstract void updateWeekNumbersVisible()
Specifies whether the calendar displays the week numbers or not.


updateWeekNamesVisible

protected abstract void updateWeekNamesVisible()
Specifies whether the calendar displays the week names or not.


updateHorizontalLinesVisible

protected abstract void updateHorizontalLinesVisible()
Specifies whether the calendar horizontal grid lines are visible or not.


updateVerticalLinesVisible

protected abstract void updateVerticalLinesVisible()
Specifies whether the calendar vertical grid lines are visible or not.


updateDisplayToday

protected abstract void updateDisplayToday()
Specifies whether the calendar displays the today button or not.


updateNoneButtonVisible

protected abstract void updateNoneButtonVisible()
Specifies whether the calendar displays the none button or not.


updateDateSelectionModel

protected abstract void updateDateSelectionModel()
Updates the selection model for the components of the calendar.


updateToggleDateSelectionEnabled

protected abstract void updateToggleDateSelectionEnabled()
Updates the toggle date selection flag for the components of the calendar.


updateMonthModel

protected abstract void updateMonthModel()
Updates the month model for the components of the calendar.


updateWeekModel

protected abstract void updateWeekModel()
Updates the week model for the components of the calendar.


updateRowsColumns

protected abstract void updateRowsColumns()
Updates the row/column arrangement of the months of the calendar.


updateTimeZone

protected abstract void updateTimeZone()
Updates the time zone for the months of the calendar.


updateWeekLabelsHighlight

protected abstract void updateWeekLabelsHighlight()
Updates the client property that enables the highlighting of the selected days of week or weeks.


updateMonthUI

protected abstract void updateMonthUI()
Updates the UI delegate used by all the JMonth objects from the JMonthView.


updateDatesOrientation

protected abstract void updateDatesOrientation()
Updates how the dates of the month are displayed.


JDatePicker v4.3

Visit www.jdatepicker.com for further information or send us your suggestions.

Copyright © 2003-2007 Stand By Soft Ltd. All Rights Reserved.