ilog.views.graphic
Class IlvFixedSizeGraphic

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvGraphicHandle
          extended by ilog.views.graphic.IlvGraphicHandleBag
              extended by ilog.views.graphic.IlvFixedSizeGraphic
All Implemented Interfaces:
GraphicBagHierarchyEventReceiver, ManagerViewsHierarchyEventReceiver, IlvGraphicBag, IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvHalfZoomingGraphic, IlvMapFixedGraphic

public class IlvFixedSizeGraphic
extends IlvGraphicHandleBag

The IlvFixedSizeGraphic class derives from the base graphic handle class IlvGraphicHandle. It implements a handle that references an object of the class IlvGraphic. An instance of this class is drawn by applying a graphic transformation to the referenced object so that the visible size of this object is not modified by the zoom level. The transformation is internally computed. Note that you should not have several instances of this class reference the same object.

See Also:
Serialized Form

Constructor Summary
IlvFixedSizeGraphic(IlvFixedSizeGraphic source)
          Creates a new IlvFixedSizeGraphic by copying an existing one.
IlvFixedSizeGraphic(IlvGraphic object, int position, IlvPoint point)
          Creates a new IlvFixedSizeGraphic.
IlvFixedSizeGraphic(IlvInputStream stream)
          Reads the object from an IlvInputStream.
 
Method Summary
 void applyTransform(IlvTransformer t)
          Applies a transformation to the shape of the object.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of the object.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests whether a point lies within the outline of the object.
 IlvGraphic copy()
          Copies the object.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
 IlvPoint getIntersectionWithOutline(IlvPoint innerPoint, IlvPoint outerPoint, IlvTransformer t)
          Returns the intersection of the line segment from inner point to outer point with the shape of the graphic object.
 IlvPoint getPoint()
          Returns the point that remains fixed.
 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 graphic object.
 int getPosition()
          Returns the position of the point that remains fixed.
 String getToolTipText(IlvPoint p, IlvTransformer t)
          Returns the tooltip text to display when the mouse pointer is at a specified location inside the graphic object.
 boolean inside(IlvRect rect, IlvRect trect, IlvTransformer t)
          Tests whether a rectangle contains the object.
 boolean intersects(IlvRect rect, IlvRect trect, IlvTransformer t)
          Tests whether a rectangle overlaps the object.
 IlvSelection makeSelection()
          Creates a selection object for this graphic object.
 void resize(float neww, float newh)
          Resizes the object.
 void rotate(IlvPoint center, double angle)
          Rotates the object.
 void setPoint(IlvPoint p)
          Changes the point that remains fixed.
 void setPosition(int position)
          Changes the position of the point that remains fixed.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 boolean zoomable()
          Returns true if the object is zoomable.
 
Methods inherited from class ilog.views.graphic.IlvGraphicHandleBag
addGraphicBagHierarchyListener, addManagerViewsHierarchyListener, addObject, applyToObject, enableGraphicBagHierarchyEventForwarding, enableManagerViewsHierarchyEventForwarding, fireGraphicBagHierarchyEvent, fireManagerViewsHierarchyEvent, getObject, getObjects, isDelegateObjectInteractor, isOwner, moveObject, needsGraphicBagHierarchyEvent, needsManagerViewsHierarchyEvent, notifyObjectInteractorToManager, reDrawObj, reDrawRegion, removeGraphicBagHierarchyListener, removeManagerViewsHierarchyListener, removeObject, reshapeObject, setDelegateMoveResize, setGraphicBag, setObject, setObjectName
 
Methods inherited from class ilog.views.graphic.IlvGraphicHandle
getObject, getOriginalPopupMenu, isPersistent, move, move, moveResize, scale, setBackground, setForeground, setOwner, translate
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, isVisible, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, setEditable, setFillOn, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ilog.views.IlvGraphicBag
getGraphicBag
 

Constructor Detail

IlvFixedSizeGraphic

public IlvFixedSizeGraphic(IlvGraphic object,
                           int position,
                           IlvPoint point)
Creates a new IlvFixedSizeGraphic.

Parameters:
object - The referenced object.
position - Indicates the point in the referenced object (for example, its center or the top-left corner of its bounding box) that must remain at the same position when the object is zoomed in or out. See the class IlvConstants for the valid values of this parameter.
point - If non-null then it will be used to specify the position of a fixed point when the object is zoomed in or out. The position parameter is not taken into account if this parameter is non-null.

IlvFixedSizeGraphic

public IlvFixedSizeGraphic(IlvFixedSizeGraphic source)
Creates a new IlvFixedSizeGraphic by copying an existing one.


IlvFixedSizeGraphic

public IlvFixedSizeGraphic(IlvInputStream stream)
                    throws IlvReadFileException
Reads the object from an IlvInputStream.

Parameters:
stream - The input stream.
Throws:
IlvReadFileException - if the format is not correct.
Method Detail

copy

public IlvGraphic copy()
Copies the object. This method copies the object by calling the copy constructor.

Overrides:
copy in class IlvGraphicHandleBag
Returns:
A copy of the object.
See Also:
IlvGraphicHandleBag.isOwner()

zoomable

public boolean zoomable()
Returns true if the object is zoomable. In this case (fixed-size graphic) it returns false.

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

