ilog.views.util.swing.calendar
Interface IlvCalendarCellRenderer

All Known Implementing Classes:
IlvDefaultCalendarCellRenderer

public interface IlvCalendarCellRenderer

This interface defines the method required by any object that would like to be a renderer for cells in an IlvJCalendarPanel. For example, to use a JLabel we suggest that you subclass IlvAbstractCellRenderer for the best performance. Your renderer would then be something like this:


 class MyCellRenderer extends IlvAbstractCellRenderer
  implements IlvCalendarCellRenderer
  {
    NumberFormat format = NumberFormat.getNumberInstance();

    public Component getCalendarCellRendererComponent(
        IlvJCalendarPanel calendarPanel,
        Calendar calendar,
        int row, int column,
        boolean isPrevMonth, boolean isNextMonth,
        boolean isSelected, boolean hasFocus)
    {
      setText(format.format(calendar.get(Calendar.DAY_OF_MONTH)));
      setFont(calendarPanel.getFont());
      setBackground(isSelected
        ? calendarPanel.getSelectionBackground()
        : calendarPanel.getBackground());
      setForeground(isSelected
        ? calendarPanel.getSelectionForeground()
        : calendarPanel.getForeground());
      return this;
    }
  }
 

Since:
JViews 5.5
See Also:
IlvJCalendarPanel.setCellRenderer(ilog.views.util.swing.calendar.IlvCalendarCellRenderer), IlvDefaultCalendarCellRenderer, IlvAbstractCellRenderer

Method Summary
 Component getCalendarCellRendererComponent(IlvJCalendarPanel calendarPanel, Calendar calendar, int row, int column, boolean isPrevMonth, boolean isNextMonth, boolean isSelected, boolean hasFocus)
          Returns a component that has been configured to render the specified day cell and value.
 

Method Detail

getCalendarCellRendererComponent

Component getCalendarCellRendererComponent(IlvJCalendarPanel calendarPanel,
                                           Calendar calendar,
                                           int row,
                                           int column,
                                           boolean isPrevMonth,
                                           boolean isNextMonth,
                                           boolean isSelected,
                                           boolean hasFocus)
Returns a component that has been configured to render the specified day cell and value. That component's paint method is then called to "render" the cell.

Parameters:
calendarPanel - The IlvJCalendarPanel that is asking the renderer to draw.
calendar - The calendar value of the cell.
row - The row index of the cell being drawn.
column - The column index of the cell being drawn.
isPrevMonth - Indicates if the cell is in the month prior to the current month displayed by the calendar panel.
isNextMonth - Indicates if the cell is in the month after the current month displayed by the calendar panel.
isSelected - Indicates if the cell is selected.
hasFocus - Indicates if the cell has the focus.
Returns:
A component whose paint() method will render the cell and value.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.