com.tensegrity.graph.view
Interface VisualGraph

All Superinterfaces:
LayoutableGraph, VisualGraphObjectContainer
All Known Subinterfaces:
VisualGraphView

public interface VisualGraph
extends VisualGraphObjectContainer, LayoutableGraph

This interface defines a view of a Graph model to which instances must always be attached. A GraphView is associated n:1 with this model object.

Objects of type Graph, Node and Edge represent the model entities in the graph domain. These entities may be associated on a one-to-many basis with objects whose types are used for the visualization inside a view. Simply put, each model class has a visual counterpart whose instances may reference exactly one model object.

The following class diagram shows the visual component structure and dependencies in the Tensegrity Graph Framework.

Constructing a VisualGraph and other visual objects is done by means of a GraphViewFactory, which will hide the particular implementation classes from client code.

The VisualGraph distinguishes among three kinds of VisualGraphObject classes:

When you add a VisualGraphObject to a view, its identifier is automatically assigned. Before adding, it, however, this identifier should be set to -1. Upon removal, this identifier will be reset to -1.

Each VisualGraphObject may only be added to at most one VisualGraph or VisualSubgraph at a time. Attempting to add the same object to more than one VisualGraph or VisualSubgraph will cause an exception to be thrown.

Besides adding and removing VisualNode and VisualEdge instances to and from a VisualGraph, you should be aware of a few notable methods defined in the VisualGraph interface:

A visual graph type is closely coupled with the following graph model types:

Model objectAssociated view object
Graph VisualGraph
GraphObject VisualGraphObject
Node VisualNode
Subgraph VisualSubgraph
Edge VisualEdge
Port VisualPort
PortDenotation VisualPortDenotation

Every time a view object is added to a VisualGraph, an associated model object must be already present in the Graph model. Every time a VisualGraph object is removed, a model object must also be present as well. These conditions can be summarized as follows:

VisualGraph objects can be nested inside another VisualGraph to any depth whatsoever. This is possible because the interface specification for VisualSubgraph derives from the interface VisualNode.

It is possible to traverse a hierarchy of VisualSubgraph objects by invoking the method VisualGraphObjectContainer.visitSubgraphs(VisualGraphVisitor) and providing a custom callback object that implements interface VisualGraphVisitor. VisualSubgraph objects can be nested inside each other recursively. The nesting hierarchy, however, may not contain cycles.

Several methods in this interface specification are inherited from the base interface VisualGraphObjectContainer, which specifies generic handling of VisualGraph and VisualSubgraph objects.

It is recommended that you configure and customize the behavior of a VisualGraph by using the rules facility only. The rules package offers the most flexible way of configuring VisualGraphs.
Therefore a VisualGraph supports the registration of a RuleRegistry.
In the context of VisualGraphs client code should register an instance of a RuleRegistry ONLY at the top-level VisualGraphView. This RuleRegistry will be subsequently registered to all the added VisualGraphObjects and nested VisualSubgraphs automatically by the GraphAPI. This means that there can be only one active RuleRegistry within the entire hierarchy of VisualGraphs.
For further information about the usage please see the documentation of RuleRegistry.
The methods a VisualGraph provides in order to support the RuleRegistry are listed below:

Any number of event listener instances may be added to a VisualGraph. Two types of event listeners are available. Instances of class VisualGraphListener listen for events in a single VisualGraph while VisualGraphEventMediator instances listen for events in the entire hierarchy of VisualGraph and nested VisualSubgraph objects.

The classes VisualNode and VisualEdge are the types managed by a VisualGraph.

Version:
$Id: VisualGraph.java,v 1.111 2005/06/09 13:06:18 AndreasEbbert Exp $
Author:
Stepan Rutz
See Also:
VisualGraphObjectContainer, VisualGraphView, VisualSubgraph, VisualGraphObject, VisualNode, VisualEdge, VisualPort, VisualPortDenotation, GraphViewFactory, Graph, GraphObject, Subgraph, Node, Edge, VisualGraphListener, RuleRegistry, VisualPortAssignmentPredicate, VisualGraphVisitor

