|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.IlvGraphic
ilog.views.graphic.composite.decoration.IlvBracket
public class IlvBracket
An IlvBracket draws a square bracket oriented to either the
left or right. This class is designed to be used with an
IlvCompositeGraphic instance.
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:
IlvDirection.LeftColor.blackColor.whitefalseBasicStroke(1)1000.25f100100
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 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.
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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IlvBracket()
IlvBracket with the default values.
public IlvBracket(IlvBracket source)
IlvBracket by copying an existing one.
public IlvBracket(IlvInputStream stream)
throws IlvReadFileException
IlvInputStream.
stream - The input stream.
IlvReadFileException - if the format is not correct.| Method Detail |
|---|
public IlvGraphic copy()
copy in class IlvGraphicIlvGraphicpublic void applyTransform(IlvTransformer t)
Note that the method must never be called with a null
argument.
applyTransform in class IlvGraphict - The transformer to be applied.IlvGraphicpublic IlvRect boundingBox(IlvTransformer t)
boundingBox in class IlvGraphict - The transformer used to draw the object. If the
transformer is null, the bounding box for the
identity transformer is returned.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphic
public void draw(Graphics dst,
IlvTransformer t)
draw in class IlvGraphicdst - The destination Graphics.t - The transformation used to draw the object.boundingBox(ilog.views.IlvTransformer),
IlvGraphic.zoomable()public void setForeground(Color color)
IlvRectangle. It is the
color used to draw the outline of the rectangle.
setForeground in class IlvGraphiccolor - The new foreground color.IlvGraphic.draw(Graphics, IlvTransformer),
IlvGraphic.setBackground(Color),
IlvGraphic.setFillOn(boolean),
IlvGraphic.setStrokeOn(boolean),
IlvGraphicpublic Color getForeground()
IlvRectangle.
It is the color used to draw the outline of the rectangle.
public void setBackground(Color color)
IlvRectangle. It is the
color used to fill the rectangle.
setBackground in class IlvGraphiccolor - The new background color.IlvGraphic.draw(Graphics, IlvTransformer),
IlvGraphic.setForeground(Color),
IlvGraphic.setFillOn(boolean),
IlvGraphic.setStrokeOn(boolean),
IlvGraphicpublic Color getBackground()
IlvRectangle. It is the
color used to fill the rectangle.
public void setWidth(float width)
setWidthRatio(float)public float getWidth()
public void setHeight(float height)
public float getHeight()
public void setWidthRatio(float ratio)
with multiplied by ratio.
This property is ignored if getFixedWidth() returns a value greater than 0.
ratio - the ratio must be between 0 1setFixedWidth(float)public float getWidthRatio()
public void setFixedWidth(float width)
width - public float getFixedWidth()
public int getOrientation()
public void setOrientation(int orientation)
orientation - public void setFillOn(boolean fillOn)
true, specifies that the inside of the
bracket will be filled.
setFillOn in class IlvGraphicfillOn - Set to true to enable the fill style for this
graphic object.isFillOn()public void setStroke(Stroke stroke)
public Stroke getStroke()
public boolean isFillOn()
true if the inside of the
bracket will be filled.
setFillOn(boolean)
public void write(IlvOutputStream stream)
throws IOException
IlvOutputStream.
You should not
call this method directly; instead, you should use the write
methods of the manager.
write in interface IlvPersistentObjectwrite in class IlvGraphicstream - The output stream.
IOException - thrown when an exception occurs during
the write operation for this object.
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||