ilog.views.gantt.graphic
Class IlvActivityGraphic

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.gantt.graphic.IlvActivityGraphic
All Implemented Interfaces:
IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvReservationGraphic

public class IlvActivityGraphic
extends IlvGraphic

The IlvActivityGraphic class is used to represent activities in an IlvGanttSheet. An IlvActivityGraphic is contained inside an IlvGanttRow object, which in turn is contained inside a special type of IlvManagerLayer. An IlvActivityGraphic delegates its rendering, bounding box, and makeSelection() operations to an IlvActivityRenderer. In this Flyweight pattern, renderer instances can be shared across multiple activity graphics, making global application of formatting possible.

See Also:
Serialized Form

Method Summary
 void applyTransform(IlvTransformer t)
          Overrides the applyTransform method of the IlvGraphic class so that it does nothing.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of this activity graphic.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests whether a point lies within the boundaries of the activity graphic.
 IlvGraphic copy()
          Overrides the copy method of the IlvGraphic class.
 void draw(Graphics dst, IlvTransformer t)
          Draws the activity graphic.
 IlvActivity getActivity()
          Gets the activity represented by the graphic.
 IlvActivityRenderer getActivityRenderer()
          Returns the activity renderer used to render this activity.
 float getDefinitionHeight()
          Returns the height of the activity graphic's definition rectangle, in world coordinates.
 IlvRect getDefinitionRect()
          Returns the activity graphic's definition rectangle, in world coordinates.
 IlvRect getDefinitionRect(IlvTransformer t)
          Returns the activity graphic's definition rectangle, transformed by the specified transformer.
 float getDefinitionWidth()
          Returns the width of the activity graphic's definition rectangle, in world coordinates.
 float getDefinitionX()
          Returns the x coordinate of the activity graphic's definition rectangle, in world coordinates.
 float getDefinitionY()
          Returns the y coordinate of the activity graphic's definition rectangle, in world coordinates.
 IlvGanttRow getGanttRow()
          Returns the Gantt row to which the activity graphic belongs.
 JPopupMenu getPopupMenu(IlvPoint p, IlvTransformer t, IlvManagerView view, IlvPopupMenuManager popupManager)
          Returns 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 getToolTipText(IlvPoint p, IlvTransformer t)
          Returns the tooltip text to display when the mouse pointer is at a specified location inside the activity graphic.
 boolean isVisible()
          Returns true if the object is visible.
 IlvSelection makeSelection()
          Creates and returns a selection object for this activity graphic.
 void setActivityRenderer(IlvActivityRenderer renderer)
          Sets the specified activity renderer used to render this activity graphic.
 void setDefinitionRect(IlvRect rect)
          Sets the definition rectangle of the activity graphic.
 boolean zoomable()
          Returns false to indicate that activity graphics are not strictly zoomable.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, move, move, moveResize, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setEditable, setFillOn, setForeground, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString, translate, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getActivity

public IlvActivity getActivity()
Gets the activity represented by the graphic.

Returns:
The IlvActivity.

getGanttRow

public IlvGanttRow getGanttRow()
Returns the Gantt row to which the activity graphic belongs.

Returns:
The IlvGanttRow.

getActivityRenderer

public IlvActivityRenderer getActivityRenderer()
Returns the activity renderer used to render this activity.

Returns:
The activity renderer.

setActivityRenderer

public void setActivityRenderer(IlvActivityRenderer renderer)
Sets the specified activity renderer used to render this activity graphic.

Parameters:
renderer - The new renderer.

getDefinitionX

public float getDefinitionX()
Returns the x coordinate of the activity graphic's definition rectangle, in world coordinates. The definition rectangle is the theoretical bounding box of the activity graphic, in world coordinates, as determined by the row layout algorithm. Technically, the x position and width of the definition rectangle are determined by the activity start and end times and the y position and height of the definition rectangle are determined by the layout algorithm. The activity graphic's actual bounding box and rendering area may be smaller or larger than the definition rectangle. This adjustment can be made in the IlvActivityRenderer.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.

Returns:
The x coordinate in world coordinates.
Since:
JViews 3.5
See Also:
getDefinitionRect(), getDefinitionRect(IlvTransformer)

getDefinitionY

