public class IlvGeneralNode extends IlvGraphicSet implements IlvLabelInterface, ilog.views.sdm.internal.labellayout.IlvSDMLabeledNode
IlvGeneralNode
is a general-purpose
graphic object with a geometric shape (square, circle,
diamond, or similar), a label, and an icon, each being optional.
The label can be zoomable and can become invisible below a given
zoom level to avoid overloaded displays. Labels can contain
several lines (separated by '\n'
characters). The
general node supports automatic word wrapping or truncation of
the label.
The shape and the icon can be defined as SVG files.
Note: In JViews 6.0, performance and graphic
improvements have been made to this class that may introduce slight
changes in bounding boxes. See setUseIlvText(boolean)
for more details.
IlvGraphicSet.DelegateObjectInteractor
Modifier and Type | Field and Description |
---|---|
static int |
CUSTOM
The shape type for a custom shape.
|
static int |
DIAMOND
The shape type for a diamond.
|
static int |
ELLIPSE
The shape type for an ellipse.
|
static int |
EXPAND_ONLY
The auto-resize policy that allows the general node
shape to be expanded to fit the labels or icon but
not to be shrunk.
|
static int |
EXPAND_OR_SHRINK
The auto-resize policy that allows the general node
shape to be expanded or shrunk to fit the labels or icon.
|
static boolean |
High_Quality_Icons
Forces
setHighQualityRendering(true) on subicons. |
protected IlvGraphic |
icon
The icon of the general node.
|
static int |
LABEL_UNCHANGED
The label mode that leaves the label unchanged.
|
protected IlvGraphic[] |
labels
The labels of the general node.
|
protected boolean |
layoutNeeded
This
boolean indicates that a property
of the general node has been modified and that
the layout must be recomputed. |
static int |
LINEAR_GRADIENT
The paint style that fills the shape with a linear gradient.
|
static int |
MARKER
The shape type for a marker (a cross).
|
static int |
NO_AUTO_RESIZE
The auto-resize policy that does not allow the
general node shape to be resized at all.
|
static int |
NO_FILL
The paint style is transparent.
|
static int |
RADIAL_GRADIENT
The paint style that fills the shape with a radial gradient.
|
protected boolean |
realizeNeeded
This
boolean indicates that a property
of the general node has been modified and that
the graphic objects must be reconstructed. |
static int |
RECTANGLE
The shape type for a rectangle.
|
static int |
ROUND_RECTANGLE
The shape type for a rectangle with rounded corners.
|
protected IlvGraphic |
shape
The basic shape of the general node.
|
static int |
SHRINK_ONLY
The auto-resize policy that allows the general node
shape to be shrunk to fit the labels or icon but
not to be expanded.
|
static int |
SOLID_COLOR
The paint style that fills a shape with a solid color.
|
static int |
TEXTURE
The paint style that fills the shape with a texture.
|
static int |
TRIANGLE_DOWN
The shape type for a triangle pointing down.
|
static int |
TRIANGLE_LEFT
The shape type for a triangle pointing left.
|
static int |
TRIANGLE_RIGHT
The shape type for a triangle pointing right.
|
static int |
TRIANGLE_UP
The shape type for a triangle pointing up.
|
static int |
TRUNCATE
The label mode that truncates the label
so that it fits in the width of the shape.
|
static int |
WORD_WRAP
The label mode that spreads the label on multiple lines
so that it fits in the width of the shape.
|
list
Constructor and Description |
---|
IlvGeneralNode()
Creates a new general node with a 20-pixel square shape,
located in (0,0), and with a default label.
|
IlvGeneralNode(IlvGeneralNode source)
Creates a new general node that is a copy of an
existing one.
|
IlvGeneralNode(IlvInputStream stream)
Reads a general node from an input stream.
|
IlvGeneralNode(IlvPoint p,
double size,
String label)
Creates a new general node with a square shape of a
given size.
|
IlvGeneralNode(IlvPoint p,
String label)
Creates a new general node with a 20-pixel square shape.
|
IlvGeneralNode(IlvRect rect)
Creates a new general node with a rectangular shape.
|
IlvGeneralNode(IlvRect rect,
int shapeType,
String label)
Creates a new general node with a predefined shape.
|
IlvGeneralNode(IlvRect rect,
String label)
Creates a new general node with a rectangular shape.
|
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 this general node.
|
IlvGraphic |
copy()
Returns a copy of this general node.
|
protected void |
doLayout()
Computes the relative positions and sizes of the
different parts of the general node: shape, labels,
icon, and decorations.
|
protected void |
drawCore(Graphics2D dst,
IlvTransformer t)
Draws the object.
|
int |
getAnchor()
Returns the anchor position of the node,
that is, the point that is
left unchanged by the
setShapeWidth(double) ,
setShapeHeight(double) , and setShapeAspectRatio(double)
methods. |
IlvRect |
getBaseBoundingBox(IlvTransformer t)
Returns the smallest rectangle that encloses
the shape and the icon of this general node.
|
IlvGraphic[] |
getDecorations()
Returns the decoration objects.
|
IlvGraphic |
getDecorations(int index)
Returns the decoration object at the specified index.
|
float |
getFillAngle()
Returns the angle (in degrees) of the gradient used to
fill the shape.
|
Color |
getFillColor1()
Returns the first color used to compute the
gradient that fills the shape of the general node.
|
Color |
getFillColor2()
Returns the second color used to compute the
gradient that fills the shape of the general node.
|
float |
getFillEnd()
Returns the position where the gradient ends,
that is, where the color is the first
color set by
setFillColor2(java.awt.Color) . |
float |
getFillStart()
Returns the position where the gradient starts,
that is, where the color is the first
color set by
setFillColor1(java.awt.Color) . |
int |
getFillStyle()
Returns the style used to fill the shape.
|
String |
getFillTexture()
Returns the texture used to fill
the shape of the general node.
|
double |
getHorizontalAutoResizeMargin()
Returns the margin that is left on both sides
of the shape when it is auto-resized horizontally.
|
int |
getHorizontalAutoResizeMode()
Returns the horizontal auto-resize mode.
|
String |
getIcon()
Returns the icon of the general node.
|
int |
getIconPosition()
Returns the position of the icon with respect
to the label.
|
String |
getLabel()
Returns the label of the general node.
|
int |
getLabelAlignment()
Returns the alignment used for multiline labels.
|
IlvRect |
getLabelBBox(IlvTransformer t)
Implementation of
IlvLabelInterface . |
Color |
getLabelColor()
Returns the color of the label of the general node.
|
Font |
getLabelFont()
Returns the font of the label of the general node.
|
double |
getLabelMargin()
Returns the margin that will be kept between the
labels and the edges of the shape when performing
word wrapping or label truncation.
|
int |
getLabelMode()
Returns the label mode of this general node.
|
int |
getLabelPosition()
Returns the position of the label with respect
to the shape.
|
double |
getLabelScaleFactor()
Returns the scale factor of the label(s) of the general node.
|
double |
getLabelSpacing()
Returns the spacing between the shape and the label.
|
double |
getLineSpacing()
Returns the spacing between the lines of multiline labels.
|
double |
getMaxLabelZoom()
Returns the zoom level above which the label becomes invisible.
|
double |
getMinLabelZoom()
Returns the zoom level below which the label becomes invisible.
|
IlvGraphic |
getShape()
Returns the shape of this general node.
|
double |
getShapeAspectRatio()
Returns the aspect ratio of the shape.
|
protected IlvRect |
getShapeBBox()
Returns the bounding box of the general node's shape.
|
double |
getShapeHeight()
Returns the height of the shape.
|
int |
getShapeType()
Returns the type of shape for this general node.
|
double |
getShapeWidth()
Returns the width of the shape.
|
Color |
getStrokeColor()
Returns the color of the stroke of the node shape.
|
float[] |
getStrokeDashArray()
Returns the dash array of the shape stroke.
|
float |
getStrokeDashPhase()
Returns the dash phase of the shape stroke.
|
int |
getStrokeEndCaps()
Returns the end cap style of the shape stroke.
|
int |
getStrokeLineJoins()
Returns the line join style of the shape stroke.
|
float |
getStrokeMiterLimit()
Returns the miter limit of the shape stroke.
|
double |
getStrokeWidth()
Returns the width of the shape stroke.
|
double |
getVerticalAutoResizeMargin()
Returns the margin that is left on both sides
of the shape when it is auto-resized vertically.
|
int |
getVerticalAutoResizeMode()
Returns the vertical auto-resize mode.
|
String |
getWordWrapChars()
Returns the characters which allow wordwrapping when the label
is implemented using
IlvZoomableLabel objects. |
double |
getWordWrapMargin()
Deprecated.
Since JViews 5.5, this method is renamed
into
getLabelMargin() . |
boolean |
getWordWrapMode()
Deprecated.
Since JViews 5.5, this method is replaced by
getLabelMode() . |
protected void |
invalidateBBoxCache()
Invalidates the bounding box cache.
|
boolean |
isKeepingAspectRatio()
Sets the flag that specifies whether the width/height
ratio is preserved by the methods
setShapeWidth(double)
and setShapeHeight(double) . |
boolean |
isLabelAntialiasing()
Returns the anti-aliasing mode of the label of the general node.
|
boolean |
isLabelZoomable()
Returns the flag specifying whether the label
should be zoomable.
|
String |
isTruncatedLabelSuffix()
Returns the string that is appended to the label when it is
truncated to fit in the shape's width.
|
boolean |
isUseIlvText()
Returns the flag specifying whether the label
of this general node is an
IlvText
or an IlvZoomableLabel . |
static boolean |
isUseIlvTextDefault()
Returns the default value of the "use IlvText" flag.
|
void |
moveLabel(double x,
double y,
IlvTransformer t)
Moves the label(s) of the node to the specified position.
|
void |
moveResize(IlvRect rect)
Moves and resizes the general node's shape to the specified
rectangle.
|
protected void |
realize()
This method creates all the components of
the general node.
|
void |
setAnchor(int position)
Sets the anchor position of the node,
that is, the point that will be
left unchanged by the
setShapeWidth(double) ,
setShapeHeight(double) , and setShapeAspectRatio(double)
methods. |
void |
setBackground(Color c)
Sets the background color of the node shape.
|
void |
setDecorations(IlvGraphic[] decorations)
Sets the decoration objects.
|
void |
setDecorations(int index,
IlvGraphic deco)
Sets the decoration object at the specified index.
|
void |
setFillAngle(float angle)
Sets the angle (in degrees) of the gradient used to
fill the shape.
|
void |
setFillColor1(Color color)
Sets the first color used to compute the
gradient that fills the shape of the general node.
|
void |
setFillColor2(Color color)
Sets the second color used to compute the
gradient that fills the shape of the general node.
|
void |
setFillEnd(float end)
Sets the position where the gradient ends,
that is, where the color is the first
color set by
setFillColor2(java.awt.Color) . |
void |
setFillStart(float start)
Sets the position where the gradient starts,
that is, where the color is the first
color set by
setFillColor1(java.awt.Color) . |
void |
setFillStyle(int fillStyle)
Sets the style used to fill the shape.
|
void |
setFillTexture(String texture)
Sets the texture used to fill
the shape of the general node.
|
void |
setForeground(Color c)
Sets the foreground color of the node shape.
|
void |
setHorizontalAutoResizeMargin(double margin)
Sets the margin that is left on both sides
of the shape when it is auto-resized horizontally.
|
void |
setHorizontalAutoResizeMode(int mode)
Sets the horizontal auto-resize mode.
|
void |
setIcon(String icon)
Sets the URL of the general node's icon.
|
void |
setIconPosition(int position)
Sets the position of the icon with respect
to the label.
|
void |
setKeepingAspectRatio(boolean keeping)
Sets the flag that specifies whether the width/height
ratio is preserved by the methods
setShapeWidth(double)
and setShapeHeight(double) . |
void |
setLabel(String label)
Sets the label of the general node.
|
void |
setLabelAlignment(int alignment)
Sets the alignment of multiline labels.
|
void |
setLabelAntialiasing(boolean labelAntialiasing)
Sets the anti-aliasing mode of the label of the general node.
|
void |
setLabelColor(Color labelColor)
Sets the color of the label of the general node.
|
void |
setLabelFont(Font labelFont)
Sets the font of the label of the general node.
|
void |
setLabelMargin(double margin)
Sets the margin that will be kept between the
labels and the edges of the shape when performing
word wrapping or label truncation.
|
void |
setLabelMode(int mode)
Sets the label mode of this general node.
|
void |
setLabelPosition(int position)
Sets the position of the label with respect
to the shape.
|
void |
setLabelScaleFactor(double labelScaleFactor)
Sets the scale factor of the label of the general node.
|
void |
setLabelSpacing(double spacing)
Sets the spacing between the shape and the label.
|
void |
setLabelZoomable(boolean zoomable)
Specifies whether the label should be zoomable.
|
void |
setLineSpacing(double spacing)
Sets the spacing between the lines of multiline labels.
|
void |
setMaxLabelZoom(double zoom)
Sets the zoom level above which the label becomes invisible.
|
void |
setMinLabelZoom(double zoom)
Sets the zoom level below which the label becomes invisible.
|
void |
setShape(IlvGraphic shape)
Sets the shape of this general node.
|
void |
setShapeAspectRatio(double aspectRatio)
Changes the aspect ratio of the shape.
|
void |
setShapeHeight(double height)
Changes the height of the shape.
|
void |
setShapeType(int shapeType)
Changes the type of shape for this general node.
|
void |
setShapeWidth(double width)
Changes the width of the shape.
|
void |
setStrokeColor(Color c)
Sets the color of the stroke (that is, the border) of the node shape.
|
void |
setStrokeDashArray(float[] dashArray)
Sets the dash array of the shape stroke.
|
void |
setStrokeDashPhase(float dashPhase)
Sets the dash phase of the shape stroke.
|
void |
setStrokeEndCaps(int endCaps)
Sets the end cap style of the shape stroke.
|
void |
setStrokeLineJoins(int lineJoins)
Sets the line join style of the shape stroke.
|
void |
setStrokeMiterLimit(float miterLimit)
Sets the miter limit of the shape stroke.
|
void |
setStrokeWidth(double width)
Sets the width of the shape stroke (that is, the border).
|
void |
setTruncatedLabelSuffix(String suffix)
Sets the string that is appended to the label when it is
truncated to fit in the shape's width.
|
void |
setUseIlvText(boolean useIlvText)
Specifies whether the label of the general node will be
an
IlvText or an
IlvZoomableLabel . |
static void |
setUseIlvTextDefault(boolean useIlvText)
Changes the default value of the "use IlvText" flag.
|
void |
setVerticalAutoResizeMargin(double margin)
Sets the margin that is left on both sides
of the shape when it is auto-resized vertically.
|
void |
setVerticalAutoResizeMode(int mode)
Sets the vertical auto-resize mode.
|
void |
setWordWrapChars(String chars)
Specifies which characters allow wordwrapping when the label
is implemented using
IlvZoomableLabel objects. |
void |
setWordWrapMargin(double margin)
Deprecated.
Since JViews 5.5, this method is renamed
into
setLabelMargin(double) . |
void |
setWordWrapMode(boolean wrap)
Deprecated.
Since JViews 5.5, this method is replaced by
setLabelMode(int) . |
boolean |
shouldElementBePartOfClip(IlvGraphic element)
Called for each element if @see #shouldElementBePartOfClip(IlvGraphic) returns true.
|
boolean |
shouldRestrictListOfElementsForClip()
Called by @see ilog.views.graphic.IlvGraphicSet#getIntersectionWithOutline(IlvPoint, IlvPoint, IlvTransformer)
to determine if the list of elements to be part of the clip should be restricted.
|
boolean |
supportMultiline()
Implementation of
IlvLabelInterface . |
void |
updateLabelingModel(IlvSDMEngine engine,
IlvAnnealingLabelLayout layout,
ilog.views.sdm.internal.labellayout.IlvSDMLabelingModel model,
Object node,
IlvGraphic graphic)
You should not call this method.
|
void |
write(IlvOutputStream stream)
Writes this general node to an output stream.
|
boolean |
zoomable()
The general node is zoomable if and only if
the label is zoomable, so this method returns
the value of
isLabelZoomable() . |
addGraphicBagHierarchyListener, addManagerViewsHierarchyListener, addObject, addObjectAt, applyToObject, applyToObjectImpl, baseTextDirectionChanged, componentOrientationChanged, contains, contains, draw, enableGraphicBagHierarchyEventForwarding, enableManagerViewsHierarchyEventForwarding, fireGraphicBagHierarchyEvent, fireManagerViewsHierarchyEvent, firstContains, getAlpha, getCardinal, getClip, getIndex, getIntersectionWithOutline, getObject, getObject, getObjectName, getObjects, getOriginalPopupMenu, getPopupMenu, getToolTipText, invalidateAndApplyToObject, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isLocaleSensitive, isPersistent, moveObject, needsGraphicBagHierarchyEvent, needsManagerViewsHierarchyEvent, reDrawObj, reDrawRegion, removeAll, removeGraphicBagHierarchyListener, removeManagerViewsHierarchyListener, removeObject, removeObjectAt, reshapeObject, setAlpha, setBaseTextDirection, setClip, setGraphicBag, setInsideApply, setObjectName
calcResolvedBaseTextDirection, getBaseTextDirection, getComponentOrientation, getResolvedBaseTextDirection, getULocale, invalidateBidiCache, setBaseTextDirection, setBaseTextDirectionDuringConstruction
addActionListener, addNamedPropertyListener, allViewsRemoved, blinkingStateOn, boundingBox, callDraw, getAndAssociateObjectInteractor, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipBaseTextDirection, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getZOrderIndex, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, isVisible, localeChanged, makeSelection, move, move, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getGraphicBag
public static final int CUSTOM
setShapeType(int)
,
Constant Field Valuespublic static final int RECTANGLE
setShapeType(int)
,
Constant Field Valuespublic static final int ROUND_RECTANGLE
setShapeType(int)
,
Constant Field Valuespublic static final int ELLIPSE
setShapeType(int)
,
Constant Field Valuespublic static final int DIAMOND
setShapeType(int)
,
Constant Field Valuespublic static final int TRIANGLE_UP
setShapeType(int)
,
Constant Field Valuespublic static final int TRIANGLE_DOWN
setShapeType(int)
,
Constant Field Valuespublic static final int TRIANGLE_LEFT
setShapeType(int)
,
Constant Field Valuespublic static final int TRIANGLE_RIGHT
setShapeType(int)
,
Constant Field Valuespublic static final int MARKER
setShapeType(int)
,
Constant Field Valuespublic static final int NO_AUTO_RESIZE
public static final int EXPAND_ONLY
public static final int SHRINK_ONLY
public static final int EXPAND_OR_SHRINK
public static final int NO_FILL
setFillStyle(int)
,
Constant Field Valuespublic static final int SOLID_COLOR
setFillStyle(int)
,
Constant Field Valuespublic static final int LINEAR_GRADIENT
setFillStyle(int)
,
Constant Field Valuespublic static final int RADIAL_GRADIENT
setFillStyle(int)
,
Constant Field Valuespublic static final int TEXTURE
setFillStyle(int)
,
Constant Field Valuespublic static final int LABEL_UNCHANGED
setLabelMode(int)
,
Constant Field Valuespublic static final int WORD_WRAP
setLabelMode(int)
,
Constant Field Valuespublic static final int TRUNCATE
setLabelMode(int)
,
Constant Field Valuespublic static boolean High_Quality_Icons
setHighQualityRendering(true)
on subicons.
The default value is true
.IlvIcon
protected IlvGraphic shape
protected IlvGraphic[] labels
protected IlvGraphic icon
protected boolean realizeNeeded
boolean
indicates that a property
of the general node has been modified and that
the graphic objects must be reconstructed.protected boolean layoutNeeded
boolean
indicates that a property
of the general node has been modified and that
the layout must be recomputed.public IlvGeneralNode(IlvRect rect, int shapeType, String label)
rect
- The rectangle defining the shape.shapeType
- The shape type, which must be one of:
label
- The label text. If this parameter is null
,
the node has no label.public IlvGeneralNode(IlvRect rect, String label)
rect
- The rectangle defining the shape.label
- The label text.public IlvGeneralNode(IlvRect rect)
rect
- The rectangle defining the shape.public IlvGeneralNode(IlvPoint p, double size, String label)
p
- The point defining the center of the square.size
- The square size.label
- The label text.public IlvGeneralNode(IlvPoint p, String label)
p
- The point defining the center of the square.label
- The label text.public IlvGeneralNode()
public IlvGeneralNode(IlvGeneralNode source)
source
- The general node whose contents will be
copied to the new general node.public IlvGeneralNode(IlvInputStream stream) throws IlvReadFileException
stream
- The input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
copy
in class IlvGraphicSet
IlvGraphic
public void write(IlvOutputStream stream) throws IOException
write
in interface IlvPersistentObject
write
in class IlvGraphicSet
stream
- The output stream.IOException
- if a write error occurred.public IlvRect boundingBox(IlvTransformer t)
boundingBox
in class IlvGraphicSet
t
- The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public boolean zoomable()
isLabelZoomable()
.
For details about the purpose of this method, see
IlvGraphic.zoomable()
.
zoomable
in class IlvGraphicSet
IlvGraphic
,
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvManager
protected void invalidateBBoxCache()
invalidateBBoxCache
in class IlvGraphicSet
public void moveResize(IlvRect rect)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
moveResize
in class IlvGraphic
rect
- The new bounding box of the general node's shape.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void applyTransform(IlvTransformer t)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
applyTransform
in class IlvGraphicSet
t
- The transformer to be applied.IlvGraphic
protected void drawCore(Graphics2D dst, IlvTransformer t)
IlvGraphicSet.draw(java.awt.Graphics, ilog.views.IlvTransformer)
after processing the
alpha transparency. It can be overridden in subclasses.drawCore
in class IlvGraphicSet
dst
- The destination Graphics
.t
- The transformation used to draw the object.IlvGraphicSet.setAlpha(float)
protected void realize()
The realize
method first removes all
the objects from the graphic set, and re-creates
them according to the current properties of the
general node. You need to override this method
is you want to add new components to the general
node.
protected void doLayout()
public void setForeground(Color c)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
setForeground
in class IlvGraphic
c
- The new foreground color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setBackground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public void setBackground(Color c)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
setBackground
in class IlvGraphic
c
- The new background color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setForeground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public void setStrokeColor(Color c)
IlvBlinkingColor
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
c
- The new stroke color.public Color getStrokeColor()
public void setStrokeWidth(double width)
-1
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
width
- The new stroke width.public double getStrokeWidth()
public void setStrokeEndCaps(int endCaps)
The end cap style controls how the ends of the segments
of the stroke will look when the stroke is dashed.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
endCaps
- The new end cap style, which must be one of:
java.awt.BasicStroke.CAP_BUTT
java.awt.BasicStroke.CAP_ROUND
java.awt.BasicStroke.CAP_SQUARE
public int getStrokeEndCaps()
public void setStrokeLineJoins(int lineJoins)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
lineJoins
- The new line join style, which must be one of:
java.awt.BasicStroke.JOIN_BEVEL
java.awt.BasicStroke.JOIN_MITER
java.awt.BasicStroke.JOIN_ROUND
public int getStrokeLineJoins()
public void setStrokeMiterLimit(float miterLimit)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
miterLimit
- The new miter limit.public float getStrokeMiterLimit()
public void setStrokeDashArray(float[] dashArray)
4,8
will create a dashed border whose segments are 4 pixels
long, separated by empty spaces of 8 pixels.
The dash array can contain more than two values to create
longer dash patterns.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
dashArray
- An array of float
values that
define the lengths in pixels of the visible and transparent
segments. If this parameter is null
, the stroke
is continuous (not dashed).public float[] getStrokeDashArray()
public void setStrokeDashPhase(float dashPhase)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
dashPhase
- A float
value that
specifies the offset from the beginning of the
stroke where the dash array pattern will start.public float getStrokeDashPhase()
public void setFillStyle(int fillStyle)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
fillStyle
- The fill style, which must be one of
NO_FILL
,
SOLID_COLOR
,
LINEAR_GRADIENT
,
RADIAL_GRADIENT
, or
TEXTURE
.public int getFillStyle()
NO_FILL
,
SOLID_COLOR
,
LINEAR_GRADIENT
,
RADIAL_GRADIENT
, or
TEXTURE
.public void setFillColor1(Color color)
IlvBlinkingColor
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
color
- The first color of the gradient.public Color getFillColor1()
public void setFillColor2(Color color)
IlvBlinkingColor
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
color
- The second color of the gradient.public Color getFillColor2()
public void setFillTexture(String texture)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
texture
- The URL of the image used as a texture.public String getFillTexture()
public void setFillStart(float start)
setFillColor1(java.awt.Color)
.
The default value is 0
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
start
- A number between 0
and 1
.public float getFillStart()
setFillColor1(java.awt.Color)
.
The default value is 0
.
0
and 1
.public void setFillEnd(float end)
setFillColor2(java.awt.Color)
.
The default value is 1
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
end
- A number between 0
and 1
.public float getFillEnd()
setFillColor2(java.awt.Color)
.
The default value is 1
.
0
and 1
.public void setFillAngle(float angle)
For a linear gradient, an angle of 0
means that
the gradient goes from left to right (that is, the first color is
on the left, and the second color on the right); an angle of
45
means that the gradient goes from the bottom
to the top, and so on.
For a radial gradient, the angle specifies the position of the
center of the gradient relative to the center of the shape. The
exact position of the center is also defined by the method
setFillStart(float)
.
Any angle between 0
and 360
can be used.
The default value is 0
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
angle
- An angle between 0
and 360
.public float getFillAngle()
The default value is 0
.
0
and 360
.setFillAngle(float)
public void setLabel(String label)
'\n'
characters in the label.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
setLabel
in interface IlvLabelInterface
label
- The new label.public String getLabel()
getLabel
in interface IlvLabelInterface
public void setLabelColor(Color labelColor)
IlvBlinkingColor
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
labelColor
- The new label color.public Color getLabelColor()
public void setLabelFont(Font labelFont)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
labelFont
- The new label font.public Font getLabelFont()
public void setLabelAntialiasing(boolean labelAntialiasing)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
labelAntialiasing
- The new label anti-aliasing mode.public boolean isLabelAntialiasing()
public void setLabelScaleFactor(double labelScaleFactor)
This property lets you adjust the size of the node label independently of the size of the shape.
Setting this property forces the label to be zoomable.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
labelScaleFactor
- The new label scale factor.setLabelZoomable(boolean)
public double getLabelScaleFactor()
public void setLabelPosition(int position)
position
- The new label position, which is
one of the static fields of the IlvDirection
interface.public int getLabelPosition()
IlvDirection
interface.public void setIconPosition(int position)
IlvDirection.Center
,
that is, if the label is inside the shape. If
the label is outside the shape, the icon is always
at the center of the shape.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
position
- The new label position, which is
one of the static fields of the IlvDirection
interface.public int getIconPosition()
IlvDirection
interface.setIconPosition(int)
public void setLabelAlignment(int alignment)
alignment
- The new label alignment, which can be
one of IlvDirection.Left
,
IlvDirection.Center
, or
IlvDirection.Right
.public int getLabelAlignment()
IlvDirection.Left
,
IlvDirection.Center
, or
IlvDirection.Right
.public IlvRect getLabelBBox(IlvTransformer t)
IlvLabelInterface
.getLabelBBox
in interface IlvLabelInterface
t
- The transformer.public boolean supportMultiline()
IlvLabelInterface
.supportMultiline
in interface IlvLabelInterface
public void setIcon(String icon)
Here are examples of how to specify the icon in the SDM style sheet:
node.aTag { icon : "url(icons/anIcon.jpg)"; } node.anotherTag { shape : "url(svg/anSVGDrawing.svg)"; } node.yetAnotherTag { shape : "url(prototypes/icons.ivl#aPrototype)"; }Note that this may change the bounding rectangle of the node. For this reason, if the node is contained inside a manager, you should modify the node using the
applyToObject
method of the
manager.icon
- The new icon location.public String getIcon()
public void setShapeType(int shapeType)
shapeType
- The new shape type, which must be one of:
RECTANGLE
,
ROUND_RECTANGLE
,
ELLIPSE
,
DIAMOND
,
TRIANGLE_UP
,
TRIANGLE_DOWN
,
TRIANGLE_LEFT
,
TRIANGLE_RIGHT
, or
MARKER
applyToObject
method of the
manager.public int getShapeType()
public void setShape(IlvGraphic shape)
CUSTOM
.
In the SDM style sheet, you can define the shape through
an "@#"
construct:
node.aTag { shape : "@#aShape"; } Subobject#aShape { class : "ilog.views.sdm.graphic.IlvGraphicFactories$Ellipse"; IlvRect : "0,0,100,50"; }or you can use an SVG file:
node.anotherTag { shape : "url(svg/anSVGDrawing.svg)"; }You can also use a Rogue Wave JViews prototype:
node.yetAnotherTag { shape : "url(prototypes/shapes.ivl#aPrototype)"; }Note that this may change the bounding rectangle of the node. For this reason, if the node is contained inside a manager, you should modify the node using the
applyToObject
method of the
manager.shape
- The shape to set.public IlvGraphic getShape()
public void setLabelSpacing(double spacing)
spacing
- The new spacing, in pixels.public double getLabelSpacing()
public void setLineSpacing(double spacing)
spacing
- The new spacing, in pixels.public double getLineSpacing()
public void setMinLabelZoom(double zoom)
zoom
- The minimum zoom level.public double getMinLabelZoom()
public void setMaxLabelZoom(double zoom)
zoom
- The maximum zoom level.public double getMaxLabelZoom()
public void setLabelZoomable(boolean zoomable)
zoomable()
method, so it may not be called
after the general node has been added to a manager.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
zoomable
- If true
, the label
of the node is an instance of IlvZoomableLabel
.
Otherwise it is an instance of IlvLabel
.public boolean isLabelZoomable()
public void setUseIlvText(boolean useIlvText)
IlvText
or an
IlvZoomableLabel
.
IlvText
is a new text object, available
since JViews 6.0, that provides better performances and more accurate
alignment and bounding box calculations.
Visually, the main difference from an
IlvZoomableLabel
is that, for a given font, the height of the label (and the spacing if
there are several lines) is the same regardless of the
actual string displayed. For example, the string "aaa"
will have the same height as "XXX"
or "ggg"
,
whereas with an IlvZoomableLabel
"aaa"
was
smaller than "XXX"
. As a result, baselines of
labels are always at the same relative positions with an
IlvText
, which looks better, but the drawback is that the
bounding box is slightly bigger.
By default, because of the significant performance and graphic improvements
that it brings, and despite the small bounding box changes that it
may cause, this property is set to true
and the label is an
IlvText
.
If the bounding box changes are a problem for your application, you can easily switch this new feature off in one of three ways:
ILVGENERALNODE_USE_ILVTEXT
to false
on the command line of the Java virtual machine.setUseIlvTextDefault(false)
at application startup.useIlvText
property to false
for all IlvGeneralNode
objects.
Note that if setLabelZoomable(false)
was called, the label will be an IlvLabel
regardless of this property.
If an IlvText
is used, wordwrapping is performed
according to the current Locale's rules, and the characters specified by
setWordWrapChars(java.lang.String)
are ignored.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
useIlvText
- If true
, the label of this general
node will be an IlvText
, otherwise it
will be an IlvZoomableLabel
.public boolean isUseIlvText()
IlvText
or an IlvZoomableLabel
.setUseIlvText(boolean)
public static void setUseIlvTextDefault(boolean useIlvText)
This static method can be used to change an application quickly so that all general nodes use (or do not use) IlvText objects.
The default value can also be changed by setting the system property
ILVGENERALNODE_USE_ILVTEXT
to true
or
false
.
useIlvText
- If true
, all IlvGeneralNode
objects will use an IlvText
by default,
otherwise all IlvGeneralNode
objects will use an IlvZoomableLabel
by default.setUseIlvText(boolean)
public static boolean isUseIlvTextDefault()
setUseIlvTextDefault(boolean)
public void setShapeWidth(double width)
isKeepingAspectRatio()
returns true
, the height of the
shape is also modified to keep the current aspect ratio.
The center of the shape is always left unchanged.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
width
- The new width.public double getShapeWidth()
public void setShapeHeight(double height)
isKeepingAspectRatio()
returns true
, the width of the
shape is also modified to keep the current aspect ratio.
The center of the shape is always left unchanged.
Note that calling this method
sets the "keep aspect ratio" flag to false
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
height
- The new height.setKeepingAspectRatio(boolean)
public double getShapeHeight()
public void setKeepingAspectRatio(boolean keeping)
setShapeWidth(double)
and setShapeHeight(double)
. If the flag is true
,
the dimensions of the shape are controlled by calling
either setShapeWidth(double)
or setShapeHeight(double)
, and by calling
setShapeAspectRatio(double)
. If the flag is false
,
the dimensions of the shape are controlled by calling
setShapeWidth(double)
and setShapeHeight(double)
.
Note that calling setShapeHeight(double)
automatically
sets the "keep aspect ratio" flag to false
,
and that calling setShapeAspectRatio(double)
automatically
sets the flag to true
.
keeping
- If true
, the methods
setShapeWidth(double)
and setShapeHeight(double)
will preserve
the width/height ratio of the node shape. Otherwise,
the width and the height can be set independently.public boolean isKeepingAspectRatio()
setShapeWidth(double)
and setShapeHeight(double)
.setKeepingAspectRatio(boolean)
public void setShapeAspectRatio(double aspectRatio)
Note that calling this method
sets the "keep aspect ratio" flag to true
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
aspectRatio
- The new aspect ratio.setKeepingAspectRatio(boolean)
public double getShapeAspectRatio()
public void setAnchor(int position)
setShapeWidth(double)
,
setShapeHeight(double)
, and setShapeAspectRatio(double)
methods.position
- One of
IlvDirection.Center
,
IlvDirection.Top
,
IlvDirection.Bottom
,
IlvDirection.Left
,
IlvDirection.Right
,
IlvDirection.TopLeft
,
IlvDirection.TopRight
,
IlvDirection.BottomLeft
, or
IlvDirection.BottomRight
.public int getAnchor()
setShapeWidth(double)
,
setShapeHeight(double)
, and setShapeAspectRatio(double)
methods.public void setLabelMode(int mode)
mode
parameter:
LABEL_UNCHANGED
: In this mode, the label is not modified.
The string set using setLabel(java.lang.String)
is displayed as is.WORD_WRAP
: In this mode, the label is automatically "cut"
into multiple lines (by inserting '\n'
characters) so that each line fits
in the width of the shape. Word wrapping will occur only
at space or punctuation characters between words of the label. More precisely,
the set of characters at which word wrapping may occur is defined by
the method setWordWrapChars(java.lang.String)
.TRUNCATE
: In this mode, the label is truncated so that
it fits, as a single line, in the width of the shape. The string "..."
is appended to indicate that the label has been truncated. This string can
be changed using the method setTruncatedLabelSuffix(java.lang.String)
.applyToObject
method of the
manager.mode
- One of the constants LABEL_UNCHANGED
, WORD_WRAP
,
or TRUNCATE
.public int getLabelMode()
setLabelMode(int)
@Deprecated public void setWordWrapMode(boolean wrap)
setLabelMode(int)
.'\n'
characters) so that each line fits
in the width of the shape. Word wrapping will only occur
at space characters between words of the label.wrap
- If true
, automatic wordwrapping
is enabled. Otherwise, the labels are left alone.@Deprecated public boolean getWordWrapMode()
getLabelMode()
.setWordWrapMode(boolean)
@Deprecated public void setWordWrapMargin(double margin)
setLabelMargin(double)
.margin
- The new margin.@Deprecated public double getWordWrapMargin()
getLabelMargin()
.public void setLabelMargin(double margin)
NO_AUTO_RESIZE
. If auto-resize is
enabled, the margin between the label and the shape is
defined by setHorizontalAutoResizeMargin(double)
instead.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
margin
- The new margin.public double getLabelMargin()
public void setWordWrapChars(String chars)
IlvZoomableLabel
objects.
If the label uses an IlvText
, wordwrapping
is done according to the current Locale's rules.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
chars
- A String containing the characters where
wordwrapping is allowed. By default, this is
" \t_-,;"
. Space (' '
) characters
are removed when word wrapping is performed, whereas
the other characters are preserved.setUseIlvText(boolean)
public String getWordWrapChars()
IlvZoomableLabel
objects.setUseIlvText(boolean)
public void setTruncatedLabelSuffix(String suffix)
"..."
.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
suffix
- The new suffix to use to indicate
that the label has been truncated.setLabelMode(int)
public String isTruncatedLabelSuffix()
setTruncatedLabelSuffix(java.lang.String)
public void setHorizontalAutoResizeMode(int mode)
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
mode
- One of NO_AUTO_RESIZE
,
EXPAND_ONLY
, SHRINK_ONLY
, or
EXPAND_OR_SHRINK
.public int getHorizontalAutoResizeMode()
public void setHorizontalAutoResizeMargin(double margin)
margin
- The new margin.public double getHorizontalAutoResizeMargin()
public void setVerticalAutoResizeMode(int mode)
mode
- One of NO_AUTO_RESIZE
,
EXPAND_ONLY
, SHRINK_ONLY
, or
EXPAND_OR_SHRINK
.public int getVerticalAutoResizeMode()
public void setVerticalAutoResizeMargin(double margin)
margin
- The new margin.public double getVerticalAutoResizeMargin()
public IlvRect getBaseBoundingBox(IlvTransformer t)
t
- The view transformer for which the bounding box
must be computed.public IlvGraphic getDecorations(int index)
index
- The position of the decoration object.getDecorations()
public void setDecorations(int index, IlvGraphic deco)
IlvGraphic
s are displayed from left to
right, following the index order. If a slot is null
,
it is safely ignored.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
index
- The position of the decoration object.deco
- The decoration object.public void setDecorations(IlvGraphic[] decorations)
IlvGraphic
s are displayed from left to
right, following the index order. If a slot is null
,
it is safely ignored.
Note that this may change the bounding rectangle of the node.
For this reason, if the node is contained inside a manager, you should
modify the node using the applyToObject
method of the
manager.
decorations
- An array containing the decoration objects.public IlvGraphic[] getDecorations()
setDecorations(ilog.views.IlvGraphic[])
public void moveLabel(double x, double y, IlvTransformer t)
x
- The new horizontal coordinate of the label, in manager coordinates.y
- The new vertical coordinate of the label, in manager coordinates.t
- The transformer.public boolean shouldRestrictListOfElementsForClip()
shouldRestrictListOfElementsForClip
in class IlvGraphicSet
public boolean shouldElementBePartOfClip(IlvGraphic element)
shouldElementBePartOfClip
in class IlvGraphicSet
element
- the Graphic Elementprotected IlvRect getShapeBBox()
public void updateLabelingModel(IlvSDMEngine engine, IlvAnnealingLabelLayout layout, ilog.views.sdm.internal.labellayout.IlvSDMLabelingModel model, Object node, IlvGraphic graphic)
updateLabelingModel
in interface ilog.views.sdm.internal.labellayout.IlvSDMLabeledNode
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.