public class IlvActivityCompositeRenderer extends Object implements IlvActivityRenderer
IlvActivityCompositeRenderer
is a renderer composed of zero,
one, or more child activity renderers
.
The child renderers are called successively to render the activity graphic.
An instance of this renderer can be used for multiple activities or parts thereof. This is provided that their rendering can be done with the same structure, that is, the same number of bars and kinds of decorations with only the parameters and visibility being changed according to the activity.
Constructor and Description |
---|
IlvActivityCompositeRenderer()
Creates a new
IlvActivityCompositeRenderer containing no child
renderers. |
Modifier and Type | Method and Description |
---|---|
void |
addRenderer(IlvActivityRenderer renderer)
Appends an activity renderer to the list of child renderers.
|
boolean |
contains(IlvActivityGraphic ag,
IlvPoint p,
IlvPoint tp,
IlvTransformer t)
This method is called by an
activity graphic to
test whether a point lies within its boundaries. |
IlvSelection |
createSelection(IlvActivityGraphic g,
String[] properties)
Creates a new selection object for the specified activity graphic.
|
void |
draw(Graphics dst,
IlvActivityGraphic ag,
IlvTransformer t)
This method is called by an
activity graphic to
render itself. |
IlvRect |
getBounds(IlvActivityGraphic ag,
IlvTransformer t)
Returns the bounding rectangle of the activity graphic.
|
JPopupMenu |
getPopupMenu(IlvActivityGraphic ag,
IlvPoint p,
IlvTransformer t,
IlvManagerView view,
IlvPopupMenuManager popupManager)
This method is called by an
activity graphic
to return the Swing pop-up menu to display when the pop-up is triggered while the mouse
pointer is at a specified location inside the activity graphic renderer. |
String |
getPopupMenuName()
This method is called by an
activity graphic
to return the name of the Swing pop-up menu. |
IlvActivityRenderer |
getRenderer(int index)
Returns the child activity renderer at the specified index in the composite renderer.
|
protected IlvActivityRenderer |
getRendererContaining(IlvActivityGraphic ag,
IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Returns which of the child composite renderers contains the specified point.
|
int |
getSize()
Returns the number of child renderers contained in the composite renderer.
|
String |
getToolTipText(IlvActivityGraphic ag,
IlvPoint p,
IlvTransformer t)
This method is called by an
activity
graphic to return tooltip text for itself. |
void |
insertRendererAt(IlvActivityRenderer renderer,
int index)
Inserts an activity renderer at the specified index in the list of child renderers.
|
boolean |
isRedrawNeeded(ActivityEvent evt)
Deprecated.
Since JViews 8.5, the method
isRedrawNeeded(IlvActivityGraphic, ActivityEvent)
should be implemented and used instead of this one. |
boolean |
isRedrawNeeded(IlvActivityGraphic ag,
ActivityEvent evt)
This method is called by an
activity graphic to
determine if the graphic should redraw itself as a result of the specified activity
event, that is, in situations when isRelayoutNeeded(ilog.views.gantt.graphic.IlvActivityGraphic, ilog.views.gantt.event.ActivityEvent) returned
false . |
boolean |
isRelayoutNeeded(IlvActivityGraphic ag,
ActivityEvent evt)
This method is called by an
activity graphic to
determine if its bounding box may have changed as a result of the
specified activity event. |
IlvSelection |
makeSelection(IlvActivityGraphic g)
This method is called by an
activity graphic
to create and return a selection object for itself. |
void |
setPopupMenuName(String popupName)
Sets the Swing pop-up menu of this activity composite renderer by name.
|
void |
setRenderer(int index,
IlvActivityRenderer renderer)
Sets an activity renderer at the specified index in the list of child renderers.
|
public IlvActivityCompositeRenderer()
IlvActivityCompositeRenderer
containing no child
renderers.public int getSize()
public IlvActivityRenderer getRenderer(int index)
index >=
getSize()
, then null
is returned.index
- The index of the child renderer.IndexOutOfBoundsException
- if index < 0
.public void addRenderer(IlvActivityRenderer renderer)
renderer
- The activity renderer to be appended.public void insertRendererAt(IlvActivityRenderer renderer, int index)
renderer
- The activity renderer to be inserted.index
- The index at which to insert the child renderer.IndexOutOfBoundsException
- if index < 0 || index >
getSize()
.public void setRenderer(int index, IlvActivityRenderer renderer)
null
renderers are added in between.index
- The index at which the renderer should be set.renderer
- The activity renderer to be set.IndexOutOfBoundsException
- if index < 0
.public IlvRect getBounds(IlvActivityGraphic ag, IlvTransformer t)
This method is called when the renderer needs to assign a bounding rectangle to the activity graphic.
This implementation calls the getBounds
method of each individual
renderer contained in the composite and merges the results into a single rectangle.
getBounds
in interface IlvActivityRenderer
ag
- The activity graphic.t
- The transformer.public boolean contains(IlvActivityGraphic ag, IlvPoint p, IlvPoint tp, IlvTransformer t)
activity graphic
to
test whether a point lies within its boundaries.contains
in interface IlvActivityRenderer
ag
- The activity graphic.p
- The point to be tested.tp
- The point p
transformed by the transformer t
.t
- The transformation used to draw the object.true
if the point lies inside this activity graphic.public void draw(Graphics dst, IlvActivityGraphic ag, IlvTransformer t)
activity graphic
to
render itself. This implementation successively calls each IlvActivityRenderer
instance contained in the composite to render the activity
graphic.draw
in interface IlvActivityRenderer
dst
- The destination into which the presentation will be drawn.ag
- The activity graphic holding the position where the presentation should be
drawn.t
- The transformer.public boolean isRelayoutNeeded(IlvActivityGraphic ag, ActivityEvent evt)
activity graphic
to
determine if its bounding box may have changed as a result of the
specified activity event.isRelayoutNeeded
in interface IlvActivityRenderer
ag
- The activity graphic affected by the event.evt
- The activity event.true
to the same query, true
is returned.public boolean isRedrawNeeded(IlvActivityGraphic ag, ActivityEvent evt)
activity graphic
to
determine if the graphic should redraw itself as a result of the specified activity
event, that is, in situations when isRelayoutNeeded(ilog.views.gantt.graphic.IlvActivityGraphic, ilog.views.gantt.event.ActivityEvent)
returned
false
.isRedrawNeeded
in interface IlvActivityRenderer
ag
- The activity graphic affected by the event.evt
- The activity event.true
to the same query, true
is returned.@Deprecated public boolean isRedrawNeeded(ActivityEvent evt)
isRedrawNeeded(IlvActivityGraphic, ActivityEvent)
should be implemented and used instead of this one.activity graphic
to
determine if the graphic should redraw itself as a result of the specified activity
event, that is, in situations when isRelayoutNeeded(ilog.views.gantt.graphic.IlvActivityGraphic, ilog.views.gantt.event.ActivityEvent)
returned
false
.evt
- The activity event.true
to the same query, true
is returned.public IlvSelection makeSelection(IlvActivityGraphic g)
activity graphic
to create and return a selection object for itself. This default implementation
determines the list of properties to be used as handles and invokes
the createSelection(IlvActivityGraphic, String[])
method.
Note: the selection object must be an instance of
IlvSelection
and of IlvActivitySelection
.
Note: the selection object must be compatible with
all activity renderer implementations in use, and not only the specific
renderer implementation that this method is invoked on. This is because
the renderer assigned to an activity graphic may change while the activity
graphic remains selected. The IlvActivityGraphicSelection
object
returned by this implementation is generic and is compatible with all
renderer implementations.
makeSelection
in interface IlvActivityRenderer
g
- The selected activity graphic.public IlvSelection createSelection(IlvActivityGraphic g, String[] properties)
Date
valued properties can be supplied as positions for displaying
the handles.
This method is called by makeSelection(IlvActivityGraphic)
.
The default implementation returns an IlvActivityGraphicSelection
instance.
Note: the selection object must be an instance of
IlvSelection
and of IlvActivitySelection
.
Note: the selection object must be compatible with
all activity renderer implementations in use, and not only the specific
renderer implementation that this method is invoked on. This is because
the renderer assigned to an activity graphic may change while the activity
graphic remains selected. The IlvActivityGraphicSelection
object
returned by this implementation is generic and is compatible with all
renderer implementations.
g
- The selected activity graphic.properties
- A list of Date
valued properties of the
activity, or null
.protected IlvActivityRenderer getRendererContaining(IlvActivityGraphic ag, IlvPoint p, IlvPoint tp, IlvTransformer t)
null
if the point is not contained by any of the child
renderers.ag
- The activity graphic.p
- The point in world coordinates.tp
- The point p
transformed.t
- The transformer.p
if there is one. Otherwise this
method returns null
.public String getToolTipText(IlvActivityGraphic ag, IlvPoint p, IlvTransformer t)
activity
graphic
to return tooltip text for itself. This implementation determines which
child renderer contains the specified mouse location and returns the value of the
child renderer's getToolTipText
method.getToolTipText
in interface IlvActivityRenderer
ag
- The activity graphic.p
- The location of the mouse (in view coordinates).t
- The transformer.public JPopupMenu getPopupMenu(IlvActivityGraphic ag, IlvPoint p, IlvTransformer t, IlvManagerView view, IlvPopupMenuManager popupManager)
activity graphic
to return the Swing pop-up menu to display when the pop-up is triggered while the mouse
pointer is at a specified location inside the activity graphic renderer. This
implementation determines which child renderer contains the specified mouse location
and returns the value of the getPopupMenu
method of the child renderer.
This method can return null
to turn off the pop-up menu for this activity
graphic object.
Note that you must enable the pop-up menu mechanism for the manager view by calling
the method IlvGanttSheet.setPopupMenusEnabled(boolean)
getPopupMenu
in interface IlvActivityRenderer
ag
- The activity graphic.p
- The location of the mouse (in view coordinates).t
- The transformer that converts the coordinate system of this
object (the manager coordinates) into the coordinate system of
the manager view in which the tooltip is about to be displayed
(the view coordinates).view
- The manager view that triggered the pop-up menu.popupManager
- The pop-up menu manager.null
.IlvActivityGraphic.getPopupMenu(IlvPoint,IlvTransformer,IlvManagerView,
IlvPopupMenuManager)
public void setPopupMenuName(String popupName)
This is an alternative way to set the pop-up menu of this renderer. You need to
register a Swing pop-up menu for the name through IlvPopupMenuManager.registerMenu(String,
JPopupMenu)
and use the name to specify the pop-up menu of this activity composite
renderer. Pop-up menus for Rogue Wave JViews activity graphic renderers will work only if
your manager view is contained in a hierarchy of Swing components. In addition, you
must enable the pop-up menu mechanism for the Gantt sheet view by calling the method
IlvGanttSheet.setPopupMenusEnabled(boolean)
.
popupName
- The name of the registered Swing pop-up menu to be used for this
activity composite renderer. If popupName
is
null
, the pop-up menu is turned off for this activity
graphic renderer.IlvPopupMenuManager
,
getPopupMenuName()
public String getPopupMenuName()
activity graphic
to return the name of the Swing pop-up menu. If you have set a pop-up menu name by
calling the setPopupMenuName(java.lang.String)
method, then that pop-up menu name is returned.
This method can return null
.getPopupMenuName
in interface IlvActivityRenderer
null
.IlvActivityGraphic.getPopupMenu(IlvPoint,IlvTransformer,IlvManagerView, IlvPopupMenuManager)
,
setPopupMenuName(java.lang.String)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.