diva.graph
Class GraphEvent

java.lang.Object
  extended by java.util.EventObject
      extended by diva.graph.GraphEvent
All Implemented Interfaces:
java.io.Serializable

public class GraphEvent
extends java.util.EventObject

A graph event that is emitted when anything interesting happens inside a graph by way of a GraphModel. The source of a graph event is the object which caused the change to the graph model, such as a particular controller of the graph or a user algorithm.

Each graph event contains an ID and a previous value for all changes and deletions, the specifics of which are described on a case-by-case basis below.

Version:
$Id: GraphEvent.java 38798 2005-07-08 20:00:01Z cxh $
Author:
Michael Shilman, John Reekie
See Also:
GraphModel, Serialized Form
Accepted Rating:
Yellow

Field Summary
private  int _id
           
private  java.lang.Object _oldValue
           
private  java.lang.Object _target
          The value of the event.
static int EDGE_HEAD_CHANGED
          Edge head is changed; target is the edge, old value is the previous value of the edge head.
static int EDGE_TAIL_CHANGED
          Edge tail is changed; target is the edge, old value is the previous value of the edge tail.
static int NODE_ADDED
          A node is added to a graph; target is the node, old value is the previous parent of the graph.
static int NODE_REMOVED
          A node is deleted from a graph; target is the node, old value is the previous parent of the graph.
static int STRUCTURE_CHANGED
          Graph is modified significantly and should be fully "refreshed"; target is the graph, old value is null.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
GraphEvent(java.lang.Object source, int id, java.lang.Object target)
          Construct a GraphEvent with the given source and target and a null previous value.
GraphEvent(java.lang.Object source, int id, java.lang.Object target, java.lang.Object oldValue)
          Construct a GraphEvent with the given source, target, and previous value.
 
Method Summary
 int getID()
          Return the type id for this event.
 java.lang.Object getOldValue()
          Return the old value, which is event-specific.
 java.lang.Object getTarget()
          Return the target value, which is event-specific.
private  java.lang.String idToString()
          Return a string representation of the ID.
 java.lang.String toString()
          Return a string representation of this event.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EDGE_HEAD_CHANGED

public static final int EDGE_HEAD_CHANGED
Edge head is changed; target is the edge, old value is the previous value of the edge head.

See Also:
Constant Field Values

EDGE_TAIL_CHANGED

public static final int EDGE_TAIL_CHANGED
Edge tail is changed; target is the edge, old value is the previous value of the edge tail.

See Also:
Constant Field Values

NODE_ADDED

public static final int NODE_ADDED
A node is added to a graph; target is the node, old value is the previous parent of the graph.

See Also:
Constant Field Values

NODE_REMOVED

public static final int NODE_REMOVED
A node is deleted from a graph; target is the node, old value is the previous parent of the graph.

See Also:
Constant Field Values

STRUCTURE_CHANGED

public static final int STRUCTURE_CHANGED
Graph is modified significantly and should be fully "refreshed"; target is the graph, old value is null.

See Also:
Constant Field Values

_id

private int _id
See Also:
getID()

_target

private java.lang.Object _target
The value of the event.


_oldValue

private java.lang.Object _oldValue
See Also:
getOldValue()
Constructor Detail

GraphEvent

public GraphEvent(java.lang.Object source,
                  int id,
                  java.lang.Object target)
Construct a GraphEvent with the given source and target and a null previous value.


GraphEvent

public GraphEvent(java.lang.Object source,
                  int id,
                  java.lang.Object target,
                  java.lang.Object oldValue)
Construct a GraphEvent with the given source, target, and previous value.

Method Detail

getID

public int getID()
Return the type id for this event.


getTarget

public java.lang.Object getTarget()
Return the target value, which is event-specific.


getOldValue

public java.lang.Object getOldValue()
Return the old value, which is event-specific.


idToString

private java.lang.String idToString()
Return a string representation of the ID.


toString

public java.lang.String toString()
Return a string representation of this event.

Overrides:
toString in class java.util.EventObject