public class IlvGraphicHandle extends IlvGraphic
IlvGraphicHandle
object, called a handle, is used to refer to an
IlvGraphic
object.
Handles make it possible to indirectly access the referenced object.
Complex graphic objects can thus be "duplicated" as many time as you like by simply
creating new handle objects which all refer to the same original graphic object.
Referring to a complex graphic object instead of copying it helps you to save computing
resources. Note that two handles that refer to the same object share the same bounding
rectangle, so this class is useful when
the handles are in different managers.
To put in the same manager several handles referring to the same object,
you may use the class IlvTransformedGraphic
.
Note:
If the graphic handle is no IlvGraphicHandleBag
, it does not support
IlvBlinkingColor
or IlvBlinkingPaint
in
the referenced graphic object.
Modifier | Constructor and Description |
---|---|
|
IlvGraphicHandle(IlvGraphic object,
boolean owner)
Creates a new
IlvGraphicHandle . |
protected |
IlvGraphicHandle(IlvGraphic object,
boolean owner,
boolean delegateMoveResize)
Creates a new
IlvGraphicHandle . |
|
IlvGraphicHandle(IlvGraphicHandle source)
Creates a new
IlvGraphicHandle by copying an existing one. |
|
IlvGraphicHandle(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 the object.
|
void |
baseTextDirectionChanged(int oldBaseTextDirection,
int newBaseTextDirection)
Called when the object is base text direction sensitive and the
resolved base text direction has changed.
|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
void |
componentOrientationChanged(ComponentOrientation oldOri,
ComponentOrientation newOri)
Called when the object is component orientation sensitive and the
component orientation has changed.
|
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests whether a point lies within the outline of the object.
|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
int |
getBaseTextDirection()
Returns the base direction of the text.
|
IlvPoint |
getIntersectionWithOutline(IlvPoint innerPoint,
IlvPoint outerPoint,
IlvTransformer t)
Returns the intersection of the line segment from inner point to outer
point with the shape of the graphic object.
|
IlvGraphic |
getObject()
Returns the referenced object.
|
protected JPopupMenu |
getOriginalPopupMenu(IlvPoint p,
IlvTransformer t,
IlvManagerView view,
IlvPopupMenuManager popupManager)
This is the original implementation of
getPopupMenu
from the superclass to retrieve the pop-up menu. |
JPopupMenu |
getPopupMenu(IlvPoint p,
IlvTransformer t,
IlvManagerView view,
IlvPopupMenuManager popupManager)
Returns the Swing pop-up menu to display when the pop-up is triggered
while the mouse pointer is at a specified location inside the graphic
object.
|
int |
getResolvedBaseTextDirection()
Returns the resolved base text direction.
|
String |
getToolTipText(IlvPoint p,
IlvTransformer t)
Returns the tooltip text to display when the mouse
pointer is at a specified location inside the graphic
object.
|
boolean |
inside(IlvRect rect,
IlvRect trect,
IlvTransformer t)
Tests whether a rectangle contains the object.
|
boolean |
intersects(IlvRect rect,
IlvRect trect,
IlvTransformer t)
Tests whether a rectangle overlaps the object.
|
boolean |
isBaseTextDirectionSensitive()
Returns
true if the bounding box of this object depends on
the base text direction of this object. |
boolean |
isOwner()
Returns the ownership property of the object.
|
boolean |
isPersistent()
If this method returns
true the IlvGraphic
instance will be saved in IVL files. |
void |
localeChanged(com.ibm.icu.util.ULocale oldLocale,
com.ibm.icu.util.ULocale newLocale)
Called when the object is locale sensitive and the
locale has changed.
|
void |
move(double x,
double y)
Moves the object.
|
void |
move(IlvPoint p)
Moves the object.
|
void |
moveResize(IlvRect size)
Resizes the object.
|
void |
resize(double neww,
double newh)
Resizes the object.
|
void |
rotate(IlvPoint center,
double angle)
Rotates the object.
|
void |
scale(double scalex,
double scaley)
Resizes the object.
|
void |
setBackground(Color c)
Changes the background color of the object.
|
void |
setBaseTextDirection(int baseTextDirection)
Changes the base direction of the text.
|
protected void |
setDelegateMoveResize(boolean delegateMoveResize)
Sets whether operations that change the position of the object are
directly delegated to the referenced object.
|
void |
setForeground(Color c)
Changes the foreground color of the object.
|
void |
setObject(IlvGraphic object)
Changes the referenced object.
|
void |
setOwner(boolean owner)
Changes the ownership property of the object.
|
void |
translate(double dx,
double dy)
Translates the object.
|
boolean |
usesBidiMarkers()
Returns
true if in-place editing implementation uses markers,
which should be taken into account in hit-to-point and point-to-hit
calculations. |
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
boolean |
zoomable()
Returns true if the object is zoomable.
|
addActionListener, addNamedPropertyListener, allViewsRemoved, blinkingStateOn, boundingBox, callDraw, getAndAssociateObjectInteractor, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipBaseTextDirection, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, invalidateBBoxCache, invalidateBidiCache, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isSelectable, isVisible, makeSelection, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, updateNeedsViewNotification, viewAddedOrRemoved
public IlvGraphicHandle(IlvGraphic object, boolean owner)
IlvGraphicHandle
.object
- the referenced object.owner
- if true then the referenced object will be copied
when the handle is copied, otherwise the copy of the handle will
reference the same object.protected IlvGraphicHandle(IlvGraphic object, boolean owner, boolean delegateMoveResize)
IlvGraphicHandle
.
This constructor is mainly useful when creating subclasses of this class.object
- The referenced object.owner
- If true
, the referenced object will be copied
when the handle is copied, otherwise the copy of the handle will
refer to the same object.delegateMoveResize
- If true
, operations that change
the position of the object are directly delegated to the referenced object.public IlvGraphicHandle(IlvGraphicHandle source)
IlvGraphicHandle
by copying an existing one.
Note that the referenced object is copied only if the origin
is owner of the reference.public IlvGraphicHandle(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- the input stream.IlvReadFileException
- if the format is not correct.public final IlvGraphic getObject()
public void setObject(IlvGraphic object)
IlvManager
, this method can be called only using the method
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
of the manager.public boolean isOwner()
setOwner(boolean)
public void setOwner(boolean owner)
isOwner()
protected void setDelegateMoveResize(boolean delegateMoveResize)
public IlvGraphic copy()
copy
in class IlvGraphic
isOwner()
public boolean zoomable()
zoomable
on the referenced object.zoomable
in class IlvGraphic
IlvGraphic
,
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvManager
public void draw(Graphics dst, IlvTransformer t)
draw
on the referenced object.draw
in class IlvGraphic
dst
- the destination Graphics.t
- the transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public IlvRect boundingBox(IlvTransformer t)
boundingBox
on the referenced object.boundingBox
in class IlvGraphic
t
- the transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public void applyTransform(IlvTransformer t)
applyTransform
on the referenced object.applyTransform
in class IlvGraphic
t
- the transformer to be applied.IlvGraphic
public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains
on the referenced object.contains
in class IlvGraphic
p
- the point to be tested.tp
- the point p transformed by the transformer t.t
- the transformation applied to the object when it
was drawn.true
if the point lies inside this graphic object.IlvGraphic
public boolean intersects(IlvRect rect, IlvRect trect, IlvTransformer t)
intersects
on the referenced object.intersects
in class IlvGraphic
rect
- the rectangle to be tested.trect
- the rectangle rect transformed by the transformer t.t
- the transformation that was applied to the object when it
was drawn.true
if the rectangle overlaps this graphic object.IlvGraphic
public boolean inside(IlvRect rect, IlvRect trect, IlvTransformer t)
inside
on the referenced object.inside
in class IlvGraphic
rect
- the rectangle to be tested.trect
- the rectangle rect transformed by the transformer t.t
- the transformation that was applied to the object when it
was drawn.IlvGraphic
public IlvPoint getIntersectionWithOutline(IlvPoint innerPoint, IlvPoint outerPoint, IlvTransformer t)
innerPoint
is not inside the graphic object,
or if outerPoint
is not outside the graphic object, it
must return a valid point. For instance, if there is no intersection,
it can return the start point.getIntersectionWithOutline
in class IlvGraphic
innerPoint
- A point usually inside the graphic object, given in
manager view coordinates.outerPoint
- A point usually outside of the graphic object, given in
manager view coordinates.t
- The transformation used to draw the object.IlvClippingLinkConnector
public void move(double x, double y)
move
on the referenced object.move
in class IlvGraphic
x
- The new horizontal position.y
- The new vertical position.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void move(IlvPoint p)
move
on the referenced object.move
in class IlvGraphic
p
- The new position of the top-left corner.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void moveResize(IlvRect size)
moveResize
on the referenced object.moveResize
in class IlvGraphic
size
- The new bounding rectangle for this object.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void translate(double dx, double dy)
translate
on the referenced object.translate
in class IlvGraphic
dx
- The horizontal translation factor.dy
- The vertical translation factor.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void rotate(IlvPoint center, double angle)
rotate
on the referenced object.rotate
in class IlvGraphic
center
- The center of the rotation.angle
- The rotation angle in degrees.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void scale(double scalex, double scaley)
scale
on the referenced object.scale
in class IlvGraphic
scalex
- The horizontal scaling factor.scaley
- The vertical scaling factor.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void resize(double neww, double newh)
resize
on the referenced object.resize
in class IlvGraphic
neww
- The new horizontal width.newh
- The new horizontal height.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void setForeground(Color c)
setForeground
on the referenced object.setForeground
in class IlvGraphic
c
- the new color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setBackground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public void setBackground(Color c)
setBackground
on the referenced object.setBackground
in class IlvGraphic
c
- the new color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setForeground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public String getToolTipText(IlvPoint p, IlvTransformer t)
Note that you must enable the tooltip mechanism for the manager view
by calling the static method
IlvToolTipManager.registerView(ilog.views.IlvManagerView)
.
getToolTipText
in class IlvGraphic
p
- The location of the mouse (in view coordinates).t
- The transformer that converts the coordinate system of this object
(the manager coordinates) into the coordinate system of the
manager view in which the tooltip is about to be displayed
(the view coordinates).p
for transformation
t
, or null
if no tooltip should be displayed.IlvGraphic
,
IlvGraphic.getToolTipText()
,
IlvGraphic.setToolTipText(String)
public JPopupMenu getPopupMenu(IlvPoint p, IlvTransformer t, IlvManagerView view, IlvPopupMenuManager popupManager)
Note that you must enable the pop-up menu mechanism for the manager view
by calling the static method
IlvPopupMenuManager.registerView(ilog.views.IlvManagerView)
.
getPopupMenu
in class IlvGraphic
p
- The location of the mouse (in view coordinates).t
- The transformer that converts the coordinate system of this object
(the manager coordinates) into the coordinate system of the
manager view in which the tooltip is about to be displayed
(the view coordinates).view
- The manager view that triggered the pop-up menu.popupManager
- The pop-up menu manager.null
.IlvGraphic
,
IlvPopupMenuManager.registerView(ilog.views.IlvManagerView)
,
IlvGraphic.getPopupMenu()
protected JPopupMenu getOriginalPopupMenu(IlvPoint p, IlvTransformer t, IlvManagerView view, IlvPopupMenuManager popupManager)
getPopupMenu
from the superclass to retrieve the pop-up menu.
Subclasses of this class might need access to the original implementation.
p
- The location of the mouse (in view coordinates).t
- The transformer that converts the coordinate system of this object
(the manager coordinates) into the coordinate system of the
manager view in which the tooltip is about to be displayed
(the view coordinates).view
- The manager view that triggered the pop-up menu.popupManager
- The pop-up menu manager.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.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.public boolean isPersistent()
true
the IlvGraphic
instance will be saved in IVL files.
The method returns true
if the referenced object
is persistent.isPersistent
in class IlvGraphic
public void setBaseTextDirection(int baseTextDirection)
setBaseTextDirection
on the referenced object.
The possible choices are:
IlvBidiUtil.INHERITED_DIRECTION
:
the base text direction is inherited from the
graphic bag that contains this object.
If this object is not contained in a graphic bag,
the base text direction is calculated from the
component orientation.
IlvBidiUtil.COMPONENT_DIRECTION
:
the base text direction is calculated from the
component orientation.
IlvBidiUtil.LEFT_TO_RIGHT
:
the base text direction is left-to-right.
IlvBidiUtil.RIGHT_TO_LEFT
:
the base text direction is right-to-left.
IlvBidiUtil.CONTEXTUAL_DIRECTION
:
the base test direction is determined from the text
that is displayed according to the standard Bidi
algorithm, if the text contains at least one character
with a strong left-to-right or right-to-left direction.
If the text doesn't contain any character with a strong
direction, the real text direction is determined from
the current component orientation of the object.
setBaseTextDirection
in interface IlvBaseTextDirectionInterface
setBaseTextDirection
in class IlvGraphic
baseTextDirection
- The base text directionIlvGraphic.baseTextDirectionChanged(int, int)
public int getBaseTextDirection()
getBaseTextDirection
on the referenced object.
The possible return values are:
IlvBidiUtil.INHERITED_DIRECTION
:
the base text direction is inherited from the
graphic bag that contains this object.
If this object is not contained in a graphic bag,
the base text direction is calculated from the
component orientation.
IlvBidiUtil.COMPONENT_DIRECTION
:
the base text direction is calculated from the
component orientation.
IlvBidiUtil.LEFT_TO_RIGHT
:
the base text direction is left-to-right.
IlvBidiUtil.RIGHT_TO_LEFT
:
the base text direction is right-to-left.
IlvBidiUtil.CONTEXTUAL_DIRECTION
:
the base test direction is determined from the text
that is displayed according to the standard Bidi
algorithm, if the text contains at least one character
with a strong left-to-right or right-to-left direction.
If the text doesn't contain any character with a strong
direction, the real text direction is determined from
the current component orientation of the object.
getBaseTextDirection
in interface IlvBaseTextDirectionInterface
getBaseTextDirection
in class IlvGraphic
public boolean isBaseTextDirectionSensitive()
true
if the bounding box of this object depends on
the base text direction of this object.isBaseTextDirectionSensitive
in class IlvGraphic
public boolean usesBidiMarkers()
true
if in-place editing implementation uses markers,
which should be taken into account in hit-to-point and point-to-hit
calculations.usesBidiMarkers
in class IlvGraphic
public int getResolvedBaseTextDirection()
This method is similar to getBaseTextDirection()
but determines
the value when it is inherited from a parent component
(IlvBidiUtil.INHERITED_DIRECTION
) or dependent on
the component orientation (IlvBidiUtil.COMPONENT_DIRECTION
).
Hence, there are only 3 possible return values:
IlvBidiUtil.LEFT_TO_RIGHT
:
the base text direction is left-to-right.
IlvBidiUtil.RIGHT_TO_LEFT
:
the base text direction is right-to-left.
IlvBidiUtil.CONTEXTUAL_DIRECTION
:
the base test direction is determined from the text
that is displayed according to the standard Bidi
algorithm, if the text contains at least one character
with a strong left-to-right or right-to-left direction.
If the text doesn't contain any character with a strong
direction, the real text direction is determined from
the current component orientation of the object.
getResolvedBaseTextDirection
in interface IlvBaseTextDirectionInterface
getResolvedBaseTextDirection
in class IlvGraphic
public void baseTextDirectionChanged(int oldBaseTextDirection, int newBaseTextDirection)
baseTextDirectionChanged
in class IlvGraphic
oldBaseTextDirection
- Resolved base text direction of this object before the change.newBaseTextDirection
- Resolved base text direction of this object after the change.isBaseTextDirectionSensitive()
public void componentOrientationChanged(ComponentOrientation oldOri, ComponentOrientation newOri)
componentOrientationChanged
in class IlvGraphic
oldOri
- Orientation of this object before the orientation change.newOri
- Orientation of this object after the orientation change.IlvGraphic.isComponentOrientationSensitive()
public void localeChanged(com.ibm.icu.util.ULocale oldLocale, com.ibm.icu.util.ULocale newLocale)
localeChanged
in class IlvGraphic
oldLocale
- Locale of this object before the locale change.newLocale
- Locale of this object after the locale change.IlvGraphic.isLocaleSensitive()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.