public float getDefinitionY()
Returns the y coordinate of the activity graphic's definition rectangle, in world coordinates. The definition rectangle is the theoretical bounding box of the activity graphic, in world coordinates, as determined by the row layout algorithm. Technically, the x position and width of the definition rectangle are determined by the activity start and end times and the y position and height of the definition rectangle are determined by the layout algorithm. The activity graphic's actual bounding box and rendering area may be smaller or larger than the definition rectangle. This adjustment can be made in the IlvActivityRenderer.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.

Returns:
The y coordinate in world coordinates.
Since:
JViews 3.5
See Also:
getDefinitionRect(), getDefinitionRect(IlvTransformer)

getDefinitionWidth

public float getDefinitionWidth()
Returns the width of the activity graphic's definition rectangle, in world coordinates. The definition rectangle is the theoretical bounding box of the activity graphic, in world coordinates, as determined by the row layout algorithm. Technically, the x position and width of the definition rectangle are determined by the activity start and end times and the y position and height of the definition rectangle are determined by the layout algorithm. The activity graphic's actual bounding box and rendering area may be smaller or larger than the definition rectangle. This adjustment can be made in the IlvActivityRenderer.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.

Returns:
The width in world coordinates.
Since:
JViews 3.5
See Also:
getDefinitionRect(), getDefinitionRect(IlvTransformer)

getDefinitionHeight

public float getDefinitionHeight()
Returns the height of the activity graphic's definition rectangle, in world coordinates. The definition rectangle is the theoretical bounding box of the activity graphic, in world coordinates, as determined by the row layout algorithm. Technically, the x position and width of the definition rectangle are determined by the activity start and end times and the y position and height of the definition rectangle are determined by the layout algorithm. The activity graphic's actual bounding box and rendering area may be smaller or larger than the definition rectangle. This adjustment can be made in the IlvActivityRenderer.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.

Returns:
The height in world coordinates.
Since:
JViews 3.5
See Also:
getDefinitionRect(), getDefinitionRect(IlvTransformer)

getDefinitionRect

public IlvRect getDefinitionRect()
Returns the activity graphic's definition rectangle, in world coordinates. The definition rectangle is the theoretical bounding box of the activity graphic, in world coordinates, as determined by the row layout algorithm. Technically, the x position and width of the definition rectangle are determined by the activity's start and end times and the y position and height of the definition rectangle are determined by the layout algorithm. The activity graphic's actual bounding box and rendering area may be smaller or larger than the definition rectangle. This adjustment can be made in the IlvActivityRenderer.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 renderer's getBounds method would look something like:

   public IlvRect getBounds(IlvActivityGraphic ag, IlvTransformer t) {
     IlvRect box = ag.getDefinitionRect();
     ... make adjustments to box in world coordinates ...
     if (t != null)
       t.apply(box);
     return box;
   }
 

Returns:
The definition rectangle in world coordinates.
See Also:
getDefinitionRect(IlvTransformer)

getDefinitionRect

public IlvRect getDefinitionRect(IlvTransformer t)
Returns the activity graphic's definition rectangle, transformed by the specified transformer. The definition rectangle is the theoretical bounding box of the activity graphic, in world coordinates, as determined by the row layout algorithm. Technically, the x position and width of the definition rectangle are determined by the activity start and end times and the y position and height of the definition rectangle are determined by the layout algorithm. The activity graphic's actual bounding box and rendering area may be smaller or larger than the definition rectangle. This adjustment can be made in the IlvActivityRenderer.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 renderer's getBounds method would look something like:

   public IlvRect getBounds(IlvActivityGraphic ag, IlvTransformer t) {
     IlvRect viewBox = ag.getDefinitionRect(t);
     ... make adjustments to box in view coordinates ...
     return viewBox;
   }
 

Parameters:
t - the transformer.
Returns:
The definition rectangle transformed by the transformer.
See Also:
getDefinitionRect()

setDefinitionRect

public void setDefinitionRect(IlvRect rect)
Sets the definition rectangle of the activity graphic. The definition rectangle is the theoretical bounding box of the activity graphic, in world coordinates, as determined by the row layout algorithm. Technically, the x position and width of the definition rectangle are determined by the activity start and end times and the y position and height of the definition rectangle are determined by the layout algorithm. The activity graphic's actual bounding box and rendering area may be smaller or larger than the definition rectangle. This adjustment can be made in the IlvActivityRenderer.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.

Note: This method should only be invoked by the row layout algorithm.

Parameters:
rect - the definition rectangle.
Since:
JViews 6.0

zoomable

public boolean zoomable()
Returns false to indicate that activity graphics are not strictly zoomable.

Overrides:
zoomable in class IlvGraphic
See Also:
IlvGraphic, IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.boundingBox(IlvTransformer), IlvManager

draw

public void draw(Graphics dst,
                 IlvTransformer t)
Draws the activity graphic. The drawing is performed by calling the draw method of the renderer associated with this activity graphic.

If you need to change the way the activity is rendered, you should change the renderer. You should not subclass and override this method.

Specified by:
draw in class IlvGraphic
Parameters:
dst - The destination where the presentation will be drawn.
t - The transformer.
See Also:
IlvGraphic.boundingBox(ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests whether a point lies within the boundaries of the activity graphic.

Overrides:
contains in class IlvGraphic
Parameters:
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
See Also:
IlvGraphic

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of this activity graphic. This is computed by calling the getBounds method of the renderer associated with this activity graphic. Typically, the renderer will use this activity graphic's definition rect and modify it as needed (for example, margins, insets, and so on).

Note: The IlvRect object returned by this method may be modified by internal methods of ILOG JViews.

Specified by:
boundingBox in class IlvGraphic
Parameters:
t - The transformer used to draw the object. The value null can be used for the identity transformer.
Returns:
The bounding box of the activity graphic.
See Also:
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

makeSelection

public IlvSelection makeSelection()
Creates and returns a selection object for this activity graphic. This is done by calling the makeSelection method of the renderer associated with this activity graphic.

Overrides:
makeSelection in class IlvGraphic
Returns:
An IlvSelection object.
Since:
JViews 3.5
See Also:
IlvDrawSelection

isVisible

public boolean isVisible()
Returns true if the object is visible. The activity is considered not visible if the containing row is not visible. You do not need to overwrite this method.

Overrides:
isVisible in class IlvGraphic
Returns:
if the object is visible.
See Also:
IlvGraphic.setVisible(boolean), IlvGraphic.setSelectable(boolean), IlvGraphic.setMovable(boolean), IlvGraphic.setEditable(boolean)

copy

public IlvGraphic copy()
Overrides the copy method of the IlvGraphic class. This method always returns null. You should not use it.

Specified by:
copy in class IlvGraphic
Returns:
null.
See Also:
IlvGraphic

applyTransform

public void applyTransform(IlvTransformer t)
Overrides the applyTransform method of the IlvGraphic class so that it does nothing. This means that all methods of IlvGraphic that are using this method will do nothing. You cannot directly change the shape of an IlvActivityGraphic. Use instead the API of the data model to change the start or the end time of the activity.

Specified by:
applyTransform in class IlvGraphic
Parameters:
t - the transformer.
See Also:
IlvGraphic

getToolTipText

public String getToolTipText(IlvPoint p,
                             IlvTransformer t)
Returns the tooltip text to display when the mouse pointer is at a specified location inside the activity graphic. This is done by calling the getToolTipText method of the renderer associated with this activity graphic.

Overrides:
getToolTipText in class IlvGraphic
Parameters:
p - The location of the mouse (in view coordinates).
t - The transformer of the manager view in which the tooltip is about to be displayed.
Returns:
The tooltip text.
Since:
JViews 3.5
See Also:
IlvGraphic, IlvGraphic.getToolTipText(), IlvGraphic.setToolTipText(String)

getPopupMenu

public JPopupMenu getPopupMenu(IlvPoint p,
                               IlvTransformer t,
                               IlvManagerView view,
                               IlvPopupMenuManager popupManager)
Returns 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. This is done by calling first the getPopupMenu method of the renderer associated with this activity graphic or else trying the registered popup menu with the name obtained from the getPopupMenuName() method of the renderer associated with this activity graphic.

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)

Overrides:
getPopupMenu in class IlvGraphic
Parameters:
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:
IlvGraphic.getPopupMenu()


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