|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.IlvGraphic
ilog.views.graphic.IlvGraphicSet
ilog.views.sdm.graphic.IlvGeneralNode
public class IlvGeneralNode
The class 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class ilog.views.graphic.IlvGraphicSet |
|---|
IlvGraphicSet.DelegateObjectInteractor |
| Field Summary | |
|---|---|
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. |
| Fields inherited from class ilog.views.graphic.IlvGraphicSet |
|---|
list |
| Constructor Summary | |
|---|---|
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,
float 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. |
|
| Method Summary | |
|---|---|
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(float),
setShapeHeight(float), and setShapeAspectRatio(float)
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. |
float |
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. |
float |
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. |
float |
getLabelSpacing()
Returns the spacing between the shape and the label. |
float |
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. |
float |
getShapeAspectRatio()
Returns the aspect ratio of the shape. |
protected IlvRect |
getShapeBBox()
Returns the bounding box of the general node's shape. |
float |
getShapeHeight()
Returns the height of the shape. |
int |
getShapeType()
Returns the type of shape for this general node. |
float |
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. |
float |
getStrokeWidth()
Returns the width of the shape stroke. |
float |
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. |
float |
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(). |
boolean |
isKeepingAspectRatio()
Sets the flag that specifies whether the width/height ratio is preserved by the methods setShapeWidth(float)
and setShapeHeight(float). |
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(float x,
float 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(float),
setShapeHeight(float), and setShapeAspectRatio(float)
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(float 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(float)
and setShapeHeight(float). |
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(float 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(float spacing)
Sets the spacing between the shape and the label. |
void |
setLabelZoomable(boolean zoomable)
Specifies whether the label should be zoomable. |
void |
setLineSpacing(float 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(float aspectRatio)
Changes the aspect ratio of the shape. |
void |
setShapeHeight(float height)
Changes the height of the shape. |
void |
setShapeType(int shapeType)
Changes the type of shape for this general node. |
void |
setShapeWidth(float 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(float 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(float 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(float margin)
Deprecated. Since JViews 5.5, this method is renamed into setLabelMargin(float). |
void |
setWordWrapMode(boolean wrap)
Deprecated. Since JViews 5.5, this method is replaced by setLabelMode(int). |
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(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface ilog.views.IlvGraphicBag |
|---|
getGraphicBag |
| Field Detail |
|---|
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
setHorizontalAutoResizeMode(int),
setVerticalAutoResizeMode(int),
Constant Field Valuespublic static final int EXPAND_ONLY
setHorizontalAutoResizeMode(int),
setVerticalAutoResizeMode(int),
Constant Field Valuespublic static final int SHRINK_ONLY
setHorizontalAutoResizeMode(int),
setVerticalAutoResizeMode(int),
Constant Field Valuespublic static final int EXPAND_OR_SHRINK
setHorizontalAutoResizeMode(int),
setVerticalAutoResizeMode(int),
Constant Field Valuespublic 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.
IlvIconprotected 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.
| Constructor Detail |
|---|
public IlvGeneralNode(IlvRect rect,
int shapeType,
String label)
rect - The rectangle defining the shape.shapeType - The shape type, which must be one of:
RECTANGLE
ROUND_RECTANGLE
ELLIPSE
DIAMOND
TRIANGLE_UP
TRIANGLE_DOWN
TRIANGLE_LEFT
TRIANGLE_RIGHT
MARKER
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,
float 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.| Method Detail |
|---|
public IlvGraphic copy()
copy in class IlvGraphicSetIlvGraphic
public void write(IlvOutputStream stream)
throws IOException
write in interface IlvPersistentObjectwrite in class IlvGraphicSetstream - The output stream.
IOException - if a write error occurred.public IlvRect boundingBox(IlvTransformer t)
boundingBox in class IlvGraphicSett - The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic boolean zoomable()
isLabelZoomable().
zoomable in class IlvGraphicSetIlvGraphic,
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer),
IlvGraphic.boundingBox(IlvTransformer),
IlvManagerpublic 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 IlvGraphicrect - 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 IlvGraphicSett - 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 IlvGraphicSetdst - 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 IlvGraphicc - The new foreground color.IlvGraphic.draw(Graphics, IlvTransformer),
IlvGraphic.setBackground(Color),
IlvGraphic.setFillOn(boolean),
IlvGraphic.setStrokeOn(boolean),
IlvGraphicpublic 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 IlvGraphicc - The new