ilog.views.util.swing.calendar
Class IlvJCalendarPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by ilog.views.util.swing.calendar.IlvJCalendarPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class IlvJCalendarPanel
extends JComponent

IlvJCalendarPanel is a Swing component that renders a monthly calendar grid.

IlvJCalendarPanel

Since:
JViews 5.5
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String CELL_RENDERER_CHANGED_PROPERTY
          Identifies that the calendar panel's cell renderer has changed.
static String DATE_SELECTED_PROPERTY
          Identifies that a user input event has selected a date in the panel.
static String HEADER_BACKGROUND_CHANGED_PROPERTY
          Identifies the background color of the header.
static String HEADER_FONT_CHANGED_PROPERTY
          Identifies the font of the header.
static String HEADER_FOREGROUND_CHANGED_PROPERTY
          Identifies the foreground color of the header.
static String HEADER_HEIGHT_CHANGED_PROPERTY
          Identifies that the height of the calendar panel's header has changed.
static String HEADER_RENDERER_CHANGED_PROPERTY
          Identifies that the calendar panel's header renderer has changed.
static String MODEL_CHANGED_PROPERTY
          Identifies that the panel's calendar model has changed.
static String NEXT_MONTH_FOREGROUND_CHANGED_PROPERTY
          Identifies the foreground color of the next month.
static String PREVIOUS_MONTH_FOREGROUND_CHANGED_PROPERTY
          Identifies the foreground color of the previous month.
static String SELECTION_BACKGROUND_CHANGED_PROPERTY
          Identifies the background color of the selection.
static String SELECTION_FOREGROUND_CHANGED_PROPERTY
          Identifies the foreground color of the selection.
static String WEEKEND_BACKGROUND_CHANGED_PROPERTY
          Identifies the background color of the weekends.
static String WEEKEND_FONT_CHANGED_PROPERTY
          Identifies the font of the weekends.
static String WEEKEND_FOREGROUND_CHANGED_PROPERTY
          Identifies the foreground color of the weekends.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IlvJCalendarPanel()
          Creates a new IlvJCalendarPanel that is initialized with a default data model.
IlvJCalendarPanel(IlvCalendarModel model)
          Creates a new IlvJCalendarPanel that is initialized with the specified data model.
 
Method Summary
protected  IlvCalendarModel createDefaultModel()
          Returns the default calendar model object for this panel, which is an IlvDefaultCalendarModel.
 void fireDateSelected()
          Fires a PropertyChange event to all subscribed listeners indicating that the user has selected a date in the panel.
 Calendar getCalendar()
          Returns the calendar displayed by the panel.
 Calendar getCellDate(int row, int column)
          Returns the date displayed in the day cell that lies at the intersection of the specified week row and day-of-week column.
 Rectangle getCellRect(int row, int column)
          Returns a rectangle for the day cell that lies at the intersection of the specified week row and day-of-week column.
 IlvCalendarCellRenderer getCellRenderer()
          Returns the object that renders the day cells.
 int getColumnAtPoint(Point point)
          Returns the index of the day-of-week column that point lies in.
 int getColumnCount()
          Returns the number of day-of-week columns in the calendar panel.
 int getColumnWidth()
          Returns the width of the day-of-week columns.
 Color getHeaderBackground()
          Returns the header background color.
 Font getHeaderFont()
          Returns the header font.
 Color getHeaderForeground()
          Returns the header foreground color.
 int getHeaderHeight()
          Returns the height of the days-of-week header, in pixels.
 IlvCalendarHeaderRenderer getHeaderRenderer()
          Returns the object that renders the day-of-week header.
 IlvCalendarModel getModel()
          Returns the data model that holds the calendar displayed by the panel.
 Color getNextMonthForeground()
          Returns the next month foreground color.
 Color getPreviousMonthForeground()
          Returns the previous month foreground color.
 int getRowAtPoint(Point point)
          Returns the index of the week row that point lies in.
 int getRowCount()
          Returns the number of week rows in the calendar panel.
 int getRowHeight()
          Returns the height of the week rows.
 Color getSelectionBackground()
          Returns the selection background color.
 Color getSelectionForeground()
          Returns the selection foreground color.
 CalendarPanelUI getUI()
          Returns the look and feel (L&F) object that renders this calendar panel.
 String getUIClassID()
          Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.
 Color getWeekendBackground()
          Returns the weekend background color.
 Font getWeekendFont()
          Returns the weekend font.
 Color getWeekendForeground()
          Returns the weekend foreground color.