Field Summary
static int EVENTQUEUEREQUEST_MASK_EDGESPLIT
          Enumeration for marking events to be queued for the different type of events.
static int EVENTQUEUEREQUEST_MASK_ISOLATED_VISUALEDGE_ADDED
          Enumeration for marking events to be queued for the different type of events.
static int EVENTQUEUEREQUEST_MASK_ISOLATED_VISUALEDGE_REMOVED
          Enumeration for marking events to be queued for the different type of events.
static int EVENTQUEUEREQUEST_MASK_VISUALEDGE_ADDED
          Enumeration for marking events to be queued for the different type of events.
static int EVENTQUEUEREQUEST_MASK_VISUALEDGE_REMOVED
          Enumeration for marking events to be queued for the different type of events.
static int EVENTQUEUEREQUEST_MASK_VISUALNODE_ADDED
          Enumeration for marking events to be queued for the different type of events.
static int EVENTQUEUEREQUEST_MASK_VISUALNODE_REMOVED
          Enumeration for marking events to be queued for the different type of events.
 
Fields inherited from interface com.tensegrity.graph.view.VisualGraphObjectContainer
EVENT_MASK_EDGESPLIT, EVENT_MASK_ISOLATED_VISUALEDGE_ADDED, EVENT_MASK_ISOLATED_VISUALEDGE_PRE_ADD, EVENT_MASK_ISOLATED_VISUALEDGE_PRE_REMOVE, EVENT_MASK_ISOLATED_VISUALEDGE_REMOVED, EVENT_MASK_LAYOUT, EVENT_MASK_VISUALEDGE_ADDED, EVENT_MASK_VISUALEDGE_PRE_ADD, EVENT_MASK_VISUALEDGE_PRE_REMOVE, EVENT_MASK_VISUALEDGE_REMOVED, EVENT_MASK_VISUALNODE_ADDED, EVENT_MASK_VISUALNODE_DELETE_CASCADE, EVENT_MASK_VISUALNODE_PRE_ADD, EVENT_MASK_VISUALNODE_PRE_REMOVE, EVENT_MASK_VISUALNODE_REMOVED
 