getPosition

public final int getPosition()
Returns the position of the point that remains fixed.

Returns:
See the class IlvConstants for the return value of this method.
See Also:
setPosition(int), IlvConstants

setPosition

public void setPosition(int position)
Changes the position of the point that remains fixed.

Parameters:
position - See the class IlvConstants for the valid values of this parameter.
See Also:
getPosition(), IlvConstants

getPoint

public final IlvPoint getPoint()
Returns the point that remains fixed.

See Also:
setPoint(ilog.views.IlvPoint)

setPoint

public void setPoint(IlvPoint p)
Changes the point that remains fixed.

Parameters:
p - The point.
See Also:
getPoint()

draw

public void draw(Graphics dst,
                 IlvTransformer t)
Draws the object.

Overrides:
draw in class IlvGraphicHandle
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
See Also:
IlvGraphic.boundingBox(ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object. Calls boundingBox on the referenced object.

Overrides:
boundingBox in class IlvGraphicHandle
Parameters:
t - The transformer used to draw the object.
See Also:
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

applyTransform

public void applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.

Overrides:
applyTransform in class IlvGraphicHandle
Parameters:
t - The transformer to be applied.
See Also:
IlvGraphic

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests whether a point lies within the outline of the object. Calls contains on the referenced object.

Overrides:
contains in class IlvGraphicHandle
Parameters:
p - The point to be tested.
tp - The point p transformed by the transformer t.
t - The transformation that was applied to the object when it was drawn.
Returns:
true if the point lies inside this graphic object.
See Also:
IlvGraphic

intersects

public boolean intersects(IlvRect rect,
                          IlvRect trect,
                          IlvTransformer t)
Tests whether a rectangle overlaps the object. Calls intersects on the referenced object.

Overrides:
intersects in class IlvGraphicHandle
Parameters:
rect - The rectangle to be tested.
trect - The rectangle rect transformed by the transformer t.
t - The transformation applied to the object when it was drawn.
Returns:
true if the rectangle overlaps this graphic object.
See Also:
IlvGraphic

inside

public boolean inside(IlvRect rect,
                      IlvRect trect,
                      IlvTransformer t)
Tests whether a rectangle contains the object. Calls inside on the referenced object.

Overrides:
inside in class IlvGraphicHandle
Parameters:
rect - The rectangle to be tested.
trect - The rectangle rect transformed by the transformer t.
t - The transformation that was applied to the object when it was drawn.
See Also:
IlvGraphic

getIntersectionWithOutline

public IlvPoint getIntersectionWithOutline(IlvPoint innerPoint,
                                           IlvPoint outerPoint,
                                           IlvTransformer t)
Returns the intersection of the line segment from inner point to outer point with the shape of the graphic object. This method is used the clip links against the shape of the node. The implementation of this method must be robust with respect to the input points: Even if innerPoint is not inside the graphic object, or if outerPoint is not outside the graphic object, it must return a valid point. For instance, if there is no intersection, it can return the start point.

Overrides:
getIntersectionWithOutline in class IlvGraphicHandle
Parameters:
innerPoint - A point usually inside the graphic object, given in manager view coordinates.
outerPoint - A point usually outside of the graphic object, given in manager view coordinates.
t - The transformation used to draw the object.
Since:
JViews 8.1
See Also:
IlvClippingLinkConnector

rotate

public void rotate(IlvPoint center,
                   double angle)
Rotates the object. This method calls the applyTransform method.

Overrides:
rotate in class IlvGraphicHandle
Parameters:
center - The center of the rotation.
angle - The rotation angle in degrees.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

resize

public void resize(float neww,
                   float newh)
Resizes the object. This method calls the applyTransform method.

Overrides:
resize in class IlvGraphicHandle
Parameters:
neww - The new horizontal width.
newh - The new horizontal height.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

makeSelection

public IlvSelection makeSelection()
Creates a selection object for this graphic object. Because this object cannot be resized using the interactor, the implementation of this method creates an instance of the class IlvUnresizeableDrawSelection.

Overrides:
makeSelection in class IlvGraphic
Since:
JViews 5.0
See Also:
IlvDrawSelection

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 graphic object. It tries to retrieve the tooltip text on the referenced object. If this fails, it tries to retrieve the tooltip text on this object.

Note that you must enable the tooltip mechanism for the manager view by calling the static method IlvToolTipManager.registerView(ilog.views.IlvManagerView).

Overrides:
getToolTipText in class IlvGraphicHandle
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).
Returns:
The tool tip at point p for transformation t, or null if no tool tip should be displayed.
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 graphic object. It tries to retrieve the popup menu on the referenced object. If this fails, it tries to retrieve the popup menu on this object.

Note that you must enable the popup menu mechanism for the manager view by calling the static method IlvPopupMenuManager.registerView(ilog.views.IlvManagerView).

Overrides:
getPopupMenu in class IlvGraphicHandle
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 8.0
See Also:
IlvGraphic.getPopupMenu(IlvPoint, IlvTransformer, IlvManagerView, IlvPopupMenuManager)

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvGraphicHandle
Parameters:
stream - The output stream.
Throws:
IOException - thrown when an exception occurs during the write operation for this object.


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