public class IlvMonthPanel extends JComponent
IlvMonthPanel
is a Swing component that displays activities from
a Gantt data model overlaid on a monthly calendar grid.
See IlvMonthView
for a component that groups an IlvMonthPanel
with a vertical scroll bar.
The month panel displays the leaf activities and milestones of the Gantt data model set on it. The panel also listens for changes to the data model and updates itself dynamically. Leaf activities from the data model are displayed using the currently set activity renderer and milestones are displayed using the current milestone renderer. You can also set a static holiday data model on the month panel. Leaf activities from the holiday model are displayed using the holiday renderer. Note, that the month panel does not listen for dynamic updates to the holiday data model.
IlvMonthView
,
Serialized FormJComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
CALENDAR_CHANGED_PROPERTY
Identifies that the panel's calendar has changed.
|
static String |
CALENDAR_MODEL_CHANGED_PROPERTY
Identifies that the panel's calendar model has changed.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvMonthPanel()
Creates a new month panel.
|
IlvMonthPanel(IlvGanttModel ganttModel)
Creates a new month panel that displays the activities in the specified Gantt
data model.
|
Modifier and Type | Method and Description |
---|---|
void |
addSelectionListener(SelectionListener listener)
Adds the specified selection listener to receive selection events from
this panel.
|
static String |
computeDisplayedLabel(String label,
FontMetrics fm,
int width)
Clips the passed in string to the space provided.
|
protected IlvCalendarModel |
createDefaultCalendarModel()
Returns the default calendar model object for this panel, which is
an instance of
IlvDefaultCalendarModel . |
void |
decrementMonth()
Decrements the panel to display the preceding month.
|
void |
deselectAllActivities()
Deselects all of the currently selected activities.
|
IlvActivity |
getActivity(Point point)
Returns the activity, milestone, or holiday that is displayed at the specified
point . |
int |
getActivityHeight()
Returns the height of activity bars and milestones.
|
int |
getActivityMargin()
Returns the horizontal margin around activity bars and milestones.
|
IlvActivityCalendarRenderer |
getActivityRenderer()
Returns the renderer that is used to draw the graphic presentation of activities
within the month panel.
|
int |
getActivitySpacing()
Returns the vertical spacing between activity bars and milestones.
|
Calendar |
getCalendar()
Returns the calendar displayed by the panel.
|
IlvCalendarModel |
getCalendarModel()
Returns the model that holds 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 . |
Calendar |
getCellDate(Point point)
Returns the date displayed in the day cell that
point lies in,
or null if it is out of range. |
Rectangle |
getCellRect(Calendar calendar)
Returns a rectangle for the specified day cell.
|
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 . |
int |
getColumn(Calendar calendar)
Returns the day-of-week column index of the specified date.
|
int |
getColumn(Date date)
Returns the day-of-week column index of the specified date.
|
int |
getColumn(Point point)
Returns the day-of-week column index that
point lies in,
or -1 if it is out of range. |
Date |
getDate()
Returns the date displayed by the panel.
|
Font |
getDayOfMonthFont()
Returns the font of the day-of-month labels.
|
Color |
getDayOfMonthForeground()
Returns the foreground color of the day-of-month labels.
|
Color |
getDayOfWeekBackground()
Returns the background color of the days-of-week header.
|
Font |
getDayOfWeekFont()
Returns the font of the days-of-week header.
|
Color |
getDayOfWeekForeground()
Returns the foreground color of the days-of-week header.
|
int |
getDayOfWeekHeight()
Returns the height of the days-of-week header.
|
IlvGanttModel |
getGanttModel()
Returns the Gantt data model that is being displayed.
|
Color |
getGridColor()
Returns the color of the grid lines.
|
Font |
getHeaderFont()
Returns the font of the month header.
|
Color |
getHeaderForeground()
Returns the foreground color of the month header.
|
int |
getHeaderHeight()
Returns the height of the month header.
|
IlvGanttModel |
getHolidayModel()
Returns the holiday model that is being displayed.
|
IlvActivityCalendarRenderer |
getHolidayRenderer()
Returns the renderer that is used to draw the graphic presentation of holidays
within the month panel.
|
IlvMilestoneCalendarRenderer |
getMilestoneRenderer()
Returns the renderer that is used to draw the graphic presentation of milestones
within the month panel.
|
int |
getRow(Calendar calendar)
Returns the week row index of the specified date.
|
int |
getRow(Date date)
Returns the week row index of the specified date.
|
int |
getRow(Point point)
Returns the week row index that
point lies in. |
int |
getRowCount()
Returns the number of week rows being displayed.
|
List |
getSelectedActivities()
Returns a list of the currently selected activities.
|
String |
getToolTipText(MouseEvent event)
Returns the string to be used as the tooltip for the specified mouse
event.
|
int |
getVisibleActivityCount()
Returns the maximum number of activity bars that are visible within a day cell.
|
Color |
getWeekendBackground()
Returns the background color of the weekends.
|
void |
incrementMonth()
Increments the panel to display the next month.
|
boolean |
isMouseSelectionEnabled()
Returns whether mouse selection of activities is enabled.
|
boolean |
isSelected(IlvActivity activity)
Returns whether the specified activity is currently selected.
|
void |
paintComponent(Graphics g)
Paints the month panel.
|
void |
removeSelectionListener(SelectionListener listener)
Remove the specified selection listener so that it no longer receives
selection events from this panel.
|
void |
setActivityHeight(int height)
Sets the height of activity bars and milestones.
|
void |
setActivityMargin(int margin)
Sets the horizontal margin around activity bars and milestones.
|
void |
setActivityRenderer(IlvActivityCalendarRenderer activityRenderer)
Sets the renderer that will be used to draw the graphic presentation of activities
within the month panel.
|
void |
setActivitySpacing(int spacing)
Sets the vertical spacing between activity bars and milestones.
|
void |
setCalendar(Calendar calendar)
Sets the calendar displayed by the panel.
|
void |
setCalendarModel(IlvCalendarModel calendarModel)
Sets the model that holds the calendar displayed by the panel.
|
void |
setDate(Date date)
Sets the date displayed by the panel.
|
void |
setDayOfMonthFont(Font font)
Sets the font of the day-of-month labels.
|
void |
setDayOfMonthForeground(Color color)
Sets the foreground color of the day-of-month labels.
|
void |
setDayOfWeekBackground(Color color)
Sets the background color of the days-of-week header.
|
void |
setDayOfWeekFont(Font font)
Sets the font of the days-of-week header.
|
void |
setDayOfWeekForeground(Color color)
Sets the foreground color of the days-of-week header.
|
void |
setDayOfWeekHeight(int height)
Sets the height of the days-of-week header.
|
void |
setGanttModel(IlvGanttModel ganttModel)
Sets the Gantt data model that will be displayed.
|
void |
setGridColor(Color color)
Sets the color of the grid lines.
|
void |
setHeaderFont(Font font)
Sets the font of the month header.
|
void |
setHeaderForeground(Color color)
Sets the foreground color of the month header.
|
void |
setHeaderHeight(int height)
Sets the height of the month header.
|
void |
setHolidayModel(IlvGanttModel holidays)
Sets the holiday model that will be displayed.
|
void |
setHolidayRenderer(IlvActivityCalendarRenderer holidayRenderer)
Sets the renderer that will be used to draw the graphic presentation of holidays
within the month panel.
|
void |
setMilestoneRenderer(IlvMilestoneCalendarRenderer milestoneRenderer)
Sets the renderer that will be used to draw the graphic presentation of milestones
within the month panel.
|
void |
setMouseSelectionEnabled(boolean enabled)
Sets whether mouse selection of activities is enabled.
|
void |
setSelected(IlvActivity activity,
boolean selected)
Selects or deselects the specified activity.
|
void |
setWeekendBackground(Color color)
Sets the background color of the weekends.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, updateUI
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, transferFocusDownCycle, validate, validateTree
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, getAccessibleContext, 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, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, 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, transferFocusBackward, transferFocusUpCycle
public static final String CALENDAR_MODEL_CHANGED_PROPERTY
public static final String CALENDAR_CHANGED_PROPERTY
public IlvMonthPanel()
public IlvMonthPanel(IlvGanttModel ganttModel)
ganttModel
- The Gantt data model.protected IlvCalendarModel createDefaultCalendarModel()
IlvDefaultCalendarModel
. A subclass can override this
method to return a different calendar model object.getCalendarModel()
,
setCalendarModel(ilog.views.util.swing.calendar.IlvCalendarModel)
public IlvCalendarModel getCalendarModel()
setCalendarModel(ilog.views.util.swing.calendar.IlvCalendarModel)
,
createDefaultCalendarModel()
public void setCalendarModel(IlvCalendarModel calendarModel)
calendarModel
- The calendar model.getCalendarModel()
,
createDefaultCalendarModel()
public Calendar getCalendar()
Calendar
objects are mutable, this method returns a copy of the panel's internal calendar
value.setCalendar(java.util.Calendar)
public void setCalendar(Calendar calendar)
calendar
- The calendar to set.getCalendar()
public Date getDate()
setDate(java.util.Date)
public void setDate(Date date)
date
- The date to set.getDate()
public void incrementMonth()
public void decrementMonth()
public IlvGanttModel getGanttModel()
setGanttModel(ilog.views.gantt.IlvGanttModel)
public void setGanttModel(IlvGanttModel ganttModel)
ganttModel
- The Gantt data model.getGanttModel()
public IlvGanttModel getHolidayModel()
setHolidayModel(ilog.views.gantt.IlvGanttModel)
public void setHolidayModel(IlvGanttModel holidays)
holidays
- The holiday model.getHolidayModel()
public void setSelected(IlvActivity activity, boolean selected)
activity
- The activity to select or deselect.selected
- true
to select the activity or
false
to deselect it.isSelected(ilog.views.gantt.IlvActivity)
,
deselectAllActivities()
,
getSelectedActivities()
public void deselectAllActivities()
public List getSelectedActivities()
isSelected(ilog.views.gantt.IlvActivity)
,
setSelected(ilog.views.gantt.IlvActivity, boolean)
,
deselectAllActivities()
public boolean isSelected(IlvActivity activity)
activity
- The activity.true
if the activity is selected, or false
otherwise.setSelected(ilog.views.gantt.IlvActivity, boolean)
,
deselectAllActivities()
,
getSelectedActivities()
public void addSelectionListener(SelectionListener listener)
listener
- The selection listener.removeSelectionListener(ilog.views.gantt.event.SelectionListener)
public void removeSelectionListener(SelectionListener listener)
listener
- The selection listener.addSelectionListener(ilog.views.gantt.event.SelectionListener)
public boolean isMouseSelectionEnabled()
true
true
if mouse selection is enabled, false
otherwise.setMouseSelectionEnabled(boolean)
public void setMouseSelectionEnabled(boolean enabled)
enabled
- true
to enable mouse selection or false
to disable mouse selection.isMouseSelectionEnabled()
public int getRowCount()
public int getColumn(Point point)
point
lies in,
or -1 if it is out of range.point
- The location of interest.point
lies in, or -1
if point
is out of range.getRow(Point)
public int getColumn(Calendar calendar)
calendar
- The date.getRow(Calendar)
,
getColumn(Date)
public int getColumn(Date date)
date
- The date.getRow(Date)
,
getColumn(Calendar)
public int getRow(Point point)
point
lies in. This
method returns -1 if the point lies in the days-of-week header. Otherwise,
this method returns -2 if the point is out of range.point
- The location of interest.point
lies in, or -1
if point
lies in the days-of-week header, or -2 if point
is out of range.getColumn(Point)
public int getRow(Calendar calendar)
calendar
- The date.getColumn(Calendar)
,
getRow(Date)
public int getRow(Date date)
date
- The date.getColumn(Date)
,
getRow(Calendar)
public Rectangle getCellRect(int row, int column)
row
and day-of-week column
. A
value of -1 can be specified for the row
to indicate the
days-of-week header. If the specified cell coordinates are out of range,
then null
is returned.row
- The week row index, or -1 to indicate the days-of-week header.column
- The day-of-week column index.null
if the specified
cell is out of range.public Rectangle getCellRect(Calendar calendar)
null
is returned.calendar
- The date.null
if the date is out of
range.public Calendar getCellDate(int row, int column)
row
and day-of-week column
.
If the specified cell coordinates are out of range, then null
is returned.row
- The week row index.column
- The day-of-week column index.null
if the specified
cell is out of range.public Calendar getCellDate(Point point)
point
lies in,
or null
if it is out of range.point
- The location of interest.null
if point
is out of range.public IlvActivity getActivity(Point point)
point
. This method returns null
if the location does
not lie in an activity, a milestone, or a holiday.point
- The location of interest.null
.public int getActivityHeight()
setActivityHeight(int)
public void setActivityHeight(int height)
height
- The activity height.getActivityHeight()
public int getActivityMargin()
setActivityMargin(int)
public void setActivityMargin(int margin)
margin
- The activity margin.getActivityMargin()
public int getActivitySpacing()
setActivitySpacing(int)
public void setActivitySpacing(int spacing)
spacing
- The activity spacing.getActivitySpacing()
public int getVisibleActivityCount()
public IlvActivityCalendarRenderer getActivityRenderer()
setActivityRenderer(ilog.views.gantt.swing.calendarview.IlvActivityCalendarRenderer)
public void setActivityRenderer(IlvActivityCalendarRenderer activityRenderer)
activityRenderer
- The activity renderer.getActivityRenderer()
public IlvActivityCalendarRenderer getHolidayRenderer()
setHolidayRenderer(ilog.views.gantt.swing.calendarview.IlvActivityCalendarRenderer)
public void setHolidayRenderer(IlvActivityCalendarRenderer holidayRenderer)
holidayRenderer
- The holiday renderer.getHolidayRenderer()
public IlvMilestoneCalendarRenderer getMilestoneRenderer()
setMilestoneRenderer(ilog.views.gantt.swing.calendarview.IlvMilestoneCalendarRenderer)
public void setMilestoneRenderer(IlvMilestoneCalendarRenderer milestoneRenderer)
milestoneRenderer
- The milestone renderer.getMilestoneRenderer()
public Color getGridColor()
setGridColor(java.awt.Color)
public void setGridColor(Color color)
color
- The grid color.getGridColor()
public int getHeaderHeight()
setHeaderHeight(int)
public void setHeaderHeight(int height)
height
- The header height.getHeaderHeight()
public Font getHeaderFont()
setHeaderFont(java.awt.Font)
public void setHeaderFont(Font font)
font
- The header font.getHeaderFont()
public Color getHeaderForeground()
setHeaderForeground(java.awt.Color)
public void setHeaderForeground(Color color)
color
- The header foreground color.getHeaderForeground()
public int getDayOfWeekHeight()
setDayOfWeekHeight(int)
public void setDayOfWeekHeight(int height)
height
- The day-of-week height.getDayOfWeekHeight()
public Font getDayOfWeekFont()
setDayOfWeekFont(java.awt.Font)
public void setDayOfWeekFont(Font font)
font
- The day-of-week font.getDayOfWeekFont()
public Color getDayOfWeekForeground()
setDayOfWeekForeground(java.awt.Color)
public void setDayOfWeekForeground(Color color)
color
- The day-of-week foreground color.getDayOfWeekForeground()
public Color getDayOfWeekBackground()
setDayOfWeekBackground(java.awt.Color)
public void setDayOfWeekBackground(Color color)
color
- The day-of-week background color.getDayOfWeekBackground()
public Font getDayOfMonthFont()
setDayOfMonthFont(java.awt.Font)
public void setDayOfMonthFont(Font font)
font
- The day-of-month font.getDayOfMonthFont()
public Color getDayOfMonthForeground()
setDayOfMonthForeground(java.awt.Color)
public void setDayOfMonthForeground(Color color)
color
- The day-of-month foreground color.getDayOfMonthForeground()
public Color getWeekendBackground()
setWeekendBackground(java.awt.Color)
public void setWeekendBackground(Color color)
color
- The weekend background color.getWeekendBackground()
public void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- The graphics context.public static String computeDisplayedLabel(String label, FontMetrics fm, int width)
label
- The string.fm
- The metrics of the font that will be used to display the string.width
- The width available to display the string.public String getToolTipText(MouseEvent event)
setToolTipText
method is returned.getToolTipText
in class JComponent
event
- The mouse event that caused the ToolTipManager
to show
the tooltip.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.