ilog.views.graphic.composite
Class IlvCompositeGraphic

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvGraphicSet
          extended by ilog.views.graphic.composite.IlvCompositeGraphic
All Implemented Interfaces:
GraphicBagHierarchyEventReceiver, ManagerSelectionListener, ManagerViewsHierarchyEventReceiver, IlvHotSpot, IlvComposite, IlvAttachmentBounds, IlvDefinitionRectInterface, IlvGraphicBag, IlvLabelInterface, IlvPersistentObject, Transferable, Serializable, EventListener

public class IlvCompositeGraphic
extends IlvGraphicSet
implements IlvComposite, IlvAttachmentBounds, ManagerSelectionListener, IlvHotSpot, IlvDefinitionRectInterface

IlvCompositeGraphic stores and controls the layout of multiple IlvGraphic objects thus building complex graphic objects.

Child Graphic Objects

An IlvCompositeGraphic instance holds a collection of IlvGraphic objects organized into a tree structure. The first child, returned by calling getChildren(0), is called the base of the composite graphic object. Call setChildren to add or remove children.

Note: the following methods inherited from IlvGraphicSet should not be called directly:

Layout and Attachment Rules

A composite graphic object is made of child graphics and a layout manager object. Unlike graphic sets, composite graphics have the capability to control the layout and attachment of the child objects. Graphic objects in a composite graphic instance can be distributed across several layers. Their layout is controlled by an IlvLayoutManager instance. Possible layout styles are as follows:

The following code example shows how to set the layout style for the composite graphic object and how to add the base of the composite graphic.

  // Create the composite graphic
  IlvCompositeGraphic composite = new IlvCompositeGraphic();
  
  // Set the layout style
  IlvAttachmentLayout layout = new IlvAttachmentLayout();
  composite.setLayout(layout);
  
  // Add the base graphic object to the composite graphic
  IlvRectangle rectangle = new IlvRectangle(new IlvRect(100, 100, 40, 40), true, true);
  composite.setChildren(0, rectangle);
 

You use attachment rules to set the position of child graphic objects in comparison to the base object.

  IlvText text = new IlvText();
  text.setLabel("Composite Graphic");
  
  // Add the graphic object to the graphics tree
  composite.setChildren(1, text);
  
  // Set the position of the object at place 1 in the graphics
  // tree relative to the base object. In this case, the top center point of 
  // the IlvText object is aligned with the bottom center of the base 
  // IlvRectangle object.
  
  composite.setConstraints(1, 
         new IlvAttachmentConstraint(
                 IlvAttachmentLocation.TopCenter,
                 IlvAttachmentLocation.BottomCenter));
 

Examples

The code examples in this section show you how to do the following:

Add an icon with a label

The following code example shows how to build the composite graphic displayed on the right:

   // We create here a composite graphic with an icon and a label which
   // will be centered in round rectangle. The icon is at the top of
   // the label.
   //
   IlvCompositeGraphic node = new IlvCompositeGraphic();
   // Creates a CenteredLayout
   IlvCenteredLayout centered = new IlvCenteredLayout(new Insets(4, 10, 4, 10));
   node.setLayout(centered);
   // Creates the first child : it is a round rectangle
   RoundRectangle2D.Float shape = new RoundRectangle2D.Float(0, 0, 10, 10, 2.5f, 2.5f);
   IlvGeneralPath path = new IlvGeneralPath(shape);
   path.setFillOn(true);
   path.setFillPaint(new IlvLinearGradientPaint(
                           new IlvPoint(0, 0),
                           new IlvPoint(10, 10),
                           new float[]{0, 1},
                           new Color[]{ new Color(205, 201, 165),
                                        new Color(255, 255, 204)},
                           IlvMultipleGradientPaint.SPREAD_REFLECT, false));
   path.setStrokeOn(true);
   path.setStroke(new BasicStroke(2));
   node.setChildren(0, path);

   // Creates the second child : it is a composite node with 2 children
   // itself, a label and an icon
   IlvCompositeGraphic contents = new IlvCompositeGraphic();
   // Add it to its parent
   node.setChildren(1, contents);
   // Sets the layout
   IlvAttachmentLayout layout = new IlvAttachmentLayout();
   contents.setLayout(layout);

   // Creates the label
   IlvZoomableLabel label = new IlvZoomableLabel(new IlvPoint(), "Activity", false);
   contents.setChildren(0, label);

   // Create the icon
   IlvIcon icon = new IlvIcon("gears-still.gif", new IlvRect(0, 0, 33, 30));
   contents.setChildren(1, icon);
   // Attach the BottomCenter (hotspot) of the icon to the
   // TopCenter (anchor) of the label
   contents.setConstraints(1,
         new IlvAttachmentConstraint(
                 IlvAttachmentLocation.BottomCenter,
                 IlvAttachmentLocation.TopCenter));

   IlvGrapher grapher = new IlvGrapher();
   grapher.addNode(node, 10, false);
 

Position an Icon to the Left of a Label

The following code example shows how to build the composite graphic displayed on the right:

   // We create here a composite graphic with an icon and a label which
   // will be centered in round rectangle. The icon is at the left of
   // the label.
   IlvCompositeGraphic node = new IlvCompositeGraphic();
   // Creates a CenteredLayout
   IlvCenteredLayout centered = new IlvCenteredLayout(new Insets(4, 10, 4, 10));
   node.setLayout(centered);
   // Creates the first child : it is a rectangle
   Rectangle2D.Float shape = new Rectangle2D.Float(0, 0, 1, 1);
   IlvGeneralPath path = new IlvGeneralPath(shape);
   path.setFillOn(true);
   path.setBackground(new Color(198, 226, 255));
   path.setStrokeOn(true);
   path.setStroke(new BasicStroke(2));
   node.setChildren(0, path);

   // Creates the second child : it a composite node with 2 children
   // itself, a label and an icon
   IlvCompositeGraphic contents = new IlvCompositeGraphic();
   // Add it to its parent
   node.setChildren(1, contents);
   // Sets the layout
   IlvAttachmentLayout layout = new IlvAttachmentLayout();
   contents.setLayout(layout);

   // Creates the label
   IlvZoomableLabel label = new IlvZoomableLabel(new IlvPoint(), "Hotline", false);
   contents.setChildren(0, label);

   // Create the icon
   IlvIcon icon = new IlvIcon("start.gif", new IlvRect(0, 0, 26, 32));
   contents.setChildren(1, icon);
   // Attach the RightCenter (hotspot) of the icon to the
   // TopCenter (anchor) of the label
   contents.setConstraints(1,
         new IlvAttachmentConstraint(
                 IlvAttachmentLocation.RightCenter,
                 IlvAttachmentLocation.LeftCenter));

   // Adds the composite graphic to the grapher
   IlvGrapher grapher = new IlvGrapher();
   grapher.addNode(node, 10, false);
 

Add a Balloon Using Hot Spots

The following code example shows how to build the composite graphic displayed on the right:

   // Creates the composite graphic
   IlvSDMCompositeNode node = new IlvSDMCompositeNode();
              
   // When selected a white border of 2 pixels around the first
   // child will be drawn around the first child.
   node.setSelectionType(IlvCompositeGraphic.BaseBorderSelection);
   // Sets the layout
   IlvAttachmentLayout layout = new IlvAttachmentLayout();
   node.setLayout(layout);

   // Creates the icon
   IlvIcon icon = new IlvIcon("system.gif", new IlvRect(0, 0, 32, 32));
   node.setChildren(0, icon);


   // Creates the name label
   IlvText name = new IlvText(new IlvPoint(), "Paris");
   node.setChildren(3, name);
   node.setConstraints(3,
         new IlvAttachmentConstraint(
                 IlvAttachmentLocation.TopCenter,
                 IlvAttachmentLocation.BottomCenter, 0, 3));

   // Creates the alarm balloon

   IlvCompositeGraphic alarmBalloon = new IlvCompositeGraphic();
   // Adds it to the node
   node.setChildren(5, alarmBalloon);
   node.setConstraints(5,
         new IlvAttachmentConstraint(
                 IlvAttachmentLocation.HotSpot,
                 IlvAttachmentLocation.TopRight, -4, 4));

   // Put the alarm balloon above all the other objects (which are at the level 10)
   node.setLayers(5, 20);
   // Sets a centered layout
   alarmBalloon.setLayout(new IlvCenteredLayout(new Insets(6, 10, 6, 10)));

   // Creates a balloon
   IlvRoundRectBalloon balloon = new IlvRoundRectBalloon();
   balloon.setOrientation(SwingConstants.NORTH_EAST);
   balloon.setPointerDepth(10);
   balloon.setShadowThickness(2);
   balloon.setRadius(15);
   balloon.setShadowColor(Color.black);
   balloon.setBorderColor(Color.black);
   balloon.setBalloonColor(Color.gray);
   // Adds it to the alarm balloon
   alarmBalloon.setChildren(0, balloon);

   // Creates the text within the balloon
   IlvText alarmSource = new IlvText(new IlvPoint(), "Kernel Panic");
   alarmSource.setFont(Font.decode("sansserif-10"));
   alarmBalloon.setChildren(1, alarmSource);
 

