ilog.views.maps.graphic
Class IlvMapLabel

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.maps.graphic.IlvMapLabel
All Implemented Interfaces:
IlvFontInterface, IlvLabelInterface, IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvMapGraphicText

public class IlvMapLabel
extends IlvGraphic
implements IlvFontInterface, IlvLabelInterface

A zoomable multiline label.
This IlvGraphic can display a label containing more than one line of text. The lines can be separated by an interline and aligned inside the label. The anchor of the label can be either a point or a rectangle. If the anchor is a point, an attachment can be provided to specify the position of the label. If the anchor is a rectangle, an alignment can be provided to align the lines inside the rectangle. The label string can contain newline characters which are recognized as line separations.

Since:
JViews 5.0
See Also:
Serialized Form

Constructor Summary
IlvMapLabel(IlvInputStream stream)
          Reads an IlvMapLabel from an IlvInputStream
IlvMapLabel(IlvMapLabel source)
          Creates an instance, copy of the source label.
IlvMapLabel(IlvPoint anchor, String labels)
          Creates an instance of the label specifying the anchor of the label as a point and the multiline (newline separated) text.
IlvMapLabel(IlvRect anchor, String labels)
          Creates an instance of the label specifying the anchor of the label as a rectangle, the multiline text .
 
Method Summary
 void applyTransform(IlvTransformer t)
          Applies the transformation on the label.
 IlvRect boundingBox(IlvTransformer transformer)
          Retrieves the bounding box of the label.
 IlvGraphic copy()
          Returns a copy of this label.
 void draw(Graphics g, IlvTransformer t)
          Draws this object.
 int getAlignment()
          Retrieves the alignment of the label.
 IlvPoint getAnchor()
          Retrieves the anchor point of the label.
 int getAttachment()
          Retrieves the attachment of the label.
 Paint getBackgroundPaint()
          Retrieves the Paint used to fill the frame of the label.
 Paint getFillPaint()
          Retrieves the Paint used to fill the characters of the text.
 Font getFont()
          Retrieves the font used to draw the label.
 Paint getFramePaint()
          Retrieves the Paint used to draw the frame of the label.
 float getInnerMargin()
          Returns the margin.
 float getInterline()
          Retrieves the interline value.
 String getLabel()
          Returns the label as a string.
 IlvRect getLabelBBox(IlvTransformer transformer)
          Returns the bounding area where the label is displayed.
 int getMaximumHeight()
          Retrieves the maximum height of the label.
 int getMaximumLineHeight()
          Retrieves the maximum line height of the label.
 int getMinimumHeight()
          Retrieves the minimum height of the label.
 int getMinimunHeight()
          Retrieves the minimum height of the label.
 IlvPoint getOffset()
          Retrieves the offset (in pixels) relatively to the anchor position.
 IlvRect getRectAnchor()
          Retrieves the anchor as a IlvRect if the label has been constructed with the IlvMapLabel(IlvRect, String)
 Paint getStrokePaint()
          Retrieves the Paint used to draw the outline of the characters of the text.
 IlvTransformer getTransformer()
          Retrieves a copy of the transformer applied on this label.
protected  void invalidate()
          Indicates that this label needs to be updated.
 boolean isAntialiasing()
          Returns true if the anti-aliasing mode of the label is on.
 boolean isFitToRect()
          Indicates whether the label will be scaled to fit the rectangular anchor or not
 boolean isUsingFractionalMetrics()
          Returns true if the fractional metrics mode of the label is on.
 boolean isVisible(IlvTransformer transformer)
          Checks the visibility of the label at transformer transformer.
 void setAlignment(int alignment)
          Sets the alignment of the label.
 void setAnchor(IlvPoint point)
          Sets the anchor point of the label.
 void setAntialiasing(boolean antialiasing)
          Changes the anti-aliasing mode of the label.
 void setAttachment(int attachment)
          Sets the label attachment.
 void setBackgroundPaint(Paint c)
          Sets the Paint used to fill the frame of the label.
 void setFillPaint(Paint c)
          Sets the Paint used to fill the characters of the text.
 void setFitToRect(boolean fit)
          Determines whether the label should be scaled to fit the rectangular anchor or not
 void setFont(Font font)
          Sets the font used to draw the label.
 void setFramePaint(Paint c)
          Sets the Paint used to draw the frame of the label.
 void setInnerMargin(float margin)
          Sets the spacing between the frame of the label and the text.
 void setInterline(float interline)
          Sets the spacing between two lines.
 void setLabel(String text)
          Changes the label.
 void setMaximumHeight(int max)
          Sets the maximum height of the label.
 void setMaximumLineHeight(int max)
          Sets the maximum height of a line of the label.
 void setMinimumHeight(int min)
          Sets the minimum height of the text.
 void setOffset(float dx, float dy)
          Sets the offset (in pixels) relatively to the anchor position.
 void setOffset(IlvPoint offset)
          Sets the offset (in pixels) relatively to the anchor position.
 void setRectAnchor(IlvRect rect)
          Sets the anchor of the label as an IlvRect.
 void setStrokePaint(Paint c)
          Sets the Paint used to draw the outline of the characters of the text.
 void setTransformer(IlvTransformer t)
          Sets the transformer.
 void setUsingFractionalMetrics(boolean fractionalMetrics)
          Changes the fraction metrics mode of the label.
 boolean supportMultiline()
          Returns true since this object supports multiline text.
 void write(IlvOutputStream stream)
          Writes this IlvMapLabel in an IlvOutputStream.
 boolean zoomable()
          IlvMapLabel is only zoomable if no offsets are set.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, contains, 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, setForeground, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvMapLabel

public IlvMapLabel(IlvPoint anchor,
                   String labels)
Creates an instance of the label specifying the anchor of the label as a point and the multiline (newline separated) text.

Parameters:
anchor - The anchor point.
labels - The text to be displayed.

IlvMapLabel

public IlvMapLabel(IlvRect anchor,
                   String labels)
Creates an instance of the label specifying the anchor of the label as a rectangle, the multiline text . The rectangle defines the position and the height of the label.

Parameters:
anchor - The rectangular anchor.
labels - The text to be displayed.

IlvMapLabel

public IlvMapLabel(IlvMapLabel source)
Creates an instance, copy of the source label.

Parameters:
source - The IlvMapLabel to be copied.

IlvMapLabel

public IlvMapLabel(IlvInputStream stream)
            throws IlvReadFileException
Reads an IlvMapLabel from an IlvInputStream

Throws:
IlvReadFileException
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes this IlvMapLabel in an IlvOutputStream.

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

boundingBox

public IlvRect boundingBox(IlvTransformer transformer)
Retrieves the bounding box of the label. The returned bounding box should not be modified.

Specified by:
boundingBox in class IlvGraphic
Parameters:
transformer - The transformer for which the bounding box is computed.
Returns:
The resulting bounding box.
See Also:
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

isVisible

public boolean isVisible(IlvTransformer transformer)
Checks the visibility of the label at transformer transformer. The setMinimumHeight(height) method allows to hide the label if its height becomes less than the minimum height value.


draw

public void draw(Graphics g,
                 IlvTransformer t)
Draws this object.

Specified by:
draw in class IlvGraphic
Parameters:
g - 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 the transformation on the label.

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

copy

public IlvGraphic copy()
Returns a copy of this label.

Specified by:
copy in class IlvGraphic
Returns:
A copy of this IlvGraphic instance.
See Also:
IlvGraphic

getTransformer

public IlvTransformer getTransformer()
Retrieves a copy of the transformer applied on this label.


setTransformer

public void setTransformer(IlvTransformer t)
Sets the transformer.


zoomable

public boolean zoomable()
IlvMapLabel is only zoomable if no offsets are set. Returns true if the label is zoomable.

Overrides:
zoomable in class IlvGraphic
See Also:
IlvGraphic, IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.boundingBox(IlvTransformer), IlvManager

setOffset

public void setOffset(float dx,
                      float dy)
Sets the offset (in pixels) relatively to the anchor position. Note that this method can change the bounding box of the object, and then must be called from an applyToObject method.


setOffset

public void setOffset(IlvPoint offset)
Sets the offset (in pixels) relatively to the anchor position. Note that this method can change the bounding box of the object, and then must be called from an applyToObject method.


getOffset

public IlvPoint getOffset()
Retrieves the offset (in pixels) relatively to the anchor position. The returned point should not be modified.


setBackgroundPaint

public void setBackgroundPaint(Paint c)
Sets the Paint used to fill the frame of the label.


getBackgroundPaint

public Paint getBackgroundPaint()
Retrieves the Paint used to fill the frame of the label.


setFillPaint

public void setFillPaint(Paint c)
Sets the Paint used to fill the characters of the text.


getFillPaint

public Paint getFillPaint()
Retrieves the Paint used to fill the characters of the text.


setStrokePaint

public void setStrokePaint(Paint c)
Sets the Paint used to draw the outline of the characters of the text.


getStrokePaint

public Paint getStrokePaint()
Retrieves the Paint used to draw the outline of the characters of the text.


setFramePaint

public void setFramePaint(Paint c)
Sets the Paint used to draw the frame of the label.


getFramePaint

public Paint getFramePaint()
Retrieves the Paint used to draw the frame of the label.


getAlignment

