ilog.views.graphic
Class IlvTextPath

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvGeneralPath
          extended by ilog.views.graphic.IlvTextPath
All Implemented Interfaces:
IlvFontInterface, IlvLabelInterface, IlvPolyPointsInterface, IlvPersistentObject, Transferable, Serializable

public class IlvTextPath
extends IlvGeneralPath
implements IlvLabelInterface, IlvFontInterface

A graphic object that displays a text on any Shape. The text is placed on the path after flattening of the outline of the shape.

Since:
JViews 5.0
See Also:
Serialized Form

Constructor Summary
IlvTextPath(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvTextPath(IlvTextPath source)
          Creates a new IlvTextPath by copying an existing one.
IlvTextPath(Shape shape, String text)
          Constructs a new IlvTextPath using the specified shape as a baseline and displaying the specified text.
IlvTextPath(Shape shape, String text, int justification, int verticalAlignment, double baseLineShift)
          Constructs a new IlvTextPath using the specified shape as a baseline, with the specified justification and the specified shift from the baseline.
 
Method Summary
protected  Paint adaptPaint(Shape shape, Paint paint)
          This method is overridden in IlvTextPath to deal with auto adaptable IlvMultipleGradientPaint instances.
 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 if a point lies within the shape.
 IlvGraphic copy()
          Copies the object.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
 double getBaselineShift()
          Returns the shift perpendicular to the baseline.
 double getFlatness()
          Returns the flatness for iterating on the path of this object.
 Font getFont()
          Returns the font of the object.
 int getJustification()
          Returns the justification of the text.
 String getLabel()
          Returns the label of the object.
 IlvRect getLabelBBox(IlvTransformer t)
          Returns the area where the label is displayed.
 double getLength()
          Returns the length of the shape.
 int getVerticalAlignment()
          Returns the justification of the text.
 Shape getVisualBounds(IlvTransformer t)
          Returns the visual bounds of this IlvTextPath.
 boolean isAntialiasing()
          Returns true if the anti-aliasing mode of the label is on.
 boolean isExtendedBaseline()
          Returns true if this IlvTextPath is in Extended baseline mode.
 boolean isFractionalMetrics()
          Returns true if the fractional metrics mode of the label is on.
 boolean isStrokeOn()
          Returns true if the shape of the object is stroked.
 void setAntialiasing(boolean set)
          Changes the anti-aliasing mode of the label.
 void setBaselineShift(double shift)
          Sets the shift perpendicular to the baseline.
 void setExtendedBaseline(boolean set)
          Changes the displaying policy of this IlvTextPath.
 void setFillPaint(Paint paint)
          Changes the paint object used to fill the shape.
 void setFlatness(double flatness)
          Sets the flatness for iterating on the path of this IlvTextPath.
 void setFont(Font font)
          Changes the font of the object.
 void setForeground(Color color)
          Changes the foreground color of the object.
 void setFractionalMetrics(boolean set)
          Changes the fraction metrics mode of the label.
protected  void setInternalShape(Shape shape)
          Sets the internal shape.
 void setJustification(int direction)
          Changes the justification of the text.
 void setLabel(String label)
          Changes the label of this object.
 void setShape(Shape shape)
          Changes the shape of the object.
 void setStroke(Stroke stroke)
          Changes the stroke object used to stroke the text.
 void setStrokeOn(boolean set)
          When set to true, specifies that the shape of the object is stroked.
 void setVerticalAlignment(int alignment)
          Sets the shift policy between the text baseline and the path this object relies on.
 boolean supportMultiline()
          Returns true if the label can be a multiline label, false otherwise.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class ilog.views.graphic.IlvGeneralPath
allowsPointInsertion, allowsPointMove, allowsPointRemoval, calcBoundingBox, getAlpha, getClip, getFillPaint, getIntersectionWithOutline, getMaximumStrokeWidth, getPointAt, getPointsCardinal, getShape, getShapeBounds, getStroke, getStrokePaint, getTransformer, insertPoint, isContainsWhenNotFilled, isFillOn, isMovePointAllowed, isPaintAbsolute, isPaintZoomed, isPointEditionAllowed, isTransformedShapeMode, makeSelection, movePoint, moveResize, pointsInBBox, removePoint, resize, setAlpha, setBackground, setClip, setContainsWhenNotFilled, setFillOn, setMaximumStrokeWidth, setMovePointAllowed, setPaintAbsolute, setPaintZoomed, setPointEditionAllowed, setShapeBounds, setStrokePaint, setTransformedShapeMode, setTransformer
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, isVisible, move, move, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, rotate, scale, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setToolTipText, setVisible, toString, translate, zoomable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvTextPath

public IlvTextPath(Shape shape,
                   String text)
Constructs a new IlvTextPath using the specified shape as a baseline and displaying the specified text. The text is left justified on the path, and the baseline of the text matches the path.


IlvTextPath

public IlvTextPath(Shape shape,
                   String text,
                   int justification,
                   int verticalAlignment,
                   double baseLineShift)
Constructs a new IlvTextPath using the specified shape as a baseline, with the specified justification and the specified shift from the baseline.


IlvTextPath

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

Parameters:
source - The source object.

IlvTextPath

public IlvTextPath(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

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an IlvOutputStream. You should not call this method directly; instead, you should use the write methods of the manager.

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

adaptPaint

protected Paint adaptPaint(Shape shape,
                           Paint paint)
This method is overridden in IlvTextPath to deal with auto adaptable IlvMultipleGradientPaint instances. Indeed, as the IlvTextPath is made of several shapes, the auto adaptable will not be sufficient.

Overrides:
adaptPaint in class IlvGeneralPath
Parameters:
shape - The shape parameter that the returned Paint should fit.
paint - The initial Paint object.
See Also:
IlvGeneralPath.isPaintAbsolute()

setFlatness

public final void setFlatness(double flatness)
Sets the flatness for iterating on the path of this IlvTextPath.


getFlatness

public final double getFlatness()
Returns the flatness for iterating on the path of this object. The default is 0.1.


setJustification

public final void setJustification(int direction)
Changes the justification of the text. Use the following values for justification:


getJustification

public final int getJustification()
Returns the justification of the text.


setVerticalAlignment

public final void setVerticalAlignment(int alignment)
Sets the shift policy between the text baseline and the path this object relies on. Use the following values:


getVerticalAlignment

public final int getVerticalAlignment()
Returns the justification of the text.


setBaselineShift

public final void setBaselineShift(double shift)
Sets the shift perpendicular to the baseline.


getBaselineShift

public final double getBaselineShift()
Returns the shift perpendicular to the baseline.


setShape

public void setShape(Shape shape)
Changes the shape of the object. Note that changing the shape of the object may change it's bounding rectangle. For this reason if the object is contained inside a manager you should modify the shape using the applyToObject method of the manager.

Overrides:
setShape in class IlvGeneralPath
See Also:
IlvGeneralPath.getShape(), IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)

setInternalShape

protected void setInternalShape(Shape shape)
Sets the internal shape.

Overrides:
setInternalShape in class IlvGeneralPath
Internal method or field: do not use!

setFont

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

Specified by:
setFont in interface IlvFontInterface
Parameters:
font - The new font.
See Also:
getFont()

getFont

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

Specified by:
getFont in interface IlvFontInterface
See Also:
setFont(java.awt.Font)

isAntialiasing

public final boolean isAntialiasing()
Returns true if the anti-aliasing mode of the label is on.


setAntialiasing

public void setAntialiasing(boolean set)
Changes the anti-aliasing mode of the label. Changing this mode may change the bounding box of the object.


isFractionalMetrics

public final boolean isFractionalMetrics()
Returns true if the fractional metrics mode of the label is on.


setFractionalMetrics

public void setFractionalMetrics(boolean set)
Changes the fraction metrics mode of the label. Changing this mode may change the bounding box of the object.


isExtendedBaseline

public final boolean isExtendedBaseline()
Returns true if this IlvTextPath is in Extended baseline mode. The default is true.


setExtendedBaseline

public void setExtendedBaseline(boolean set)
Changes the displaying policy of this IlvTextPath. Changing this mode may change the bounding box of the object. When in Extended baseline mode, glyphs are displayed even if they do not fit on the path limits. Otherwise, characters that fall off the baseline are not displayed.


getLength

public double getLength()
Returns the length of the shape.


isStrokeOn

public boolean isStrokeOn()
Returns true if the shape of the object is stroked.

Overrides:
isStrokeOn in class IlvGeneralPath
See Also:
setStroke(java.awt.Stroke), IlvGeneralPath.setStrokePaint(java.awt.Paint), setStrokeOn(boolean)

setStrokeOn

public void setStrokeOn(boolean set)
When set to true, specifies that the shape of the object is stroked. Note that this may change its bounding rectangle. For this reason, if the object is contained inside a manager, you should modify the shape using the applyToObject method of the manager.

Overrides:
setStrokeOn in class IlvGeneralPath
Parameters:
set - Set to true to enable the stroke in your customized graphic object.
See Also:
setStroke(java.awt.Stroke), IlvGeneralPath.setStrokePaint(java.awt.Paint), isStrokeOn()

setStroke

public void setStroke(Stroke stroke)
Changes the stroke object used to stroke the text. You may set the value to null to remove the stroke. Note that changing the stroke may modify the bounding rectangle of the object. For this reason, if the object is contained inside a manager, you should modify the shape using the applyToObject method of the manager.

Overrides:
setStroke in class IlvGeneralPath
See Also:
IlvGeneralPath.getStrokePaint(), IlvGeneralPath.getStroke(), isStrokeOn()

setFillPaint

public void setFillPaint(Paint paint)
Changes the paint object used to fill the shape.

Overrides:
setFillPaint in class IlvGeneralPath
Parameters:
paint - The new filling object.
See Also:
IlvGeneralPath.getFillPaint(), IlvGeneralPath.isFillOn()

setForeground

public void setForeground(Color color)
Changes the foreground color of the object. That is the color that fills the font. It calls setFillPaint on the object.

Overrides:
setForeground in class IlvGeneralPath
Parameters:
color - The new color.
See Also:
setFillPaint(java.awt.Paint)

getVisualBounds

public Shape getVisualBounds(IlvTransformer t)
Returns the visual bounds of this IlvTextPath. The visual bounds are a composition of the visual bounds of all GlyphVector needed to draw this IlvTextPath.


copy

public IlvGraphic copy()
Copies the object.

Overrides:
copy in class IlvGeneralPath
Returns:
A new IlvGeneralPath.
See Also:
IlvGraphic

boundingBox

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

Specified by:
boundingBox in interface IlvPolyPointsInterface
Overrides:
boundingBox in class IlvGeneralPath
Parameters:
t - The transformer used to draw the object.
See Also:
IlvGeneralPath.getShapeBounds(IlvTransformer)

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests if a point lies within the shape.

Overrides:
contains in class IlvGeneralPath
Parameters:
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.
Returns:
true if the point lies inside this graphic object.
See Also:
IlvGeneralPath.isContainsWhenNotFilled()

draw

public void draw(Graphics dst,
                 IlvTransformer t)
Draws the object.

Overrides:
draw in class IlvGeneralPath
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
See Also:
IlvGraphic.boundingBox(ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

applyTransform

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

Overrides:
applyTransform in class IlvGeneralPath
Parameters:
t - The transformer to be applied.
See Also:
IlvGeneralPath.setClip(java.awt.Shape)

getLabel

public String getLabel()
Returns the label of the object.

Specified by:
getLabel in interface IlvLabelInterface

getLabelBBox

public IlvRect getLabelBBox(IlvTransformer t)
Returns the area where the label is displayed.

Specified by:
getLabelBBox in interface IlvLabelInterface
Parameters:
t - the transformer used to draw the graphic object.

setLabel

public void setLabel(String label)
Changes the label of this object.

Specified by:
setLabel in interface IlvLabelInterface

supportMultiline

public boolean supportMultiline()
Returns true if the label can be a multiline label, false otherwise.

Specified by:
supportMultiline in interface IlvLabelInterface


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