Search this API

y.base
Class GraphEvent

java.lang.Object
  extended by java.util.EventObject
      extended by y.base.GraphEvent
All Implemented Interfaces:
java.io.Serializable

public class GraphEvent
extends java.util.EventObject

An event which indicates that a graph structure change occurred. This low-level event is generated by a graph when its structure changes. The event is passed to every GraphListener object that registered to receive such events using the graph's addGraphListener method.

The object that implements the GraphListener interface gets this GraphEvent when the event occurs.

Each GraphEvent has a type that signals what kind of change occurred in the graph and a data object that is the object (either node or edge) that was involved in the structural change of the graph, e.g., the node that has been created or the edge that has been reversed.

See Also:
Serialized Form
 

Field Summary
static byte EDGE_CREATION
          Type constant that identifies an event that gets fired immediately after an edge has been created.
static byte EDGE_REINSERTION
          Type constant that identifies an event that gets fired immediately after an edge has been reinserted into the graph.
static byte NODE_CREATION
          Type constant that identifies an event that gets fired immediately after a node has been created.
static byte NODE_REINSERTION
          Type constant that identifies an event that gets fired immediately after a node has been reinserted into the graph.
static byte POST_EDGE_CHANGE
          Type constant that identifies an event that gets fired immediately after the end points of an edge have been changed.
static byte POST_EDGE_REMOVAL
          Type constant that identifies an event that gets fired immediately after an edge has been removed from the graph.
static byte POST_EVENT
          Type constant that signals the end of a some logically coherent event sequence.
static byte POST_NODE_REMOVAL
          Type constant that identifies an event that gets fired immediately after a node has been removed from the graph.
static byte PRE_EDGE_CHANGE
          Type constant that identifies an event that gets fired immediately before the end points of an edge will be changed.
static byte PRE_EDGE_REMOVAL
          Type constant that identifies an event that gets fired immediately before an edge will be removed from the graph.
static byte PRE_EVENT
          Type constant that signals the start of a some logically coherent event sequence.
static byte PRE_NODE_REMOVAL
          Type constant that identifies an event that gets fired immediately before a node will be removed from the graph.
static byte SUBGRAPH_INSERTION
          Type constant that identifies an event that gets fired after a subgraph of a graph G has been moved to the emitting graph.
static byte SUBGRAPH_REMOVAL
          Type constant that identifies an event that gets fired after a subgraph of the emitting graph has been moved to a graph G.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
GraphEvent(Graph source, byte type, java.lang.Object data)
          Creates a new GraphEvent instance with given type and data.
 
Method Summary
 java.lang.Object getData()
          Returns the data object associated with this graph event.
 Graph getGraph()
          Returns the graph that is the emitter of this event.
 byte getType()
          Returns the type of this GraphEvent.
 java.lang.String toString()
          Returns a String representation of this GraphEvent object's type.
 
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

NODE_CREATION

public static final byte NODE_CREATION
Type constant that identifies an event that gets fired immediately after a node has been created. The data of the event is the newly created node.

See Also:
Constant Field Values

EDGE_CREATION

public static final byte EDGE_CREATION
Type constant that identifies an event that gets fired immediately after an edge has been created. The data of the event is the newly created edge.

See Also:
Constant Field Values

PRE_NODE_REMOVAL

public static final byte PRE_NODE_REMOVAL
Type constant that identifies an event that gets fired immediately before a node will be removed from the graph. The data of the event is the node to be removed.

See Also:
Constant Field Values

POST_NODE_REMOVAL

public static final byte POST_NODE_REMOVAL
Type constant that identifies an event that gets fired immediately after a node has been removed from the graph. The data of the event is the removed node.

See Also:
Constant Field Values

PRE_EDGE_REMOVAL

public static final byte PRE_EDGE_REMOVAL
Type constant that identifies an event that gets fired immediately before an edge will be removed from the graph. The data of the event is the edge to be removed.

See Also:
Constant Field Values

POST_EDGE_REMOVAL

public static final byte POST_EDGE_REMOVAL
Type constant that identifies an event that gets fired immediately after an edge has been removed from the graph. The data of the event is the removed edge.

See Also:
Constant Field Values

NODE_REINSERTION

public static final byte NODE_REINSERTION
Type constant that identifies an event that gets fired immediately after a node has been reinserted into the graph. The data of the event is the reinserted node.

See Also:
Constant Field Values

EDGE_REINSERTION

public static final byte EDGE_REINSERTION
Type constant that identifies an event that gets fired immediately after an edge has been reinserted into the graph. The data of the event is the reinserted edge.

See Also:
Constant Field Values

PRE_EDGE_CHANGE

public static final byte PRE_EDGE_CHANGE
Type constant that identifies an event that gets fired immediately before the end points of an edge will be changed. The data of the event is the edge to be redefined.

See Also:
Constant Field Values

POST_EDGE_CHANGE

public static final byte POST_EDGE_CHANGE
Type constant that identifies an event that gets fired immediately after the end points of an edge have been changed. The data of the event is the redefined edge.

See Also:
Constant Field Values

SUBGRAPH_INSERTION

public static final byte SUBGRAPH_INSERTION
Type constant that identifies an event that gets fired after a subgraph of a graph G has been moved to the emitting graph. The data of the event is a NodeList containing the nodes that induce the moved subgraph.

This event gets fired just after the SUBGRAPH_REMOVAL event got fired on the subgraph's original graph G. Note that at the time the event gets fired, the nodes from the node list are already part of the emitting graph.

See Also:
Constant Field Values

SUBGRAPH_REMOVAL

public static final byte SUBGRAPH_REMOVAL
Type constant that identifies an event that gets fired after a subgraph of the emitting graph has been moved to a graph G. The data of the event is a NodeList containing the nodes that induce the moved subgraph.

This event gets fired just before the SUBGRAPH_INSERTION event will be fired on the subgraph's new graph G. Note that at the time the event gets fired, the nodes from the node list are already part of graph G.

See Also:
Constant Field Values

PRE_EVENT

public static final byte PRE_EVENT
Type constant that signals the start of a some logically coherent event sequence. If specified, the data of this event is its ID.

See Also:
Constant Field Values

POST_EVENT

public static final byte POST_EVENT
Type constant that signals the end of a some logically coherent event sequence. If specified, the data of this event is its ID.

See Also:
Constant Field Values
Constructor Detail

GraphEvent

public GraphEvent(Graph source,
                  byte type,
                  java.lang.Object data)
Creates a new GraphEvent instance with given type and data.

Method Detail

getType

public byte getType()
Returns the type of this GraphEvent. It can be either of the type constants defined in this class.


getData

public java.lang.Object getData()
Returns the data object associated with this graph event. For a "Node"-associated event, it returns an object of type y.base.Node. For an "Edge"-associated event, it returns an object of type y.base.Edge. To check the type of event, see the method getType()


getGraph

public Graph getGraph()
Returns the graph that is the emitter of this event.


toString

public java.lang.String toString()
Returns a String representation of this GraphEvent object's type.

Overrides:
toString in class java.util.EventObject

© Copyright 2000-2018,
yWorks GmbH.
All rights reserved.