ilog.views.graphic
Class IlvGraphicHandleBag

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

public class IlvGraphicHandleBag
extends IlvGraphicHandle
implements IlvGraphicBag, GraphicBagHierarchyEventReceiver, ManagerViewsHierarchyEventReceiver

An IlvGraphicHandleBag object is a graphic handle that is at the same time a graphic bag for the contained object. This means, the method IlvGraphic.getGraphicBag() applied on the referenced object returns the handle. You can consider it as graphic set that contains only one element.

Since:
JViews 8.0
See Also:
Serialized Form

Constructor Summary
  IlvGraphicHandleBag(IlvGraphic object)
          Creates a new IlvGraphicHandleBag.
protected IlvGraphicHandleBag(IlvGraphic object, boolean delegateMoveResize)
          Creates a new IlvGraphicHandleBag.
  IlvGraphicHandleBag(IlvGraphicHandleBag source)
          Creates a new IlvGraphicHandleBag by copying an existing one.
  IlvGraphicHandleBag(IlvInputStream stream)
          Reads the object from an IlvInputStream.
 
Method Summary
 void addGraphicBagHierarchyListener(GraphicBagHierarchyListener listener)
          Adds the specified listener to receive events from the ancestor managers and ancestor graphic sets and from this handle when the hierarchy of graphic bags has changed.
 void addManagerViewsHierarchyListener(ManagerViewsChangedListener listener)
          Adds the specified listener to receive events from the owning manager of this object and from its ancestors when a manager view was added or removed.
 void addObject(IlvGraphic graphic, boolean redraw)
          Adds a graphic object to the bag.
 void applyToObject(IlvGraphic graphic, IlvApplyObject f, Object arg, boolean redraw)
          Applies a method to a graphic object of the bag.
 IlvGraphic copy()
          Copies the object.
 void enableGraphicBagHierarchyEventForwarding()
          Enables forwarding of GraphicBagHierarchyEvent events, since the objects contained in this graphic handle bag need to receive the events.
 void enableManagerViewsHierarchyEventForwarding()
          Enables forwarding of ManagerViewsChangedEvent events through the nesting hierarchy, since the objects contained in this graphic handle bag need to receive the events.
 void fireGraphicBagHierarchyEvent(GraphicBagHierarchyEvent event)
          Fires a graphic bag hierarchy event to this graphic handle bag and all contained objects.
 void fireManagerViewsHierarchyEvent(ManagerViewsChangedEvent event)
          Fires a ManagerViewsChangedEvent event to all listeners installed via addManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener) on this graphic set or contained objects.
 IlvGraphic getObject(String name)
          Returns the graphic object with that name if it exists in the bag, otherwise returns null.
 IlvGraphicEnumeration getObjects()
          Returns the objects of the bag.
 boolean isDelegateObjectInteractor(IlvObjectInteractor inter)
          Tests whether the input object interactor is the delegate interactor suitable for this class.
 boolean isOwner()
          Returns the ownership property of the object.
 void moveObject(IlvGraphic graphic, float x, float y, boolean redraw)
          Changes the location of a graphic object.
 boolean needsGraphicBagHierarchyEvent()
          Returns whether this object needs to receive GraphicBagHierarchyEvent events, either from itself or from its ancestors.
 boolean needsManagerViewsHierarchyEvent()
          Returns whether the graphic handle bag needs to receive ManagerViewsChangedEvent events, either from its owning manager or from its ancestors.
protected  void notifyObjectInteractorToManager(IlvObjectInteractor interactor)
          Notifies the manager that the object interactor has changed.
 void reDrawObj(IlvGraphic graphic)
          Redraws a graphic object located in the bag.
 void reDrawRegion(IlvRegion region)
          Redraws a region of the bag.
 void removeGraphicBagHierarchyListener(GraphicBagHierarchyListener listener)
          Removes the specified listener so that it no longer receives events from ancestor manager and ancestor graphic sets and from this handle when the hierarchy of graphic bags has changed.
 void removeManagerViewsHierarchyListener(ManagerViewsChangedListener listener)
          Removes the specified listener so that it no longer receives events from the owning manager of this object and from its ancestors when a manager view was added or removed.
 void removeObject(IlvGraphic graphic, boolean redraw)
          Removes a graphic object from the bag.
 void reshapeObject(IlvGraphic graphic, IlvRect newrect, boolean redraw)
          Changes the size of a graphic object.