Use the Stacker Layout

The following code example shows how to build the composite graphic displayed on the right:

   // Creates the composite graphic
   IlvCompositeGraphic node = new IlvCompositeGraphic();
   // Sets the layout
   IlvAttachmentLayout layout = new IlvAttachmentLayout();
   node.setLayout(layout);

   // Creates a white rectangle
   RoundRectangle2D.Float shape = new RoundRectangle2D.Float(0, 0, 100, 50, 10, 10);
   IlvGeneralPath path = new IlvGeneralPath(shape);
   path.setFillOn(true);
   path.setStroke(new BasicStroke(2));
   path.setForeground(Color.black);
   path.setBackground(Color.white);
   node.setChildren(0, path);

   // Creates the container for stacking the icons horizontally to the right
   IlvCompositeGraphic icons = new IlvCompositeGraphic();
   IlvStackerLayout stacker = new IlvStackerLayout(
                                    SwingConstants.RIGHT,
                                    SwingConstants.CENTER, 3);
   icons.setLayout(stacker);

   // Create the ad-hoc icon
   IlvIcon ad_hoc = new IlvIcon("ad-hoc-marker.gif", new IlvRect(0, 0, 16, 7));
   icons.setChildren(1, ad_hoc);
   // Create the loop icon
   IlvIcon loop = new IlvIcon("loop-marker.gif", new IlvRect(0, 0, 16, 16));
   icons.setChildren(2, loop);
   // Create the collapsed icon
   IlvIcon collapsed = new IlvIcon("collapsed-marker.gif", new IlvRect(0, 0, 16, 16));
   icons.setChildren(3, collapsed);

   // Attach the BottomCenter (hotspot) of the stacker to the
   // BottomCenter (anchor) of the rectangle
   node.setChildren(1, icons);
   node.setConstraints(1,
         new IlvAttachmentConstraint(
                 IlvAttachmentLocation.BottomCenter,
                 IlvAttachmentLocation.BottomCenter, 0, -1));

   // Creates the label
   IlvZoomableLabel name = new IlvZoomableLabel(new IlvPoint(), "Name", false);
   name.setFont(Font.decode("sansserif-BOLD-12"));
   node.setChildren(2, name);
   node.setConstraints(2,
         new IlvAttachmentConstraint(
                 IlvAttachmentLocation.Center,
                 IlvAttachmentLocation.Center));
 

Add a Tooltip

The following code example shows how to build the composite graphic displayed on the right:

 // Creates the composite graphic
 IlvCompositeGraphic node = new IlvCompositeGraphic();
 // Sets the layout
 node.setLayout(new IlvAttachmentLayout());

 // Creates the fax icon
 IlvIcon fax = new IlvIcon("fax4a.gif", new IlvRect(0, 0, 32, 32));
 node.setChildren(0, fax);

 // Creates the alarm symbol
 IlvIcon critical = new IlvIcon("critical.gif", new IlvRect(0, 0, 16, 16));
 node.setChildren(1, critical);
 // Attaches the symbol
 node.setConstraints(1,
       new IlvAttachmentConstraint(
               IlvAttachmentLocation.BottomRight,
               IlvAttachmentLocation.BottomRight, 7, 4));

 // Tooltips can be on the entire node, or on any of its children.
 // Creates the tooltip on the alarm symbol
 String tp = "<HTML>" +
      "<TABLE>" +
      "<CAPTION><b>Fax Alarms</b></CAPTION>" +
      "<TR><TD>Critical:</TD><TD>1</TD></TR>" +
      "<TR><TD>Major:</TD><TD>3</TD></TR>" +
      "<TR><TD>Minor:</TD><TD>6</TD></TR>" +
      "</TABLE>" +
      "</HTML>";
 critical.setToolTipText(tp);
 

About Graphic Objects

IlvCompositeGraphic is a custom graphic object, that is, a subclass of IlvGraphic. Graphic objects are controlled using an instance of IlvManager or one of its subclasses, and displayed using one or more IlvManagerView instances in a Java Swing application. For information about generic features for graphic objects, see IlvGraphic.

Limitation: IlvCompositeGraphic is not compatible with ILOG JViews Prototypes and should not be used inside a prototype.

Since:
JViews 6.0
See Also:
IlvAttachmentConstraint, IlvAttachmentLayout, IlvAttachmentLocation, IlvAttachmentConstraint, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class ilog.views.graphic.IlvGraphicSet
IlvGraphicSet.DelegateObjectInteractor
 
Field Summary
static int BaseBorderSelection
          The IlvBaseBorderSelection class draws a white border of 2 pixels around the first child (the base) of an IlvCompositeGraphic instance to show that it is selected.
static int BaseHandleSelection
          Selection type that draws eight handles around the bounding rectangle of the first child (the base) of an IlvCompositeGraphic instance to show that it is selected.
static int CompositeHandleSelection
          Selection type that draws eight handles around the bounding rectangle of the IlvCompositeGraphic instance to show that it is selected.
static int InvisibleSelection
          With the IlvInvisibleSelection class, nothing is drawn around the bounding box of an selected IlvGraphic instance.
static int ResizingBase
          The rectangle parameter of moveResize(ilog.views.IlvRect) specifies the new size of the base
static int ResizingComposite
          The rectangle parameter of moveResize(ilog.views.IlvRect) specifies the new size of the composite
static int TransformationModeAll
          The transformation passed as a parameter to applyTransform(IlvTransformer) will be applied to all the children
static int TransformationModeBaseOnly
          The transformation passed as a parameter to applyTransform(IlvTransformer) will be applied only to the first child (the base), depending on the layout
 
Fields inherited from class ilog.views.graphic.IlvGraphicSet
list
 
Constructor Summary
IlvCompositeGraphic()
          Creates an IlvCompositeGraphic instance.
IlvCompositeGraphic(IlvCompositeGraphic source)
          Creates a new IlvCompositeGraphic by copying an existing one.
IlvCompositeGraphic(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvCompositeGraphic(IlvLayoutManager layout)
          Creates an IlvCompositeGraphic instance with the given layout.
 
Method Summary
 int addChild(IlvGraphic child)
          Adds a child at the first available slot in the children array.
 void applyTransform(IlvTransformer t)
          Applies a transformation to the shape of the object.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of this composite node.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests if a point lies within the outline of the object.
 IlvGraphic copy()
          Returns a copy of this composite node.
 void doLayout()
          Lays out this Composite Node.
protected  void drawCore(Graphics2D dst, IlvTransformer t)
          Draws the object.
 Action getAction(int index, IlvMouseGesture gesture)
          Returns the action associated with the child and the given gesture if any.
 IlvAttachableGraphic getAttachableGraphic(IlvGraphic element)
          Returns an IlvAttachableGraphic for the supplied IlvGraphic
 IlvAttachable[] getAttachables()
          Returns the children of this object wrapped into IlvAttachableGraphic instances.
 IlvRect getAttachmentBounds()
          Returns the "attachment rectangle".
static IlvRect getAttachmentBounds(IlvGraphic graphic)
          Returns the bounding box used to attach the graphics within a composite graphic.
 IlvGraphic[] getChildren()
          Returns all the children of this IlvCompositeGraphic instance.
 IlvGraphic getChildren(int index)
          Returns the child at the supplied position.
 Object[] getConstraints()
          Returns the constraints of the children of this object.
 Object getConstraints(int index)
          Returns the constraints of the child at the given position of this object.
 IlvRect getDefinitionRect()
          Returns the rectangle that contains the ellipse defining the arc.
 IlvTransformer getDefinitionTransformer()
          This function returns null to indicate that there is no definition transformation.
 IlvEventMap getEventMap()
          Returns the event map of this object.
 IlvEventMap[] getEventMaps()
          Returns the event maps of the children of this object.
 IlvEventMap getEventMaps(int index)
          Returns the event map of the child of this object at the supplied position.
protected  IlvGraphic getGraphicBag(int index)
          Returns the graphic of the child at the given position
 IlvPoint getHotSpot()
          Returns the hotspot of the base (first child of this object) if any, otherwise null
 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.
 String getLabel()
          Returns the label of the object.
 IlvRect getLabelBBox(IlvTransformer t)
          Returns the area where the label is displayed.
protected  int getLayers(int index)
          Returns the layer of the child at the specified position, or -1 if the child at the specified position is in the same layer as this IlvCompositeGraphic.
 IlvLayoutManager getLayout()
          Returns the layout manager for this composite graphic.
 boolean[] getLinkClippables()
          Returns whether the clipping link connector clips agains the children.
 boolean getLinkClippables(int index)
          Returns whether the clipping link connector clips agains the child with the given index.
 IlvGraphic getObject(String name)
          Returns the object with the specified name.
 IlvComposite getParent()
          Returns the parent of this object.
 int getResizingPolicy()
          Returns the resizing policy
 IlvComposite getRoot()
          Returns the root of the hierarchy to this object belongs to.
 int getSelectionType()
          Return the type of the IlvSelection class that is used to show the selection.
 int getTransformationMode()
          Returns the transformation mode.
 double[] getVisibilityThresholds()
          Returns the zoom level above which the children are visible.
 double getVisibilityThresholds(int index)
          Returns the zoom level above which the child at the supplied position is visible.
 boolean hasActions(int index)
          Returns true if this objet has at least one action for the child at the supplied position
 void invalidate()
          Invalidates this IlvCompositeGraphic.
 boolean isEmpty()
          Returns true if this IlvCompositeGraphic has no children.
static boolean isJViews80BoundingBoxCompatibility()
          Returns whether the compatibility mode how the bounding box of composite graphic objects are treated.
 boolean isSensitive()
          When returns true, the AWT events are dispatched to the Swing actions defined in the event maps.
 boolean isValid()
          Returns true when this object needs to be rebuilt.
 boolean isVisible()
          Returns true when this graphic set is visible and at least one graphic object of this set is visible.
 IlvSelection makeSelection()
          Creates an selection object around the bounding box of the first child.
 void moveResize(IlvRect size)
          Resizes this object depending on the resizingPolicy.
protected  void removeChild(int index)
          Remove the child at the supplied position.
 void reshapeObject(IlvGraphic obj, IlvRect newrect, boolean redraw)
          Changes the size of a graphic child in this IlvCompositeGraphic.
 void resize(float neww, float newh)
          Resizes this object.
 void rotate(IlvPoint center, double angle)
          Rotates the object.
 void scale(double scalex, double scaley)
          Resizes the object.
 void selectionChanged(ManagerSelectionChangedEvent event)
          This method is called when the selection changes in a manager.
 void setChildren(IlvGraphic[] children)
          Sets a new collection of children for this object.
 void setChildren(int index, IlvGraphic child)
          Removes the current child at the supplied position if any, and adds the given child to this object at the supplied position.
 void setConstraints(int index, Object constraint)
          Sets the attachments for the child at the given position of this object.
 void setConstraints(Object[] attachments)
          Sets the attachments for each child of this object.
 void setDefinitionRect(IlvRect rect)
          Note that, if this composite graphic 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.
 void setEventMap(IlvEventMap eventMap)
          Sets the event map of this object.
 void setEventMaps(IlvEventMap[] eventMaps)
          Sets the event maps of all the children of this object.
 void setEventMaps(int index, IlvEventMap eventMap)
          Sets the event map of the child at the supplied position.
 void setGraphicBag(IlvGraphicBag bag)
          Changes the bag that contains the object.
static void setJViews80BoundingBoxCompatibility(boolean enable)
          Enables or disables the compatibility mode how the bounding box of composite graphic objects are treated.
 void setLabel(String label)
          Changes the label of the object.
 void setLayout(IlvLayoutManager layout)
          Sets the layout manager for this composite graphic.
 void setLayoutEnabled(boolean layoutSelf, boolean layoutParent)
          This method is for internal purposes, do not use.
 void setLinkClippables(boolean[] clippables)
          Sets whether the clipping link connector clips agains the children.
 void setLinkClippables(int index, boolean clippable)
          Sets whether the clipping link connector clips agains the child with the given index.
 void setResizingPolicy(int resizingPolicy)
          There are two possible values for the resizingPolicy parameter: ResizingBase: The rectangle parameter of moveResize(ilog.views.IlvRect) specifies the new size of the base.
 void setSelectionType(int selectionType)
          Sets the IlvSelection class that is used to show that this IlvCompositeGraphic is selected.
 void setSensitive(boolean sensitive)
          When this property is set to true, the object interactor IlvCompositeInteractor dispatches the AWT events to the Swing actions defined in the event maps.
 void setTransformationMode(int mode)
          Sets the transformation mode.
 void setVisibilityThresholds(double[] thresholds)
          Sets the zoom thresholds for each child above which the children are visible
 void setVisibilityThresholds(int index, double threshold)
          This property defines above which zoom level the child at the supplied index will be visible.
 boolean supportMultiline()
          Returns true if the label can be a multiline label; false otherwise.
 void validate()
          Ensures that this component has a valid layout.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 boolean zoomable()
          Tests if the graphic set is zoomable.
 
Methods inherited from class ilog.views.graphic.IlvGraphicSet
addGraphicBagHierarchyListener, addManagerViewsHierarchyListener, addObject, addObjectAt, applyToObject, contains, draw, enableGraphicBagHierarchyEventForwarding, enableManagerViewsHierarchyEventForwarding, fireGraphicBagHierarchyEvent, fireManagerViewsHierarchyEvent, firstContains, getAlpha, getCardinal, getClip, getIndex, getObject, getObjectName, getObjects, getOriginalPopupMenu, getPopupMenu, getToolTipText, isPersistent, moveObject, needsGraphicBagHierarchyEvent, needsManagerViewsHierarchyEvent, reDrawObj, reDrawRegion, removeAll, removeGraphicBagHierarchyListener, removeManagerViewsHierarchyListener, removeObject, removeObjectAt, setAlpha, setClip, setObjectName
 
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, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, move, move, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, setBackground, setEditable, setFillOn, setForeground, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString, translate
 
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
 

Field Detail

BaseHandleSelection

public static final int BaseHandleSelection
Selection type that draws eight handles around the bounding rectangle of the first child (the base) of an IlvCompositeGraphic instance to show that it is selected.

See Also:
Constant Field Values

BaseBorderSelection

public static final int BaseBorderSelection
The IlvBaseBorderSelection class draws a white border of 2 pixels around the first child (the base) of an IlvCompositeGraphic instance to show that it is selected.

See Also:
Constant Field Values

InvisibleSelection

public static final int InvisibleSelection
With the IlvInvisibleSelection class, nothing is drawn around the bounding box of an selected IlvGraphic instance.

See Also:
Constant Field Values

CompositeHandleSelection

public static final int CompositeHandleSelection
Selection type that draws eight handles around the bounding rectangle of the IlvCompositeGraphic instance to show that it is selected.

Since:
JViews 7.5
See Also:
Constant Field Values

ResizingComposite

public static final int ResizingComposite
The rectangle parameter of moveResize(ilog.views.IlvRect) specifies the new size of the composite

See Also:
setResizingPolicy(int), Constant Field Values

ResizingBase

public static final int ResizingBase
The rectangle parameter of moveResize(ilog.views.IlvRect) specifies the new size of the base

See Also:
setResizingPolicy(int), Constant Field Values

TransformationModeAll

public static final int TransformationModeAll
The transformation passed as a parameter to applyTransform(IlvTransformer) will be applied to all the children

Since:
JViews 7.5
See Also:
setTransformationMode(int), Constant Field Values

TransformationModeBaseOnly

public static final int TransformationModeBaseOnly
The transformation passed as a parameter to applyTransform(IlvTransformer) will be applied only to the first child (the base), depending on the layout

Since:
JViews 7.5
See Also:
setTransformationMode(int), IlvLayoutManager.resizeFirstChildOnly(), Constant Field Values
Constructor Detail

IlvCompositeGraphic

public IlvCompositeGraphic()
Creates an IlvCompositeGraphic instance.


IlvCompositeGraphic

public IlvCompositeGraphic(IlvLayoutManager layout)
Creates an IlvCompositeGraphic instance with the given layout.

Parameters:
layout - The layout to be used to position the children of this object.
See Also:
setLayout(ilog.views.graphic.composite.layout.IlvLayoutManager), getLayout(), IlvAttachmentLayout, IlvCenteredLayout, IlvStackerLayout

IlvCompositeGraphic

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


IlvCompositeGraphic

public IlvCompositeGraphic(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()
Returns a copy of this composite node.

Overrides:
copy in class IlvGraphicSet
Returns:
A new composite node that is a copy of this one.
See Also:
IlvGraphic

isValid

public boolean isValid()
Returns true when this object needs to be rebuilt.

Specified by:
isValid in interface IlvComposite

invalidate

public void invalidate()
Invalidates this IlvCompositeGraphic. This composite graphic and all parents above it are marked as needing to be laid out.

This method must also be called whenever bounding box is changed, even if this change does not require a relayout of the decorations.

Note that this method is automatically called when a change occurs for this composite graphic. It only needs to be called directly in special cases such as writing subclassing. For instance, the default implementation of moveResize(IlvRect) performs the invalidation. Hence, if this method is overridden without calling super.moveResize, invalidate must be called explicitly.

Specified by:
invalidate in interface IlvComposite

validate

public void validate()
Ensures that this component has a valid layout.


setLayout

public void setLayout(IlvLayoutManager layout)
Sets the layout manager for this composite graphic.

Parameters:
layout - the specified layout manager
See Also:
getLayout()

getLayout

public IlvLayoutManager getLayout()
Returns the layout manager for this composite graphic.

See Also:
setLayout(ilog.views.graphic.composite.layout.IlvLayoutManager)

setChildren

public void setChildren(IlvGraphic[] children)
Sets a new collection of children for this object. Note that a call to this method can modify the bounding box of this object. For this reason, if the graphic set 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.

Parameters:
children - Array of children to be added. The value null removes all the children.

setChildren

public void setChildren(int index,
                        IlvGraphic child)
Removes the current child at the supplied position if any, and adds the given child to this object at the supplied position. Note that a call to this method can modify the bounding box of this object. For this reason, if the graphic set 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.

Parameters:
index - The position of the child to be set.
child - The child to be added. The value null removes the current child at the supplied position.

getChildren

public IlvGraphic getChildren(int index)
Returns the child at the supplied position.

Specified by:
getChildren in interface IlvComposite
Parameters:
index - The position of the child to return.
Returns:
The IlvGraphic at the given position or null if none.

getParent

public IlvComposite getParent()
Returns the parent of this object.

Specified by:
getParent in interface IlvComposite

getRoot

public IlvComposite getRoot()
Returns the root of the hierarchy to this object belongs to.

Specified by:
getRoot in interface IlvComposite

getChildren

public IlvGraphic[] getChildren()
Returns all the children of this IlvCompositeGraphic instance.

Specified by:
getChildren in interface IlvComposite
Returns:
Array of the children, some position may be null

setConstraints

public void setConstraints(Object[] attachments)
Sets the attachments for each child of this object. These attachments are taken into account by the layout.

Parameters:
attachments - Array of constraints for the layout
See Also:
setLayout(ilog.views.graphic.composite.layout.IlvLayoutManager), IlvAttachmentConstraint, IlvAttachmentLayout

setConstraints

public void setConstraints(int index,
                           Object constraint)
Sets the attachments for the child at the given position of this object. These attachments are taken into account by the layout.

Parameters:
index - The position of the child that the supplied constraint applies to.
constraint - The constraint used by the layout for the child
See Also:
setLayout(ilog.views.graphic.composite.layout.IlvLayoutManager), IlvAttachmentConstraint, IlvAttachmentLayout

getConstraints

public Object[] getConstraints()
Returns the constraints of the children of this object.

See Also:
IlvAttachmentConstraint, IlvAttachmentLayout

getConstraints

public Object getConstraints(int index)
Returns the constraints of the child at the given position of this object.

See Also:
IlvAttachmentConstraint, IlvAttachmentLayout

getAttachables

public IlvAttachable[] getAttachables()
Returns the children of this object wrapped into IlvAttachableGraphic instances.

See Also:
IlvAttachableGraphic, IlvLayoutManager

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of this composite node.

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

zoomable

public boolean zoomable()
Tests if the graphic set is zoomable. This object is zoomable if all contained objects are zoomable.

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

moveResize

public void moveResize(IlvRect size)
Resizes this object depending on the resizingPolicy.
if the resizingPolicy is resizingComposite the supplied size defines the new size of this object.
if the resizingPolicy is resizingBase the supplied size defines the new size of the base.

Overrides:
moveResize in class IlvGraphic
Parameters:
size - The new bounding rectangle of this object.
See Also:
setResizingPolicy(int), ResizingBase, ResizingComposite

resize

public void resize(float neww,
                   float newh)
Resizes this object. The way the bounding box of this object is modified depends on the resizingPolicy.
If the resizingPolicy is ResizingComposite, it sets its new size as (neww, newh).
If the resizingPolicy is ResizingBase, it sets the size of the base as (neww, newh). This method calls the applyTransform method.

Overrides:
resize in class IlvGraphic
Parameters:
neww - The new horizontal width.
newh - The new horizontal height.
See Also:
setResizingPolicy(int), ResizingBase, ResizingComposite

scale

public void scale(double scalex,
                  double scaley)
Resizes the object. Resizes the bounding rectangle of the object by a factor (scalex, scaley). This method calls the applyTransform method.

Overrides:
scale in class IlvGraphic
Parameters:
scalex - The horizontal scaling factor.
scaley - The vertical scaling factor.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

setResizingPolicy

public void setResizingPolicy(int resizingPolicy)
There are two possible values for the resizingPolicy parameter:

Parameters:
resizingPolicy -
See Also:
ResizingBase, ResizingComposite, moveResize(ilog.views.IlvRect)

getResizingPolicy

public int getResizingPolicy()
Returns the resizing policy

See Also:
setResizingPolicy(int)

drawCore

protected void drawCore(Graphics2D dst,
                        IlvTransformer t)
Draws the object. This method is called from IlvGraphicSet.draw(java.awt.Graphics, ilog.views.IlvTransformer) after processing the alpha transparency. It can be overridden in subclasses.

Overrides:
drawCore in class IlvGraphicSet
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
Since:
JViews 8.1
See Also:
IlvGraphicSet.setAlpha(float)

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests if a point lies within the outline of the object. Calls firstContains to find the first object that contains the point.

Overrides:
contains in class IlvGraphicSet
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:
IlvGraphicSet.firstContains(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvTransformer)

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

applyTransform

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

Note that the method must never be called with a null argument.

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

setLayoutEnabled

public void setLayoutEnabled(boolean layoutSelf,
                             boolean layoutParent)
This method is for internal purposes, do not use.

Since:
JViews 8.0

doLayout

public void doLayout()
Lays out this Composite Node. You should not call this method directly.

Specified by:
doLayout in interface IlvComposite

setGraphicBag

public void setGraphicBag(IlvGraphicBag bag)
Changes the bag that contains the object. You should not call this method directly unless you are creating a new type of bag.

Overrides:
setGraphicBag in class IlvGraphicSet
Parameters:
bag - The graphic bag.
See Also:
IlvGraphic

removeChild

protected void removeChild(int index)
Remove the child at the supplied position.

Parameters:
index - The position of the child to be removed.