public class IlvDoubleGraphicHandleBag extends IlvBidiGraphic implements IlvGraphicBag, GraphicBagHierarchyEventReceiver, ManagerViewsHierarchyEventReceiver
IlvDoubleGraphicHandleBag
object is a graphic bag
that contains two contained objects.
This means, the method IlvGraphic.getGraphicBag()
applied on the
referenced objects returns the handle.
You can consider it as graphic set that contains only two elements.Modifier and Type | Field and Description |
---|---|
protected static short |
MAX_FLAG
The maximal used bit flag.
|
Modifier | Constructor and Description |
---|---|
|
IlvDoubleGraphicHandleBag(IlvDoubleGraphicHandleBag source)
Creates a new
IlvDoubleGraphicHandleBag by copying
an existing one. |
|
IlvDoubleGraphicHandleBag(IlvGraphic object1,
IlvGraphic object2)
Creates a new
IlvDoubleGraphicHandleBag . |
protected |
IlvDoubleGraphicHandleBag(IlvGraphic object1,
IlvGraphic object2,
boolean delegateMoveResize)
Creates a new
IlvDoubleGraphicHandleBag . |
|
IlvDoubleGraphicHandleBag(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
Modifier and Type | Method and Description |
---|---|
void |
addGraphicBagHierarchyListener(GraphicBagHierarchyListener listener)
Adds the specified listener to receive events from the ancestor
managers and ancestor graphic sets and from this handle when the
hierarchy of graphic bags has changed.
|
void |
addManagerViewsHierarchyListener(ManagerViewsChangedListener listener)
Adds the specified listener to receive events from the owning manager
of this object and from its ancestors when a manager view was added or
removed.
|
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.
|
void |
applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.
|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
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.
|
void |
enableGraphicBagHierarchyEventForwarding()
Enables forwarding of
GraphicBagHierarchyEvent events, since
the objects contained in this graphic handle bag need to receive the events. |
void |
enableManagerViewsHierarchyEventForwarding()
Enables forwarding of
ManagerViewsChangedEvent events through the nesting hierarchy,
since the objects contained in this graphic handle bag need to receive the
events. |
void |
fireGraphicBagHierarchyEvent(GraphicBagHierarchyEvent event)
Fires a graphic bag hierarchy event to this graphic handle bag and all
contained objects.
|
void |
fireManagerViewsHierarchyEvent(ManagerViewsChangedEvent event)
Fires a
ManagerViewsChangedEvent event to all listeners
installed via addManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener) on this graphic
set or contained objects. |
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(String name)
Returns the graphic object with that name if it exists in the bag,
otherwise returns
null . |
IlvGraphic |
getObject1()
Returns the first referenced object.
|
IlvGraphic |
getObject2()
Returns the second referenced object.
|
IlvGraphicEnumeration |
getObjects()
Returns the objects of the bag.
|
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.
|
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.
|
protected boolean |
isFlagSet(short mask)
Returns true if a flag is set.
|
boolean |
isPersistent()
If this method returns
true the IlvGraphic
instance will be saved in IVL files. |
void |
move(double x,
double y)
Moves the object.
|
void |
move(IlvPoint p)
Moves the object.
|
void |
moveObject(IlvGraphic graphic,
double x,
double y,
boolean redraw)
Changes the location of a graphic object.
|
boolean |
needsGraphicBagHierarchyEvent()
Returns whether this object needs to receive
GraphicBagHierarchyEvent events, either from itself or from its
ancestors. |
boolean |
needsManagerViewsHierarchyEvent()
Returns whether the graphic handle bag needs to receive
ManagerViewsChangedEvent events, either from its owning manager
or from its ancestors. |
protected String |
object1Name()
Returns the name of the first object in the IVL file.
|
protected String |
object2Name()
Returns the name of the second object in the IVL file.
|
void |
reDrawObj(IlvGraphic graphic)
Redraws a graphic object located in the bag.
|
void |
reDrawRegion(IlvRegion region)
Redraws a region of the bag.
|
void |
removeGraphicBagHierarchyListener(GraphicBagHierarchyListener listener)
Removes the specified listener so that it no longer
receives events from ancestor manager and ancestor graphic sets and
from this handle when the hierarchy of graphic bags has changed.
|
void |
removeManagerViewsHierarchyListener(ManagerViewsChangedListener listener)
Removes the specified listener so that it no longer receives events from
the owning manager of this object and from its ancestors when a manager
view was added or removed.
|
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.
|
protected void |
setDelegateMoveResize(boolean delegateMoveResize)
Sets whether operations that change the position of the object are
directly delegated to both referenced objects.
|
protected void |
setFlag(short mask,
boolean value)
Sets a flag.
|
void |
setGraphicBag(IlvGraphicBag bag)
Changes the bag that contains the object.
|
void |
setObject1(IlvGraphic object)
Changes the first referenced object.
|
void |
setObject2(IlvGraphic object)
Changes the second referenced object.
|
boolean |
setObjectName(IlvGraphic graphic,
String name)
Changes the name of a graphic object.
|
void |
translate(double dx,
double dy)
Translates the object.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
boolean |
zoomable()
Returns true if the object is zoomable.
|
calcResolvedBaseTextDirection, getBaseTextDirection, getComponentOrientation, getResolvedBaseTextDirection, getULocale, invalidateBidiCache, setBaseTextDirection, setBaseTextDirection, setBaseTextDirectionDuringConstruction
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipBaseTextDirection, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getZOrderIndex, hasProperty, invalidateBBoxCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isSelectable, isVisible, localeChanged, makeSelection, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setForeground, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getGraphicBag
protected static final short MAX_FLAG
setFlag(short, boolean)
,
Constant Field Valuespublic IlvDoubleGraphicHandleBag(IlvGraphic object1, IlvGraphic object2)
IlvDoubleGraphicHandleBag
.object1
- The first referenced object.object2
- The second referenced object.protected IlvDoubleGraphicHandleBag(IlvGraphic object1, IlvGraphic object2, boolean delegateMoveResize)
IlvDoubleGraphicHandleBag
.
This constructor is mainly useful when creating subclasses of this class.object1
- The first referenced object.object2
- The second referenced object.delegateMoveResize
- If true
, operations that change
the position of the object are directly delegated to both referenced
objects.public IlvDoubleGraphicHandleBag(IlvDoubleGraphicHandleBag source)
IlvDoubleGraphicHandleBag
by copying
an existing one.public IlvDoubleGraphicHandleBag(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.public final IlvGraphic getObject1()
public void setObject1(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 final IlvGraphic getObject2()
public void setObject2(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.protected void setDelegateMoveResize(boolean delegateMoveResize)
public IlvGraphic copy()
null
if the contained object cannot be copied.copy
in class IlvGraphic
IlvGraphic
public boolean zoomable()
zoomable
on the referenced objects.zoomable
in class IlvGraphic
IlvGraphic
,
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvManager
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.protected String object1Name()
protected String object2Name()
public void setGraphicBag(IlvGraphicBag bag)
Note: do not call this method directly unless you are creating a custom graphic bag.
setGraphicBag
in class IlvGraphic
bag
- The graphic bag to contain this graphic object.IlvGraphic
public void draw(Graphics dst, IlvTransformer t)
draw
on the referenced objects.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 objects.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 objects.applyTransform
in class IlvGraphic
t
- the transformer to be applied.IlvGraphic
public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains
on the referenced objects.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 objects.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 objects.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
to the referenced objects.move
in class IlvGraphic
x
- The new horizontal position.y
- The new vertical position.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void move(IlvPoint p)
move
to the referenced objects.move
in class IlvGraphic
p
- The new position of the top-left corner.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void translate(double dx, double dy)
translate
to the referenced objects.translate
in class IlvGraphic
dx
- The horizontal translation factor.dy
- The vertical translation factor.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public boolean isPersistent()
true
the IlvGraphic
instance will be saved in IVL files.
The method returns true
if all subobjects are persistent.isPersistent
in class 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.protected final boolean isFlagSet(short mask)
MAX_FLAG
protected final void setFlag(short mask, boolean value)
MAX_FLAG
public void addObject(IlvGraphic graphic, boolean redraw)
IlvGraphicBag
interface.
Do not use it for this object.addObject
in interface IlvGraphicBag
graphic
- The graphic object.redraw
- If true
the object is redrawn.public void removeObject(IlvGraphic graphic, boolean redraw)
IlvGraphicBag
interface.
Do not use it for this object.removeObject
in interface IlvGraphicBag
graphic
- The graphic object.redraw
- If true
the object is redrawn.public IlvGraphicEnumeration getObjects()
IlvGraphicBag
interface.
This returns an enumeration with one object: the referenced object.getObjects
in interface IlvGraphicBag
IlvGraphic
objects, or
null
.public void reDrawObj(IlvGraphic graphic)
IlvGraphicBag
interface.
If this graphic handle bag is inside a graphic bag, it redraws this
graphic handle bag.reDrawObj
in interface IlvGraphicBag
graphic
- The graphic object.public void reDrawRegion(IlvRegion region)
IlvGraphicBag
interface.
If this graphic handle bag is inside a graphic bag, it redraws this
graphic handle bag.reDrawRegion
in interface IlvGraphicBag
region
- The region to redraw.public void reshapeObject(IlvGraphic graphic, IlvRect newrect, boolean redraw)
IlvGraphicBag
interface.
Since the graphic handle bag can contain only one object,
you can reshape only the currently referenced object.
applyToObject
on its graphic bag while reshaping
the object.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)
IlvGraphicBag
interface.
Since the graphic handle bag can contain only one object,
you can move only the currently referenced object.
applyToObject
on its graphic bag while moving
the object.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
interface.
If the graphic handle bag is in a graphic bag, it automatically
calls applyToObject
on its graphic bag while applying
the object.
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)
IlvGraphicBag
interface.
Since the graphic handle bag can contain only one object,
you can only change the name of the currently referenced object.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
.
Since the graphic handle bag can contain only one object,
it returns currently referenced object if this matches the input name,
and null
otherwise.getObject
in interface IlvGraphicBag
name
- The graphic object name.public void addGraphicBagHierarchyListener(GraphicBagHierarchyListener listener)
addGraphicBagHierarchyListener
in interface GraphicBagHierarchyEventReceiver
listener
- The listener.removeGraphicBagHierarchyListener(ilog.views.event.GraphicBagHierarchyListener)
public void removeGraphicBagHierarchyListener(GraphicBagHierarchyListener listener)
removeGraphicBagHierarchyListener
in interface GraphicBagHierarchyEventReceiver
listener
- The listener.addGraphicBagHierarchyListener(ilog.views.event.GraphicBagHierarchyListener)
public void enableGraphicBagHierarchyEventForwarding()
GraphicBagHierarchyEvent
events, since
the objects contained in this graphic handle bag need to receive the events.enableGraphicBagHierarchyEventForwarding
in interface GraphicBagHierarchyEventReceiver
public boolean needsGraphicBagHierarchyEvent()
GraphicBagHierarchyEvent
events, either from itself or from its
ancestors.needsGraphicBagHierarchyEvent
in interface GraphicBagHierarchyEventReceiver
public void fireGraphicBagHierarchyEvent(GraphicBagHierarchyEvent event)
fireGraphicBagHierarchyEvent
in interface GraphicBagHierarchyEventReceiver
public void addManagerViewsHierarchyListener(ManagerViewsChangedListener listener)
The hierarchy event mechanism is comparable to
java.awt.event.HierarchyEvent
on swing components.
The view changed event is generated by a manager when a view is added
or removed, and passed down the nesting hierarchy.
The event is dispatched to every graphic handle bag that is contained in the
manager whose view has changed.
addManagerViewsHierarchyListener
in interface ManagerViewsHierarchyEventReceiver
listener
- The listener.removeManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener)
public void removeManagerViewsHierarchyListener(ManagerViewsChangedListener listener)
removeManagerViewsHierarchyListener
in interface ManagerViewsHierarchyEventReceiver
listener
- The listener.addManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener)
public void enableManagerViewsHierarchyEventForwarding()
ManagerViewsChangedEvent
events through the nesting hierarchy,
since the objects contained in this graphic handle bag need to receive the
events.enableManagerViewsHierarchyEventForwarding
in interface ManagerViewsHierarchyEventReceiver
public boolean needsManagerViewsHierarchyEvent()
ManagerViewsChangedEvent
events, either from its owning manager
or from its ancestors. It returns true
, if a listener was installed through
addManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener)
on this graphic handle bag or on
any object contained in this graphic handle bag.needsManagerViewsHierarchyEvent
in interface ManagerViewsHierarchyEventReceiver
public void fireManagerViewsHierarchyEvent(ManagerViewsChangedEvent event)
ManagerViewsChangedEvent
event to all listeners
installed via addManagerViewsHierarchyListener(ilog.views.event.ManagerViewsChangedListener)
on this graphic
set or contained objects.fireManagerViewsHierarchyEvent
in interface ManagerViewsHierarchyEventReceiver
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.