ilog.views.graphic.composite.decoration
Class IlvRoundRectBalloon

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.composite.decoration.IlvBalloon
          extended by ilog.views.graphic.composite.decoration.IlvRoundRectBalloon
All Implemented Interfaces:
IlvHotSpot, IlvPersistentObject, Transferable, Serializable

public class IlvRoundRectBalloon
extends IlvBalloon

IlvRoundRectBalloon represents a balloon with a rectangle shape and rounded corners.

The default settings for an IlvRoundRectBalloon instance are the same as IlvBalloon.

Example

The following code example shows how to use IlvRoundRectBalloon in a simple Java application:
  IlvManager manager = new IlvManager();
  // Creates the composite graphic with an IlvCenteredLayout
  IlvCompositeGraphic node = new IlvCompositeGraphic();
  node.setLayout(new IlvCenteredLayout(new Insets(4,10,4,10)));

  // Creates the 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.red);

  // Creates a multiline label
  IlvZoomableLabel label = new IlvZoomableLabel(new IlvPoint(0,0),
        "IlvRoundRectBalloon Example\nThis is a balloon");

  // Adds the balloon and its label
  node.setChildren(0,balloon);
  node.setChildren(1,label);
  manager.addObject(node, true);
 

The following image shows the graphic objects created in the code example:

About Graphic Objects

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

Since:
JViews 6.0
See Also:
IlvCompositeGraphic, IlvCenteredLayout, IlvManager, IlvManagerView, Serialized Form

Constructor Summary
IlvRoundRectBalloon()
          Beans constructor.
IlvRoundRectBalloon(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvRoundRectBalloon(IlvRoundRectBalloon source)
          Creates a new IlvRoundRectBalloon by copying an existing one.
IlvRoundRectBalloon(int orientation, int pointerDepth, int shadowThickness, Color balloonColor, Color balloonBorderColor, Color balloonShadowColor, int radius, int pointerDistance)
          Creates a round rectangle balloon with the characteristics given as parameters.
 
Method Summary
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests if a point lies within this balloon.
 IlvGraphic copy()
          Returns a copy of this balloon.
 void draw(Graphics g, IlvTransformer t)
          Draws the object.
 IlvPoint getHotSpot()
          The hot spot is the corner of the pointer
 int getPointerDistance()
          Returns the pointer distance, which is the distance from the left balloon face.
 int getRadius()
          Returns the radius used to create the round rectangle.
 void setPointerDistance(int pointerDistance)
          Sets the distance from the left balloon face.
 void setRadius(int radius)
          Sets the radius used to create the round rectangle.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class ilog.views.graphic.composite.decoration.IlvBalloon
applyTransform, boundingBox, getBalloonColor, getBorderColor, getInsets, getOrientation, getPointerDepth, getShadowColor, getShadowThickness, moveResize, setBalloonColor, setBorderColor, setInsets, setOrientation, setPointerDepth, setShadowColor, setShadowThickness
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, isVisible, makeSelection, move, move, 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, zoomable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvRoundRectBalloon

public IlvRoundRectBalloon()
Beans constructor.


IlvRoundRectBalloon

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


IlvRoundRectBalloon

public IlvRoundRectBalloon(int orientation,
                           int pointerDepth,
                           int shadowThickness,
                           Color balloonColor,
                           Color balloonBorderColor,
                           Color balloonShadowColor,
                           int radius,
                           int pointerDistance)
Creates a round rectangle balloon with the characteristics given as parameters.

Parameters:
orientation - Balloon orientation.
pointerDepth - Balloon pointer depth.
shadowThickness - Balloon shadow thickness.
balloonColor - Balloon background color.
balloonBorderColor - Balloon border color.
balloonShadowColor - Balloon shadow color.
radius - Balloon round rectangle radius.
pointerDistance - Balloon pointer distance.

IlvRoundRectBalloon

public IlvRoundRectBalloon(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 balloon.

Specified by:
copy in class IlvGraphic
Returns:
A new balloon that is a copy of this one.
See Also:
IlvGraphic

getHotSpot

public IlvPoint getHotSpot()
The hot spot is the corner of the pointer


setPointerDistance

public void setPointerDistance(int pointerDistance)
Sets the distance from the left balloon face. By default, the balloon pointer is displayed in the middle of the balloon face.


getPointerDistance

public int getPointerDistance()
Returns the pointer distance, which is the distance from the left balloon face.


setRadius

public void setRadius(int radius)
Sets the radius used to create the round rectangle.


getRadius

public int getRadius()
Returns the radius used to create the round rectangle.


draw

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

Specified by:
draw in class IlvGraphic
Parameters:
g - The graphic context.
t - The transformer used to draw the object.
See Also:
IlvGraphic.boundingBox(ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests if a point lies within this balloon.

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

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an IlvOutputStream. You should not call this method directly; instead, you should use the write methods of the manager.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvBalloon
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.