public class IlvRectangularScale extends IlvScale implements IlvDefinitionRectInterface
IlvRectangularScale
represents a vertical or horizontal scale.
The default values for an IlvRectangularScale
instance are
as follows:
IlvPoint()
100
"###"
, see java.text.DecimalFormat
0
100
5
2
IlvConstants.LEFT
IlvConstants.TOP
5
2
Color.black
IlvToolkit.defaultFont
To have a vertical scale, set the origin
to
IlvConstants.TOP
or IlvConstants.BOTTOM
; for a
horizontal scale, set the origin to IlvConstants.LEFT
or
IlvConstants.RIGHT
.
The following code example shows how to use an IlvRectangularScale
in a simple Java application:
IlvManager manager = new IlvManager(); IlvRectangularScale myDefaultScale = new IlvRectangularScale(); myDefaultScale.move(new IlvPoint(40,30)); IlvRectangularScale myCustomScale = new IlvRectangularScale( new IlvPoint(120,20), 54, "#", 0, 76, 7, 3, IlvConstants.BOTTOM, IlvConstants.BOTTOM, 5, 2); myCustomScale.setForeground(Color.blue); myCustomScale.setFont(new Font("SansSerif", Font.BOLD, 14)); manager.addObject( myDefaultScale, true); manager.addObject( myCustomScale, true);
The following image shows the graphic objects created in the code example:
>
IlvRectangularScale
is a custom graphic object, that is, a
subclass of IlvGraphic
. Graphic objects are controlled using an
IlvManager
instance and displayed using one or more
IlvManagerView
instances in a Java Swing application.
For information about generic features for graphic objects, see
IlvGraphic.
IlvRect
,
IlvPoint
,
IlvConstants
,
IlvManager
,
IlvManagerView
,
Serialized FormConstructor and Description |
---|
IlvRectangularScale()
Creates a new rectangular scale with default values for all the parameters.
|
IlvRectangularScale(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvRectangularScale(IlvPoint origin,
double size,
String[] labels,
int numberOfSubSteps,
int originPosition,
int labelsPosition,
float stepSize,
float subStepSize)
Creates a new
IlvRectangularScale by specifying the
labels to be displayed. |
IlvRectangularScale(IlvPoint origin,
double size,
String format,
float min,
float max,
int numberOfSteps,
int numberOfSubSteps,
int originPosition,
int labelsPosition,
float stepSize,
float subStepSize)
Creates a new
IlvRectangularScale by specifying a minimum
and a maximum value for the labels. |
IlvRectangularScale(IlvRectangularScale source)
Creates a new
IlvRectangularScale by copying an existing one. |
Modifier and Type | Method and Description |
---|---|
void |
applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.
|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
IlvRect |
getDefinitionRect()
Returns a copy of the definition rectangle.
|
IlvTransformer |
getDefinitionTransformer()
This function returns
null to indicate that there is no definition
transformation. |
boolean |
getLabelsCentered()
Returns
true if the scale draws its labels between the
markers; false if it draws each label with its corresponding
marker. |
int |
getLabelsPosition()
Returns the position of the labels of the scale.
|
IlvPoint |
getOrigin()
Returns the origin of the scale (the location
of the minimum value
representation).
|
int |
getOriginPosition()
Returns the position of the origin of the scale.
|
double |
getSize()
Returns the size of the scale (the height or the width).
|
void |
moveResize(IlvRect rect)
Resizes the object.
|
void |
setDefinitionRect(IlvRect rect)
Sets the definition rectangle.
|
void |
setLabelsCentered(boolean set)
Centers the label between the markers.
|
void |
setLabelsPosition(int position)
Changes the position of the labels of the scale.
|
void |
setOrigin(IlvPoint point)
Changes the origin of the scale (the location
of the minimum value
representation).
|
void |
setOriginPosition(int orientation)
Changes the position of the origin of the scale.
|
void |
setSize(double size)
Sets the size of the scale (the height or the width).
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
boolean |
zoomable()
Returns
true if the object is zoomable. |
baseTextDirectionChanged, componentOrientationChanged, getFont, getForeground, getFormat, getLabels, getMax, getMin, getNumberOfSteps, getNumberOfSubSteps, getStepSize, getSubStepSize, isAntialiasing, isBaseTextDirectionSensitive, isLocaleSensitive, localeChanged, setAntialiasing, setFont, setForeground, setFormat, setLabel, setLabels, setMax, setMin, setNumberOfSteps, setNumberOfSubSteps, setStepSize, setSubStepSize
calcResolvedBaseTextDirection, getBaseTextDirection, getComponentOrientation, getResolvedBaseTextDirection, getULocale, invalidateBidiCache, setBaseTextDirection, setBaseTextDirection, setBaseTextDirectionDuringConstruction
addActionListener, addNamedPropertyListener, allViewsRemoved, blinkingStateOn, boundingBox, callDraw, contains, getAndAssociateObjectInteractor, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, isVisible, makeSelection, move, move, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, 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
public IlvRectangularScale(IlvPoint origin, double size, String format, float min, float max, int numberOfSteps, int numberOfSubSteps, int originPosition, int labelsPosition, float stepSize, float subStepSize)
IlvRectangularScale
by specifying a minimum
and a maximum value for the labels.origin
- the origin of the scale. The location of the minimum value
representation.size
- the height or the width depending on if the scale is vertical or horizontal.format
- the format used to display the labels. (See the class
java.text.DecimalFormat
for a description of this parameter.)min
- the minimum value for labelsmax
- the maximum value for labelsnumberOfSteps
- the number of major steps.numberOfSubSteps
- the number of minor steps between two major steps.originPosition
- the position of the origin. The value can be
IlvConstants.TOP
or IlvConstants.BOTTOM
for a
vertical scale and IlvConstants.LEFT
or
IlvConstants.RIGHT
for a horizontal scale.labelsPosition
- the position of the labels on the scale. It can be
IlvConstants.TOP
or IlvConstants.BOTTOM
for
a horizontal scale of IlvConstants.LEFT
or
IlvConstants.RIGHT
for a vertical scale.stepSize
- the size of the major ticks.subStepSize
- the size of the minor ticks.public IlvRectangularScale(IlvPoint origin, double size, String[] labels, int numberOfSubSteps, int originPosition, int labelsPosition, float stepSize, float subStepSize)
IlvRectangularScale
by specifying the
labels to be displayed.origin
- the origin of the scale. The location of the minimum value
representation.size
- the height or the width depending if the scale is vertical or horizontal.labels
- the labels of the scale. The number of elements in the array defines
the number of major steps.numberOfSubSteps
- the number of minor steps between two major steps.originPosition
- the position of the origin. The value can be
IlvConstants.TOP
or IlvConstants.BOTTOM
for a
vertical scale and IlvConstants.LEFT
or
IlvConstants.RIGHT
for a horizontal scale.labelsPosition
- the position of the labels on the scale. It can be
IlvConstants.TOP
or IlvConstants.BOTTOM
for
a horizontal scale of IlvConstants.LEFT
or
IlvConstants.RIGHT
for a vertical scale.stepSize
- the size of the major ticks.subStepSize
- the size of the minor ticks.public IlvRectangularScale()
public IlvRectangularScale(IlvRectangularScale source)
IlvRectangularScale
by copying an existing one.source
- the origin object for the copy.public IlvRectangularScale(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- the input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
copy
in class IlvGraphic
IlvGraphic
public final int getOriginPosition()
IlvConstants.TOP
or IlvConstants.BOTTOM
for a vertical scale, or IlvConstants.LEFT
or
IlvConstants.RIGHT
for a horizontal scale.public final void setOriginPosition(int orientation)
IlvConstants.TOP
or IlvConstants.BOTTOM
for a vertical scale, or IlvConstants.LEFT
or
IlvConstants.RIGHT
for a horizontal scale. Changing this attribute may change the
bounding box of the scale.public final int getLabelsPosition()
public final void setLabelsPosition(int position)
IlvConstants.LEFT
or IlvConstants.RIGHT
.
If the scale is horizontal, the possible values for position
are IlvConstants.TOP
or IlvConstants.BOTTOM
.public final void setSize(double size)
public final double getSize()
public final boolean getLabelsCentered()
true
if the scale draws its labels between the
markers; false
if it draws each label with its corresponding
marker.public final void setLabelsCentered(boolean set)
getLabelsCentered()
public IlvRect getDefinitionRect()
getDefinitionRect
in interface IlvDefinitionRectInterface
setDefinitionRect(IlvRect)
public void setDefinitionRect(IlvRect rect)
setDefinitionRect
in interface IlvDefinitionRectInterface
rect
- The new definition rectangle.getDefinitionRect()
public IlvTransformer getDefinitionTransformer()
null
to indicate that there is no definition
transformation.getDefinitionTransformer
in interface IlvDefinitionRectInterface
null
.IlvDefinitionRectInterface
public final IlvPoint getOrigin()
public final void setOrigin(IlvPoint point)
point
- the new origin.public boolean zoomable()
true
if the object is zoomable.
Otherwise it returns false
.zoomable
in class IlvGraphic
IlvGraphic
,
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvManager
public IlvRect boundingBox(IlvTransformer t)
boundingBox
in class IlvScale
t
- The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public void draw(Graphics dst, IlvTransformer t)
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 void applyTransform(IlvTransformer t)
applyTransform
in class IlvScale
t
- The transformer to be applied.IlvGraphic
public void moveResize(IlvRect rect)
IlvRect
parameter.
This method calls the applyTransform(ilog.views.IlvTransformer)
method.moveResize
in class IlvGraphic
rect
- The new bounding rectangle of the object.setDefinitionRect(IlvRect)
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
Note that even if this is a public method, you should not
call it directly, you should use the write
methods of the manager.write
in interface IlvPersistentObject
write
in class IlvScale
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.