public int getAlignment()
Retrieves the alignment of the label.


setAlignment

public void setAlignment(int alignment)
Sets the alignment of the label. The alignment is only taken into account when the anchor is a rectangular anchor.
Valid values are :


getFont

public Font getFont()
Retrieves the font used to draw the label.

Specified by:
getFont in interface IlvFontInterface

setFont

public void setFont(Font font)
Sets the font used to draw the label.

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

getInterline

public float getInterline()
Retrieves the interline value.

Returns:
The interline.

setInterline

public void setInterline(float interline)
Sets the spacing between two lines.

Parameters:
interline - The interline.

getAttachment

public int getAttachment()
Retrieves the attachment of the label.

Returns:
The attachment.

setAttachment

public void setAttachment(int attachment)
Sets the label attachment. Valid values for attachment are :

Parameters:
attachment - The attachment.

getInnerMargin

public float getInnerMargin()
Returns the margin.

Returns:
The margin value.

setInnerMargin

public void setInnerMargin(float margin)
Sets the spacing between the frame of the label and the text.

Parameters:
margin - The new margin.

setLabel

public void setLabel(String text)
Changes the label. Each line is ended by a new-line character.

Specified by:
setLabel in interface IlvLabelInterface
Parameters:
text - The new string.

getLabel

public String getLabel()
Returns the label as a string. The returned string should not be modified.

Specified by:
getLabel in interface IlvLabelInterface
Returns:
The string of the label.

supportMultiline

public boolean supportMultiline()
Returns true since this object supports multiline text.

Specified by:
supportMultiline in interface IlvLabelInterface
Returns:
true

getLabelBBox

public IlvRect getLabelBBox(IlvTransformer transformer)
Returns the bounding area where the label is displayed. The area is the bounding box of the object.

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

setAntialiasing

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

Parameters:
antialiasing - The new antialiasing value.

isAntialiasing

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

Returns:
true if the anti-aliasing mode of the label is on, false otherwise.

setUsingFractionalMetrics

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

Parameters:
fractionalMetrics - The new fractionalMetrics value.

isUsingFractionalMetrics

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

Returns:
true is the label uses fractional metrics, false otherwise.

setMinimumHeight

public void setMinimumHeight(int min)
Sets the minimum height of the text. Below this limit, the label will not be visible.

Parameters:
min - The minimum height of the label.

getMinimunHeight

public int getMinimunHeight()
Retrieves the minimum height of the label.

Returns:
The minimum height of the label.

getMinimumHeight

public int getMinimumHeight()
Retrieves the minimum height of the label.

Returns:
The minimum height of the label.
Since:
JViews 7.5

setMaximumHeight

public void setMaximumHeight(int max)
Sets the maximum height of the label.

Parameters:
max - The maximum height of the label.

getMaximumHeight

public int getMaximumHeight()
Retrieves the maximum height of the label.

Returns:
The maximum height of the label.

setMaximumLineHeight

public void setMaximumLineHeight(int max)
Sets the maximum height of a line of the label.

Parameters:
max - The maximum height of a line.

getMaximumLineHeight

public int getMaximumLineHeight()
Retrieves the maximum line height of the label.

Returns:
The maximum height of line.

setAnchor

public void setAnchor(IlvPoint point)
Sets the anchor point of the label.

Parameters:
point - The new anchor point.

getAnchor

public IlvPoint getAnchor()
Retrieves the anchor point of the label.

Returns:
The anchor point.

setRectAnchor

public void setRectAnchor(IlvRect rect)
Sets the anchor of the label as an IlvRect. To be effective the label must have been constructed with the IlvMapLabel(IlvRect, String) constructor.

Parameters:
rect - The rectangular anchor.
Since:
JViews 7.5
See Also:
IlvMapLabel(IlvRect,String)

getRectAnchor

public IlvRect getRectAnchor()
Retrieves the anchor as a IlvRect if the label has been constructed with the IlvMapLabel(IlvRect, String)

Returns:
The anchor as an IlvRect or null is the label as been constructed with a IlvPoint anchor.
Since:
JViews 7.5

invalidate

protected void invalidate()
Indicates that this label needs to be updated.

Since:
JViews 7.5

isFitToRect

public boolean isFitToRect()
Indicates whether the label will be scaled to fit the rectangular anchor or not

Returns:
true if this label will fit to rect anchor and false otherwise.
Since:
JViews 7.5
See Also:
setFitToRect(boolean)

setFitToRect

public void setFitToRect(boolean fit)
Determines whether the label should be scaled to fit the rectangular anchor or not

Parameters:
fit - The fit to rect value.
Since:
JViews 7.5
See Also:
IlvMapLabel(IlvRect, String)


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