public class IlvActivityGraphicRenderer extends Object implements IlvActivityRenderer
IlvActivityGraphicRenderer
is an IlvActivityRenderer
implementation that renders activities, or parts of activities, by
delegating to an IlvGraphic
object.
An instance of this renderer can render an entire activity, or
the part of an activity between the times designated by the
getStartTimeProperty()
and getEndTimeProperty()
properties. Rendering can also be invisible, depending on
the getVisibilityProperty
property.
An instance of this renderer can be used for multiple activities or parts
thereof. This can only happen when the rendering can be done using the same
type of IlvGraphic
, with only parameters changed to match the
activity. See prepareGraphic(IlvActivityGraphic, IlvTransformer)
, and
draw(Graphics, IlvActivityGraphic, IlvTransformer)
for more information.
Constructor and Description |
---|
IlvActivityGraphicRenderer(IlvGraphic graphic)
Creates an
IlvActivityGraphicRenderer by using a given
IlvGraphic . |
Modifier and Type | Method and Description |
---|---|
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. |
protected void |
endProcessing(IlvActivityGraphic ag)
Ends the processing of an activity graphic.
|
int |
getBaseTextDirection()
Returns the base text direction for text that is drawn through this
renderer.
|
double |
getBottomMargin()
Gets the bottom margin of the renderer with respect to the definition
rectangle of the activity graphic.
|
IlvRect |
getBounds(IlvActivityGraphic ag,
IlvTransformer t)
Returns the bounding rectangle of the drawing performed by this renderer
for the given activity graphic.
|
IlvRect |
getDefinitionRect(IlvActivityGraphic ag,
IlvTransformer t)
Returns the definition rectangle for the activity graphic for this renderer.
|
Date |
getEndTime(IlvActivityGraphic ag)
Returns the time point that defines the end of the rendering of this
renderer for the given activity graphic.
|
String |
getEndTimeProperty()
Returns the name of the activity property which determines where the
rendering drawn by this renderer ends.
|
IlvGraphic |
getGraphic()
Returns the
IlvGraphic used to render activities. |
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 object. |
String |
getPopupMenuName()
This method is called by an
activity graphic to return
the name of the Swing pop-up menu. |
Date |
getStartTime(IlvActivityGraphic ag)
Returns the time point that defines the start of the rendering of this
renderer for the given activity graphic.
|
String |
getStartTimeProperty()
Returns the name of the activity property which determines where the
rendering drawn by this renderer starts.
|
String |
getToolTipText()
Returns the tooltip text for the renderer that was set by calling the
setToolTipText(java.lang.String) method. |
String |
getToolTipText(IlvActivityGraphic ag,
IlvPoint p,
IlvTransformer t)
This method is called by an
activity graphic
to return tooltip text for itself. |
double |
getTopMargin()
Gets the top margin of the renderer with respect to the definition
rectangle of the activity graphic.
|
String |
getVisibilityProperty()
Returns the name of the activity property that determines whether the
rendering drawn by this renderer is present.
|
boolean |
isPropertyEditable(String property)
Specifies if a given time property of an activity of type
IlvPropertyHolderActivity is editable by the user. |
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)
called by an
activity graphic to create and
return a selection object for itself. |
protected IlvGraphic |
prepareGraphic(IlvActivityGraphic ag,
IlvTransformer t)
Prepares the underlying graphic for drawing by setting its visibility.
|
protected void |
prepareGraphicVisibility(IlvActivityGraphic ag)
Prepares the visibility of the underlying graphic according to the
visibility property.
|
void |
setBackground(Color bg)
Sets the background color of the underlying graphic object.
|
void |
setBaseTextDirection(int btd)
Sets the base text direction for text that is drawn through this
renderer.
|
void |
setBottomMargin(double margin)
Sets the bottom margin of the renderer with respect to the definition
rectangle of the activity graphic.
|
void |
setEndTimeProperty(String property)
Sets the name of the activity property which determines where the
rendering drawn by this renderer ends.
|
void |
setForeground(Color fg)
Sets the foreground color of the underlying graphic object.
|
void |
setGraphic(IlvGraphic graphic)
Sets the
IlvGraphic used to render activities. |
void |
setPopupMenu(JPopupMenu popup)
Sets the Swing pop-up menu of this renderer.
|
void |
setPopupMenuName(String popupName)
Sets the Swing pop-up menu of this activity graphic renderer by name.
|
void |
setStartTimeProperty(String property)
Sets the name of the activity property used to determine the start of
the rendering drawn by this renderer.
|
void |
setToolTipText(String text)
Sets the tooltip text for the activity renderer.
|
void |
setTopMargin(double margin)
Sets the top margin of the renderer with respect to the definition
rectangle of the activity graphic.
|
void |
setVisibilityProperty(String property)
Sets the name of the activity property that determines whether the
rendering drawn by this renderer is present.
|
protected void |
startProcessing(IlvActivityGraphic ag)
Starts processing an activity graphic.
|
public IlvActivityGraphicRenderer(IlvGraphic graphic)
IlvActivityGraphicRenderer
by using a given
IlvGraphic
.graphic
- The IlvGraphic
used to render activities.public IlvGraphic getGraphic()
IlvGraphic
used to render activities.setGraphic(ilog.views.IlvGraphic)
public void setGraphic(IlvGraphic graphic)
IlvGraphic
used to render activities. Note that the
foreground and background colors of the old graphic are not copied to the
new one.graphic
- The new IlvGraphic
.getGraphic()
public final String getVisibilityProperty()
IlvPropertyHolderActivity
.
For example, an IlvGeneralActivity
or an IlvTableActivity
object. The value of the property should be a Boolean
. For all
other activity types, this property is not applied and the rendering will
always be visible.null
.public void setVisibilityProperty(String property)
IlvPropertyHolderActivity
. For example,
an IlvGeneralActivity
or an IlvTableActivity
object.
The value of this property should be a Boolean
. For all other
activity types, this property is not applied and the rendering will always
be visible.
The default value of this property is null
. This denotes that
there is no particular constraint on visibility.
property
- The name of the activity property.public final String getStartTimeProperty()
IlvPropertyHolderActivity
. For example, an
IlvGeneralActivity
or an IlvTableActivity
object. The
value of the property should be a Date
. For all other activity
types, this property is not applied and rendering will start at the
start of the activity. See IlvActivity.getStartTime()
for more
information.null
.setStartTimeProperty(String)
public void setStartTimeProperty(String property)
IlvPropertyHolderActivity
.
For example, an IlvGeneralActivity
or an IlvTableActivity
object.
The value of this property should be a Date
. For all other
activity types, this property is not applied and the rendering will start
at the start of the activity (see IlvActivity.getStartTime()
).
Normally, this activity property name should be listed with the property names
returned by activity.getTimeProperties()
. If it is not, the
rendering drawn by this renderer may lie outside the area allocated by the
activity layout.
The default value is null
, which denotes the start of the
activity (see IlvActivity.getStartTime()
. For
activities of type IlvPropertyHolderActivity
, this is equivalent to
the property IlvPropertyHolderActivity.START_TIME_PROPERTY
.
property
- The name of the activity property.getStartTimeProperty()
,
isPropertyEditable(String)
public final String getEndTimeProperty()
IlvPropertyHolderActivity
.
For example, an IlvGeneralActivity
or an IlvTableActivity
object.
The value of this property should be a Date
. For all other
activity types, this property is not applied and the rendering will finish
at the end of the activity (see IlvActivity.getEndTime()
).null
.setEndTimeProperty(String)
public void setEndTimeProperty(String property)
IlvPropertyHolderActivity
object.
For example, an IlvGeneralActivity
or an IlvTableActivity
object. The value of the property should be a Date
.
For all other activity types, this
property is not applied and the rendering will end when the
activity finishes. See IlvActivity.getEndTime()
for more information.
This activity property name should be among the property names
returned by activity.getTimeProperties()
. If it is not, the
rendering drawn by this renderer may lie outside the area allocated by the
activity layout.
The default value is null
, which denotes the end of the
activity (see IlvActivity.getEndTime()
. For
activities of type IlvPropertyHolderActivity
, this is equivalent to
the property IlvPropertyHolderActivity.END_TIME_PROPERTY
.
property
- The name of the activity property.getEndTimeProperty()
,
isPropertyEditable(String)
public void setForeground(Color fg)
fg
- The new color.public void setBackground(Color bg)
bg
- The new color.public double getTopMargin()
setTopMargin(double)
,
getBottomMargin()
,
getBottomMargin()
public void setTopMargin(double margin)
margin
- The new proportional top margin. The value is
proportional to the height of the activity graphic. Therefore, it must be
enclosed in the [0.0 1.0] range.getTopMargin()
,
getBottomMargin()
,
setBottomMargin(double)
public double getBottomMargin()
getTopMargin()
,
setTopMargin(double)
,
setBottomMargin(double)
public void setBottomMargin(double margin)
margin
- The new proportional bottom margin. The value is
proportional to the height of the activity graphic, so the value must
be enclosed in the [0.0 1.0] range.getBottomMargin()
,
getTopMargin()
,
setTopMargin(double)
public final int getBaseTextDirection()
The base text direction influences the display of text strings that are composed of segments that are read from left to right as well as of segments that are read from right to left. It determines the order of these segments.
IlvBidiUtil.COMPONENT_DIRECTION
,
IlvBidiUtil.CONTEXTUAL_DIRECTION
,
IlvBidiUtil.LEFT_TO_RIGHT
,
IlvBidiUtil.RIGHT_TO_LEFT
,
IlvBidiUtil.INHERITED_DIRECTION
.setBaseTextDirection(int)
public void setBaseTextDirection(int btd)
The base text direction influences the display of text strings that are composed of segments that are read from left to right as well as of segments that are read from right to left. It determines the order of these segments.
Possible values are:
IlvBidiUtil.COMPONENT_DIRECTION
,
IlvBidiUtil.CONTEXTUAL_DIRECTION
,
IlvBidiUtil.LEFT_TO_RIGHT
, IlvBidiUtil.RIGHT_TO_LEFT
,
and IlvBidiUtil.INHERITED_DIRECTION
.
btd
- The base text direction.getBaseTextDirection()
,
IlvGraphic.setBaseTextDirection(int)
public String getToolTipText()
setToolTipText(java.lang.String)
method. If the text is not null
,
this will be the text displayed in the activity graphic's tooltip.setToolTipText(java.lang.String)
,
getToolTipText(IlvActivityGraphic,IlvPoint,IlvTransformer)
public void setToolTipText(String text)
text
- The tooltip text. If null
, the activity
graphic will display the
tooltip text
of the renderer's underlying graphic
.getToolTipText()
,
getToolTipText(IlvActivityGraphic,IlvPoint,IlvTransformer)
public Date getStartTime(IlvActivityGraphic ag)
If the activity is of type IlvPropertyHolderActivity
, such as an
IlvGeneralActivity
or an IlvTableActivity
, this method
returns the value of the getStartTimeProperty()
activity property.
If not, the start time
for the activity is
returned.
ag
- The activity graphic.ag
.getStartTimeProperty()
,
IlvActivity.getStartTime()
public Date getEndTime(IlvActivityGraphic ag)
If the activity is of type IlvPropertyHolderActivity
, such as an
IlvGeneralActivity
or an IlvTableActivity
, this method
returns the value of the getEndTimeProperty()
activity property.
If not the end time
for the activity is
returned.
ag
- The activity graphic.ag
.getEndTimeProperty()
,
IlvActivity.getEndTime()
protected void startProcessing(IlvActivityGraphic ag)
Calls to startProcessing
and endProcessing
must
occur in pairs:
startProcessing(ag); try { ... do something ... } finally { endProcessing(ag); }
endProcessing(IlvActivityGraphic)
protected void endProcessing(IlvActivityGraphic ag)
startProcessing
and endProcessing
must
occur in pairs.startProcessing(IlvActivityGraphic)
protected void prepareGraphicVisibility(IlvActivityGraphic ag)
ag
- The graphic to prepare.getVisibilityProperty()
public IlvRect getDefinitionRect(IlvActivityGraphic ag, IlvTransformer t)
transformer
.
The definition rectangle for this renderer has:
getStartTime(IlvActivityGraphic)
.getEndTime(IlvActivityGraphic)
.
The bounding box
and
rendering area for the activity graphic may be smaller or larger than the
definition rectangle.
This adjustment can be made in the getBounds(ilog.views.gantt.graphic.IlvActivityGraphic, ilog.views.IlvTransformer)
method and is
usually due to margin insets, labels, or symbols that extend past
the activity end times, and so on.
This method is typically used when you define a custom
activity render
. The
getBounds
method used for the renderer would look
something like:
public IlvRect getBounds(IlvActivityGraphic ag, IlvTransformer t) { IlvRect viewBox = getDefinitionRect(ag, t); ... make adjustments to box in view coordinates ... return viewBox; }
ag
- The activity graphic.t
- The transformer.IlvActivityGraphic.getDefinitionRect()
,
getStartTime(IlvActivityGraphic)
,
getEndTime(IlvActivityGraphic)
,
getBounds(IlvActivityGraphic, IlvTransformer)
public IlvRect getBounds(IlvActivityGraphic ag, IlvTransformer t)
The results of this
method are used by the
prepareGraphic
method to position the underlying graphic
prior to drawing, and to manage redraw regions. This implementation
applies the transformer to the definitionRect
of the activity graphic, while taking the top and bottom margins of the renderer into
account. This defines a bounding box whose x dimensions are specified by
the time interval of the activity, and whose y dimensions are specified by
the activity layout algorithm.
You can override this method for two purposes:
transformer currently set on the Gantt sheet
.
This is to ensure that the sheet prints correctly when t
is different than the Gantt sheet transformer used for the screen display.
For example, if you want to modify the x position of the
bounding box of a graphic based upon a Date
value, avoid code
like this:
rect.x = ganttSheet.getPosition(aDate);
Use this instead:
IlvTimeConverter timeConverter = ag.getGanttRow().getTimeConverter(); rect.x = IlvTimeScrollUtil.getPosition(aDate, timeConverter, t);
Note: the IlvActivityCompositeGraphicRenderer
subclass has different methods that should be overridden if you want to
modify the position and sizing of the graphic.
getBounds
in interface IlvActivityRenderer
ag
- The activity graphic.t
- The transformer.protected IlvGraphic prepareGraphic(IlvActivityGraphic ag, IlvTransformer t)
bounds
of the renderer.ag
- The activity graphic holding the position where the presentation
should be drawn.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
is returned.public void draw(Graphics dst, IlvActivityGraphic ag, IlvTransformer t)
activity
graphic
to render itself.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.
Subclasses should override this method as needed.isRelayoutNeeded
in interface IlvActivityRenderer
ag
- The activity graphic that is affected by the event.evt
- The activity event.true
if the
value of getVisibilityProperty()
,
getStartTimeProperty()
, or getEndTimeProperty()
has changed.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
.
Subclasses should override this method as needed.isRedrawNeeded
in interface IlvActivityRenderer
ag
- The activity graphic that is affected by the event.evt
- The activity event.false
.@Deprecated public boolean isRedrawNeeded(ActivityEvent evt)
isRedrawNeeded(IlvActivityGraphic, ActivityEvent)
should be implemented and used instead of this one.activity graphic
to
determine if it 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
. This default implementation always returns false
.evt
- The activity event.public boolean isPropertyEditable(String property)
IlvPropertyHolderActivity
is editable by the user.
This method can be overridden using subclasses.
property
- Set to thevalue of getStartTimeProperty()
,
or getEndTimeProperty()
.
Do not set this parameter to null
.true
is returned. This default implementation
always returns true
.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.isPropertyEditable(String)
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
.public String getToolTipText(IlvActivityGraphic ag, IlvPoint p, IlvTransformer t)
activity graphic
to return tooltip text for itself. If you have set a tooltip by calling the
setToolTipText(java.lang.String)
method, then that text is returned. Otherwise,
this default implementation returns the
tooltip text
from the renderer's underlying graphic
.getToolTipText
in interface IlvActivityRenderer
ag
- The activity graphic.p
- The location of the mouse (in view coordinates).t
- The transformer.public void setPopupMenu(JPopupMenu popup)
Pop-up menus for Rogue Wave JViews activity graphic renderers will work only
if you enable the pop-up menu mechanism for the Gantt sheet view by
calling the method
IlvGanttSheet.setPopupMenusEnabled(boolean)
.
For performance reasons, it is strongly recommended that activity graphic renderers share the same pop-up menu whenever possible.
popup
- The Swing pop-up menu to be used for this activity graphic
renderer. If popup
is null
, the
pop-up menu is turned off for this activity graphic renderer.IlvPopupMenuManager
,
setPopupMenuName(String)
,
getPopupMenu(IlvActivityGraphic, IlvPoint, IlvTransformer,
IlvManagerView, IlvPopupMenuManager)
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 object. If you have set a pop-up menu by calling the
setPopupMenu(javax.swing.JPopupMenu)
method, then that pop-up menu is returned. Otherwise,
this default implementation returns the
pop-up menu
from the underlying graphic
of the 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
.IlvGraphic.getPopupMenu()
public void setPopupMenuName(String popupName)
This is an alternative way of setting 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 graphic 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 graphic 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. Otherwise, this default implementation returns the
pop-up menu name
from ther underlying graphic
of the renderer.
This method can return null
.getPopupMenuName
in interface IlvActivityRenderer
null
.IlvActivityGraphic.getPopupMenu(IlvPoint, IlvTransformer,
IlvManagerView, IlvPopupMenuManager)
,
setPopupMenuName(String)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.