ilog.views.gantt.graphic.renderer
Class IlvActivityGraphicRenderer

java.lang.Object
  extended by ilog.views.gantt.graphic.renderer.IlvActivityGraphicRenderer
All Implemented Interfaces:
IlvActivityRenderer
Direct Known Subclasses:
IlvActivityCompositeGraphicRenderer, IlvBasicActivityBar, IlvBasicActivityLabel, IlvBasicActivitySymbol

public class IlvActivityGraphicRenderer
extends Object
implements IlvActivityRenderer

An IlvActivityGraphicRenderer is an IlvActivityRenderer implementation that renders activities by delegating to an IlvGraphic.


Constructor Summary
IlvActivityGraphicRenderer(IlvGraphic graphic)
          Creates an IlvActivityGraphicRenderer by using a given IlvGraphic.
 
Method Summary
 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.
 void draw(Graphics dst, IlvActivityGraphic ag, IlvTransformer t)
          This method is called by an activity graphic to render itself.
 float 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 rectangle in which the activity graphic should be drawn.
 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 popup menu to display when the popup 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 popup menu.
 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.
 float getTopMargin()
          Gets the top margin of the renderer with respect to the definition rectangle of the activity graphic.
 boolean isRedrawNeeded(ActivityEvent evt)
          This method is called by an activity graphic to determine if it should redraw itself 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.
protected  IlvGraphic prepareGraphic(IlvActivityGraphic ag, IlvTransformer t)
          Prepares the underlying graphic for drawing by resizing and positioning it according to the renderer's bounds.
 void setBackground(Color bg)
          Sets the background color of the underlying graphic object.
 void setBottomMargin(float margin)
          Sets the bottom margin of the renderer with respect to the definition rectangle of the activity graphic.
 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 popup menu of this renderer.
 void setPopupMenuName(String popupName)
          Sets the Swing popup menu of this activity graphic renderer by name.
 void setToolTipText(String text)
          Sets the tooltip text for the activity renderer.
 void setTopMargin(float margin)
          Sets the top margin of the renderer with respect to the definition rectangle of the activity graphic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvActivityGraphicRenderer

public IlvActivityGraphicRenderer(IlvGraphic graphic)
Creates an IlvActivityGraphicRenderer by using a given IlvGraphic.

Parameters:
graphic - The IlvGraphic used to render activities.
Method Detail

getGraphic

public IlvGraphic getGraphic()
Returns the IlvGraphic used to render activities.

Returns:
The graphic object.
See Also:
setGraphic(ilog.views.IlvGraphic)

setGraphic

public void setGraphic(IlvGraphic graphic)
Sets the IlvGraphic used to render activities. Note that the foreground and background colors of the old graphic are not copied to the new one.

Parameters:
graphic - The new IlvGraphic.
See Also:
getGraphic()

setForeground

public void setForeground(Color fg)
Sets the foreground color of the underlying graphic object. Note that not all graphic objects have a foreground color. Therefore, a call to this method may not do anything.

Parameters:
fg - The new color.

setBackground

public void setBackground(Color bg)
Sets the background color of the underlying graphic object. Note that not all graphic objects have a background color. Therefore, a call to this method may not do anything.

Parameters:
bg - The new color.

getTopMargin

public float getTopMargin()
Gets the top margin of the renderer with respect to the definition rectangle of the activity graphic.

Returns:
The proportional top margin.
See Also:
setTopMargin(float), getBottomMargin(), getBottomMargin()

setTopMargin

public void setTopMargin(float margin)
Sets the top margin of the renderer with respect to the definition rectangle of the activity graphic.

Parameters:
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.
See Also:
getTopMargin(), getBottomMargin(), setBottomMargin(float)

getBottomMargin

public float getBottomMargin()
Gets the bottom margin of the renderer with respect to the definition rectangle of the activity graphic.

Returns:
The proportional bottom margin.
See Also:
getTopMargin(), setTopMargin(float), setBottomMargin(float)

setBottomMargin

public void setBottomMargin(float margin)
Sets the bottom margin of the renderer with respect to the definition rectangle of the activity graphic.

Parameters:
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.
See Also:
getBottomMargin(), getTopMargin(), setTopMargin(float)

getToolTipText

public String getToolTipText()
Returns the tooltip text for the renderer that was set by calling the setToolTipText(java.lang.String) method. If the text is not null, this will be the text displayed in the activity graphic's tooltip.

Returns:
The tooltip text.
Since:
JViews 5.5
See Also:
setToolTipText(java.lang.String), getToolTipText(IlvActivityGraphic,IlvPoint,IlvTransformer)

setToolTipText

public void setToolTipText(String text)
Sets the tooltip text for the activity renderer.

Parameters:
text - The tooltip text. If null, the activity graphic will display the tooltip text of the renderer's underlying graphic.
Since:
JViews 5.5
See Also:
getToolTipText(), getToolTipText(IlvActivityGraphic,IlvPoint,IlvTransformer)

getBounds

public IlvRect getBounds(IlvActivityGraphic ag,
                         IlvTransformer t)
Returns the rectangle in which the activity graphic should be drawn. This implementation applies the transformer to the definitionRect of the activity graphic, while taking the top and bottom margins of the renderer into account.

Specified by:
getBounds in interface IlvActivityRenderer
Parameters:
ag - The activity graphic.
t - The transformer.
Returns:
The bounding box.

contains

public 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.

Specified by:
contains in interface IlvActivityRenderer
Parameters:
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.
Returns:
true if the point lies inside this activity graphic.
Since:
JViews 8.1

prepareGraphic

protected IlvGraphic prepareGraphic(IlvActivityGraphic ag,
                                    IlvTransformer t)
Prepares the underlying graphic for drawing by resizing and positioning it according to the renderer's bounds.

Parameters:
ag - The activity graphic holding the position where the presentation should be drawn.
t - The transformer.
Returns:
The prepared underlying graphic.
Since:
JViews 3.5

draw

public void draw(Graphics dst,
                 IlvActivityGraphic ag,
                 IlvTransformer t)
This method is called by an activity graphic to render itself.

Specified by:
draw in interface IlvActivityRenderer
Parameters:
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.

isRedrawNeeded

public boolean isRedrawNeeded(ActivityEvent evt)
This method is called by an activity graphic to determine if it should redraw itself as a result of the specified activity event. This default implementation always returns false. Subclasses should override this method as needed.

Specified by:
isRedrawNeeded in interface IlvActivityRenderer
Parameters:
evt - The activity event.
Returns:
Whether the activity graphic should redraw based upon the specified activity change.

makeSelection

public IlvSelection makeSelection(IlvActivityGraphic g)
This method is called by an activity graphic to create and return a selection object for itself. This default implementation returns an IlvActivityGraphicSelection instance.

Note, that the selection object must be compatible with all activity renderer implementations in use, not just 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 returned by this implementation is generic and is compatible with all renderer implementations.

Specified by:
makeSelection in interface IlvActivityRenderer
Parameters:
g - The activity graphic.
Returns:
The selection object.
Since:
JViews 3.5

getToolTipText

public String getToolTipText(IlvActivityGraphic ag,
                             IlvPoint p,
                             IlvTransformer t)
This method is called by an 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.

Specified by:
getToolTipText in interface IlvActivityRenderer
Parameters:
ag - The activity graphic.
p - The location of the mouse (in view coordinates).
t - The transformer.
Returns:
The tooltip text.
Since:
JViews 3.5

setPopupMenu

public void setPopupMenu(JPopupMenu popup)
Sets the Swing popup menu of this renderer.

Popup menus for ILOG JViews activity graphic renderers will work only if you enable the popup 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 popup menu whenever possible.

Parameters:
popup - The Swing popup menu to be used for this activity graphic renderer. If popup is null, the popup menu is turned off for this activity graphic renderer.
Since:
JViews 7.5
See Also:
IlvPopupMenuManager, setPopupMenuName(String), getPopupMenu(IlvActivityGraphic, IlvPoint, IlvTransformer, IlvManagerView, IlvPopupMenuManager)

getPopupMenu

public JPopupMenu getPopupMenu(IlvActivityGraphic ag,
                               IlvPoint p,
                               IlvTransformer t,
                               IlvManagerView view,
                               IlvPopupMenuManager popupManager)
This method is called by an activity graphic to return the Swing popup menu to display when the popup is triggered while the mouse pointer is at a specified location inside the activity graphic object. If you have set a popup menu by calling the setPopupMenu(javax.swing.JPopupMenu) method, then that popup menu is returned. Otherwise, this default implementation returns the popup menu from the underlying graphic of the renderer.

This method can return null to turn off the popup menu for this activity graphic object.

Note that you must enable the popup menu mechanism for the manager view by calling the method IlvGanttSheet.setPopupMenusEnabled(boolean)

Specified by:
getPopupMenu in interface IlvActivityRenderer
Parameters:
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 tool tip is about to be displayed (the view coordinates).
view - The manager view that triggered the popup menu.
popupManager - The popup menu manager.
Returns:
The Swing popup menu, which can be null.
Since:
JViews 7.5
See Also:
IlvGraphic.getPopupMenu()

setPopupMenuName

public void setPopupMenuName(String popupName)
Sets the Swing popup menu of this activity graphic renderer by name.

This is an alternative way of setting the popup menu of this renderer. You need to register a Swing popup menu for the name through IlvPopupMenuManager.registerMenu(String, JPopupMenu) and use the name to specify the popup menu of this activity graphic renderer. Popup menus for ILOG 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 popup menu mechanism for the Gantt sheet view by calling the method IlvGanttSheet.setPopupMenusEnabled(boolean).

Parameters:
popupName - The name of the registered Swing popup menu to be used for this activity graphic renderer. If popupName is null, the popup menu is turned off for this activity graphic renderer.
Since:
JViews 7.5
See Also:
IlvPopupMenuManager, getPopupMenuName()

getPopupMenuName

public String getPopupMenuName()
This method is called by an activity graphic to return the name of the Swing popup menu. If you have set a popup menu name by calling the setPopupMenuName(java.lang.String) method, then that popup menu name is returned. Otherwise, this default implementation returns the popup menu name from ther underlying graphic of the renderer. This method can return null.

Specified by:
getPopupMenuName in interface IlvActivityRenderer
Returns:
The name of the Swing popup menu, which can be null.
Since:
JViews 7.5
See Also:
IlvActivityGraphic.getPopupMenu(IlvPoint, IlvTransformer, IlvManagerView, IlvPopupMenuManager), setPopupMenuName(String)


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