protected  void init()
          Initializes calendar panel properties to their default values.
 boolean isFocusTraversable()
          Returns whether the focus can be traversed.
 void setCalendar(Calendar calendar)
          Sets the calendar displayed by the panel.
 void setCellRenderer(IlvCalendarCellRenderer cellRenderer)
          Sets the object that renders the day cells.
 void setHeaderBackground(Color headerBackground)
          Sets the background color for the days-of-week header cells.
 void setHeaderFont(Font headerFont)
          Sets the font for header cells.
 void setHeaderForeground(Color headerForeground)
          Sets the foreground color for selected cells.
 void setHeaderHeight(int headerHeight)
          Sets the height of the days-of-week header, in pixels.
 void setHeaderRenderer(IlvCalendarHeaderRenderer headerRenderer)
          Sets the object that renders the day-of-week header.
 void setModel(IlvCalendarModel model)
          Sets the data model that holds the calendar displayed by the panel.
 void setNextMonthForeground(Color nextMonthForeground)
          Sets the foreground color for the next month cells.
 void setPreviousMonthForeground(Color previousMonthForeground)
          Sets the foreground color for the previous month cells.
 void setSelectionBackground(Color selectionBackground)
          Sets the background color for selected cells.
 void setSelectionForeground(Color selectionForeground)
          Sets the foreground color for selected cells.
 void setUI(CalendarPanelUI ui)
          Sets the look and feel (L&F) object that renders this calendar panel.
 void setWeekendBackground(Color weekendBackground)
          Sets the background color for selected cells.
 void setWeekendFont(Font weekendFont)
          Sets the font for weekend cells.
 void setWeekendForeground(Color weekendForeground)
          Sets the foreground color for weekend cells.
 void updateUI()
          Resets the UI property with the value from the current look and feel.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MODEL_CHANGED_PROPERTY

public static final String MODEL_CHANGED_PROPERTY
Identifies that the panel's calendar model has changed.

See Also:
Constant Field Values

DATE_SELECTED_PROPERTY

public static final String DATE_SELECTED_PROPERTY
Identifies that a user input event has selected a date in the panel. This event is not fired if the calendar panel is updated by its model.

See Also:
Constant Field Values

CELL_RENDERER_CHANGED_PROPERTY

public static final String CELL_RENDERER_CHANGED_PROPERTY
Identifies that the calendar panel's cell renderer has changed.

See Also:
Constant Field Values

HEADER_RENDERER_CHANGED_PROPERTY

public static final String HEADER_RENDERER_CHANGED_PROPERTY
Identifies that the calendar panel's header renderer has changed.

See Also:
Constant Field Values

HEADER_HEIGHT_CHANGED_PROPERTY

public static final String HEADER_HEIGHT_CHANGED_PROPERTY
Identifies that the height of the calendar panel's header has changed.

See Also:
Constant Field Values

SELECTION_FOREGROUND_CHANGED_PROPERTY

public static final String SELECTION_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the selection.

See Also:
Constant Field Values

SELECTION_BACKGROUND_CHANGED_PROPERTY

public static final String SELECTION_BACKGROUND_CHANGED_PROPERTY
Identifies the background color of the selection.

See Also:
Constant Field Values

WEEKEND_FOREGROUND_CHANGED_PROPERTY

public static final String WEEKEND_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the weekends.

See Also:
Constant Field Values

WEEKEND_BACKGROUND_CHANGED_PROPERTY

public static final String WEEKEND_BACKGROUND_CHANGED_PROPERTY
Identifies the background color of the weekends.

See Also:
Constant Field Values

WEEKEND_FONT_CHANGED_PROPERTY

public static final String WEEKEND_FONT_CHANGED_PROPERTY
Identifies the font of the weekends.

See Also:
Constant Field Values

PREVIOUS_MONTH_FOREGROUND_CHANGED_PROPERTY

public static final String PREVIOUS_MONTH_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the previous month.

See Also:
Constant Field Values

NEXT_MONTH_FOREGROUND_CHANGED_PROPERTY

public static final String NEXT_MONTH_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the next month.

See Also:
Constant Field Values

HEADER_FOREGROUND_CHANGED_PROPERTY

