public class GraphicSprite extends GraphicElement
GraphicElement.SwingElementRenderer
AbstractElement.AttributeChangeEvent
Modifier and Type | Field and Description |
---|---|
protected GraphicEdge |
edge
The edge this sprite is attached to.
|
protected GraphicNode |
node
The node this sprite is attached to.
|
Values |
position
Sprite position.
|
acceptedAttribute, component, hidden, label, mygraph, style
attributes, attributesBeingRemoved, id
Constructor and Description |
---|
GraphicSprite(String id,
GraphicGraph graph)
New sprite.
|
Modifier and Type | Method and Description |
---|---|
void |
attachToEdge(GraphicEdge edge)
Attach this sprite to the given edge.
|
void |
attachToNode(GraphicNode node)
Attach this sprite to the given node.
|
protected void |
attributeChanged(AbstractElement.AttributeChangeEvent event,
String attribute,
Object oldValue,
Object newValue)
Handle the "ui.class", "label", "ui.style", etc. attributes.
|
protected double |
checkAngle(double angle) |
void |
detach()
Detach this sprite from the edge or node it was attached to.
|
GraphicElement |
getAttachment()
Return the graphic object this sprite is attached to or null if not
attached.
|
GraphicEdge |
getEdgeAttachment()
The edge this sprite is attached to or null if not attached to an edge.
|
GraphicNode |
getNodeAttachment()
The node this sprite is attached to or null if not attached to an edge.
|
Selector.Type |
getSelectorType()
Type of selector for the graphic element (Node, Edge, Sprite ?).
|
StyleConstants.Units |
getUnits() |
double |
getX()
Abscissa of the element, always in GU (graph units).
|
double |
getY()
Ordinate of the element, always in GU (graph units).
|
double |
getZ()
Depth of the element, always in GU (graph units).
|
boolean |
isAttached()
True if the sprite is attached to a node or edge.
|
boolean |
isAttachedToEdge()
True if the node is attached to an edge.
|
boolean |
isAttachedToNode()
True if the sprite is attached to a node.
|
void |
move(double x,
double y,
double z)
Try to force the element to move at the give location in graph units
(GU).
|
protected void |
removed()
The graphic element was removed from the graphic graph, clean up.
|
void |
setPosition(double value)
Reposition this sprite.
|
void |
setPosition(double x,
double y,
double z,
StyleConstants.Units units)
Reposition this sprite.
|
void |
setPosition(Values values) |
addAttribute, getComponent, getLabel, getStyle, myGraph, nullAttributesAreErrors, setComponent
addAttributes, changeAttribute, clearAttributes, clearAttributesWithNoEvent, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute, setIndex, toString
protected GraphicNode node
protected GraphicEdge edge
public GraphicSprite(String id, GraphicGraph graph)
id
- The sprite unique identifier.graph
- The graph containing this sprite.public GraphicNode getNodeAttachment()
public GraphicEdge getEdgeAttachment()
public GraphicElement getAttachment()
public boolean isAttached()
public boolean isAttachedToNode()
public boolean isAttachedToEdge()
public Selector.Type getSelectorType()
GraphicElement
getSelectorType
in class GraphicElement
public double getX()
GraphicElement
getX
in class GraphicElement
public double getY()
GraphicElement
getY
in class GraphicElement
public double getZ()
GraphicElement
getZ
in class GraphicElement
public StyleConstants.Units getUnits()
public void move(double x, double y, double z)
GraphicElement
move
in class GraphicElement
x
- The new X.y
- The new Y.z
- the new Z.public void attachToNode(GraphicNode node)
node
- A graphic node.public void attachToEdge(GraphicEdge edge)
edge
- A graphic edge.public void detach()
public void setPosition(double value)
value
- The coordinate.public void setPosition(double x, double y, double z, StyleConstants.Units units)
x
- First coordinate.y
- Second coordinate.z
- Third coordinate.units
- The units to use for lengths and radii, null means
"unchanged".public void setPosition(Values values)
protected double checkAngle(double angle)
protected void attributeChanged(AbstractElement.AttributeChangeEvent event, String attribute, Object oldValue, Object newValue)
GraphicElement
attributeChanged
in class GraphicElement
event
- The type of event among ADD, CHANGE and REMOVE.attribute
- The attribute name that changed.oldValue
- The old value of the attribute, null if the attribute was
added.newValue
- The new value of the attribute, null if the attribute is about
to be removed.protected void removed()
GraphicElement
removed
in class GraphicElement
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses