com.tensegrity.graph.view
Interface VisualGraphObject

All Superinterfaces:
Attributable, AttributableOnSet, Layoutable
All Known Subinterfaces:
VisualEdge, VisualNode, VisualSubgraph

public interface VisualGraphObject
extends AttributableOnSet, Layoutable

This interface represents the aspects common to all visual graph elements, including a VisualNode, VisualEdge and VisualSubgraph. The first of these aspects includes the identifiable nature of these elements. Every VisualGraphObject has both an identifier unique to its context as well as a global identifier that is unique within a hierarchy of VisualGraph objects. Methods to access both of these identifiers are available.

VisualGraphObject instances are created using factory objects that return specialized, concrete VisualGraphObject types.

Each VisualGraphObject implementation is constructed with an initial identifier of -1. When a VisualGraphObject is added to a GraphObjectContainer, the identifier is changed internally by the container to a value that becomes unique within that container context. The container may nest other containers recursively, which might have the same identifier assigned to one of their managed objects. Identifiers, therefore, are unique within the scope of a single GraphObjectContainer only.

When a VisualGraphObject is removed from a GraphObjectContainer, the identifier is reset to -1.

Each VisualGraphObject can only be stored in one dedicated VisualGraphObjectContainer at a time.

The identifiers that are internally assigned to a VisualGraphObject corresponds with the identifier of the associated model object. In this way, a mapping from model to view objects is possible. You can create multiple VisualGraphObject instances that all reference the same model object.

VisualGraphObject instances that are removed from their containers and dereferenced will be garbage collected.

Since the VisualGraphObject interface extends the AttributableOnSet interface an instance of it notifies a registered listener about changes in the supported Attributes. As explained in the AttributableOnSet interface notification can be turned on and off by using the corresponding methods.
Notice: When turning on or off the attribute change notification of a VisualGraphObject the attribute change notification of the underlying BaseComposite is also turned on or off.

VisualGraphObject extends the AttributableOnSet interface, which allows clients to associate attributes with them.

Version:
$Id: VisualGraphObject.java,v 1.56 2006/04/11 11:43:33 MichaelKegel Exp $
Author:
MichaelKegel, Stepan Rutz
See Also:
VisualNode, VisualEdge, VisualGraphObjectContainer, VisualGraph, VisualSubgraph, RuleRegistry, Layoutable

Field Summary
 
Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
TREE_SUBSET_POSTFIX
 
Method Summary
 VisualGraphObject deepCopy()
          Returns a deep independent copy of this instance.
 BaseComposite getBaseComposite()
          Returns the instance of the BaseComposite that is associated to the VisualGraphObject instance.
 GraphObject getGraphObject()
          Returns the instance of the GraphObject that corresponds to the VisualGraphObject instance.
 long getID()
          Returns the id of this VisualGraph object.
 VisualGraphObjectContainer getParentContainer()
          This method returns the VisualGraphObjectContainer this VisualGraphObject instance currently resides in.
 VisualGraphObjectContainer getRootContainer()
          VisualGraphObjectContainer instances can be nested inside of each other by means of the VisualSubgraph class.
 java.lang.String getRule()
          Gets the rule associated with this object.
 RuleRegistry getRuleRegistry()
          Retrieves the active RuleRegistry for this VisualGraphObject instance.
 long getUniqueID()
          Returns the global id of this VisualGraphObject instance.
 boolean isPinned()
          Return a boolean that indicates whether this VisualGraphObject is pinned.
 void registerVetoableVisualEventMediator(VetoableVisualGraphEventMediator vmediator)
          Registers the VetoableVisualGraphEventMediator object given by vmediator to the VisualGraphObject.
 void registerVisualEventMediator(VisualGraphEventMediator mediator)
          Registers the VisualGraphEventMediator object given by mediator to the VisualGraphObject.
 void setPinned(boolean pinned)
          Marks this VisualGraphObject as pinned.
 void setRule(java.lang.String rule)
          Sets the rule name associated with this object.
 void setRuleRegistry(RuleRegistry ruleregistry)
          Stores the active RuleRegistry of the rule in the visualgraphobject, so that it can be traced back.
 
Methods inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
addAttributableOnSetListener, areAttributableEventsEnabled, disableAttributableEvents, enableAttributableEvents, getAttributes, getAttributesTree, removeAttributableOnSetListener, setAttributes, setAttributesTree
 