Method Summary
 void addAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
          Adds an attributeableOnSetListener to track attribute changes in all the elements of this VisualGraph.
 void addVetoableVisualEventMediatorListener(VetoableVisualGraphEventMediatorListener listener)
          Adds the VetoableVisualGraphEventMediatorListener given by listener to the VisualGraph's internal structure of listeners that are notified when an event occurs.
 void addVetoableVisualGraphListener(VetoableVisualGraphListener listener)
          Adds the VetoableVisualGraphListener given by listener to the VisualGraph's internal structure of listeners that are notified when an event occurs.
 void addVisualEventMediatorListener(VisualGraphEventMediatorListener listener)
          Adds the VisualGraphEventMediatorListener given by listener to the VisualGraph's internal structure of listeners that are notified when an event occurs.
 void addVisualGraphListener(VisualGraphListener listener)
          Adds the VisualGraphListener given by listener to the VisualGraph's internal structure of listeners that are notified when an event occurs.
 VisualGraph deepCopy(Graph graph)
          Makes a deep copy of the VisualGraph and registers the copy with the given Graph.
 VisualGraph deepCopyWithoutNodesAndEdges(Graph graph)
          Makes a deep copy of the VisualGraph and registers the copy with the given Graph.
 void disableEventQueueRequests(int eventmask)
          Disables all of the events specified in the given event mask.
 void enableEventQueueRequests(int eventmask)
          Enables all of the events specified in the given event mask.
 void flushQueuedEvents()
          When events were marked as queued events, they are internally gathered by the VisualGraph.
 Graph getGraph()
          Returns the reference to the Graph this VisualGraph is associated with.
 RuleRegistry getRuleRegistry()
          Gets the RuleRegistry that is the currently active set of rules for this VisualGraph.
 boolean internalAddVisualNodeWithInteractionExecution(InteractionInfo info, VisualNode visualnode, boolean doEvent, boolean doRules, boolean useCursorPosition, int x, int y)
          Notice: For internal use only.
 boolean isVisualGraphListener(VisualGraphListener listener)
          Queries whether a given listener is currently registered.
 void portsReassignment(VisualPortAssignmentPredicate predicate)
          Reassigns all ports of all edges to the desired port.
 void removeAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
          Removes an attributeableOnSetListener to track attribute changes in all the elements of this VisualGraph.
 void removeVetoableVisualEventMediatorListener(VetoableVisualGraphEventMediatorListener listener)
          Removes the VetoableVisualGraphEventMediatorListener given by listener from the VisualGraph's internal structure of listener so that he is no longer be notified about the occurrence of events.
 void removeVetoableVisualGraphListener(VetoableVisualGraphListener listener)
          Removes the VetoableVisualGraphListener given by listener from the VisualGraph's internal structure of listener so that he is no longer be notified about the occurrence of events.
 void removeVisualEventMediatorListener(VisualGraphEventMediatorListener listener)
          Removes the VisualGraphEventMediatorListener given by listener from the VisualGraph's internal structure of listener so that he is no longer be notified about the occurrence of events.
 void removeVisualGraphListener(VisualGraphListener listener)
          Removes the VisualGraphListener given by listener from the VisualGraph's internal structure of listener so that he is no longer be notified about the occurrence of events
 void setRuleRegistry(RuleRegistry ruleregistry)
          Sets a RuleRegistry as the currently active set of rules for this VisualGraph.
 void setRuleRegistry(RuleRegistry ruleregistry, boolean preserveAssignedRules)
          Sets a RuleRegistry as the currently active set of rules for this VisualGraph.
 void updateEdges()
          Updates all edges.
 
Methods inherited from interface com.tensegrity.graph.view.VisualGraphObjectContainer
addIsolatedVisualEdge, addVisualEdge, addVisualNode, disableVisualGraphEvents, enableVisualGraphEvents, getAllVisualEdges, getGraphObjectContainer, getIsolatedVisualEdgeByID, getIsolatedVisualEdgeCount, getIsolatedVisualEdges, getIsolatedVisualEdgesCollection, getParentContainer, getRootContainer, getVisualEdgeByID, getVisualEdgeCount, getVisualEdges, getVisualEdgesCollection, getVisualGraphEventmask, getVisualGraphObjects, getVisualNodeByID, getVisualNodeByName, getVisualNodeCount, getVisualNodes, getVisualNodesCollection, getVisualPortByID, removeIsolatedVisualEdge, removeVisualEdge, removeVisualNode, specificPortReassignmentVisualEdge, specificPortReassignmentVisualEdge, specificPortReassignmentVisualEdgeSource, specificPortReassignmentVisualEdgeTarget, startBulkModify, stopBulkModify, visitSubgraphs
 

Field Detail

EVENTQUEUEREQUEST_MASK_VISUALNODE_ADDED

public static final int EVENTQUEUEREQUEST_MASK_VISUALNODE_ADDED
Enumeration for marking events to be queued for the different type of events.

See Also:
Constant Field Values

EVENTQUEUEREQUEST_MASK_VISUALNODE_REMOVED

public static final int EVENTQUEUEREQUEST_MASK_VISUALNODE_REMOVED
Enumeration for marking events to be queued for the different type of events.

See Also:
Constant Field Values

EVENTQUEUEREQUEST_MASK_VISUALEDGE_ADDED

public static final int EVENTQUEUEREQUEST_MASK_VISUALEDGE_ADDED
Enumeration for marking events to be queued for the different type of events.

See Also:
Constant Field Values

EVENTQUEUEREQUEST_MASK_VISUALEDGE_REMOVED

public static final int EVENTQUEUEREQUEST_MASK_VISUALEDGE_REMOVED
Enumeration for marking events to be queued for the different type of events.

