public class IlvHalfZoomingGraphic extends IlvFixedSizeGraphic
IlvHalfZoomingGraphic
is a wrapper class
that is used to prevent a graphic object from zooming above (or below)
a given maximum (or minimum) zoom level.
This class is used like the class IlvFixedSizeGraphic
:
You create an instance of IlvHalfZoomingGraphic
that wraps another
graphic object.
The behavior of the IlvHalfZoomingGraphic
object is controlled by two properties:
a maximum zoom level and a minimum zoom level.
When the zoom of the manager view is greater than the maximum zoom, the IlvHalfZoomingGraphic
object behaves like a fixed-size graphic: its size remains constant.
When the zoom of the manager view is less than the minimum zoom, the behavior depends on the
value of the grayedWhenUnzoomed
property.
grayedWhenUnzoomed
is true
, the IlvHalfZoomingGraphic
object is drawn as a gray rectangle. The gray rectangle zooms out normally: it becomes
smaller when the view is zoomed out.
grayedWhenUnzoomed
is false
, the IlvHalfZoomingGraphic
object behaves like a fixed-size graphic: its size remains constant.
Between minimum and maximum zoom levels, the IlvHalfZoomingGraphic
object behaves just like the wrapped object: it zooms in and out normally.
You can also specify an initial zoom factor. The actual zoom factor of the view will be multiplied by this initial zoom for all transformer calculations. For example, if the initial zoom is 2, and the view's transformer is the identity, the object will behave as if the view was initially zoomed by a factor 2.
An additional feature is the alpha transparency support. If the alpha value is set below 1, the wrapped object is drawn in a transparent way even if the colors of the wrapped object are not set to transparent colors. This is useful if you want to add transparency to the entire wrapped object without changing all individual foreground, background and stroke colors of the wrapped object.
Modifier and Type | Field and Description |
---|---|
static IlvObjectInteractor |
DELEGATE_INTERACTOR
The delegate interactor for
IlvHalfZoomingGraphic
objects. |
Constructor and Description |
---|
IlvHalfZoomingGraphic(IlvGraphic object,
IlvPoint point,
double minZoom,
double maxZoom,
double initialZoom)
Creates a new half-zooming object that stops zooming
when the zoom factor of the manager view exceeds a specified
zoom level.
|
IlvHalfZoomingGraphic(IlvGraphic object,
int position,
double minZoom,
double maxZoom,
double initialZoom)
Creates a new half-zooming object that stops zooming
when the zoom factor of the manager view exceeds a specified
zoom level.
|
IlvHalfZoomingGraphic(IlvGraphic object,
int position,
IlvPoint point,
double minZoom,
double maxZoom,
double initialZoom)
Creates a new half-zooming object that stops zooming
when the zoom factor of the manager view exceeds a specified
zoom level.
|
IlvHalfZoomingGraphic(IlvHalfZoomingGraphic source)
Creates a new
IlvHalfZoomingGraphic by copying an existing one. |
IlvHalfZoomingGraphic(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
Modifier and Type | Method and Description |
---|---|
void |
applyTransform(IlvTransformer t)
Applies a transformation to the object.
|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
IlvTransformer |
computeTransformer(IlvTransformer t)
Computes the transformer used to draw this object
based on the specified transformer.
|
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.
|
float |
getAlpha()
Returns the alpha value of this object.
|
double |
getInitialZoom()
Returns the initial zoom level.
|
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.
|
double |
getMaxZoom()
Returns the maximum zoom level above which the object
stops zooming.
|
double |
getMinZoom()
Returns the minimum zoom level below which the object
stops zooming.
|
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.
|
protected double |
getReferenceZoom()
Returns the reference zoom.
|
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.
|
Color |
getUnzoomedBackground()
Returns the background color used to fill
the rectangle when the object is
below the minimum zoom level.
|
Color |
getUnzoomedForeground()
Returns the foreground color used to draw the
outline of the rectangle when the object is
below the minimum zoom level.
|
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 |
isAlphaBufferEnabled()
Returns
true if an additional buffer is used to draw the
object when the alpha composition value is not 1.0. |
boolean |
isDelegateObjectInteractor(IlvObjectInteractor inter)
Tests whether the input object interactor is the delegate interactor
suitable for this class.
|
boolean |
isGrayedWhenUnzoomed()
Returns the flag specifying whether the object is drawn as
a gray box when the zoom level is less than the minimum zoom,
or if it is drawn at its minimum size.
|
boolean |
isRotatable()
Returns
true if the object supports rotation. |
IlvSelection |
makeSelection()
Creates the selection object for this class.
|
protected void |
notifyObjectInteractorToManager(IlvObjectInteractor interactor)
Notifies the manager that the object interactor has changed.
|
void |
setAlpha(float alpha)
Changes the alpha value of this object.
|
void |
setAlphaBufferEnabled(boolean enable)
Sets whether an additional buffer is used to draw the object when
the alpha composition value is not 1.0.
|
void |
setGraphicBag(IlvGraphicBag bag)
Changes the bag that contains the object.
|
void |
setGrayedWhenUnzoomed(boolean grayedWhenUnzoomed)
Specifies whether the object is drawn as a gray box
when the zoom level is less than the minimum zoom, or if
it is drawn at its minimum size.
|
void |
setInitialZoom(double initialZoom)
Sets the initial zoom level.
|
void |
setMaxZoom(double maxZoom)
Sets the maximum zoom level above which the object
stops zooming.
|
void |
setMinZoom(double minZoom)
Sets the minimum zoom level below which the object
stops zooming.
|
void |
setPoint(IlvPoint p)
Changes the point that remains fixed.
|
void |
setPosition(int position)
Changes the position of the point that remains fixed.
|
void |
setRotatable(boolean flag)
Sets whether the object supports rotation.
|
void |
setUnzoomedBackground(Color background)
Sets the background color used to fill
the rectangle when the object is
below the minimum zoom level.
|
void |
setUnzoomedForeground(Color foreground)
Sets the foreground color used to draw the
outline of the rectangle when the object is
below the minimum zoom level.
|
protected IlvRect |
unzoomedBBox()
Returns the bounding box used when the
object is drawn below the minimum zoom level.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
boolean |
zoomable()
Returns
true if this object is zoomable,
and false otherwise. |
getPoint, getPosition, resize, rotate
addGraphicBagHierarchyListener, addManagerViewsHierarchyListener, addObject, applyToObject, baseTextDirectionChanged, componentOrientationChanged, enableGraphicBagHierarchyEventForwarding, enableManagerViewsHierarchyEventForwarding, fireGraphicBagHierarchyEvent, fireManagerViewsHierarchyEvent, getObject, getObjects, getResolvedBaseTextDirection, isOwner, localeChanged, moveObject, needsGraphicBagHierarchyEvent, needsManagerViewsHierarchyEvent, reDrawObj, reDrawRegion, removeGraphicBagHierarchyListener, removeManagerViewsHierarchyListener, removeObject, reshapeObject, setDelegateMoveResize, setObject, setObjectName
getBaseTextDirection, getObject, getOriginalPopupMenu, isBaseTextDirectionSensitive, isPersistent, move, move, moveResize, scale, setBackground, setBaseTextDirection, setForeground, setOwner, translate, usesBidiMarkers
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, needsViewNotification, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, updateNeedsViewNotification, viewAddedOrRemoved
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getGraphicBag
public static final IlvObjectInteractor DELEGATE_INTERACTOR
IlvHalfZoomingGraphic
objects. Use this interactor as object interactor of the half-zooming
object if the wrapped object has an object interactor. The delegate
interactor forwards all events to the object interactor of the wrapped
object.
The delegate interactor is always installed by default when an
instance of IlvHalfZoomingGraphic
is allocated.
You can call IlvGraphic.setObjectInteractor(ilog.views.IlvObjectInteractor)
to install a different
object interactor (use a null
argument to avoid the
delegation to the object interactor of the child).
IlvGraphic.setObjectInteractor(ilog.views.IlvObjectInteractor)
public IlvHalfZoomingGraphic(IlvGraphic object, int position, IlvPoint point, double minZoom, double maxZoom, double initialZoom)
object
- The referenced object.position
- Indicates the point in the referenced object (for example,
its center or the top-left corner of its bounding box) that must remain
at the same position when the object is zoomed in or out. See the class
IlvDirection
for the valid values of this parameter.point
- If non-null
it will be used to specify the
position of a fixed point when the object is zoomed in or out.
The position
parameter is not taken into account if this
parameter is non-null
.minZoom
- Specifies the zoom level below which the object will
be replaced by a gray box.
A typical value for minZoom
is 0.25
.maxZoom
- Specifies the maximum zoom level above which the object will
stop zooming.
A typical value for maxZoom
is 4
.initialZoom
- Specifies the initial zoom level. The zoom factor of the
view's transformer will be multiplied by this initial zoom level for all
transformer calculations.public IlvHalfZoomingGraphic(IlvGraphic object, IlvPoint point, double minZoom, double maxZoom, double initialZoom)
object
- The referenced object.point
- Specifies the
position of a fixed point when the object is zoomed in or out.minZoom
- Specifies the zoom level below which the object will
be replaced by a gray box.
A typical value for minZoom
is 0.25
.maxZoom
- Specifies the maximum zoom level above which the object will * stop zooming.
A typical value for maxZoom
is 4
.initialZoom
- Specifies the initial zoom level. The zoom factor of the * view's transformer will be multiplied by this initial zoom level for all
transformer calculations.public IlvHalfZoomingGraphic(IlvGraphic object, int position, double minZoom, double maxZoom, double initialZoom)
object
- The referenced object.position
- Indicates the point in the referenced object (for example,
its center or the top-left corner of its bounding box) that must remain
at the same position when the object is zoomed in or out. See the class
IlvDirection
for the valid values of this parameter.minZoom
- Specifies the zoom level below which the object will
be replaced by a gray box.
A typical value for minZoom
is 0.25
.maxZoom
- Specifies the maximum zoom level above which the object will * stop zooming.
A typical value for maxZoom
is 4
.initialZoom
- Specifies the initial zoom level. The zoom factor of the * view's transformer will be multiplied by this initial zoom level for all
transformer calculations.public IlvHalfZoomingGraphic(IlvHalfZoomingGraphic source)
IlvHalfZoomingGraphic
by copying an existing one.source
- The source object to copy.public IlvHalfZoomingGraphic(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
copy
in class IlvFixedSizeGraphic
IlvGraphicHandleBag.isOwner()
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.write
in interface IlvPersistentObject
write
in class IlvFixedSizeGraphic
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.public void setGraphicBag(IlvGraphicBag bag)
IlvGraphicBag
such as an
IlvManager
.
You should not call this method directly unless you are
creating a new type of bag.setGraphicBag
in class IlvGraphicHandleBag
bag
- The graphic bag.IlvGraphic
public final void setPosition(int position)
setPosition
in class IlvFixedSizeGraphic
position
- See the class IlvConstants
for the
valid values of this parameter.IlvFixedSizeGraphic.getPosition()
,
IlvConstants
public final void setPoint(IlvPoint p)
setPoint
in class IlvFixedSizeGraphic
p
- The point.IlvFixedSizeGraphic.getPoint()
public double getMinZoom()
public void setMinZoom(double minZoom)
minZoom
- Specifies the zoom level below which the object will
be replaced by a gray box.public double getMaxZoom()
public void setMaxZoom(double maxZoom)
Note: If the maximum zoom is less than the initial zoom
,
the object is not zoomable any more
(that is, zoomable()
returns false
),
and it will be handled less
efficiently by JViews.
maxZoom
- Specifies the maximum zoom level above which the object will
stop zooming.
A typical value for maxZoom
is 4
.public double getInitialZoom()
public void setInitialZoom(double initialZoom)
Note: If the initial zoom is greater than the maximum zoom
,
the object is not zoomable any more
(that is to say, zoomable()
returns false
),
and it will be handled less
efficiently by JViews.
initialZoom
- Specifies the initial zoom level. It cannot
be 0
.public void setUnzoomedForeground(Color foreground)
IlvBlinkingColor
.foreground
- The new foreground color.public Color getUnzoomedForeground()
public void setUnzoomedBackground(Color background)
IlvBlinkingColor
.background
- The new background color.public Color getUnzoomedBackground()
public void setGrayedWhenUnzoomed(boolean grayedWhenUnzoomed)
The default value of true
.
Note: If this property is set to false
,
the object is not zoomable any more
(that is to say, zoomable()
returns false
),
and it will be handled less
efficiently by JViews.
grayedWhenUnzoomed
- If true
, the object
is drawn as a gray box when the zoom level is less than the
minimum zoom, and the gray box keeps unzooming as the zoom
level decreases. If false
, the object is always
drawn at its minimum size whenever the zoom level is below
the minimum zoom.public boolean isGrayedWhenUnzoomed()
public void setRotatable(boolean flag)
The default value is true
.
isRotatable()
public boolean isRotatable()
true
if the object supports rotation.
If this wrapper has the rotation support disabled, the object always stays
in upright position, even if the wrapped object would support rotation.
The rotation factor is not delegated to the wrapped object.
If this wrapper has the rotation support enabled, it depends on the
wrapped object how it behaves under rotation. If the wrapped object
also supports rotation, it will rotate normally.setRotatable(boolean)
public void setAlpha(float alpha)
alpha
- The new transparency level in the range [0.0, 1.0].getAlpha()
public float getAlpha()
setAlpha(float)
public void setAlphaBufferEnabled(boolean enable)
enable
- Whether the alpha buffer is enabled.getAlpha()
,
isAlphaBufferEnabled()
public boolean isAlphaBufferEnabled()
true
if an additional buffer is used to draw the
object when the alpha composition value is not 1.0.getAlpha()
,
setAlphaBufferEnabled(boolean)
public boolean isDelegateObjectInteractor(IlvObjectInteractor inter)
isDelegateObjectInteractor
in class IlvGraphicHandleBag
protected void notifyObjectInteractorToManager(IlvObjectInteractor interactor)
notifyObjectInteractorToManager
in class IlvGraphicHandleBag
public IlvTransformer computeTransformer(IlvTransformer t)
draw
method is called,
the computeTransformer
method
computes a modified transformer that takes into
account the minimum and maximum zoom levels. Then,
the new transformer is passed to the draw
method of the superclass to actually draw the object.
t
- The manager view transformer.public void draw(Graphics dst, IlvTransformer t)
draw
in class IlvFixedSizeGraphic
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 IlvFixedSizeGraphic
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
in class IlvFixedSizeGraphic
t
- The transformer to be applied.IlvGraphic
protected IlvRect unzoomedBBox()
The default implementation returns
boundingBox(null)
. If you redefine
this method, and if you return a bigger rectangle than
the default implementation, then the object
is not zoomable any more, and you must also
redefine zoomable()
to return
false
.
protected double getReferenceZoom()
The default implementation returns 1.0
.
public boolean zoomable()
true
if this object is zoomable,
and false
otherwise.
Whether this object is zoomable depends on whether the wrapped object
is zoomable and on the parameters of this half-zooming object.zoomable
in class IlvFixedSizeGraphic
IlvGraphic
,
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvManager
public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains
on the referenced object.contains
in class IlvFixedSizeGraphic
p
- The point to be tested.tp
- The point p
transformed by the transformer t
.t
- The transformation that was 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 IlvFixedSizeGraphic
rect
- The rectangle to be tested.trect
- The rectangle rect
transformed by the transformer t
.t
- The transformation 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 IlvFixedSizeGraphic
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 IlvFixedSizeGraphic
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 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 IlvFixedSizeGraphic
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 IlvFixedSizeGraphic
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.getPopupMenu(IlvPoint, IlvTransformer, IlvManagerView, IlvPopupMenuManager)
public IlvSelection makeSelection()
IlvSplineSelection
.makeSelection
in class IlvFixedSizeGraphic
IlvSplineSelection
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.