public class IlvGraphicHandleSelection extends IlvHandlesSelection implements IlvGraphicBag
IlvGraphicHandleSelection
object is a selection that acts
like a handle to another selection. It is used as selection for
subclasses of IlvGraphicHandle
.CIRCLE_SHAPE, defaultHandleBackgroundColor, defaultHandleColor, defaultHandleShape, defaultHandleSize, FILLED_CIRCLE_SHAPE, FILLED_SQUARE_SHAPE, SQUARE_SHAPE
Constructor and Description |
---|
IlvGraphicHandleSelection(IlvGraphic object,
IlvSelection selection)
Creates a new
IlvGraphicHandleSelection . |
Modifier and Type | Method and Description |
---|---|
void |
addObject(IlvGraphic graphic,
boolean redraw)
Adds a graphic object to the bag.
|
protected void |
afterLoopAllHandles()
This is called by this class after iterating over all handles
and calling
getHandle(int, ilog.views.IlvTransformer) . |
void |
applyToObject(IlvGraphic graphic,
IlvApplyObject f,
Object arg,
boolean redraw)
Applies a method to a graphic object of the bag.
|
protected void |
beforeLoopAllHandles(IlvTransformer t)
This is called by this class before iterating over all handles
and calling
getHandle(int, ilog.views.IlvTransformer) . |
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.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
void |
drawWithoutHandles(Graphics dst,
IlvTransformer t)
Draws the selection without the handles.
|
String |
getDefaultInteractor()
Returns the default interactor class name.
|
IlvPoint |
getHandle(int i,
IlvTransformer t)
Returns the location of a handle.
|
int |
getHandleCardinal()
Returns the number of handles for this object.
|
IlvGraphic |
getObject(String name)
Returns the graphic object with that name if it exists in the bag,
otherwise returns
null . |
IlvGraphicEnumeration |
getObjects()
Returns the objects of the bag.
|
IlvSelection |
getSelection()
Returns the referenced selection.
|
protected IlvTransformer |
getVirtualToRealViewTransformer(IlvTransformer t)
Returns the transformer that converts the virtual view coordinate system
to the real view coordinate system.
|
protected IlvTransformer |
getVirtualViewTransformer(IlvTransformer t)
Returns the transformer that converts the manager coordinate system
of the wrapped object into a virtual view coordinate system.
|
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 |
isOptimizedDrawingEnabled()
This method allows or disables an optimization
for drawing a selection object and its selected
object.
|
boolean |
isPersistent()
If this method returns
true the IlvGraphic
instance will be saved in IVL files. |
boolean |
isVisible()
Returns true if the object is visible.
|
void |
moveObject(IlvGraphic graphic,
double x,
double y,
boolean redraw)
Changes the location of a graphic object.
|
void |
onEnter(IlvObjectInteractorContext context)
Called when the selection is entered.
|
void |
onExit(IlvObjectInteractorContext context)
Called when the selection is exited.
|
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 |
setBackground(Color c)
Changes the background color of the object.
|
void |
setForeground(Color c)
Changes the foreground color of the object.
|
boolean |
setObjectName(IlvGraphic graphic,
String name)
Changes the name of a graphic object.
|
void |
setSelection(IlvSelection selection)
Sets the referenced selection.
|
boolean |
zoomable()
Returns true if the object is zoomable.
|
getActiveHandlesColor, getHandle, getHandlesColor, getHandlesShape, getHandlesSize, isActive, setActiveHandlesColor, setHandlesColor, setHandlesShape, setHandlesSize
applyTransform, copy, getObject, SetDefaultInteractor
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getResolvedBaseTextDirection, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, invalidateBBoxCache, invalidateBidiCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isSelectable, localeChanged, makeSelection, move, move, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getGraphicBag
public IlvGraphicHandleSelection(IlvGraphic object, IlvSelection selection)
IlvGraphicHandleSelection
.object
- the object that has the selection.selection
- the referenced selection.public void setSelection(IlvSelection selection)
public final IlvSelection getSelection()
public boolean isVisible()
isVisible
in class IlvSelection
true
if this graphic object is visible.IlvGraphic.setVisible(boolean)
,
IlvGraphic.setSelectable(boolean)
,
IlvGraphic.setMovable(boolean)
,
IlvGraphic.setEditable(boolean)
public boolean isOptimizedDrawingEnabled()
true
if the selection object
covers completely the selected objects. In other words if the
bounding box of this selection object is the same or bigger
than the bounding box of the corresponding selected object.
Note that the default value is false
.isOptimizedDrawingEnabled
in class IlvSelection
public boolean zoomable()
zoomable
on the referenced object.zoomable
in class IlvHandlesSelection
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 IlvHandlesSelection
dst
- the destination Graphics.t
- the transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public void drawWithoutHandles(Graphics dst, IlvTransformer t)
drawWithoutHandles
in class IlvHandlesSelection
public IlvRect boundingBox(IlvTransformer t)
boundingBox
on the referenced object.boundingBox
in class IlvHandlesSelection
t
- the transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains
on the referenced object.contains
in class IlvHandlesSelection
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 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 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 onEnter(IlvObjectInteractorContext context)
Subclasses can override this method to perform specific tasks when the selection is entered. The default implementation does nothing.
onEnter
in class IlvHandlesSelection
context
- The context for the object interactor.public void onExit(IlvObjectInteractorContext context)
Subclasses can override this method to perform specific tasks when the selection is entered. The default implementation does nothing.
onExit
in class IlvHandlesSelection
context
- The context for the object interactor.public int getHandleCardinal()
getHandleCardinal
in class IlvHandlesSelection
public IlvPoint getHandle(int i, IlvTransformer t)
getHandle
in class IlvHandlesSelection
i
- the index of the handle.t
- the transformer through which the object is drawn.protected void beforeLoopAllHandles(IlvTransformer t)
getHandle(int, ilog.views.IlvTransformer)
. Subclasses can override this method
to do preparations so that getHandle(int, ilog.views.IlvTransformer)
is fast, e.g. fill
certain caches that are needed by getHandle(int, ilog.views.IlvTransformer)
.beforeLoopAllHandles
in class IlvHandlesSelection
t
- The transformer to draw this object.afterLoopAllHandles()
protected void afterLoopAllHandles()
getHandle(int, ilog.views.IlvTransformer)
. Subclasses can override this method
to do cleanup caches that were needed by getHandle(int, ilog.views.IlvTransformer)
.afterLoopAllHandles
in class IlvHandlesSelection
beforeLoopAllHandles(ilog.views.IlvTransformer)
protected IlvTransformer getVirtualViewTransformer(IlvTransformer t)
t
- The transformer of the real view.null
to indicate identity transformer.protected IlvTransformer getVirtualToRealViewTransformer(IlvTransformer t)
null
or the identity transformer.
It returns null
by default.t
- The transformer of the real view.null
to indicate identity transformer.public String getDefaultInteractor()
getDefaultInteractor
in class IlvSelection
IlvReshapeSelection
,
IlvSelection.SetDefaultInteractor(java.lang.String)
public void addObject(IlvGraphic graphic, boolean redraw)
IlvGraphicBag
interface.
Since the graphic handle selection can contain only one object,
you can add only an object if the currently referenced object is
null
. The passed object becomes the new
currently referenced object.
If the graphic handle selection is in a graphic bag, it automatically
calls applyToObject
on its graphic bag while adding
the 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.
Since the graphic handle selection can contain only one object,
you can remove only the currently referenced object.
If the graphic handle selection is in a graphic bag, it automatically
calls applyToObject
on its graphic bag while removing
the 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 selection is inside a graphic bag, it redraws this
graphic handle selection.reDrawObj
in interface IlvGraphicBag
graphic
- The graphic object.public void reDrawRegion(IlvRegion region)
IlvGraphicBag
interface.
If this graphic handle selection is inside a graphic bag, it redraws this
graphic handle selection.reDrawRegion
in interface IlvGraphicBag
region
- The region to redraw.public void reshapeObject(IlvGraphic graphic, IlvRect newrect, boolean redraw)
IlvGraphicBag
interface.
Since the graphic handle selection can contain only one object,
you can reshape only the currently referenced object.
If the graphic handle selection is in a graphic bag, it automatically
calls 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 selection can contain only one object,
you can move only the currently referenced object.
If the graphic handle selection is in a graphic bag, it automatically
calls 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 selection 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 selection 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 selection 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.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.