y.view
Class Graph2DEvent
java.lang.Object
java.util.EventObject
java.beans.PropertyChangeEvent
y.view.Graph2DEvent
- All Implemented Interfaces:
- java.io.Serializable
public class Graph2DEvent
- extends java.beans.PropertyChangeEvent
An event which indicates that a property associated with
a Graph2D or associated with one of its elements has changed.
Unlike GraphEvents, instances of Graph2DEvent do not reflect
structural changes of a graph. They are more related to
events of type PropertyChangeEvent. They carry a source, an oldValue
and a newValue. Additionally they carry a subject, which may be
different from the source. The source is always of type Graph2D.
The subject may be of any type, although most of the times the subject is
of type NodeRealizer, EdgeRealizer, NodeLabel or EdgeLabel, depending on the
attribute that has changed in the graph.
If, for example, the label text of a NodeRealizer changes to another value,
then the subject of
the emitted Graph2DEvent will be of type NodeRealizer, its property name
will be "labelText" and its old and new value will be added.
If, on the other hand, the text of one of the labels associated with an edge changes,
then the subject of the event emitted will be of type EdgeLabel and
the associated property name will be "text", since the text of an
edge label gets ultimately
changed by calling method "setText" on an instance of EdgeLabel.
Whenever a Graph2DEvent is emitted, then the associated new value will
be already set on the subject.
Property values of primitive type will be marshaled by the corresponding
primitive data type wrapper classes Boolean, Double, Integer, etc.
- See Also:
- Serialized Form
-
-
Fields inherited from class java.util.EventObject |
source |
Constructor Summary |
Graph2DEvent(Graph2D source,
java.lang.Object subject,
java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Creates a new instance of Graph2DEvent. |
Method Summary |
Graph2D |
getGraph2D()
Returns the source of this event. |
java.lang.String |
getPropertyName()
Returns the property name of the feature whose value has been changed. |
java.lang.Object |
getSubject()
Returns the subject of this event. |
Methods inherited from class java.beans.PropertyChangeEvent |
getNewValue, getOldValue, getPropagationId, setPropagationId |
Methods inherited from class java.util.EventObject |
getSource, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Graph2DEvent
public Graph2DEvent(Graph2D source,
java.lang.Object subject,
java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
- Creates a new instance of Graph2DEvent.
- Parameters:
source
- the Graph2D object that is the
source emitting this event.subject
- the subject of this event.propertyName
- the name of the changed propertyoldValue
- the former value of the named property.newValue
- the new value of the named property
getGraph2D
public Graph2D getGraph2D()
- Returns the source of this event.
getSubject
public java.lang.Object getSubject()
- Returns the subject of this event. The subject of an event is
the actual object whose property has been changed.
getPropertyName
public java.lang.String getPropertyName()
- Returns the property name of the feature whose value has been changed.
Property names follow the Java Beans naming conventions. If a feature
xyz has been changed by calling the setXyz() method on the subject,
then the property name will be "xyz", i.e. text changed by a method setText,
has the property name "text".
- Overrides:
getPropertyName
in class java.beans.PropertyChangeEvent