ilog.views
Interface IlvGraphicBag

All Known Implementing Classes:
IltComponentGraphic, IltNetwork, IlvAssociation, IlvCompositeGraphic, IlvCompositeLink, IlvDefaultGraphicManagerFrame, IlvDefaultLaneGraphic, IlvFixedSizeGraphic, IlvFullZoomingGraphic, IlvGeneralLink, IlvGeneralNode, IlvGrapher, IlvGraphicGroup, IlvGraphicHandleBag, IlvGraphicHandleSelection, IlvGraphicSet, IlvHalfZoomingGraphic, IlvHalfZoomingGraphic, IlvHalfZoomingRenderer.HalfZoomingGraphic, IlvHyperGrapher, IlvLinkBundle, IlvManager, IlvMapFixedGraphic, IlvMapGraphicSet, IlvPowerLabel, IlvPrototypeBeanSupport, IlvSDMCompositeLink, IlvSDMCompositeNode, IlvSubGraphRenderer.CollapsedGraphic, IlvSubGraphRenderer.GraphicManagerFrame, IlvSVGGraphicSet, IlvSwimLanesRenderer.DefaultSwimLaneGraphic, IlvURLGraphic

public interface IlvGraphicBag

This interface must be implemented by classes that manage several objects. For instance, it is implemented by the class IlvManager.


Method Summary
 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.
 IlvGraphicBag getGraphicBag()
          Returns the IlvGraphicBag that contains this bag or null if it is not contained in any bag.
 IlvGraphic getObject(String name)
          Returns the graphic object with that name if it exists in the bag, otherwise returns null.
 IlvGraphicEnumeration getObjects()
          Returns an enumeration of all the objects in this graphic bag.
 void moveObject(IlvGraphic graphic, float x, float y, boolean redraw)
          Changes the location of a graphic object.
 void reDrawObj(IlvGraphic graphic)
          Redraws a graphic object located in the bag.
 void reDrawRegion(IlvRegion region)
          Redraws a region of the bag.
 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.
 boolean setObjectName(IlvGraphic graphic, String name)
          Changes the name of a graphic object.
 

Method Detail

addObject

void addObject(IlvGraphic graphic,
               boolean redraw)
Adds a graphic object to the bag.

Parameters:
graphic - The graphic object.
redraw - If true the object is redrawn.

removeObject

void removeObject(IlvGraphic graphic,
                  boolean redraw)
Removes a graphic object from the bag.

Parameters:
graphic - The graphic object.
redraw - If true the object is redrawn.

getObjects

IlvGraphicEnumeration getObjects()
Returns an enumeration of all the objects in this graphic bag. Note that when using this enumeration, you must not add or remove any object in the manager; otherwise, going through this enumeration may return incorrect values.

Since:
JViews 5.0

reDrawObj

void reDrawObj(IlvGraphic graphic)
Redraws a graphic object located in the bag.

Parameters:
graphic - The graphic object.

reDrawRegion

void reDrawRegion(IlvRegion region)
Redraws a region of the bag.

Parameters:
region - The region to redraw.

reshapeObject

void reshapeObject(IlvGraphic graphic,
                   IlvRect newrect,
                   boolean redraw)
Changes the size of a graphic object.

Parameters:
graphic - The graphic object.
newrect - The new desired bounding rectangle.
redraw - If true the object is redrawn.

moveObject

void moveObject(IlvGraphic graphic,
                float x,
                float y,
                boolean redraw)
Changes the location of a graphic object.

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

void applyToObject(IlvGraphic graphic,
                   IlvApplyObject f,
                   Object arg,
                   boolean redraw)
Applies a method to a graphic object of the bag. Every implementation of applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean) must call IlvGraphic.setInApplyToObject(boolean) in the following way:
 public void applyToObject(IlvGraphic obj,
                           IlvApplyObject f, Object arg,
                           boolean redraw)
 {
   obj.setInApplyToObject(true);
   try {
     ...
   } finally {
     obj.setInApplyToObject(false);
   }
 }
 
If an IlvGraphic implements the IlvGraphicBag interface, the implementation can be done in the following way:
 public void applyToObject(IlvGraphic obj,
                           IlvApplyObject f, Object arg,
                           boolean redraw)
 {
   boolean needsRecursion = obj.setInApplyToObject(true);
   try {
     if (needsRecursion && getGraphicBag() != null) {
       final IlvGraphic fobj = obj;
       final IlvApplyObject ff = f;
       getGraphicBag().applyToObject(this, new IlvApplyObject() {
          public void apply(IlvGraphic thisObj, Object arg) {
            doSomething(fobj, ff, arg, false);
          }
       }, arg, redraw);
     } else {
       doSomething(obj, f, arg, redraw);
     }
   } finally {
     obj.setInApplyToObject(false);
   }
 }
 

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

boolean setObjectName(IlvGraphic graphic,
                      String name)
Changes the name of a graphic object.

Parameters:
graphic - The graphic object.
name - The new name.
Returns:
true if the name can be changed.

getObject

IlvGraphic getObject(String name)
Returns the graphic object with that name if it exists in the bag, otherwise returns null.

Parameters:
name - The graphic object name.
Since:
JViews 6.0

getGraphicBag

IlvGraphicBag getGraphicBag()
Returns the IlvGraphicBag that contains this bag or null if it is not contained in any bag.

Since:
JViews 5.0


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