See Also:
Constant Field Values

EVENTQUEUEREQUEST_MASK_ISOLATED_VISUALEDGE_ADDED

public static final int EVENTQUEUEREQUEST_MASK_ISOLATED_VISUALEDGE_ADDED
Enumeration for marking events to be queued for the different type of events.

See Also:
Constant Field Values

EVENTQUEUEREQUEST_MASK_ISOLATED_VISUALEDGE_REMOVED

public static final int EVENTQUEUEREQUEST_MASK_ISOLATED_VISUALEDGE_REMOVED
Enumeration for marking events to be queued for the different type of events.

See Also:
Constant Field Values

EVENTQUEUEREQUEST_MASK_EDGESPLIT

public static final int EVENTQUEUEREQUEST_MASK_EDGESPLIT
Enumeration for marking events to be queued for the different type of events.

See Also:
Constant Field Values
Method Detail

enableEventQueueRequests

public void enableEventQueueRequests(int eventmask)
Enables all of the events specified in the given event mask.

Parameters:
eventmask - specifies which events to enable.

disableEventQueueRequests

public void disableEventQueueRequests(int eventmask)
Disables all of the events specified in the given event mask.

Parameters:
eventmask - specifies which events to disable.

flushQueuedEvents

public void flushQueuedEvents()
When events were marked as queued events, they are internally gathered by the VisualGraph. Invoking this method will empty the queue by delivering all stored events. If an event was disabled by the event mask, it is not queued. The event-queue may be flushed automatically if it becomes too large. The event-queue can buffer at least 4096 events.


isVisualGraphListener

public boolean isVisualGraphListener(VisualGraphListener listener)
Queries whether a given listener is currently registered.

Parameters:
listener - the listener to check against the list of currently registered listeners.
Returns:
true if the listener is currently registered, otherwise false.

addVisualGraphListener

public void addVisualGraphListener(VisualGraphListener listener)
Adds the VisualGraphListener given by listener to the VisualGraph's internal structure of listeners that are notified when an event occurs.

Parameters:
listener - the VisualGraphListener instance to add

removeVisualGraphListener

public void removeVisualGraphListener(VisualGraphListener listener)
Removes the VisualGraphListener given by listener from the VisualGraph's internal structure of listener so that he is no longer be notified about the occurrence of events

Parameters:
listener - the VisualGraphListener listener instance to remove

addVetoableVisualGraphListener

public void addVetoableVisualGraphListener(VetoableVisualGraphListener listener)
Adds the VetoableVisualGraphListener given by listener to the VisualGraph's internal structure of listeners that are notified when an event occurs.

Parameters:
listener - the VetoableVisualGraphListener instance to add

removeVetoableVisualGraphListener

public void removeVetoableVisualGraphListener(VetoableVisualGraphListener listener)
Removes the VetoableVisualGraphListener given by listener from the VisualGraph's internal structure of listener so that he is no longer be notified about the occurrence of events.

Parameters:
listener - the VetoableVisualGraphListener listener instance to remove

addVisualEventMediatorListener

public void addVisualEventMediatorListener(VisualGraphEventMediatorListener listener)
Adds the VisualGraphEventMediatorListener given by listener to the VisualGraph's internal structure of listeners that are notified when an event occurs.

Parameters:
listener - the VisualGraphEventMediatorListener instance to add

removeVisualEventMediatorListener

public void removeVisualEventMediatorListener(VisualGraphEventMediatorListener listener)
Removes the VisualGraphEventMediatorListener given by listener from the VisualGraph's internal structure of listener so that he is no longer be notified about the occurrence of events.

Parameters:
listener - the VisualGraphEventMediatorListener listener instance to remove

addVetoableVisualEventMediatorListener

public void addVetoableVisualEventMediatorListener(VetoableVisualGraphEventMediatorListener listener)
Adds the VetoableVisualGraphEventMediatorListener given by listener to the VisualGraph's internal structure of listeners that are notified when an event occurs.

