ilog.views.graphic
Class IlvScale

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvScale
All Implemented Interfaces:
IlvFontInterface, IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvCircularScale, IlvRectangularScale

public abstract class IlvScale
extends IlvGraphic
implements IlvFontInterface

IlvScale is an abstract class from which all instances of scale object classes are derived. This class manages the basic information concerning scales.

See Also:
Serialized Form

Constructor Summary
IlvScale(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvScale(IlvRect rect, int numberOfSteps, int numberOfSubSteps, float stepSize, float subStepSize, float min, float max, String format)
          Creates a new scale by specifying a minimum and maximum value for the labels.
IlvScale(IlvRect rect, String[] labels, int numberOfSubSteps, float stepSize, float subStepSize)
          Creates a new scale by specifying the labels.
IlvScale(IlvScale source)
          Creates a new IlvScale by copying an existing one.
 
Method Summary
 void applyTransform(IlvTransformer t)
          Applies a transformation to the shape of the object.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of the object.
 Font getFont()
          Returns the font of the object.
 Color getForeground()
          Returns the color of the IlvScale.
 String getFormat()
          Returns the format used to display numeric labels.
 String[] getLabels()
          Returns the labels of the scale.
 float getMax()
          Returns the maximum value displayed as a label of the scale.
 float getMin()
          Returns the minimum value displayed as a label of the scale.
 int getNumberOfSteps()
          Returns the number of major steps for this scale.
 int getNumberOfSubSteps()
          Returns the number of minor steps for this scale.
 float getStepSize()
          Returns the size of a major tick mark.
 float getSubStepSize()
          Returns the size of a minor tick mark.
 boolean isAntialiasing()
          Returns true if the anti-aliasing mode of the labels is on.
 void setAntialiasing(boolean set)
          Changes the anti-aliasing mode of the labels.
 void setFont(Font font)
          Changes the font of the object.
 void setForeground(Color color)
          Changes the color of the IlvScale.
 void setFormat(String format)
          Changes the format used to display numeric labels.
 void setLabel(int index, String label)
          Changes the specified label of the scale.
 void setLabels(String[] labels)
          Changes all labels of the scale.
 void setMax(float max)
          Changes the maximum value displayed as a label of the scale.
 void setMin(float min)
          Changes the minimum value displayed as a label of the scale.
 void setNumberOfSteps(int steps)
          Changes the number of major steps for this scale.
 void setNumberOfSubSteps(int substeps)
          Changes the number of minor steps for this scale.
 void setStepSize(float stepSize)
          Changes the size of a major tick mark.
 void setSubStepSize(float subStepSize)
          Changes the size of a minor tick mark.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, contains, copy, draw, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, isVisible, makeSelection, move, move, moveResize, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setEditable, setFillOn, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString, translate, zoomable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvScale

public IlvScale(IlvRect rect,
                int numberOfSteps,
                int numberOfSubSteps,
                float stepSize,
                float subStepSize,
                float min,
                float max,
                String format)
Creates a new scale by specifying a minimum and maximum value for the labels.

Parameters:
rect - the location and size of the scale.
numberOfSteps - the number of major steps.
numberOfSubSteps - the number of minor steps displayed between major steps.
stepSize - the size of the major tick mark.
subStepSize - the size of the minor tick mark.
min - the minimum value of the labels of the scale.
max - the maximum value of the labels of the scale.
format - a format used to display the labels of the scale. (See the class java.text.DecimalFormat for a description of this parameter.)

IlvScale

public IlvScale(IlvRect rect,
                String[] labels,
                int numberOfSubSteps,
                float stepSize,
                float subStepSize)
Creates a new scale by specifying the labels.

Parameters:
rect - the location and size of the scale.
labels - the labels of the scale.
numberOfSubSteps - the number of minor steps displayed between major steps.
stepSize - the size of the major tick mark.
subStepSize - the size of the minor tick mark.

IlvScale

public IlvScale(IlvScale source)
Creates a new IlvScale by copying an existing one.

Parameters:
source - the origin object for the copy.

IlvScale

public IlvScale(IlvInputStream stream)
         throws IlvReadFileException
Reads the object from an IlvInputStream.

Parameters:
stream - the input stream.
Throws:
IlvReadFileException - if the format is not correct.
Method Detail

getNumberOfSteps

public final int getNumberOfSteps()
Returns the number of major steps for this scale.


setNumberOfSteps

public final void setNumberOfSteps(int steps)
Changes the number of major steps for this scale. This method assumes that you have created the scale by specifying a minimum and a maximum value. The labels are recomputed based on the min and max values.


getNumberOfSubSteps

public final int getNumberOfSubSteps()
Returns the number of minor steps for this scale.


setNumberOfSubSteps

public final void setNumberOfSubSteps(int substeps)
Changes the number of minor steps for this scale.


getStepSize

public final float getStepSize()
Returns the size of a major tick mark.


setStepSize

public final void setStepSize(float stepSize)
Changes the size of a major tick mark. This may change the bounding box of the object.


getSubStepSize

public final float getSubStepSize()
Returns the size of a minor tick mark.


setSubStepSize

public final void setSubStepSize(float subStepSize)
Changes the size of a minor tick mark. This may change the bounding box of the object.


getMin

public final float getMin()
Returns the minimum value displayed as a label of the scale. The result of this method may not be relevant if the scale labels have been set by the setLabels method.

See Also:
getMax()

setMin

public final void setMin(float min)
Changes the minimum value displayed as a label of the scale. All the labels will be recomputed. This may change the bounding box of the object.

See Also:
setMax(float)

getMax

public final float getMax()
Returns the maximum value displayed as a label of the scale. The result of this method may not be relevant if the scale labels have been set by the setLabels method.

See Also:
getMin()

setMax

public final void setMax(float max)
Changes the maximum value displayed as a label of the scale. All the labels will be recomputed. This may change the bounding box of the object.

See Also:
setMin(float)

getFormat

public final String getFormat()
Returns the format used to display numeric labels. When labels are numeric values (within min and max), the labels are computed using this format. The format is a decimal format as described in the class java.text.DecimalFormat.


setFormat

public final void setFormat(String format)
Changes the format used to display numeric labels. When labels are numeric values (within min and max), the labels are computed using this format. The format is a decimal format as described in the class java.text.DecimalFormat. Changing the format may change the bounding box of the object.


setFont

public void setFont(Font font)
Changes the font of the object.

Specified by:
setFont in interface IlvFontInterface
Parameters:
font - the new font.

getFont

public Font getFont()
Returns the font of the object.

Specified by:
getFont in interface IlvFontInterface

isAntialiasing

public final boolean isAntialiasing()
Returns true if the anti-aliasing mode of the labels is on. Note that Anti-aliasing works only with Java 1.2.


setAntialiasing

public final void setAntialiasing(boolean set)
Changes the anti-aliasing mode of the labels. Note that Anti-aliasing works only with Java 1.2. Changing this mode may change the bounding box of the object.


getLabels

public final String[] getLabels()
Returns the labels of the scale. Note that you should not change the returned value.


setLabels

public void setLabels(String[] labels)
Changes all labels of the scale. Note that this may change the bounding box of the object.

Parameters:
labels - the new labels.

setLabel

public void setLabel(int index,
                     String label)
Changes the specified label of the scale. Note that this may change the bounding box of the object.

Parameters:
index - the index of the label to change.
label - the new label.

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.

Specified by:
boundingBox in class IlvGraphic
Parameters:
t - The transformer used to draw the object.
See Also:
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

applyTransform

public void applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.

Specified by:
applyTransform in class IlvGraphic
Parameters:
t - The transformer to be applied.
See Also:
IlvGraphic

setForeground

public void setForeground(Color color)
Changes the color of the IlvScale.

Overrides:
setForeground in class IlvGraphic
Parameters:
color - the new color.
See Also:
IlvGraphic.draw(Graphics, IlvTransformer), IlvGraphic.setBackground(Color), IlvGraphic.setFillOn(boolean), IlvGraphic.setStrokeOn(boolean), IlvGraphic

getForeground

public Color getForeground()
Returns the color of the IlvScale.

Returns:
the color of the object.

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an 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.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvGraphic
Parameters:
stream - The output stream.
Throws:
IOException - thrown when an exception occurs during the write operation for this object.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.