protected  void setDelegateMoveResize(boolean delegateMoveResize)
          Sets whether operations that change the position of the object are directly delegated to the referenced object.
 void setGraphicBag(IlvGraphicBag bag)
          Changes the bag that contains the object.
 void setObject(IlvGraphic object)
          Changes the referenced object.
 boolean setObjectName(IlvGraphic graphic, String name)
          Changes the name of a graphic object.
 
Methods inherited from class ilog.views.graphic.IlvGraphicHandle
applyTransform, boundingBox, contains, draw, getIntersectionWithOutline, getObject, getOriginalPopupMenu, getPopupMenu, getToolTipText, inside, intersects, isPersistent, move, move, moveResize, resize, rotate, scale, setBackground, setForeground, setOwner, translate, write, zoomable
 
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, makeSelection, 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

IlvGraphicHandleBag

public IlvGraphicHandleBag(IlvGraphic object)
Creates a new IlvGraphicHandleBag.

Parameters:
object - the referenced object.

IlvGraphicHandleBag

protected IlvGraphicHandleBag(IlvGraphic object,
                              boolean delegateMoveResize)
Creates a new IlvGraphicHandleBag. This constructor is mainly useful when creating subclasses of this class.

Parameters:
object - the referenced object.
delegateMoveResize - If true, operations that change the position of the object are directly delegated to the referenced object.

IlvGraphicHandleBag

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


IlvGraphicHandleBag

public IlvGraphicHandleBag(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

setObject

public void setObject(IlvGraphic object)
Changes the referenced object. Note that a call to this method can modify the bounding box of the graphic handle. For this reason, if the graphic handle is contained inside an IlvManager, this method can be called only using the method IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean) of the manager.

Overrides:
setObject in class IlvGraphicHandle

isOwner

public boolean isOwner()
Returns the ownership property of the object. If the handle owns the object it references, then copying the handle will copy the referenced object; otherwise the new handle is referencing the same object.

This implementation always returns true.

Overrides:
isOwner in class IlvGraphicHandle
See Also:
IlvGraphicHandle.setOwner(boolean)

setDelegateMoveResize

protected void setDelegateMoveResize(boolean delegateMoveResize)
Sets whether operations that change the position of the object are directly delegated to the referenced object.

Overrides:
setDelegateMoveResize in class IlvGraphicHandle

copy

public IlvGraphic copy()
Copies the object. May return null if the contained object cannot be copied.

Overrides:
copy in class IlvGraphicHandle
Returns:
a copy of the object.
See Also:
isOwner()

notifyObjectInteractorToManager

protected void notifyObjectInteractorToManager(IlvObjectInteractor interactor)
Notifies the manager that the object interactor has changed.

Overrides:
notifyObjectInteractorToManager in class IlvGraphic
Since:
JViews 8.1
Internal method or field: do not use!

isDelegateObjectInteractor

public boolean isDelegateObjectInteractor(IlvObjectInteractor inter)
Tests whether the input object interactor is the delegate interactor suitable for this class.

Since:
JViews 8.1

setGraphicBag

public void setGraphicBag(IlvGraphicBag bag)
Changes the bag that contains the object.

Note: do not call this method directly unless you are creating a custom graphics bag.

Overrides:
setGraphicBag in class IlvGraphic
Parameters:
bag - The graphic bag to contain this graphic object.
See Also:
IlvGraphic

addObject

public void addObject(IlvGraphic graphic,
                      boolean redraw)
Adds a graphic object to the bag. This is part of the IlvGraphicBag interface. Since the graphic handle bag can contain only one object, you can add only an object if the currently referenced object is null. The passed object becomes the new currently referenced object.

If the graphic handle bag is in a graphic bag, it automatically calls applyToObject on its graphic bag while adding the object.

Specified by:
addObject in interface IlvGraphicBag
Parameters:
graphic - The graphic object.
redraw - If true the object is redrawn.

removeObject

public void removeObject(IlvGraphic graphic,
                         boolean redraw)
Removes a graphic object from the bag. This is part of the IlvGraphicBag interface. Since the graphic handle bag can contain only one object, you can remove only the currently referenced object.

If the graphic handle bag is in a graphic bag, it automatically calls applyToObject on its graphic bag while removing the object.

Specified by:
removeObject in interface IlvGraphicBag
Parameters:
graphic - The graphic object.
redraw - If true the object is redrawn.

getObjects

public IlvGraphicEnumeration getObjects()
Returns the objects of the bag. This is part of the IlvGraphicBag interface. This returns an enumeration with one object: the referenced object.

Specified by:
getObjects in interface IlvGraphicBag

reDrawObj

public void reDrawObj(IlvGraphic graphic)
Redraws a graphic object located in the bag. This is part of the IlvGraphicBag interface. If this graphic handle bag is inside a graphic bag, it redraws this graphic handle bag.

Specified by:
reDrawObj in interface IlvGraphicBag
Parameters:
graphic - The graphic object.

reDrawRegion

public void reDrawRegion(IlvRegion region)
Redraws a region of the bag. This is part of the IlvGraphicBag interface. If this graphic handle bag is inside a graphic bag, it redraws this graphic handle bag.

Specified by:
reDrawRegion in interface IlvGraphicBag
Parameters:
region - The region to redraw.

reshapeObject

public void reshapeObject(IlvGraphic graphic,
                          IlvRect newrect,
                          boolean redraw)
Changes the size of a graphic object. This is part of the IlvGraphicBag interface. Since the graphic handle bag can contain only one object, you can reshape only the currently referenced object.

If the graphic handle bag is in a graphic bag, it automatically calls applyToObject on its graphic bag while reshaping the object.

Specified by:
reshapeObject in interface IlvGraphicBag
Parameters:
graphic - The graphic object.
newrect - The new desired bounding rectangle.
redraw - If true the object is redrawn.

moveObject

public void moveObject(IlvGraphic graphic,
                       float x,
                       float y,
                       boolean redraw)
Changes the location of a graphic object. This is part of the IlvGraphicBag interface. Since the graphic handle bag can contain only one object, you can move only the currently referenced object.

If the graphic handle bag is in a graphic bag, it automatically calls applyToObject on its graphic bag while moving the object.

Specified by:
moveObject in interface IlvGraphicBag
Parameters:
graphic - The graphic object.
x - The new desired x position.
y - The new desired y position.
redraw - If true the object is redrawn.

applyToObject

public void applyToObject(IlvGraphic graphic,
                          IlvApplyObject f,
                          Object arg,
                          boolean redraw)
Applies a method to a graphic object of the bag. This is part of the IlvGraphicBag interface.

If the graphic handle bag is in a graphic bag, it automatically calls applyToObject on its graphic bag while applying the object.

Specified by:
applyToObject in interface IlvGraphicBag
Parameters:
graphic - The graphic object.
f - The method to apply.
arg - The arguments passed to the method f.
redraw - If true the object is redrawn.

setObjectName

public boolean setObjectName(IlvGraphic graphic,
                             String name)
Changes the name of a graphic object. This is part of the IlvGraphicBag interface. Since the graphic handle bag can contain only one object, you can only change the name of the currently referenced object.

Specified by:
setObjectName in interface IlvGraphicBag
Parameters:
graphic - The graphic object.
name - The new name.
Returns:
true if the name can be changed.

getObject

public IlvGraphic getObject(String name)
Returns the graphic object with that name if it exists in the bag, otherwise returns null. Since the graphic handle bag can contain only one object, it returns currently referenced object if this matches the input name, and null otherwise.

Specified by:
getObject in interface IlvGraphicBag
Parameters:
name - The graphic object name.

addGraphicBagHierarchyListener

public void addGraphicBagHierarchyListener(GraphicBagHierarchyListener listener)
Adds the specified listener to receive events from the ancestor managers and ancestor graphic sets and from this handle when the hierarchy of graphic bags has changed. The hierarchy event is generated by a manager, a graphic set, or a graphic handle bag when it is added to or removed from another manager, graphic set, or handle bag. The event is passed down the hierarchy. The event is dispatched to every graphic handle bag that is contained in object (manager, graphic set, handle bag) whose graphic bag has changed.

Specified by:
addGraphicBagHierarchyListener in interface GraphicBagHierarchyEventReceiver
Parameters:
listener - The listener.
Since:
JViews 8.1
See Also:
removeGraphicBagHierarchyListener(ilog.views.event.GraphicBagHierarchyListener)

removeGraphicBagHierarchyListener

public void removeGraphicBagHierarchyListener(GraphicBagHierarchyListener listener)
Removes the specified listener so that it no longer receives events from ancestor manager and ancestor graphic sets and from this handle when the hierarchy of graphic bags has changed.

Specified by:
removeGraphicBagHierarchyListener in interface GraphicBagHierarchyEventReceiver
Parameters:
listener - The listener.
Since:
JViews 8.1
See Also:
addGraphicBagHierarchyListener(ilog.views.event.GraphicBagHierarchyListener)

enableGraphicBagHierarchyEventForwarding

public void enableGraphicBagHierarchyEventForwarding()
Enables forwarding of GraphicBagHierarchyEvent events, since the objects contained in this graphic handle bag need to receive the events.

Specified by:
enableGraphicBagHierarchyEventForwarding in interface GraphicBagHierarchyEventReceiver
Since:
JViews 8.1

needsGraphicBagHierarchyEvent

public boolean needsGraphicBagHierarchyEvent()
Returns whether this object needs to receive GraphicBagHierarchyEvent events, either from itself or from its ancestors.

Specified by:
needsGraphicBagHierarchyEvent in interface GraphicBagHierarchyEventReceiver
Since:
JViews 8.1

fireGraphicBagHierarchyEvent

public void fireGraphicBagHierarchyEvent(GraphicBagHierarchyEvent event)
Fires a graphic bag hierarchy event to this graphic handle bag and all contained objects.

Specified by:
fireGraphicBagHierarchyEvent in interface GraphicBagHierarchyEventReceiver
Since:
JViews 8.1

addManagerViewsHierarchyListener

public void addManagerViewsHierarchyListener(ManagerViewsChangedListener listener)
Adds the specified listener to receive events from the owning manager of this object and from its ancestors when a manager view was added or removed.

The hierarchy event mechanism is comparable to java.awt.event.HierarchyEvent on swing components. The view changed event is generated by a manager when a view is added or removed, and passed down the nesting hierarchy. The event is dispatched to every graphic handle bag that is contained in the manager whose view has changed.

Specified by:
addManagerViewsHierarchyListener in interface ManagerViewsHierarchyEventReceiver
Parameters:
listener - The listener.
Since:
JViews 8.1
See Also:
removeManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener)

removeManagerViewsHierarchyListener

public void removeManagerViewsHierarchyListener(ManagerViewsChangedListener listener)
Removes the specified listener so that it no longer receives events from the owning manager of this object and from its ancestors when a manager view was added or removed.

Specified by:
removeManagerViewsHierarchyListener in interface ManagerViewsHierarchyEventReceiver
Parameters:
listener - The listener.
Since:
JViews 8.1
See Also:
addManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener)

enableManagerViewsHierarchyEventForwarding

public void enableManagerViewsHierarchyEventForwarding()
Enables forwarding of ManagerViewsChangedEvent events through the nesting hierarchy, since the objects contained in this graphic handle bag need to receive the events.

Specified by:
enableManagerViewsHierarchyEventForwarding in interface ManagerViewsHierarchyEventReceiver
Since:
JViews 8.1

needsManagerViewsHierarchyEvent

public boolean needsManagerViewsHierarchyEvent()
Returns whether the graphic handle bag needs to receive ManagerViewsChangedEvent events, either from its owning manager or from its ancestors. It returns true, if a listener was installed though addManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener) on this graphic handle bag or on any object contained in this graphic handle bag.

Specified by:
needsManagerViewsHierarchyEvent in interface ManagerViewsHierarchyEventReceiver
Since:
JViews 8.1

fireManagerViewsHierarchyEvent

public void fireManagerViewsHierarchyEvent(ManagerViewsChangedEvent event)
Fires a ManagerViewsChangedEvent event to all listeners installed via addManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener) on this graphic set or contained objects.

Specified by:
fireManagerViewsHierarchyEvent in interface ManagerViewsHierarchyEventReceiver
Since:
JViews 8.1


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