|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
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:
VisualNode defines nodes in the VisualGraph and
corresponds to the Node in the
model scope.
VisualEdge defines connected edges in the VisualGraph
and corresponds to the Edge in the
model scope.
VisualEdge defines unconnected edges and does not
correspond to an Edge in the model
scope, since the model can only represent connected edges.
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:
deepCopy(com.tensegrity.graph.model.Graph) can be invoked on a VisualGraph to create
a deep, independent copy of it.
setRuleRegistry(RuleRegistry) allows you to apply a
RuleRegistry to a VisualGraph, thereby constraining
the way a user interacts with and programmatically invokes objects.
This helps you to customize applications with certain requirements that
determine how a VisualGraph can be manipulated at runtime.
portsReassignment(com.tensegrity.graph.view.VisualPortAssignmentPredicate) allows processing of all ports in the
VisualGraph. All ports are visited with the supplied visitor
method and can be readjusted.
A visual graph type is closely coupled with the following graph model types:
| Model object | Associated 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:
RuleRegistry getRuleRegistry()void setRuleRegistry(RuleRegistry)void setRuleRegistry(RuleRegistry, boolean)
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.
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. |
| 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. |
| Field Detail |
public static final int EVENTQUEUEREQUEST_MASK_VISUALNODE_ADDED
public static final int EVENTQUEUEREQUEST_MASK_VISUALNODE_REMOVED
public static final int EVENTQUEUEREQUEST_MASK_VISUALEDGE_ADDED
public static final int EVENTQUEUEREQUEST_MASK_VISUALEDGE_REMOVED
public static final int EVENTQUEUEREQUEST_MASK_ISOLATED_VISUALEDGE_ADDED
public static final int EVENTQUEUEREQUEST_MASK_ISOLATED_VISUALEDGE_REMOVED
public static final int EVENTQUEUEREQUEST_MASK_EDGESPLIT
| Method Detail |
public void enableEventQueueRequests(int eventmask)
eventmask - specifies which events to enable.public void disableEventQueueRequests(int eventmask)
eventmask - specifies which events to disable.public void flushQueuedEvents()
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.
public boolean isVisualGraphListener(VisualGraphListener listener)
listener - the listener to check against the list of currently
registered listeners.
true if the listener is currently registered,
otherwise false.public void addVisualGraphListener(VisualGraphListener listener)
VisualGraphListener given by
listener to the VisualGraph's internal
structure of listeners that are notified when an event occurs.
listener - the VisualGraphListener instance to addpublic void removeVisualGraphListener(VisualGraphListener listener)
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
listener - the VisualGraphListener listener instance
to removepublic void addVetoableVisualGraphListener(VetoableVisualGraphListener listener)
VetoableVisualGraphListener
given by listener to the VisualGraph's internal
structure of listeners that are notified when an event occurs.
listener - the VetoableVisualGraphListener instance to
addpublic void removeVetoableVisualGraphListener(VetoableVisualGraphListener listener)
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.
listener - the VetoableVisualGraphListener listener
instance to removepublic void addVisualEventMediatorListener(VisualGraphEventMediatorListener listener)
VisualGraphEventMediatorListener
given by listener to the VisualGraph's internal
structure of listeners that are notified when an event occurs.
listener - the VisualGraphEventMediatorListener
instance to addpublic void removeVisualEventMediatorListener(VisualGraphEventMediatorListener listener)
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.
listener - the VisualGraphEventMediatorListener
listener instance to removepublic void addVetoableVisualEventMediatorListener(VetoableVisualGraphEventMediatorListener listener)
VetoableVisualGraphEventMediatorListener
given by listener to the VisualGraph's internal
structure of listeners that are notified when an event occurs.
listener - the VetoableVisualGraphEventMediatorListener
instance to addpublic void removeVetoableVisualEventMediatorListener(VetoableVisualGraphEventMediatorListener listener)
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.
listener - the VetoableVisualGraphEventMediatorListener
listener instance to removepublic void addAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
VisualGraph.
attributableOnSetListener - the listener to add to this
VisualGraph.AttributableOnSetListenerpublic void removeAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
VisualGraph.
attributableOnSetListener - the listener to remove from this
VisualGraph.AttributableOnSetListenerpublic Graph getGraph()
Graph
this VisualGraph is associated with.
Graphpublic VisualGraph deepCopy(Graph graph)
VisualGraph and registers the
copy with the given Graph.
graph - the Graph
to associate the copy with.
VisualGraph.Graphpublic VisualGraph deepCopyWithoutNodesAndEdges(Graph graph)
VisualGraph and registers the copy
with the given Graph.
During the copy nodes and edges are omitted.
graph - the Graph
to associate the copy with.
VisualGraph.Graphpublic void portsReassignment(VisualPortAssignmentPredicate predicate)
VisualGraph are processed.
predicate - a VisualPortAssignmentPredicate that
specifies the details of the port reassignment.VisualPortAssignmentPredicatepublic RuleRegistry getRuleRegistry()
RuleRegistry
that is the currently active set of rules for this
VisualGraph. Initially the
RuleRegistry of a VisualGraph is
null.
RuleRegistry of this instance, may
be null.public void setRuleRegistry(RuleRegistry ruleregistry)
RuleRegistry
as the currently active set of rules for this
VisualGraph.
The default rules are assigned to all objects in the VisualGraph.
ruleregistry - the rules to apply for this VisualGraph.
public void setRuleRegistry(RuleRegistry ruleregistry,
boolean preserveAssignedRules)
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.
ruleregistry - the rules to apply for this VisualGraph.preserveAssignedRules - whether to preserve already assigned rules.public void updateEdges()
public boolean internalAddVisualNodeWithInteractionExecution(InteractionInfo info,
VisualNode visualnode,
boolean doEvent,
boolean doRules,
boolean useCursorPosition,
int x,
int y)
info - the InteractionInfo instance that is used to
execute interactionvisualnode - the VisualNode that should be addeddoEvent - flag that indicates whether to generate events or notdoRules - flag that indicates whether to check rules or not
VisualNode has
been added or not
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||