Methods inherited from interface com.tensegrity.generic.attribute.Attributable
getAttribute, getAttributeType, getAttributeValue, setAttribute, setAttributeValue
 
Methods inherited from interface com.tensegrity.graph.layout.Layoutable
getEdgeLayoutContext, getLayoutAttributeSet, getLayoutContext, getNodeLayoutContext, setEdgeLayoutContext, setLayoutAttributes, setLayoutContext, setNodeLayoutContext
 

Method Detail

getID

public long getID()
Returns the id of this VisualGraph object. The id is local to the VisualGraph and exists as well in the associated graph-model objects. The id however is unique in the scope of VisualGraphObjects of a single VisualGraph.

Returns:
long the id of this VisualGraphObject.

Find more information in the class documentation


getUniqueID

public long getUniqueID()
Returns the global id of this VisualGraphObject instance. The returned id is unique within the complete graph hierarchy and is the same as the unique id of the associated GraphObject.

Specified by:
getUniqueID in interface Layoutable
Returns:
long the unique id of this VisualGraphObject.

Find more information in the class documentation


getRule

public java.lang.String getRule()
Gets the rule associated with this object.

Returns:
the rule associated with this object.

Find more information in the class documentation


setRule

public void setRule(java.lang.String rule)
Sets the rule name associated with this object.

Parameters:
rule - the rule label associated with this object.

Find more information in the class documentation


getRuleRegistry

public RuleRegistry getRuleRegistry()
Retrieves the active RuleRegistry for this VisualGraphObject instance.

Returns:
the RuleRegistry for this rule or null.

Find more information in the class documentation


setRuleRegistry

public void setRuleRegistry(RuleRegistry ruleregistry)
Stores the active RuleRegistry of the rule in the visualgraphobject, so that it can be traced back.

Parameters:
ruleregistry - the RuleRegistry we are working with.

Find more information in the class documentation


getBaseComposite

public BaseComposite getBaseComposite()
Returns the instance of the BaseComposite that is associated to the VisualGraphObject instance.

Returns:
the associated BaseComposite instance

Find more information in the class documentation


getGraphObject

public GraphObject getGraphObject()
Returns the instance of the GraphObject that corresponds to the VisualGraphObject instance.

Returns:
the corresponding GraphObject instance.

Find more information in the class documentation


getParentContainer

public VisualGraphObjectContainer getParentContainer()
This method returns the VisualGraphObjectContainer this VisualGraphObject instance currently resides in. In case this VisualGraphObject instance is not added to a VisualGraphObjectContainer this method returns null.

Returns:
VisualGraphObjectContainer the parent container of this VisualGraphObject instance or null.

Find more information in the class documentation


getRootContainer

public VisualGraphObjectContainer getRootContainer()
VisualGraphObjectContainer instances can be nested inside of each other by means of the VisualSubgraph class. This method returns the root component of the nesting hierarchy, or the this pointer if this instance is the root of the hierarchy. In case this instance is not added to a parent VisualGraphObjectContainer null is returned.

Returns:
the root of the nesting hierarchy or this.

Find more information in the class documentation


registerVisualEventMediator

public void registerVisualEventMediator(VisualGraphEventMediator mediator)
Registers the VisualGraphEventMediator object given by mediator to the VisualGraphObject. Subsequently the mediator will be informed about all events that occurs at the VisualGraphObject.
NOTE:
This method is an internal method used by the framework and forceful recommended not to work with!!

Parameters:
mediator - the ViusalGraphEventMediator to register

registerVetoableVisualEventMediator

public void registerVetoableVisualEventMediator(VetoableVisualGraphEventMediator vmediator)
Registers the VetoableVisualGraphEventMediator object given by vmediator to the VisualGraphObject. Subsequently the vmediator will be informed about all vetoable events that occurs at the VisualGraphObject.
NOTE:
This method is an internal method used by the framework and forceful recommended not to work with!!

Parameters:
vmediator - the VetoableViusalGraphEventMediator to register

deepCopy

public VisualGraphObject deepCopy()
Returns a deep independent copy of this instance.

Returns:
a deep independent copy of this instance.

isPinned

public boolean isPinned()
Return a boolean that indicates whether this VisualGraphObject is pinned.

Returns:
boolean true if this the VisualGraphObject is pinned; otherwise false.

Find more information in the class documentation


setPinned

public void setPinned(boolean pinned)
Marks this VisualGraphObject as pinned.

Parameters:
pinned - a flag that indicates whether the VisualGraphObject is pinned.

Find more information in the class documentation



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