ilog.views.graphic.composite.decoration
Class IlvBracket

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

public class IlvBracket
extends IlvGraphic

An IlvBracket draws a square bracket oriented to either the left or right. This class is designed to be used with an IlvCompositeGraphic instance.

Overview

The size of an IlvBracket instance is defined by the width and height properties of its defining rectangle. If the fixed width of this IlvBracket instance is greater than 0, the width between the horizontal borders is the value returned by getFixedWidth(). If the fixed width equals 0, the width between the horizontal borders is the width of the definition rectangle multiplied by the ratio.

The default values for an IlvBracket instance are as follows:

Example

The following code example shows how to use IlvBracket in a simple Java application:

 IlvGrapher grapher = new IlvGrapher();
 // Creates the composite graphic with an IlvCenteredLayout layout
 IlvCompositeGraphic composite = new IlvCompositeGraphic();
 IlvCenteredLayout cl = new IlvCenteredLayout();
 cl.setInsets(new Insets(10,10,10,10));
 composite.setLayout(cl);

 // Creates an IlvBracket and adds it to the composite graphic
 IlvBracket bracket = new IlvBracket();
 bracket.setFillOn(false);
 bracket.setStroke(new BasicStroke(2));
 bracket.setBackground(Color.lightGray);
 bracket.setWidthRatio(0.5f);
 composite.setChildren(0,bracket);

 // Creates the label and adds it to the composite graphic
 IlvZoomableLabel text = new IlvZoomableLabel(new IlvPoint(),"This is a Left Bracket");
 composite.setChildren(1,text);

 // Adds the composite into the grapher.
 grapher.addNode(composite,false);
 

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

IlvBracket

About Graphic Objects

IlvBracket 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.

Since:
JViews 6.0
See Also:
setWidth(float), setHeight(float), setWidthRatio(float), setFixedWidth(float), IlvCompositeGraphic, IlvCenteredLayout, IlvManager, IlvManagerView, IlvGrapher, Serialized Form

Constructor Summary
IlvBracket()
          Creates an IlvBracket with the default values.
IlvBracket(IlvBracket source)
          Creates a new IlvBracket by copying an existing one.
IlvBracket(IlvInputStream stream)
          Reads the object from an IlvInputStream.
 
Method Summary
 void applyTransform(IlvTransformer t)
          Applies a transformation to the shape of this object.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of this object.
 IlvGraphic copy()
          Copies this object.
 void draw(Graphics dst, IlvTransformer t)
          Draws this object.
 Color getBackground()
          Returns the background color of the IlvRectangle.
 float getFixedWidth()
          Returns the width used to draw the two horizontal borders of this object.
 Color getForeground()
          Returns the foreground color of the IlvRectangle.
 float getHeight()
          Returns the height of the definition rectangle.
 int getOrientation()
          Returns the orientation of the bracket.
 Stroke getStroke()
          Returns the stroke used to draw this bracket
 float getWidth()
          Returns the width of the definition rectangle.
 float getWidthRatio()
          Returns the ratio
 boolean isFillOn()
          Returns true if the inside of the bracket will be filled.
 void setBackground(Color color)
          Changes the background color of the IlvRectangle.
 void setFillOn(boolean fillOn)
          If true, specifies that the inside of the bracket will be filled.
 void setFixedWidth(float width)
          Sets the width used to draw the two horizontal borders of this object.
 void setForeground(Color color)
          Changes the foreground color of the IlvRectangle.
 void setHeight(float height)
          Sets the height of the definition rectangle.
 void setOrientation(int orientation)
          Sets the orientation of the bracket.
 void setStroke(Stroke stroke)
          Sets the stroke used to draw this bracket
 void setWidth(float width)
          Sets the width of the definition rectangle.
 void setWidthRatio(float ratio)
          Sets the ratio used to compute the width of the two horizontal borders of this object.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, contains, 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, moveResize, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setEditable, 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

IlvBracket

public IlvBracket()
Creates an IlvBracket with the default values.


IlvBracket

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


IlvBracket

public IlvBracket(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 this object.

Specified by:
copy in class IlvGraphic
Returns:
A copy of this object.
See Also:
IlvGraphic

applyTransform

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

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

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

boundingBox

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

Specified by:
boundingBox in class IlvGraphic
Parameters:
t - The transformer used to draw the object. If the transformer is null, the bounding box for the identity transformer is returned.
See Also:
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

draw

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

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

setForeground

public void setForeground(Color color)
Changes the foreground color of the IlvRectangle. It is the color used to draw the outline of the rectangle.

Overrides:
setForeground in class IlvGraphic
Parameters:
color - The new foreground color.
See Also:
IlvGraphic.draw(Graphics, IlvTransformer), IlvGraphic.setBackground(Color), IlvGraphic.setFillOn(boolean), IlvGraphic.setStrokeOn(boolean), IlvGraphic

getForeground

public Color getForeground()
Returns the foreground color of the IlvRectangle. It is the color used to draw the outline of the rectangle.

Returns:
The foreground color.

setBackground

public void setBackground(Color color)
Changes the background color of the IlvRectangle. It is the color used to fill the rectangle.

Overrides:
setBackground in class IlvGraphic
Parameters:
color - The new background color.
See Also:
IlvGraphic.draw(Graphics, IlvTransformer), IlvGraphic.setForeground(Color), IlvGraphic.setFillOn(boolean), IlvGraphic.setStrokeOn(boolean), IlvGraphic

getBackground

public Color getBackground()
Returns the background color of the IlvRectangle. It is the color used to fill the rectangle.

Returns:
The background color.

setWidth

public void setWidth(float width)
Sets the width of the definition rectangle.

See Also:
setWidthRatio(float)

getWidth

public float getWidth()
Returns the width of the definition rectangle.


setHeight

public void setHeight(float height)
Sets the height of the definition rectangle.


getHeight

public float getHeight()
Returns the height of the definition rectangle.


setWidthRatio

public void setWidthRatio(float ratio)
Sets the ratio used to compute the width of the two horizontal borders of this object. The width of the two horizontal borders is with multiplied by ratio. This property is ignored if getFixedWidth() returns a value greater than 0.

Parameters:
ratio - the ratio must be between 0 1
See Also:
setFixedWidth(float)

getWidthRatio

public float getWidthRatio()
Returns the ratio


setFixedWidth

public void setFixedWidth(float width)
Sets the width used to draw the two horizontal borders of this object.

Parameters:
width -

getFixedWidth

public float getFixedWidth()
Returns the width used to draw the two horizontal borders of this object.


getOrientation

public int getOrientation()
Returns the orientation of the bracket. The possible values are:


setOrientation

public void setOrientation(int orientation)
Sets the orientation of the bracket. The possible values are:

Parameters:
orientation -

setFillOn

public void setFillOn(boolean fillOn)
If true, specifies that the inside of the bracket will be filled.

Overrides:
setFillOn in class IlvGraphic
Parameters:
fillOn - Set to true to enable the fill style for this graphic object.
See Also:
isFillOn()

setStroke

public void setStroke(Stroke stroke)
Sets the stroke used to draw this bracket


getStroke

public Stroke getStroke()
Returns the stroke used to draw this bracket


isFillOn

public boolean isFillOn()
Returns true if the inside of the bracket will be filled.

See Also:
setFillOn(boolean)

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 IlvGraphic
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.