Packagecom.yworks.yfiles.base
Classpublic class GraphEvent
InheritanceGraphEvent Inheritance EventObject Inheritance YObject Inheritance Object

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 com.yworks.yfiles.base.GraphListener object that registered to receive such events using the graph's addGraphListener (com.yworks.yfiles.base.Graph.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

com.yworks.yfiles.base.GraphListener
addGraphListener


Public Properties
 PropertyDefined By
  data : Object
[read-only] Returns the data object associated with this graph event.
GraphEvent
  graph : Graph
[read-only] Returns the graph that is the emitter of this event.
GraphEvent
 Inheritedsource : Object
[read-only] Answers the event source.
EventObject
  type : int
[read-only] Returns the type of this GraphEvent.
GraphEvent
Protected Properties
 PropertyDefined By
 Inherited_source : Object
The event source.
EventObject
Public Methods
 MethodDefined By
  
GraphEvent(source:Graph, type:int, data:Object, init:Boolean = true)
Creates a new GraphEvent instance with given type and data.
GraphEvent
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
GraphEvent
 Inherited
hashCode():int
YObject
 Inherited
[static] Constructs a new instance of this class.
EventObject
  
newGraphEvent(source:Graph, type:int, data:Object):GraphEvent
[static] Creates a new GraphEvent instance with given type and data.
GraphEvent
  
toString():String
[override] Returns a String representation of this GraphEvent object's type.
GraphEvent
Protected Methods
 MethodDefined By
 Inherited
initEventObject(source:Object):void
Initializes this object.
EventObject
  
initGraphEvent(source:Graph, type:int, data:Object):void
Initializes this object.
GraphEvent
Public Constants
 ConstantDefined By
  EDGE_CREATION : int = 1
[static] Type constant that identifies an event that gets fired immediately after an edge has been created.
GraphEvent
  EDGE_REINSERTION : int = 7
[static] Type constant that identifies an event that gets fired immediately after an edge has been reinserted into the graph.
GraphEvent
  NODE_CREATION : int = 0
[static] Type constant that identifies an event that gets fired immediately after a node has been created.
GraphEvent
  NODE_REINSERTION : int = 6
[static] Type constant that identifies an event that gets fired immediately after a node has been reinserted into the graph.
GraphEvent
  POST_EDGE_CHANGE : int = 9
[static] Type constant that identifies an event that gets fired immediately after the end points of an edge have been changed.
GraphEvent
  POST_EDGE_REMOVAL : int = 5
[static] Type constant that identifies an event that gets fired immediately after an edge has been removed from the graph.
GraphEvent
  POST_EVENT : int = 13
[static] Type constant that signals the end of a some logically coherent event sequence.
GraphEvent
  POST_NODE_REMOVAL : int = 3
[static] Type constant that identifies an event that gets fired immediately after a node has been removed from the graph.
GraphEvent
  PRE_EDGE_CHANGE : int = 8
[static] Type constant that identifies an event that gets fired immediately before the end points of an edge will be changed.
GraphEvent
  PRE_EDGE_REMOVAL : int = 4
[static] Type constant that identifies an event that gets fired immediately before an edge will be removed from the graph.
GraphEvent
  PRE_EVENT : int = 12
[static] Type constant that signals the start of a some logically coherent event sequence.
GraphEvent
  PRE_NODE_REMOVAL : int = 2
[static] Type constant that identifies an event that gets fired immediately before a node will be removed from the graph.
GraphEvent
  SUBGRAPH_INSERTION : int = 10
[static] Type constant that identifies an event that gets fired after a subgraph of a graph G has been moved to the emitting graph.
GraphEvent
  SUBGRAPH_REMOVAL : int = 11
[static] Type constant that identifies an event that gets fired after a subgraph of the emitting graph has been moved to a graph G.
GraphEvent
Property Detail
dataproperty
data:Object  [read-only]

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()


Implementation
    public function get data():Object
graphproperty 
graph:Graph  [read-only]

Returns the graph that is the emitter of this event.


Implementation
    public function get graph():Graph
typeproperty 
type:int  [read-only]

Returns the type of this GraphEvent. It can be either of the type constants defined in this class.


Implementation
    public function get type():int
Constructor Detail
GraphEvent()Constructor
public function GraphEvent(source:Graph, type:int, data:Object, init:Boolean = true)

Creates a new GraphEvent instance with given type and data.

Parameters
source:Graph
 
type:int
 
data:Object
 
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
getClass()method
override public function getClass():Class

Returns
Class
initGraphEvent()method 
protected final function initGraphEvent(source:Graph, type:int, data:Object):void

Initializes this object. See the documentation of the corresponding factory method newGraphEvent() for details.

Parameters

source:Graph
 
type:int
 
data:Object

See also

newGraphEvent()method 
public static function newGraphEvent(source:Graph, type:int, data:Object):GraphEvent

Creates a new GraphEvent instance with given type and data.

Parameters

source:Graph
 
type:int
 
data:Object

Returns
GraphEvent
toString()method 
override public function toString():String

Returns a String representation of this GraphEvent object's type.

Returns
String
Constant Detail
EDGE_CREATIONConstant
public static const EDGE_CREATION:int = 1

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.

EDGE_REINSERTIONConstant 
public static const EDGE_REINSERTION:int = 7

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.

NODE_CREATIONConstant 
public static const NODE_CREATION:int = 0

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.

NODE_REINSERTIONConstant 
public static const NODE_REINSERTION:int = 6

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.

POST_EDGE_CHANGEConstant 
public static const POST_EDGE_CHANGE:int = 9

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.

POST_EDGE_REMOVALConstant 
public static const POST_EDGE_REMOVAL:int = 5

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.

POST_EVENTConstant 
public static const POST_EVENT:int = 13

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

POST_NODE_REMOVALConstant 
public static const POST_NODE_REMOVAL:int = 3

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.

PRE_EDGE_CHANGEConstant 
public static const PRE_EDGE_CHANGE:int = 8

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.

PRE_EDGE_REMOVALConstant 
public static const PRE_EDGE_REMOVAL:int = 4

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.

PRE_EVENTConstant 
public static const PRE_EVENT:int = 12

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

PRE_NODE_REMOVALConstant 
public static const PRE_NODE_REMOVAL:int = 2

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.

SUBGRAPH_INSERTIONConstant 
public static const SUBGRAPH_INSERTION:int = 10

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 com.yworks.yfiles.base.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

SUBGRAPH_REMOVALConstant 
public static const SUBGRAPH_REMOVAL:int = 11

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 com.yworks.yfiles.base.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