public class IlvGraphicDecoration extends IlvPositionableDecoration implements IlvGraphicBag, IlvULocaleAware, IlvComponentOrientationAware, IlvBaseTextDirectionInterface
IlvGraphic
, a graphic object in the
JViews Framework sense, as a chart decoration.
The decoration is positioned at an arbitrary fixed position in the chart.IlvChartDecoration
,
Serialized FormBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
IlvGraphicDecoration()
Creates a new
IlvGraphicDecoration object for displaying a
graphic object. |
IlvGraphicDecoration(IlvGraphic graphic)
Creates a new
IlvGraphicDecoration object displaying the
specified graphic object centered within the plot area. |
IlvGraphicDecoration(IlvGraphic graphic,
int anchor)
Creates a new
IlvGraphicDecoration object displaying the
specified graphic object. |
Modifier and Type | Method and Description |
---|---|
void |
addObject(IlvGraphic graphic,
boolean redraw)
Adds a graphic object to the bag.
|
void |
applyToObject(IlvGraphic graphic,
IlvApplyObject f,
Object arg,
boolean redraw)
Applies a method to a graphic object of the bag.
|
protected void |
baseTextDirectionChanged()
This method is invoked when the effective base text direction of the chart
has changed.
|
protected void |
chartConnected(IlvChart oldChart,
IlvChart newChart)
Called when the decoration is added to or removed from a chart.
|
protected void |
componentOrientationChanged(ComponentOrientation oldOrientation,
ComponentOrientation newOrientation)
This method is invoked when the component orientation of the chart has
changed.
|
void |
draw(Graphics g)
Draws the decoration into the specified
Graphics context. |
int |
getBaseTextDirection()
Returns the base text direction of the chart to which this decoration
belongs.
|
Rectangle2D |
getBounds(Rectangle2D retBounds)
Returns the bounds of this decoration.
|
ComponentOrientation |
getComponentOrientation()
Returns the component orientation of the chart to which this decoration
belongs.
|
IlvGraphic |
getGraphic()
Returns the graphic object wrapped by this decoration.
|
IlvGraphicBag |
getGraphicBag()
Returns the
IlvGraphicBag that contains this bag or
null if it is not contained in any bag. |
IlvGraphic |
getObject(String name)
Returns the graphic object with that name if it exists in the bag,
otherwise returns
null . |
IlvGraphicEnumeration |
getObjects()
Returns an enumeration of all the objects in this graphic bag.
|
int |
getResolvedBaseTextDirection()
Returns the resolved base text direction of the chart to which this
decoration belongs.
|
com.ibm.icu.util.ULocale |
getULocale()
Returns the locale of the chart to which this decoration belongs.
|
void |
moveObject(IlvGraphic graphic,
double x,
double y,
boolean redraw)
Changes the location of a graphic object.
|
void |
reDrawObj(IlvGraphic graphic)
Redraws a graphic object located in the bag.
|
void |
reDrawRegion(IlvRegion region)
Redraws a region of the bag.
|
void |
removeObject(IlvGraphic graphic,
boolean redraw)
Removes a graphic object from the bag.
|
void |
reshapeObject(IlvGraphic graphic,
IlvRect newrect,
boolean redraw)
Changes the size of a graphic object.
|
void |
setBaseTextDirection(int btd)
This method does nothing.
|
void |
setComponentOrientation(ComponentOrientation orientation)
This method does nothing.
|
void |
setGraphic(IlvGraphic graphic)
Sets the graphic object wrapped by this decoration.
|
boolean |
setObjectName(IlvGraphic graphic,
String name)
Changes the name of a graphic object.
|
void |
setULocale(com.ibm.icu.util.ULocale locale)
This method does nothing.
|
computeLocation, getAnchor, getLocation, getOffset, setAnchor, setOffset
afterDraw, beforeDraw, getChart, getDrawOrder, has3DSupport, isVisible, repaint, setDrawOrder, setVisible, updateBoundsCache
public IlvGraphicDecoration()
IlvGraphicDecoration
object for displaying a
graphic object. The graphic object needs to be installed afterwards, using
the setGraphic(ilog.views.IlvGraphic)
method.public IlvGraphicDecoration(IlvGraphic graphic)
IlvGraphicDecoration
object displaying the
specified graphic object centered within the plot area.graphic
- The graphic object to display.public IlvGraphicDecoration(IlvGraphic graphic, int anchor)
IlvGraphicDecoration
object displaying the
specified graphic object.graphic
- The graphic object to display.anchor
- The decoration's position within the plot area. One of the
SwingConstants.CENTER
, SwingConstants.NORTH
,
SwingConstants.NORTH_WEST
, SwingConstants.WEST
,
SwingConstants.SOUTH_WEST
, SwingConstants.SOUTH
,
SwingConstants.SOUTH_EAST
, SwingConstants.EAST
,
SwingConstants.NORTH_EAST
constants.protected void chartConnected(IlvChart oldChart, IlvChart newChart)
chartConnected
in class IlvPositionableDecoration
oldChart
- The chart with which the decoration was associated, or
null
if the decoration is added to a new chart.newChart
- The chart to which the decoration is added, or
null
if the decoration is removed from its current chart.IlvChartOwnedDrawable.getChart()
public final IlvGraphic getGraphic()
setGraphic(ilog.views.IlvGraphic)
public void setGraphic(IlvGraphic graphic)
public void draw(Graphics g)
Graphics
context.draw
in interface IlvChartDrawable
draw
in class IlvChartDecoration
public Rectangle2D getBounds(Rectangle2D retBounds)
getBounds
in interface IlvChartDrawable
getBounds
in class IlvPositionableDecoration
retBounds
- A rectangle used to store the result. If this parameter
is null
, a new Rectangle2D
is allocated.public void addObject(IlvGraphic graphic, boolean redraw)
addObject
in interface IlvGraphicBag
graphic
- The graphic object.redraw
- If true
the object is redrawn.public void removeObject(IlvGraphic graphic, boolean redraw)
removeObject
in interface IlvGraphicBag
graphic
- The graphic object.redraw
- If true
the object is redrawn.public IlvGraphicEnumeration getObjects()
ConcurrentModificationException
.
For multithread safety, it is useful to lock the manager's
tree lock
for the duration of the use of
this enumeration.getObjects
in interface IlvGraphicBag
IlvGraphic
objects, or
null
.public void reDrawObj(IlvGraphic graphic)
reDrawObj
in interface IlvGraphicBag
graphic
- The graphic object.public void reDrawRegion(IlvRegion region)
reDrawRegion
in interface IlvGraphicBag
region
- The region to redraw.public void reshapeObject(IlvGraphic graphic, IlvRect newrect, boolean redraw)
reshapeObject
in interface IlvGraphicBag
graphic
- The graphic object.newrect
- The new desired bounding rectangle.redraw
- If true
the object is redrawn.public void moveObject(IlvGraphic graphic, double x, double y, boolean redraw)
moveObject
in interface IlvGraphicBag
graphic
- The graphic object.x
- The new desired x position.y
- The new desired y position.redraw
- If true
the object is redrawn.public void applyToObject(IlvGraphic graphic, IlvApplyObject f, Object arg, boolean redraw)
IlvGraphicBag.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
must
call IlvGraphic.setInApplyToObject(boolean)
in the following way:
public void applyToObject(IlvGraphic obj, IlvApplyObject f, Object arg, boolean redraw) { obj.setInApplyToObject(true); try { ... } finally { obj.setInApplyToObject(false); } }If an
IlvGraphic
implements the IlvGraphicBag
interface, the implementation can be done in the following way:
public void applyToObject(IlvGraphic obj, IlvApplyObject f, Object arg, boolean redraw) { boolean needsRecursion = obj.setInApplyToObject(true); try { if (needsRecursion && getGraphicBag() != null) { final IlvGraphic fobj = obj; final IlvApplyObject ff = f; getGraphicBag().applyToObject(this, new IlvApplyObject() { public void apply(IlvGraphic thisObj, Object arg) { doSomething(fobj, ff, arg, false); } }, arg, redraw); } else { doSomething(obj, f, arg, redraw); } } finally { obj.setInApplyToObject(false); } }
applyToObject
in interface IlvGraphicBag
graphic
- The graphic object.f
- The method to apply.arg
- The arguments passed to the method f
.redraw
- If true
the object is redrawn.public boolean setObjectName(IlvGraphic graphic, String name)
setObjectName
in interface IlvGraphicBag
graphic
- The graphic object.name
- The new name.true
if the name can be changed.public IlvGraphic getObject(String name)
null
.getObject
in interface IlvGraphicBag
name
- The graphic object name.public IlvGraphicBag getGraphicBag()
IlvGraphicBag
that contains this bag or
null
if it is not contained in any bag.getGraphicBag
in interface IlvGraphicBag
public com.ibm.icu.util.ULocale getULocale()
getULocale
in interface IlvULocaleAware
IlvULocaleAware.setULocale(com.ibm.icu.util.ULocale)
public void setULocale(com.ibm.icu.util.ULocale locale)
setULocale
in interface IlvULocaleAware
locale
- The new locale.getULocale()
public ComponentOrientation getComponentOrientation()
getComponentOrientation
in interface IlvComponentOrientationAware
IlvComponentOrientationAware.setComponentOrientation(java.awt.ComponentOrientation)
public void setComponentOrientation(ComponentOrientation orientation)
setComponentOrientation
in interface IlvComponentOrientationAware
orientation
- The new component orientation.getComponentOrientation()
public int getBaseTextDirection()
This implementation always throws an
UnsupportedOperationException
.
getBaseTextDirection
in interface IlvBaseTextDirectionInterface
public void setBaseTextDirection(int btd)
setBaseTextDirection
in interface IlvBaseTextDirectionInterface
btd
- The base text direction.getBaseTextDirection()
public int getResolvedBaseTextDirection()
getResolvedBaseTextDirection
in interface IlvBaseTextDirectionInterface
getBaseTextDirection()
protected void componentOrientationChanged(ComponentOrientation oldOrientation, ComponentOrientation newOrientation)
componentOrientationChanged
in class IlvChartDecoration
oldOrientation
- The component orientation before the change.newOrientation
- The component orientation after the change.Component.getComponentOrientation()
protected void baseTextDirectionChanged()
chart.getResolvedBaseTextDirection()
has changed, orchart.getComponentOrientation()
has
changed and the value of
chart.getResolvedBaseTextDirection()
is
IlvBidiUtil.CONTEXTUAL_DIRECTION
.baseTextDirectionChanged
in class IlvChartDecoration
IlvChart.getResolvedBaseTextDirection()
,
Component.getComponentOrientation()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.