public abstract class GraphicElement extends AbstractElement
Each graphic element references a style, a graphic graph and has a label.
The element also defines the basic behaviour to reload the style when needed, defines abstract methods to set and get the position and bounds in spaces of the element, and to do appropriate actions when specific predefined attributes change (most of them starting with the prefix "ui.").
The graphic element has the ability to store attributes like any other graph element, however the attributes stored by the graphic element are restricted. There is a filter on the attribute adding methods that let pass only :
Modifier and Type | Class and Description |
---|---|
static interface |
GraphicElement.SwingElementRenderer
Interface for renderers registered in each style group.
|
AbstractElement.AttributeChangeEvent
Modifier and Type | Field and Description |
---|---|
protected static Pattern |
acceptedAttribute |
Object |
component
Associated GUI component.
|
boolean |
hidden
Do not show.
|
String |
label
The label or null if not specified.
|
protected GraphicGraph |
mygraph
Graph containing this element.
|
StyleGroup |
style
The node style.
|
attributes, attributesBeingRemoved, id
Constructor and Description |
---|
GraphicElement(String id,
GraphicGraph graph)
New element.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String attribute,
Object... values)
Add or replace the value of an attribute.
|
protected void |
attributeChanged(AbstractElement.AttributeChangeEvent event,
String attribute,
Object oldValue,
Object newValue)
Handle the "ui.class", "label", "ui.style", etc. attributes.
|
Object |
getComponent()
The associated GUI component.
|
String |
getLabel()
Label or null if not set.
|
abstract Selector.Type |
getSelectorType()
Type of selector for the graphic element (Node, Edge, Sprite ?).
|
StyleGroup |
getStyle()
Style group.
|
abstract double |
getX()
Abscissa of the element, always in GU (graph units).
|
abstract double |
getY()
Ordinate of the element, always in GU (graph units).
|
abstract double |
getZ()
Depth of the element, always in GU (graph units).
|
abstract void |
move(double x,
double y,
double z)
Try to force the element to move at the give location in graph units
(GU).
|
GraphicGraph |
myGraph() |
protected boolean |
nullAttributesAreErrors() |
protected abstract void |
removed()
The graphic element was removed from the graphic graph, clean up.
|
void |
setComponent(Object component)
Set the GUI component of this element.
|
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 GraphicGraph mygraph
public StyleGroup style
public boolean hidden
protected static Pattern acceptedAttribute
public GraphicElement(String id, GraphicGraph graph)
public GraphicGraph myGraph()
protected boolean nullAttributesAreErrors()
nullAttributesAreErrors
in class AbstractElement
public abstract Selector.Type getSelectorType()
public StyleGroup getStyle()
public abstract double getX()
public abstract double getY()
public abstract double getZ()
public Object getComponent()
protected abstract void removed()
public abstract void move(double x, double y, double z)
x
- The new X.y
- The new Y.z
- the new Z.public void setComponent(Object component)
component
- The component.protected void attributeChanged(AbstractElement.AttributeChangeEvent event, String attribute, Object oldValue, Object newValue)
attributeChanged
in class AbstractElement
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.public void addAttribute(String attribute, Object... values)
Element
addAttribute
in interface Element
addAttribute
in class AbstractElement
attribute
- The attribute name.values
- The attribute value or set of values.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses