ilog.views.gantt.graphic.renderer
Class IlvActivityCompositeRenderer

java.lang.Object
  extended by ilog.views.gantt.graphic.renderer.IlvActivityCompositeRenderer
All Implemented Interfaces:
IlvActivityRenderer
Direct Known Subclasses:
IlvActivitySummary

public class IlvActivityCompositeRenderer
extends Object
implements IlvActivityRenderer

An IlvActivityCompositeRenderer is a renderer composed of zero, one, or more child activity renderers. The various child renderers are called successively to render the activity graphic.


Constructor Summary
IlvActivityCompositeRenderer()
          Creates a new IlvActivityCompositeRenderer containing no child renderers.
 
Method Summary
 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.
 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 rectangle in which the activity graphic should be drawn.
 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 renderer.
 String getPopupMenuName()
          This method is called by an activity graphic to return the name of the Swing popup menu.
 IlvActivityRenderer getRenderer(int index)
          Returns the child activity renderer at the specified index in the composite renderer.
 IlvActivityRenderer getRendererAt(int index)
          Deprecated. Beginning with ILOG JViews 6.0, you should use the getRenderer(int) method instead.
protected  IlvActivityRenderer getRendererContaining(IlvActivityGraphic ag, IlvPoint p)
          Deprecated. Beginning with ILOG JViews 6.0 you should use the getRendererContaining(IlvActivityGraphic,IlvPoint,IlvPoint, IlvTransformer) method instead.
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)
          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.
 void setPopupMenuName(String popupName)
          Sets the Swing popup 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.
 void setRendererAt(IlvActivityRenderer renderer, int index)
          Deprecated. Beginning with ILOG JViews 6.0, you should use the setRenderer(int, ilog.views.gantt.graphic.renderer.IlvActivityRenderer) method instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvActivityCompositeRenderer

public IlvActivityCompositeRenderer()
Creates a new IlvActivityCompositeRenderer containing no child renderers.

Method Detail

getSize

public int getSize()
Returns the number of child renderers contained in the composite renderer.


getRendererAt

public IlvActivityRenderer getRendererAt(int index)
Deprecated. Beginning with ILOG JViews 6.0, you should use the getRenderer(int) method instead.

Returns the child activity renderer at the specified index in the composite renderer. If there is no defined renderer at the specified index, then null is returned.

Parameters:
index - The index of the child renderer.
Throws:
IndexOutOfBoundsException - if index < 0 || index >= getSize().

getRenderer

public IlvActivityRenderer getRenderer(int index)
Returns the child activity renderer at the specified index in the composite renderer. If there is no defined renderer at the specified index or index >= getSize(), then null is returned.

Parameters:
index - The index of the child renderer.
Throws:
IndexOutOfBoundsException - if index < 0.
Since:
JViews 5.5

addRenderer

public void addRenderer(IlvActivityRenderer renderer)
Appends an activity renderer to the list of child renderers.

Parameters:
renderer - The activity renderer to be appended.

insertRendererAt

public void insertRendererAt(IlvActivityRenderer renderer,
                             int index)
Inserts an activity renderer at the specified index in the list of child renderers. The child renderer at that position and all subsequent renderers are shifted to the right, having their indices incremented.

Parameters:
renderer - The activity renderer to be inserted.
index - The index at which to insert the child renderer.
Throws:
IndexOutOfBoundsException - if index < 0 || index > getSize().

setRendererAt

public void setRendererAt(IlvActivityRenderer renderer,
                          int index)
Deprecated. Beginning with ILOG JViews 6.0, you should use the setRenderer(int, ilog.views.gantt.graphic.renderer.IlvActivityRenderer) method instead.

Sets an activity renderer at the specified index in the list of child renderers. The old renderer at this position will be removed.

Parameters:
renderer - The activity renderer to be set.
index - The index at which the renderer should be set.
Throws:
IndexOutOfBoundsException - if index < 0 || index >= getSize().

setRenderer

public void setRenderer(int index,
                        IlvActivityRenderer renderer)
Sets an activity renderer at the specified index in the list of child renderers. The old renderer at this position will be removed. If the position is greater than the last renderer position, null renderers are added in between.

Parameters:
index - The index at which the renderer should be set.
renderer - The activity renderer to be set.
Throws:
IndexOutOfBoundsException - if index < 0.
Since:
JViews 5.5

getBounds

public IlvRect getBounds(IlvActivityGraphic ag,
                         IlvTransformer t)
Returns the rectangle in which the activity graphic should be drawn. This implementation calls the getBounds method of each individual renderer contained in the composite and merges the results into a single rectangle.

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

draw

public void draw(Graphics dst,
                 IlvActivityGraphic ag,
                 IlvTransformer t)
This method is called by an activity graphic to render itself. This implementation successively calls each IlvActivityRenderer instance contained in the composite to render the activity graphic.

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 method is implemented to return true if any of the composite renderer's children return true to the same query.

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

getRendererContaining

protected IlvActivityRenderer getRendererContaining(IlvActivityGraphic ag,
                                                    IlvPoint p)
Deprecated. Beginning with ILOG JViews 6.0 you should use the getRendererContaining(IlvActivityGraphic,IlvPoint,IlvPoint, IlvTransformer) method instead.

Returns which of the composite renderer's children contains the point specified in world coordinates. Returns null if the point is not contained by any of the child renderers.

Parameters:
ag - The activity graphic.
p - The point in world coordinates.
Since:
JViews 3.5

getRendererContaining

protected IlvActivityRenderer getRendererContaining(IlvActivityGraphic ag,
                                                    IlvPoint p,
                                                    IlvPoint tp,
                                                    IlvTransformer t)
Returns which of the child composite renderers contains the specified point. This method returns null if the point is not contained by any of the child renderers.

Parameters:
ag - The activity graphic.
p - The point in world coordinates.
tp - The point p transformed.
t - The transformer.
Returns:
The child renderer at location p if there is one. Otherwise this method returns null.
Since:
JViews 6.0

getToolTipText

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

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

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 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 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 tooltip 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:
IlvActivityGraphic.getPopupMenu(IlvPoint,IlvTransformer,IlvManagerView, IlvPopupMenuManager)

setPopupMenuName

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

This is an alternative way to set 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 composite 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 composite 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. 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(java.lang.String)


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