Parameters:
listener - the VetoableVisualGraphEventMediatorListener instance to add

removeVetoableVisualEventMediatorListener

public void removeVetoableVisualEventMediatorListener(VetoableVisualGraphEventMediatorListener listener)
Removes the VetoableVisualGraphEventMediatorListener given by listener from the VisualGraph's internal structure of listener so that he is no longer be notified about the occurrence of events.

Parameters:
listener - the VetoableVisualGraphEventMediatorListener listener instance to remove

addAttributableOnSetListener

public void addAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
Adds an attributeableOnSetListener to track attribute changes in all the elements of this VisualGraph.

Parameters:
attributableOnSetListener - the listener to add to this VisualGraph.
See Also:
AttributableOnSetListener

removeAttributableOnSetListener

public void removeAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
Removes an attributeableOnSetListener to track attribute changes in all the elements of this VisualGraph.

Parameters:
attributableOnSetListener - the listener to remove from this VisualGraph.
See Also:
AttributableOnSetListener

getGraph

public Graph getGraph()
Returns the reference to the Graph this VisualGraph is associated with.

Returns:
the associated graph model object.
See Also:
Graph

deepCopy

public VisualGraph deepCopy(Graph graph)
Makes a deep copy of the VisualGraph and registers the copy with the given Graph.

Parameters:
graph - the Graph to associate the copy with.
Returns:
a deep copy of the VisualGraph.
See Also:
Graph

deepCopyWithoutNodesAndEdges

public VisualGraph deepCopyWithoutNodesAndEdges(Graph graph)
Makes a deep copy of the VisualGraph and registers the copy with the given Graph. During the copy nodes and edges are omitted.

Parameters:
graph - the Graph to associate the copy with.
Returns:
a deep copy of the VisualGraph.
See Also:
Graph

portsReassignment

public void portsReassignment(VisualPortAssignmentPredicate predicate)
Reassigns all ports of all edges to the desired port. This is done accordingly to the user supplied predicate function. All connections in the VisualGraph are processed.

Parameters:
predicate - a VisualPortAssignmentPredicate that specifies the details of the port reassignment.
See Also:
VisualPortAssignmentPredicate

Find more information in the class documentation


getRuleRegistry

public RuleRegistry getRuleRegistry()
Gets the RuleRegistry that is the currently active set of rules for this VisualGraph. Initially the RuleRegistry of a VisualGraph is null.

Returns:
the current RuleRegistry of this instance, may be null.

Find more information in the class documentation


setRuleRegistry

public void setRuleRegistry(RuleRegistry ruleregistry)
Sets a RuleRegistry as the currently active set of rules for this VisualGraph. The default rules are assigned to all objects in the VisualGraph.

Parameters:
ruleregistry - the rules to apply for this VisualGraph.

Find more information in the class documentation


setRuleRegistry

public void setRuleRegistry(RuleRegistry ruleregistry,
                            boolean preserveAssignedRules)
Sets a RuleRegistry as the currently active set of rules for this VisualGraph. The default rules are assigned to all objects in the VisualGraph that do not have a rule set already if and only if the preserveAssignedRules flag is set to true.

Parameters:
ruleregistry - the rules to apply for this VisualGraph.
preserveAssignedRules - whether to preserve already assigned rules.

Find more information in the class documentation


updateEdges

public void updateEdges()
Updates all edges.


internalAddVisualNodeWithInteractionExecution

public boolean internalAddVisualNodeWithInteractionExecution(InteractionInfo info,
                                                             VisualNode visualnode,
                                                             boolean doEvent,
                                                             boolean doRules,
                                                             boolean useCursorPosition,
                                                             int x,
                                                             int y)
Notice: For internal use only.

Parameters:
info - the InteractionInfo instance that is used to execute interaction
visualnode - the VisualNode that should be added
doEvent - flag that indicates whether to generate events or not
doRules - flag that indicates whether to check rules or not
Returns:
boolean that indicates whether the VisualNode has been added or not


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.