public class IlvBracket extends IlvGraphic
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.Left
Color.black
Color.white
false
BasicStroke(1)
100
0.25
100
100
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.5); 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(double)
,
setHeight(double)
,
setWidthRatio(double)
,
setFixedWidth(double)
,
IlvCompositeGraphic
,
IlvCenteredLayout
,
IlvManager
,
IlvManagerView
,
IlvGrapher
,
Serialized FormConstructor and Description |
---|
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 . |
Modifier and Type | Method and Description |
---|---|
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 . |
double |
getFixedWidth()
Returns the width used to draw the two horizontal borders of this object.
|
Color |
getForeground()
Returns the foreground color of the
IlvRectangle . |
double |
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
|
double |
getWidth()
Returns the width of the definition rectangle.
|
double |
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(double 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(double 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(double width)
Sets the width of the definition rectangle.
|
void |
setWidthRatio(double 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 . |
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, contains, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getResolvedBaseTextDirection, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, invalidateBidiCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isPersistent, isSelectable, isVisible, localeChanged, makeSelection, move, move, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved, zoomable
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.public IlvGraphic copy()
copy
in class IlvGraphic
IlvGraphic
public void applyTransform(IlvTransformer t)
Note that the method must never be called with a null
argument.
applyTransform
in class IlvGraphic
t
- The transformer to be applied.IlvGraphic
public IlvRect boundingBox(IlvTransformer t)
boundingBox
in class IlvGraphic
t
- 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 IlvGraphic
dst
- 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.
This property supports
IlvBlinkingColor
.setForeground
in class IlvGraphic
color
- The new foreground color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setBackground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public 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.
This property supports
IlvBlinkingColor
.setBackground
in class IlvGraphic
color
- The new background color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setForeground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public Color getBackground()
IlvRectangle
. It is the
color used to fill the rectangle.public void setWidth(double width)
setWidthRatio(double)
public double getWidth()
public void setHeight(double height)
public double getHeight()
public void setWidthRatio(double ratio)
with
multiplied by ratio
.
This property is ignored if getFixedWidth()
returns a value greater than 0.ratio
- the ratio must be between 0
1
setFixedWidth(double)
public double getWidthRatio()
public void setFixedWidth(double width)
width
- The width used to draw the two horizontal borders of this object.public double getFixedWidth()
public int getOrientation()
public void setOrientation(int orientation)
IlvDirection.Left
- Left orientation.
IlvDirection.Right
- Right orientation.
orientation
- The orientation.public void setFillOn(boolean fillOn)
true
, specifies that the inside of the
bracket will be filled.setFillOn
in class IlvGraphic
fillOn
- Set to true
to enable the fill style for this
graphic object.isFillOn()
public boolean isFillOn()
true
if the inside of the
bracket will be filled.setFillOn(boolean)
public void setStroke(Stroke stroke)
public Stroke getStroke()
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 IlvPersistentObject
write
in class IlvGraphic
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.