public static final String HEADER_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the header.

See Also:
Constant Field Values

HEADER_BACKGROUND_CHANGED_PROPERTY

public static final String HEADER_BACKGROUND_CHANGED_PROPERTY
Identifies the background color of the header.

See Also:
Constant Field Values

HEADER_FONT_CHANGED_PROPERTY

public static final String HEADER_FONT_CHANGED_PROPERTY
Identifies the font of the header.

See Also:
Constant Field Values
Constructor Detail

IlvJCalendarPanel

public IlvJCalendarPanel(IlvCalendarModel model)
Creates a new IlvJCalendarPanel that is initialized with the specified data model.

Parameters:
model - The data model for the calendar panel.

IlvJCalendarPanel

public IlvJCalendarPanel()
Creates a new IlvJCalendarPanel that is initialized with a default data model.

See Also:
createDefaultModel()
Method Detail

init

protected void init()
Initializes calendar panel properties to their default values.


isFocusTraversable

public boolean isFocusTraversable()
Returns whether the focus can be traversed.

Overrides:
isFocusTraversable in class Component
Returns:
true if the focus is traversable, or false otherwise.

createDefaultModel

protected IlvCalendarModel createDefaultModel()
Returns the default calendar model object for this panel, which is an IlvDefaultCalendarModel. A subclass can override this method to return a different calendar model object.

Returns:
The default calendar model object.
See Also:
getModel(), setModel(ilog.views.util.swing.calendar.IlvCalendarModel)

getModel

public IlvCalendarModel getModel()
Returns the data model that holds the calendar displayed by the panel.

See Also:
setModel(ilog.views.util.swing.calendar.IlvCalendarModel), createDefaultModel()

setModel

public void setModel(IlvCalendarModel model)
Sets the data model that holds the calendar displayed by the panel.

Parameters:
model - The data model to set.
See Also:
getModel(), createDefaultModel()

getCalendar

public Calendar getCalendar()
Returns the calendar displayed by the panel.

See Also:
setCalendar(java.util.Calendar)

setCalendar

public void setCalendar(Calendar calendar)
Sets the calendar displayed by the panel.

Parameters:
calendar - The calendar to set.
See Also:
getCalendar()

getCellDate

public Calendar getCellDate(int row,
                            int column)
Returns the date displayed in the day cell that lies at the intersection of the specified week row and day-of-week column. If the specified cell coordinates are out of range, then null is returned.

Parameters:
row - The week row.
column - The day-of-week column.
Returns:
The date displayed in the day cell.

getUIClassID

public String getUIClassID()
Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.

Overrides:
getUIClassID in class JComponent

getUI

public CalendarPanelUI getUI()
Returns the look and feel (L&F) object that renders this calendar panel.

Returns:
The CalendarPanelUI object that renders this component.

setUI

public void setUI(CalendarPanelUI ui)
Sets the look and feel (L&F) object that renders this calendar panel.

Parameters:
ui - The CalendarPanelUI L&F object.

updateUI

public void updateUI()
Resets the UI property with the value from the current look and feel.

Overrides:
updateUI in class JComponent

fireDateSelected

public void fireDateSelected()
Fires a PropertyChange event to all subscribed listeners indicating that the user has selected a date in the panel.

Warning: This method is considered to be part of an IlvJCalendarPanel's internal implementation and not a public API. This method should only be invoked by the panel's LAF delegate.


getCellRenderer

public IlvCalendarCellRenderer getCellRenderer()
Returns the object that renders the day cells.

See Also:
setCellRenderer(ilog.views.util.swing.calendar.IlvCalendarCellRenderer)

setCellRenderer

public void setCellRenderer(IlvCalendarCellRenderer cellRenderer)
Sets the object that renders the day cells.

Parameters:
cellRenderer - The cell renderer object.
See Also:
getCellRenderer()

getHeaderRenderer

public IlvCalendarHeaderRenderer getHeaderRenderer()
Returns the object that renders the day-of-week header.

See Also:
setHeaderRenderer(ilog.views.util.swing.calendar.IlvCalendarHeaderRenderer)

setHeaderRenderer

public void setHeaderRenderer(IlvCalendarHeaderRenderer headerRenderer)
Sets the object that renders the day-of-week header.

Parameters:
headerRenderer - The day-of-week header renderer object.
See Also:
getHeaderRenderer()