com.cra.bnet.engine
Class NodeEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.cra.bnet.engine.NodeEvent
All Implemented Interfaces:
Serializable

public class NodeEvent
extends EventObject

A node-related event. This event is used to represent name changed, state added, state removed, state reordered, and state name changed events.

See Also:
Serialized Form

Field Summary
static com.cra.bnet.engine.NodeEvent.NodeEventType DESCRIPTION_CHANGED
          The description changed event type.
static com.cra.bnet.engine.NodeEvent.NodeEventType LOCATION_CHANGED
          The location changed event type.
static com.cra.bnet.engine.NodeEvent.NodeEventType NAME_CHANGED
          The name changed event type.
static com.cra.bnet.engine.NodeEvent.NodeEventType PARENT_REORDERED
          The parent reordered event type.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
NodeEvent(Node node, Node parent, int index)
          Creates a new parent reordered NodeEvent using the specified node, parent, and index.
NodeEvent(Node node, Point oldLocation, Point newLocation)
          Creates a new location changed NodeEvent using the specified node, old and new locations.
NodeEvent(Node node, String oldNodeName, String newNodeName, com.cra.bnet.engine.NodeEvent.NodeEventType type)
          Creates a new name or description changed NodeEvent using the specified node, old name, and new name.
 
Method Summary
 int getIndex()
          Returns the index of parent.
 Point getNewLocation()
          Returns the new location.
 String getNewName()
          Returns the new node name.
 Node getNode()
          Returns the node this event occurred on.
 Point getOldLocation()
          Returns the old location.
 String getOldName()
          Returns the old node name.
 Node getParent()
          Returns the parent that was reordered or null if the type of this event is not PARENT_REORDERED.
 com.cra.bnet.engine.NodeEvent.NodeEventType getType()
          Returns the type of this node event.
 String toString()
          Returns a string representation of this node 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

NAME_CHANGED

public static final com.cra.bnet.engine.NodeEvent.NodeEventType NAME_CHANGED
The name changed event type.


PARENT_REORDERED

public static final com.cra.bnet.engine.NodeEvent.NodeEventType PARENT_REORDERED
The parent reordered event type.


DESCRIPTION_CHANGED

public static final com.cra.bnet.engine.NodeEvent.NodeEventType DESCRIPTION_CHANGED
The description changed event type.


LOCATION_CHANGED

public static final com.cra.bnet.engine.NodeEvent.NodeEventType LOCATION_CHANGED
The location changed event type.

Constructor Detail

NodeEvent

public NodeEvent(Node node,
                 String oldNodeName,
                 String newNodeName,
                 com.cra.bnet.engine.NodeEvent.NodeEventType type)
Creates a new name or description changed NodeEvent using the specified node, old name, and new name.

Parameters:
node - node that the event occurred on.
oldNodeName - node's old name or description.
newNodeName - node's new name or description.
type - must be either NAME_CHANGED or DESCRIPTION_CHANGED.

NodeEvent

public NodeEvent(Node node,
                 Node parent,
                 int index)
Creates a new parent reordered NodeEvent using the specified node, parent, and index.

Parameters:
node - node the event occurred on.
parent - parent that was reordered.
index - old index of the parent.

NodeEvent

public NodeEvent(Node node,
                 Point oldLocation,
                 Point newLocation)
Creates a new location changed NodeEvent using the specified node, old and new locations.

Parameters:
node - node the event occurred on.
oldLocation - old location.
newLocation - new location.
Method Detail

getIndex

public int getIndex()
Returns the index of parent. This method returns the following for the different types of events:

Returns:
index of the parent.

getNewName

public String getNewName()
Returns the new node name. This method returns the following for the different types of events:

Returns:
the new node name.

getNewLocation

public Point getNewLocation()
Returns the new location.

Returns:
the new location.

getOldLocation

public Point getOldLocation()
Returns the old location.

Returns:
the old location.

getNode

public Node getNode()
Returns the node this event occurred on.

Returns:
the node this event occurred on.

getOldName

public String getOldName()
Returns the old node name. This method returns the following for the different types of events:

Returns:
the old node name.

getType

public com.cra.bnet.engine.NodeEvent.NodeEventType getType()
Returns the type of this node event.

Returns:
the type of this node event.

getParent

public Node getParent()
Returns the parent that was reordered or null if the type of this event is not PARENT_REORDERED.

Returns:
the parent that was reordered or null.

toString

public String toString()
Returns a string representation of this node event.

Overrides:
toString in class EventObject
Returns:
a string representation of this node event.