com.tensegrity.graph.layout.controller
Class LayoutController

java.lang.Object
  extended bycom.tensegrity.graph.layout.controller.LayoutController
All Implemented Interfaces:
Attributable, AttributableOnSet
Direct Known Subclasses:
FreeWorkflowLayoutController, GraphLayoutController, OrgChartLayoutController, SwimlaneLayoutController

public abstract class LayoutController
extends java.lang.Object
implements AttributableOnSet

The abstract class LayoutController is responsible for managing a number of Layout instances and ensuring that they are properly used. Since each Layout uses a graph drawing algorithm to arrange an entire VisualGraph or parts of it, the LayoutController must distinguish between a Layout instance that deals with a VisualNode and one that deals with a VisualEdge. For this reason, the Layout interface is derived by the two interfaces NodeLayout and EdgeLayout.

Every Layout is a component that can be registered at runtime. The LayoutController ensures its full and complete integration by encapsulating the implementation and mediating between the Layout instance and application code.

This abstract base class holds methods common to and provides a default behavior for all derived LayoutController classes. This design resembles the TEMPLATE design pattern. Methods prefixed with on are those that need to be customized. The other methods provide the template functionality.

A VisualGraphView provides the methods VisualGraphView.setLayoutController(LayoutController) and VisualGraphView.getLayoutController() to set and retrieve a LayoutController. The VisualGraphView notifies the LayoutController about its changes so that the layout can run automatically if the dynamic layout is enabled. The methods enableDynamicNodeLayout(boolean) and enableDynamicEdgeLayout(boolean) can be used to enable or disable the dynamic layout for nodes and edges respectively.

The LayoutController allows clients to access a Layout through an alias called a layout context. The context name is bound to an object which wraps a specific Layout with a parameterized configuration of that layout. The purpose of a layout context is to eliminate conflicts between applications that use the same Layout concurrently. Furthermore, this pattern permits different groups of elements to use the same Layout objects but with different configuration settings, saving considerable time during modeling, since users are not forced to manually change layout attributes at runtime.

The LayoutController retains a copy of all attributes of a Layout for each created layout context and releases them before the layout is applied. This way it is possible to create several layout contexts for the same Layout, each holding a separate layout configuration.

Subgraphs are processed recursively in a post-order tree traversal. The generic functionality for such recursive layouts is incorporated in this base class. In order to achieve a recursive layout, the algorithm is applied to all subgraphs before a parent graph is touched. Since the layout of a subgraph may change its appropriate size, it often becomes necessary to adjust the subgraphs external size to make its internal content fit. This behavior should be performed in the method onEndVisualSubgraphLayout(VisualSubgraph).

Each VisualSubgraph can be associated with a node layout context and/or an edge layout context. The methods Layoutable.setNodeLayoutContext(String) and Layoutable.setEdgeLayoutContext(String) can be used to define the layout context responsible for arranging the subgraph. Whenever the apply() method is invoked (explicitly or implicitly if dynamic layout is active), the LayoutController traverses through all nested subgraphs and arranges them according to their specified layout context. In this way it becomes possible to apply different layouts on different subgraphs in a nested graph.

Version:
$Id: LayoutController.java,v 1.222 2006/05/31 05:15:49 SharokhKhani Exp $
Author:
Sharokh Khani

Field Summary
static int ACTIVE
          Layout state specifier.
static int ACTIVE_EDGELAYOUT
          Layout state specifier.
static int ACTIVE_NODELAYOUT
          Layout state specifier.
protected  boolean animation
          Indicates the animation state.
static java.lang.String ANIMATION_TIME
           
protected  int animationDuration
          Indicates the animation duration.
static java.lang.String ANIMATIONDURATION
          XML tag: Specifies the animation time.
static java.lang.String ANIMATIONENABLED
          XML tag: Indicates whether the animation is enabled.
static java.lang.String ATTRIBUTENAME_EDGE_LAYOUT
           
static java.lang.String ATTRIBUTENAME_GLOBAL_SETTINGS
           
static java.lang.String ATTRIBUTENAME_LAYOUT_CONTEXT
           
static java.lang.String ATTRIBUTENAME_LAYOUT_SETTING
           
static java.lang.String ATTRIBUTENAME_NODE_LAYOUT
           
static java.lang.String DEFAULTEDGELAYOUTCONTEXT
          XML tag: Specifies the edge layout context for the main graph.
static java.lang.String DEFAULTNODELAYOUTCONTEXT
          XML tag: Specifies the node layout context for the main graph.
static java.lang.String DEPENDING_ON_LAYOUT_DIRECTION
           
static int DYNAMIC
          Layout state specifier.
static java.lang.String DYNAMIC_PORT_REASSIGNMENT
           
protected  boolean dynamicEdgeLayout
          Indicates whether the edges must be laid outed automatically after user interactions.
static java.lang.String DYNAMICEDGELAYOUT
          XML tag: Indicates whether the edges must be laid outed automatically after user interactions.
protected  boolean dynamicNodeLayout
          Indicates whether the nodes must be laid outed automatically after user interactions.
static java.lang.String DYNAMICNODELAYOUT
          XML tag: Indicates whether the nodes must be laid outed automatically after user interactions.
static java.lang.String EDGE_OPTIONS
           
protected  java.lang.String edgeLayoutContext
          Specifies the edge layout context for the main graph.
static java.lang.String ENABLE_ANIMATION
           
static java.lang.String GLOBAL_CONFIGURATION
          XML tag for common options.
static java.lang.String IGNORE_UNCONNECTED_NODES
           
static int INACTIVE
          Layout state specifier.
static java.lang.String LAYOUT_DOMAIN
           
protected  int layoutDomain
          Indicates the current layout domain.
static int LAYOUTDOMAIN_ALL
          Layout domain specifier.
static int LAYOUTDOMAIN_CONSIDER_SELECTED_GROUPS
          Layout domain specifier.
static java.lang.String LAYOUTDOMAIN_SELECTION
          XML tag: Specifies the value "Selected groups" for the attribute LAYOUTDOMAIN_USED.
static java.lang.String LAYOUTDOMAIN_USED
          XML tag: Indicates the current layout domain.
static java.lang.String LAYOUTDOMAIN_WHOLE
          XML tag: Specifies the value "All" for the attribute LAYOUTDOMAIN_USED.
static java.lang.String NODE_OPTIONS
           
protected  java.lang.String nodeLayoutContext
          Specifies the node layout context for the main graph.
protected  Observable observable
          layout observer to update view during animation.
static java.lang.String OTHER_OPTIONS
           
static java.lang.String RELAYOUT_EDGES_ON_CHANGE
           
static java.lang.String RELAYOUT_NODES_ON_CHANGE
           
static java.lang.String SELECTED_GROUPS
           
protected  int state
          Indicates the current layout state.
protected  java.lang.String strErrorMessage
          Variable to store the error messages during the layout process
protected  VisualGraphObjectContainer visualGraphObjectContainer
          The VisualGraphObjectContainer with which this instance of a LayoutController associates.
protected  VisualGraphView visualGraphView
          The VisualGraphView with which this instance of a LayoutController associates.
static java.lang.String WHOLE_GRAPH
           
 
Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
TREE_SUBSET_POSTFIX
 
Constructor Summary
protected LayoutController()
          Constructs a new LayoutController instance.
  LayoutController(boolean createDefaultContexts)
          Constructs a new OrgChartLayoutController instance.
protected LayoutController(LayoutController layoutController, VisualGraphObjectContainer visualGraphObjectContainer)
          Copy constructor for the LayoutController instance.
 
Method Summary
 void addAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
          Adds a listener to the attributable on set instance.
protected  void addErrorMessage(java.lang.String msg)
          Adds a message text to the current error message.
 boolean addLayoutContext(java.lang.String baseLayouter, java.lang.String layoutContext)
          Creates a new layout context and adds it to the pool of layout contexts.
 void addObserver(Observer observer)
          Adds an observer to the internally managed list of observers of this observable.
 void addProgressListener(ProgressListener progresslistener)
          Adds a ProgressListener.
 boolean apply()
          This method applies a layout on the visual nodes and edges of the associated VisualGraphObjectContainer which should, together with an appropriate edge layout context and node layout context, be set in advance.
protected  boolean apply(boolean doUndoRedo)
           
 boolean apply(java.util.List objectList, java.lang.String nodeLayoutContext, java.lang.String edgeLayoutContext)
          This method applies a layout on the nodes and edges specified in the passed List of visual graph objects.
protected  boolean apply(java.util.List objectList, java.lang.String nodeLayoutContext, java.lang.String edgeLayoutContext, boolean doUndoRedo)
          This method is an extended function of the method apply(List, String, String).
 boolean apply(java.lang.String nodeLayoutContext)
          This method applies a layout algorithm on nodes and edges of the associated VisualGraphObjectContainer.
 boolean applyDynamic()
          This method causes the LayoutController to perform a single dynamic layout.
 boolean applyEdgeLayout()
          Applies a layout on the edges of the associated VisualGraphObjectContainer.
protected  boolean applyEdgeLayout(boolean doUndoRedo)
          This method is a extended variant of the method applyEdgeLayout().
 boolean areAttributableEventsEnabled()
          Returns a boolean that indicates whether generating of events is enabled or not.
 void considerCurrentEdgesRoute()
          Call this method to keep the current edge's route.
abstract  LayoutController deepCopy(VisualGraphObjectContainer visualGraphObjectContainer)
          Override this method with a meaningful deep-copy operation that returns a new independent layout-controller associated with the given VisualGraphObjectContainer.
 void deleteObserver(Observer observer)
          Deletes an observer from the internally managed list of observers of this observable.
 void disableAttributableEvents()
          Disables events for the registered listeners.
 AttributeSet duplicateLayoutContext(java.lang.String templateLayoutContext, java.lang.String newLayoutContext)
          Creates a copy of an existing layout context.
 void enableAnimation(boolean enable)
          Enables or disables the layout animation mode.
 void enableAttributableEvents()
          Enables the transmission of events to registered listeners.
 void enableDynamicEdgeLayout(boolean layoutpremanent)
          This method enables the dynamic edge layout mode.
 void enableDynamicNodeLayout(boolean layoutpremanent)
          This method enables the automatic layout mode.
 boolean error()
          Returns true if an error has occurred; otherwise false.
 int getAnimateDuration()
          Returns the animation duration time in milliseconds.
 Attribute getAttribute(java.lang.String name)
          Returns the attribute with the given name or null if there is no Attribute with the given name.
 AttributeSet getAttributes()
          Returns an AttributeSet consisting of all attributes of this AttributableOnSet.
 AttributeSet getAttributesTree()
          Returns an AttributeSet containing all Attributes of this AttributableOnSet in a treelike structure.
 AttributeSet getAttributesTree(java.lang.String nodeContext, java.lang.String edgeContext)
          This method returns an AttributeSet that consist of common options, attributes of the specified by nodeContext and edgeContext.
 AttributeType getAttributeType(java.lang.String name)
          Returns the AttributeType of the attribute with the given name.
 java.lang.Object getAttributeValue(java.lang.String name)
          Return the value of the attribute with the given name.
 boolean getAutomaticPortReassignment()
          Returns the status of the automatic port reassignment mode.
 boolean getAutomaticPortReassignmentDirectionDependent()
          Indicates whether the direction-dependent port reassignment is active.
 java.lang.String getBaseLayoutEngine(java.lang.String layoutContext)
          Deprecated. Please use getBaseLayouter(String) instead. The method is about to be removed in future releases.
 java.lang.String getBaseLayouter(java.lang.String layoutContext)
          This method returns the base Layout of an specified layout contexts.
 AttributeSet getConfiguration(java.lang.String[] listOfLayoutContexts)
          This method returns an AttributeSet holding all information about the current configuration.
 AttributeSet getEdgeDefaultLayoutAttributes(java.lang.String layoutContext)
          This method returns the default edge attributes of the Layout which underlies the specified layoutContext.
 java.lang.String getEdgeLayoutContext()
          Gets the current edge layout context.
 Constraint getEdgeLayoutContextConstraint()
          Returns an EnumConstraint that contains all valid edge layout contexts
 java.lang.String[] getEdgeLayoutContextList()
          This method returns the list of all defined edge layout contexts.
 java.lang.String[] getEdgeLayouterList()
          This method returns an array of unique names of all registered edge layout contexts.
 java.lang.String getErrorMessage()
          Returns the error message if an error has occurred, which can be determined by invoking method error().
 int[] getGraphPosition()
          Returns the left/top-position of the graph after the layout process.
 boolean getIgnoreIsolatedNodes()
          Indicates whether isolated nodes are excluded from layout process.
 java.lang.Object getLayoutAttribute(java.lang.String layoutContext, java.lang.String key)
          Obtains the value of a particular attribute of a specified layout context.
 AttributeSet getLayoutAttributeSet(java.lang.String layoutContext)
          Returns the AttributeSet of the specified layout context.
 java.lang.String getLayoutContext()
          Deprecated. use getNodeLayoutContext() and getEdgeLayoutContext() instead.
 java.lang.String[] getLayoutContextList()
          This method returns an array of all defined layout contexts.
 java.lang.String[] getLayoutContextList(java.lang.String baseLayouter)
          This method returns the list of defined layout contexts that associate with a particular Layout .
 int getLayoutDomain()
          Returns the current layout domain.
 boolean getLayoutEdgesContextDepended()
          Indicates whether the edges are arranged context dependently or not.
 AttributeSet getLayoutReport(java.lang.String layoutContext)
          This method provides a detailed report about the last layout process and typically contains the calculation durations of different processing steps.
 LayoutService getLayoutService()
          Deprecated. The LayoutService class is about to be removed in future releases. All methods are available at the LayoutController class now.
 AttributeSet getNodeDefaultLayoutAttributes(java.lang.String layoutContext)
          This method returns the default node attributes of the Layout which underlies the specified layoutContext.
 java.lang.String getNodeLayoutContext()
          Gets the current node layout context.
 Constraint getNodeLayoutContextConstraint()
          Returns an EnumConstraint that contains all valid node layout contexts
 java.lang.String[] getNodeLayoutContextList()
          This method returns the list of all defined node layout contexts.
 java.lang.String[] getNodeLayouterList()
          This method returns an array of unique names of all registered node layout contexts.
 java.util.Map getPreviousEdgeLayoutAttributeMap()
           
 java.util.Map getPreviousEdgeLayoutContextMap()
           
 java.util.Map getPreviousNodeLayoutAttributeMap()
           
 java.util.Map getPreviousNodeLayoutContextMap()
           
 int getState()
          Returns the current state of the layout process.
 java.lang.String[] getUsingLayoutContexts()
          This method returns an array of all layout context names that are actually used in the associated VisualGraphObjectContainer.
 VisualGraphObjectContainer getVisualGraphObjectContainer()
          Gets the associated VisualGraphObjectContainer.
protected abstract  void init()
          This method must be overwritten by derived LayoutControllers.
 boolean isAnimationEnabled()
          Indicates whether the animation mode is enabled.
 boolean isDynamicEdgeLayoutEnabled()
          This method returns the dynamic edge layout mode status.
 boolean isDynamicLayoutSupported()
          Indicates whether the dynamic node layout or the dynamic edge layout is enabled.
 boolean isDynamicNodeLayoutEnabled()
          This method indicates whether the dynamic node layout mode is enabled.
 boolean isNodeLayoutContext(java.lang.String layoutContext)
          Returns true if the specified layoutContext is associated with a NodeLayout, otherwise false.
protected  boolean isRecursive()
          Deprecated. The recursive behavior of layout can be also influenced by layout domain. Please use the methods setLayoutDomain(int) and getLayoutDomain() instead.
 boolean isValidLayoutContext(java.lang.String layoutContext)
          Checks whether the specified layout context is valid.
protected  void journalStartLayout()
          In case this LayoutController instance is associated to an instance of a VisualGraphView this method opens an undo-redo layout tag for the current VisualGraphObjectContainer.
protected  void journalStopLayout()
          In case this LayoutController instance is associated to an instance of a VisualGraphView this method closes an undo-redo layout tag for the current VisualGraphObjectContainer.
protected  void onBeginLayout()
          Override this method with code that should be performed when the layout is about to begin.
 void onBeginLoading()
          This method should be called to indicate the layoutController that the loading process is going to start.
protected  void onBeginVisualSubgraphEdgeLayout(VisualSubgraph visualsubgraph)
          Override this method with code that should be performed before the edge layout is applied on a VisualSubgraph.
protected  void onBeginVisualSubgraphLayout(VisualSubgraph visualsubgraph)
          Override this method with code that should be performed before a layout on a VisualSubgraph is about to be performed.
protected  void onEndLayout()
          Override this method with code that should be performed when the layout has completed.
 void onEndLoading()
          This method should be triggered to indicate the layoutController that the loading process is finished.
protected  void onEndVisualSubgraphEdgeLayout(VisualSubgraph visualsubgraph)
          Override this method with code that should be performed when the edge layout on a VisualSubgraph has completed.
protected  void onEndVisualSubgraphLayout(VisualSubgraph visualsubgraph)
          Override this method with code that should be performed after layout on a VisualSubgraph has completed.
protected  void onLayoutEdgeSubgraph(VisualSubgraph visualsubgraph)
          This method will be called by applyEdgeLayout() for each subgraph for which an edge layout will be performed.
protected  void onLayoutSubgraph(VisualSubgraph visualsubgraph)
          This method will be called by apply() for each subgraph for which a layout is to be performed.
 boolean registerLayout(EdgeLayout edgeLayout)
          This method should be used to add a new EdgeLayout object into the edge layout pool.
 boolean registerLayout(NodeLayout nodeLayout)
          This method should be used to add a new NodeLayout object into the node layout pool.
 boolean registerLayoutEngine(EdgeLayout edgeLayout)
          Deprecated. Please use registerLayout(EdgeLayout) instead. The method is about to be removed in future releases.
 boolean registerLayoutEngine(NodeLayout layoutEngine)
          Deprecated. Please use registerLayout(NodeLayout) instead. The method is about to be removed in future releases.
 void removeAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
          Removes a listener from the attributable on set instance.
 boolean removeLayoutContext(java.lang.String layoutContext)
          Removes the specified layout context.
 void removeProgressListener(ProgressListener progresslistener)
          Removes the specified Progress-listener.
 void setAnimateDuration(int duration)
          Configures the animation duration time for the layout process.
 void setAttribute(Attribute attribute)
          Sets the value of the attribute with the same name to the value of the given attribute.
 void setAttributes(AttributeSet set)
          Searches within the AttributeSet given by attributes for attributes that have the same name as the attributes of this AttributableOnSet holds.
 void setAttributesTree(AttributeSet attributes)
          Performs the same operation as the setAttributes(com.tensegrity.generic.attribute.AttributeSet) method with the difference that the AttributeSet given to this method must provide the treelike structure mentioned in the documentation of the getAttributesTree().
 void setAttributesTree(AttributeSet attributes, VisualSubgraph subgraph)
          This method use the input attributes to configure the layout contexts specified by nodeContext, edgeContext and itself.
 void setAttributeValue(java.lang.String name, java.lang.Object value)
          Sets the value of the attribute with the name to the given value.
 void setAutomaticPortReassignment(boolean reassignPorts)
          Specifies whether the edges can be automatically reassigned to different ports of a node.
 void setAutomaticPortReassignmentDirectionDependent(boolean enable)
          Enables or disables the direction-dependent port reassignment mode, which authorizes or prevents the responsible layouter from reassigning edges to an appropriate port.
protected  void setBorder(VisualSubgraph visualsubgraph)
          This method may be used for a subgraph to ensure that the associated edge layouter keeps edges inside subgraph area.
 void setChanged()
          Sets the state to changed and notifies all registered observers.
 void setChanged(java.lang.Object arg)
          Sets the state to changed and notifies all registered observers with the given arg.
 void setConfiguration(AttributeSet attributes)
          This method uses the passed AttributeSet to configure itself and all used layout contexts.
 void setEdgeLayoutContext(java.lang.String layoutContext)
          This helper method can be used to set the edge layout context for a VisualGraph.
 void setGraphPosition(int x, int y)
          Sets the left/top-position of the graph after the layout process.
 void setIgnoreIsolatedNodes(boolean ignore)
          This method configures isolated nodes to be included or excluded from the layout process.
 boolean setLayoutAttribute(java.lang.String layoutContext, java.lang.String key, java.lang.Object value)
          This method may be used to change the value of a particular attribute of a layout context.
 boolean setLayoutAttributeSet(java.lang.String layoutContext, AttributeSet attributeSet)
          Sets the AttributeSet of the specified layout context.
 void setLayoutContext(java.lang.String layoutContext)
          Deprecated. use setNodeLayoutContext(String) and setEdgeLayoutContext(String) instead.
 void setLayoutDomain(int layoutDomain)
          Sets the layout domain, which determines which part of the graph should be arranged.
 void setLayoutEdgesContextDepended(boolean depended)
          Deprecated. After redesign of the Layout it is not necessary to use this method anymore.
protected  void setLayoutService(LayoutService service)
          Deprecated. The LayoutService class is about to be removed in future releases. All methods are available at the base LayoutController class now.
 void setNodeLayoutContext(java.lang.String layoutContext)
          This helper method can be used to set the node layout context for a VisualGraph.
 void setVisualGraphObjectContainer(VisualGraphObjectContainer vgoc)
          Sets the VisualGraphObjectContainer that is to be associated.
 java.lang.String toString()
           
 void updateLayoutAttributeSet(java.lang.String layoutContext, AttributeSet layoutAttribute)
          This method updates the specified AttributeSet by modifying the attributes that depend on the current layout style.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WHOLE_GRAPH

public static final java.lang.String WHOLE_GRAPH
See Also:
Constant Field Values

SELECTED_GROUPS

public static final java.lang.String SELECTED_GROUPS
See Also:
Constant Field Values

ANIMATION_TIME

public static final java.lang.String ANIMATION_TIME
See Also:
Constant Field Values

ENABLE_ANIMATION

public static final java.lang.String ENABLE_ANIMATION
See Also:
Constant Field Values

LAYOUT_DOMAIN

public static final java.lang.String LAYOUT_DOMAIN
See Also:
Constant Field Values

DEPENDING_ON_LAYOUT_DIRECTION

public static final java.lang.String DEPENDING_ON_LAYOUT_DIRECTION
See Also:
Constant Field Values

DYNAMIC_PORT_REASSIGNMENT

public static final java.lang.String DYNAMIC_PORT_REASSIGNMENT
See Also:
Constant Field Values

RELAYOUT_EDGES_ON_CHANGE

public static final java.lang.String RELAYOUT_EDGES_ON_CHANGE
See Also:
Constant Field Values

RELAYOUT_NODES_ON_CHANGE

public static final java.lang.String RELAYOUT_NODES_ON_CHANGE
See Also:
Constant Field Values

IGNORE_UNCONNECTED_NODES

public static final java.lang.String IGNORE_UNCONNECTED_NODES
See Also:
Constant Field Values

OTHER_OPTIONS

public static final java.lang.String OTHER_OPTIONS
See Also:
Constant Field Values

EDGE_OPTIONS

public static final java.lang.String EDGE_OPTIONS
See Also:
Constant Field Values

NODE_OPTIONS

public static final java.lang.String NODE_OPTIONS
See Also:
Constant Field Values

ATTRIBUTENAME_GLOBAL_SETTINGS

public static final java.lang.String ATTRIBUTENAME_GLOBAL_SETTINGS
See Also:
Constant Field Values

ATTRIBUTENAME_NODE_LAYOUT

public static final java.lang.String ATTRIBUTENAME_NODE_LAYOUT
See Also:
Constant Field Values

ATTRIBUTENAME_EDGE_LAYOUT

public static final java.lang.String ATTRIBUTENAME_EDGE_LAYOUT
See Also:
Constant Field Values

ATTRIBUTENAME_LAYOUT_CONTEXT

public static final java.lang.String ATTRIBUTENAME_LAYOUT_CONTEXT
See Also:
Constant Field Values

ATTRIBUTENAME_LAYOUT_SETTING

public static final java.lang.String ATTRIBUTENAME_LAYOUT_SETTING
See Also:
Constant Field Values

LAYOUTDOMAIN_USED

public static final java.lang.String LAYOUTDOMAIN_USED
XML tag: Indicates the current layout domain.

See Also:
Constant Field Values

LAYOUTDOMAIN_WHOLE

public static final java.lang.String LAYOUTDOMAIN_WHOLE
XML tag: Specifies the value "All" for the attribute LAYOUTDOMAIN_USED.

See Also:
Constant Field Values

LAYOUTDOMAIN_SELECTION

public static final java.lang.String LAYOUTDOMAIN_SELECTION
XML tag: Specifies the value "Selected groups" for the attribute LAYOUTDOMAIN_USED.

See Also:
Constant Field Values

DYNAMICNODELAYOUT

public static final java.lang.String DYNAMICNODELAYOUT
XML tag: Indicates whether the nodes must be laid outed automatically after user interactions.

See Also:
Constant Field Values

DYNAMICEDGELAYOUT

public static final java.lang.String DYNAMICEDGELAYOUT
XML tag: Indicates whether the edges must be laid outed automatically after user interactions.

See Also:
Constant Field Values

ANIMATIONENABLED

public static final java.lang.String ANIMATIONENABLED
XML tag: Indicates whether the animation is enabled.

See Also:
Constant Field Values

ANIMATIONDURATION

public static final java.lang.String ANIMATIONDURATION
XML tag: Specifies the animation time.

See Also:
Constant Field Values

DEFAULTNODELAYOUTCONTEXT

public static final java.lang.String DEFAULTNODELAYOUTCONTEXT
XML tag: Specifies the node layout context for the main graph.

See Also:
Constant Field Values

DEFAULTEDGELAYOUTCONTEXT

public static final java.lang.String DEFAULTEDGELAYOUTCONTEXT
XML tag: Specifies the edge layout context for the main graph.

See Also:
Constant Field Values

GLOBAL_CONFIGURATION

public static final java.lang.String GLOBAL_CONFIGURATION
XML tag for common options.

See Also:
Constant Field Values

state

protected int state
Indicates the current layout state.

See Also:
getState()

INACTIVE

public static final int INACTIVE
Layout state specifier. Indicates that the layout process is inactive.

See Also:
getState(), Constant Field Values

ACTIVE

public static final int ACTIVE
Layout state specifier. Indicates that the layout process is running.

See Also:
getState(), Constant Field Values

ACTIVE_NODELAYOUT

public static final int ACTIVE_NODELAYOUT
Layout state specifier. Indicates that the layout process is arranging nodes.

See Also:
getState(), Constant Field Values

ACTIVE_EDGELAYOUT

public static final int ACTIVE_EDGELAYOUT
Layout state specifier. Indicates that the layout process is arranging edges.

See Also:
getState(), Constant Field Values

DYNAMIC

public static final int DYNAMIC
Layout state specifier. Indicates that the layout process is triggered by dynamic layout.

See Also:
getState(), Constant Field Values

layoutDomain

protected int layoutDomain
Indicates the current layout domain.


LAYOUTDOMAIN_ALL

public static final int LAYOUTDOMAIN_ALL
Layout domain specifier. Layout will be applied on whole graph.

See Also:
Constant Field Values

LAYOUTDOMAIN_CONSIDER_SELECTED_GROUPS

public static final int LAYOUTDOMAIN_CONSIDER_SELECTED_GROUPS
Layout domain specifier. Layout will be applied on selected subgraph if any; otherwise the layout will be applied on the main graph and the subgraphs will be ignored.

See Also:
Constant Field Values

observable

protected Observable observable
layout observer to update view during animation.


visualGraphView

protected VisualGraphView visualGraphView
The VisualGraphView with which this instance of a LayoutController associates.


visualGraphObjectContainer

protected VisualGraphObjectContainer visualGraphObjectContainer
The VisualGraphObjectContainer with which this instance of a LayoutController associates.


nodeLayoutContext

protected java.lang.String nodeLayoutContext
Specifies the node layout context for the main graph.


edgeLayoutContext

protected java.lang.String edgeLayoutContext
Specifies the edge layout context for the main graph.


strErrorMessage

protected java.lang.String strErrorMessage
Variable to store the error messages during the layout process


dynamicNodeLayout

protected boolean dynamicNodeLayout
Indicates whether the nodes must be laid outed automatically after user interactions.


dynamicEdgeLayout

protected boolean dynamicEdgeLayout
Indicates whether the edges must be laid outed automatically after user interactions.


animationDuration

protected int animationDuration
Indicates the animation duration.


animation

protected boolean animation
Indicates the animation state.

Constructor Detail

LayoutController

protected LayoutController()
Constructs a new LayoutController instance.


LayoutController

public LayoutController(boolean createDefaultContexts)
Constructs a new OrgChartLayoutController instance.

Parameters:
createDefaultContexts - determines whether the new instance of this class should be initialized with default default layout contexts or not

LayoutController

protected LayoutController(LayoutController layoutController,
                           VisualGraphObjectContainer visualGraphObjectContainer)
Copy constructor for the LayoutController instance.

Parameters:
layoutController - the instance to copy data from.
visualGraphObjectContainer - the VisualGraphObjectContainer the copy is to be associated with.
Method Detail

getState

public int getState()
Returns the current state of the layout process.

Returns:
return an integer that indicates the current state of the layout process. It can be a combination of the following values: INACTIVE, ACTIVE, ACTIVE_NODELAYOUT, ACTIVE_EDGELAYOUT and DYNAMIC;

setLayoutService

protected final void setLayoutService(LayoutService service)
Deprecated. The LayoutService class is about to be removed in future releases. All methods are available at the base LayoutController class now.

Sets the LayoutService that should be used.

Parameters:
service - the LayoutService.

getLayoutService

public final LayoutService getLayoutService()
Deprecated. The LayoutService class is about to be removed in future releases. All methods are available at the LayoutController class now.

Gets the LayoutService that is used.

Returns:
the instance of the layout-service is using.

init

protected abstract void init()
This method must be overwritten by derived LayoutControllers. It should be used to register necessary Layout and define the according layout-contexts.


getLayoutContext

public final java.lang.String getLayoutContext()
Deprecated. use getNodeLayoutContext() and getEdgeLayoutContext() instead.

Gets the default layout-context that is used.

Returns:
the layout-context that is used.
See Also:
apply()

setLayoutContext

public void setLayoutContext(java.lang.String layoutContext)
Deprecated. use setNodeLayoutContext(String) and setEdgeLayoutContext(String) instead.

Sets the default layout-context to use.

Parameters:
layoutContext - the layout-context to use.
See Also:
apply()

getVisualGraphObjectContainer

public VisualGraphObjectContainer getVisualGraphObjectContainer()
Gets the associated VisualGraphObjectContainer.

Returns:
the associated VisualGraphObjectContainer.

setVisualGraphObjectContainer

public void setVisualGraphObjectContainer(VisualGraphObjectContainer vgoc)
Sets the VisualGraphObjectContainer that is to be associated.
Notice: It is not necessary to invoke this method explicitly if the method VisualGraphView.setLayoutController(LayoutController) was used since the VisualGraphView calls this method internally.

Parameters:
vgoc - the associated VisualGraphObjectContainer.

isRecursive

protected final boolean isRecursive()
Deprecated. The recursive behavior of layout can be also influenced by layout domain. Please use the methods setLayoutDomain(int) and getLayoutDomain() instead.

Returns whether this instance performs a recursive layout.

Returns:
true when this instance performs a recursive layout.

apply

public boolean apply()
This method applies a layout on the visual nodes and edges of the associated VisualGraphObjectContainer which should, together with an appropriate edge layout context and node layout context, be set in advance. You can set the layout contexts for the main graph and nested subgraphs by invoking methods Layoutable.setNodeLayoutContext(String) and Layoutable.setEdgeLayoutContext(String) or the helper method pair setNodeLayoutContext(String) and setEdgeLayoutContext(String). This method processes subgraphs recursively in a post-order tree traversal. Please note that for a recursive layout, the algorithm is applied to all subgraphs before their parents. The methods onBeginVisualSubgraphLayout(VisualSubgraph) and onLayoutSubgraph(VisualSubgraph) will be triggered for each subgraph. The methods onBeginLayout() and onEndLayout() will be triggered before and after the main graph is arranged respectively.
Notice: The layout area is restricted according to the current layout domain. Please see getLayoutDomain() for more information.

Returns:
true if the function was successful; otherwise false, in which case the method getErrorMessage() could be used to obtain details about the error.
See Also:
setVisualGraphObjectContainer(VisualGraphObjectContainer), setNodeLayoutContext(String), setEdgeLayoutContext(String), apply(List, String, String), apply(String), getLayoutDomain()

Find more information in the class documentation


apply

protected boolean apply(boolean doUndoRedo)

apply

public boolean apply(java.util.List objectList,
                     java.lang.String nodeLayoutContext,
                     java.lang.String edgeLayoutContext)
This method applies a layout on the nodes and edges specified in the passed List of visual graph objects. The method uses the specified node layout context and edge layout context to layout the graph. Please note that this method does not layout recursively. You should use method apply() if you need to layout nested graphs. The method onBeginLayout() will be triggered before the layout process is started and the method onEndLayout() will be called after the layout process has been completed.

Parameters:
objectList - The list of VisualNode and VisualEdge objects that should be arranged.
nodeLayoutContext - The node layout context that should be used to arrange nodes of the graph.
edgeLayoutContext - The edge layout context that should be used to arrange edges of the graph.
Returns:
true if the function was successful; otherwise false, in which case the method getErrorMessage() could be used to obtain details about the error.
See Also:
apply(), apply(String)

Find more information in the class documentation


apply

protected boolean apply(java.util.List objectList,
                        java.lang.String nodeLayoutContext,
                        java.lang.String edgeLayoutContext,
                        boolean doUndoRedo)
This method is an extended function of the method apply(List, String, String). Please read apply(List, String, String) for more information.

Parameters:
objectList - The list of VisualNode and VisualEdge objects that should be arranged.
nodeLayoutContext - The node layout context that should be used to arrange nodes of the graph.
edgeLayoutContext - The edge layout context that should be used to arrange edges of the graph.
doUndoRedo - determines whether the layout action should be registered by the redo/undo engine.
Returns:
true if the function was successful; otherwise false, in which case the method getErrorMessage() could be used to obtain details about the error.
See Also:
apply(List, String, String), apply(), apply(String)

apply

public boolean apply(java.lang.String nodeLayoutContext)
This method applies a layout algorithm on nodes and edges of the associated VisualGraphObjectContainer. This method calls setNodeLayoutContext(String) and apply() internally. For more details please see setNodeLayoutContext(String) and apply().

Parameters:
nodeLayoutContext - The node layout context that should be used to arrange nodes of the graph.
Returns:
true if the layout process was successful, otherwise false.
See Also:
apply(), apply(List, String, String)

Find more information in the class documentation


applyEdgeLayout

public final boolean applyEdgeLayout()
Applies a layout on the edges of the associated VisualGraphObjectContainer. The purpose of this method is to perfect the layout of visual edges without moving any nodes. The associated VisualGraphObjectContainer and specified edge layout context for the main graph and contained subgraphs should be set in advance. You can set the edge layout context for the main graph and contained subgraphs either by invoking method Layoutable.setEdgeLayoutContext(String) directly or by calling the helper method setNodeLayoutContext(String). This method processes subgraphs recursively in a post-order tree traversal. Please note that for a recursive layout, the algorithm is applied to all subgraphs before their parents. The method onLayoutEdgeSubgraph(VisualSubgraph) will be invoked for each subgraph. The method pair onBeginLayout() and onEndLayout() will be triggered for the main graph before and after the layout process.
Notice: You don't need to call this method immediately after one of the methods apply(), apply(List, String, String) or apply(String) are invoked since these methods arrange not only nodes of the given graph but also its edges.

Returns:
true if the function was successful, otherwise false, in which case the method getErrorMessage() should be invoked to obtain the error details.
See Also:
setVisualGraphObjectContainer(VisualGraphObjectContainer), setEdgeLayoutContext(String), apply()

Find more information in the class documentation


applyEdgeLayout

protected final boolean applyEdgeLayout(boolean doUndoRedo)
This method is a extended variant of the method applyEdgeLayout().

Parameters:
doUndoRedo - determines whether the layout action should be registered by the redo/undo engine.
Returns:
true if the function was successful, otherwise false, in which case the method getErrorMessage() should be invoked to obtain the error details.
See Also:
applyEdgeLayout()

addErrorMessage

protected final void addErrorMessage(java.lang.String msg)
Adds a message text to the current error message.

Parameters:
msg - the error message that should be added.

deepCopy

public abstract LayoutController deepCopy(VisualGraphObjectContainer visualGraphObjectContainer)
Override this method with a meaningful deep-copy operation that returns a new independent layout-controller associated with the given VisualGraphObjectContainer.

Parameters:
visualGraphObjectContainer - the VisualGraphObjectContainer the copy is to be associated with.
Returns:
a deep-copy of the instance.

onBeginLayout

protected void onBeginLayout()
Override this method with code that should be performed when the layout is about to begin.

Find more information in the class documentation


onEndLayout

protected void onEndLayout()
Override this method with code that should be performed when the layout has completed.

Find more information in the class documentation


journalStartLayout

protected final void journalStartLayout()
In case this LayoutController instance is associated to an instance of a VisualGraphView this method opens an undo-redo layout tag for the current VisualGraphObjectContainer.
Notice: Calling this method requires a call to journalStopLayout() after the layout operation has been performed!
This method has to be called before the layout of a VisualGraphObjectContainer otherwise the a layout operation made upon that VisualGraphObjectContainer is NOT covered by the undo-redo mechanism.

See Also:
#undo_redoStopAction

journalStopLayout

protected final void journalStopLayout()
In case this LayoutController instance is associated to an instance of a VisualGraphView this method closes an undo-redo layout tag for the current VisualGraphObjectContainer.
Notice: Calling this method requires a call to journalStartLayout() before the layout operation has been performed!
This method has to be called before the layout of a VisualGraphObjectContainer otherwise the a layout operation made upon that VisualGraphObjectContainer is NOT covered by the undo-redo mechanism.


onBeginLoading

public void onBeginLoading()
This method should be called to indicate the layoutController that the loading process is going to start. Notice: Usually this method is not invoked directly by the client. Instead it is invoked by the framework internally.

See Also:
onEndLoading()

onEndLoading

public void onEndLoading()
This method should be triggered to indicate the layoutController that the loading process is finished. Notice: Usually this method is not invoked directly by the client. Instead it is invoked by the framework internally.

See Also:
onBeginLoading()

onBeginVisualSubgraphLayout

protected void onBeginVisualSubgraphLayout(VisualSubgraph visualsubgraph)
Override this method with code that should be performed before a layout on a VisualSubgraph is about to be performed.

Parameters:
visualsubgraph - the VisualSubgraph that was just arranged.

Find more information in the class documentation


onEndVisualSubgraphLayout

protected void onEndVisualSubgraphLayout(VisualSubgraph visualsubgraph)
Override this method with code that should be performed after layout on a VisualSubgraph has completed.

Parameters:
visualsubgraph - the VisualSubgraph instance that was just arranged.

Find more information in the class documentation


onLayoutSubgraph

protected void onLayoutSubgraph(VisualSubgraph visualsubgraph)
This method will be called by apply() for each subgraph for which a layout is to be performed.

Parameters:
visualsubgraph - The subgraph to layout.

Find more information in the class documentation


onBeginVisualSubgraphEdgeLayout

protected void onBeginVisualSubgraphEdgeLayout(VisualSubgraph visualsubgraph)
Override this method with code that should be performed before the edge layout is applied on a VisualSubgraph.

Parameters:
visualsubgraph - the VisualSubgraph which is about to be arranged.

onEndVisualSubgraphEdgeLayout

protected void onEndVisualSubgraphEdgeLayout(VisualSubgraph visualsubgraph)
Override this method with code that should be performed when the edge layout on a VisualSubgraph has completed.

Parameters:
visualsubgraph - the VisualSubgraph which is arranged previously.

onLayoutEdgeSubgraph

protected void onLayoutEdgeSubgraph(VisualSubgraph visualsubgraph)
This method will be called by applyEdgeLayout() for each subgraph for which an edge layout will be performed.

Parameters:
visualsubgraph - The subgraph of which the edges are to be layouted. layout_notify

Find more information in the class documentation


toString

public java.lang.String toString()

enableDynamicNodeLayout

public void enableDynamicNodeLayout(boolean layoutpremanent)
This method enables the automatic layout mode. If the dynamic node layout is active, the LayoutController will layout nodes and edges during user interaction and whenever it becomes necessary. In this mode users are not able to move nodes, because moving them would trigger a new layout process that would place them back into their original position.

Parameters:
layoutpremanent - true to enable dynamic layout, otherwise false.
See Also:
enableDynamicEdgeLayout(boolean), isDynamicNodeLayoutEnabled(), enableDynamicEdgeLayout(boolean)

Find more information in the class documentation


isDynamicNodeLayoutEnabled

public boolean isDynamicNodeLayoutEnabled()
This method indicates whether the dynamic node layout mode is enabled.

Returns:
true if the permanent node layout is enabled, otherwise false.
See Also:
enableDynamicNodeLayout(boolean)

Find more information in the class documentation


enableDynamicEdgeLayout

public void enableDynamicEdgeLayout(boolean layoutpremanent)
This method enables the dynamic edge layout mode. If the dynamic edge layout mode is enabled, the LayoutController will layout edges during user interaction.

Parameters:
layoutpremanent - true to enable dynamic layout, otherwise false.
See Also:
isDynamicEdgeLayoutEnabled(), enableDynamicNodeLayout(boolean)

Find more information in the class documentation


isDynamicEdgeLayoutEnabled

public boolean isDynamicEdgeLayoutEnabled()
This method returns the dynamic edge layout mode status.

Returns:
true if the dynamic edge layout is enabled, otherwise false.

Find more information in the class documentation


applyDynamic

public boolean applyDynamic()
This method causes the LayoutController to perform a single dynamic layout. Usually this method is not invoked directly by the client. Instead it is invoked by the framework internally during user interaction.
However it may be needed to invoke this method directly in case the graph was manipulated in a programmatically way that rendered it in a non layouted state.

Returns:
true if the layout was successful, otherwise false; in this case the method getErrorMessage() can be used to obtain a description of the error's reason.
See Also:
isDynamicLayoutSupported(), enableDynamicNodeLayout(boolean), enableDynamicEdgeLayout(boolean)

isDynamicLayoutSupported

public boolean isDynamicLayoutSupported()
Indicates whether the dynamic node layout or the dynamic edge layout is enabled. Usually this method is not invoked directly by the client. Instead it is invoked by the framework internally to find out whether invoking of applyDynamic() is appropriate.

Returns:
true it dynamic layout is supported, otherwise false
See Also:
applyDynamic()

setIgnoreIsolatedNodes

public void setIgnoreIsolatedNodes(boolean ignore)
This method configures isolated nodes to be included or excluded from the layout process.

Parameters:
ignore - true if the isolated nodes are to exclude.
See Also:
getIgnoreIsolatedNodes()

Find more information in the class documentation


getIgnoreIsolatedNodes

public boolean getIgnoreIsolatedNodes()
Indicates whether isolated nodes are excluded from layout process.

Returns:
true if the isolated nodes are ignored, otherwise false.
See Also:
setIgnoreIsolatedNodes(boolean)

Find more information in the class documentation


setAutomaticPortReassignment

public void setAutomaticPortReassignment(boolean reassignPorts)
Specifies whether the edges can be automatically reassigned to different ports of a node. If edges can be automatically reassigned, the method setAutomaticPortReassignmentDirectionDependent(boolean) can be invoked to specify whether the port reassignment should be performed by the responsible layouter or simply to the nearest available port.

Parameters:
reassignPorts - true if the ports should be reassigned.

Find more information in the class documentation


getAutomaticPortReassignment

public boolean getAutomaticPortReassignment()
Returns the status of the automatic port reassignment mode.

Returns:
true if the automatic port reassigning is enable; otherwise false.
See Also:
setAutomaticPortReassignment(boolean)

Find more information in the class documentation


setAutomaticPortReassignmentDirectionDependent

public void setAutomaticPortReassignmentDirectionDependent(boolean enable)
Enables or disables the direction-dependent port reassignment mode, which authorizes or prevents the responsible layouter from reassigning edges to an appropriate port. Depending on the layout style, automatic port reassignment is necessary to preserve the structure and form of the arranged graph. If this mode is disabled, edges will be simply reassigned to the nearest available port. This configuration method only has an effect if the general automatic port reassignment mode has been enabled. Please see the method setAutomaticPortReassignment(boolean) to enable and disable this mode.

Parameters:
enable - Set true to reassign ports layout dependent; or false to reconnect edges to the next ports.
See Also:
getAutomaticPortReassignmentDirectionDependent()

Find more information in the class documentation


getAutomaticPortReassignmentDirectionDependent

public boolean getAutomaticPortReassignmentDirectionDependent()
Indicates whether the direction-dependent port reassignment is active.

Returns:
true if enabled; otherwise false.

Find more information in the class documentation


setAnimateDuration

public void setAnimateDuration(int duration)
Configures the animation duration time for the layout process. The animation can be enabled or disabled by calling method enableAnimation(boolean).

Parameters:
duration - The total duration time in milliseconds
See Also:
enableAnimation(boolean), getAnimateDuration()

Find more information in the class documentation


getAnimateDuration

public int getAnimateDuration()
Returns the animation duration time in milliseconds.

Returns:
the animation duration time in milliseconds.
See Also:
setAnimateDuration(int), isAnimationEnabled()

Find more information in the class documentation


enableAnimation

public void enableAnimation(boolean enable)
Enables or disables the layout animation mode.

Parameters:
enable - true to enable animation or false to disable it

Find more information in the class documentation


isAnimationEnabled

public boolean isAnimationEnabled()
Indicates whether the animation mode is enabled.

Returns:
true if the animation mode is enabled; otherwise false.

Find more information in the class documentation


setLayoutEdgesContextDepended

public void setLayoutEdgesContextDepended(boolean depended)
Deprecated. After redesign of the Layout it is not necessary to use this method anymore.

Indicates whether the automatic edge layout is active.

Parameters:
depended - true if the edges are to be arranged by node layouter, or false if the edges should be arranged by a global edge layout.

getLayoutEdgesContextDepended

public boolean getLayoutEdgesContextDepended()
Indicates whether the edges are arranged context dependently or not.

Returns:
true if context depended edge layout is active.

setGraphPosition

public void setGraphPosition(int x,
                             int y)
Sets the left/top-position of the graph after the layout process.

Parameters:
x - the target x-position of the graph.
y - the target y-position of the graph.

getGraphPosition

public int[] getGraphPosition()
Returns the left/top-position of the graph after the layout process.

Returns:
an integer array of the length 2. the first field contains the x-position and the second field the y-position of the graph after layout.

setLayoutDomain

public void setLayoutDomain(int layoutDomain)
Sets the layout domain, which determines which part of the graph should be arranged. Valid domain values are:

Parameters:
layoutDomain - the layoutDomain to set.
See Also:
getLayoutDomain()

Find more information in the class documentation


getLayoutDomain

public int getLayoutDomain()
Returns the current layout domain. Valid domain values are:

Returns:
the return value can be one of the following:
See Also:
setLayoutDomain(int)

Find more information in the class documentation


getUsingLayoutContexts

public java.lang.String[] getUsingLayoutContexts()
This method returns an array of all layout context names that are actually used in the associated VisualGraphObjectContainer.

Returns:
The list of all edge and node layout contexts that are in use.
See Also:
getConfiguration(String[])

Find more information in the class documentation


getConfiguration

public AttributeSet getConfiguration(java.lang.String[] listOfLayoutContexts)
This method returns an AttributeSet holding all information about the current configuration. It contains the current settings of the LayoutController as well as the settings of the specified layout contexts passed. This method may be used to temporarily save and restore a LayoutController instance.

Parameters:
listOfLayoutContexts - The list of the layout contexts of which the attributes should be saved; or null if the configuration of all registered layout contexts is required.
Returns:
The requested AttributeSet.
See Also:
getUsingLayoutContexts(), setConfiguration(AttributeSet)

Find more information in the class documentation


setConfiguration

public void setConfiguration(AttributeSet attributes)
This method uses the passed AttributeSet to configure itself and all used layout contexts.

Parameters:
attributes - the AttributeSet that contains the global properties and the settings of layout contexts that should be used.
See Also:
getConfiguration(String[])

Find more information in the class documentation


addObserver

public void addObserver(Observer observer)
Adds an observer to the internally managed list of observers of this observable.

Parameters:
observer - the observer to add to the internal list.

deleteObserver

public void deleteObserver(Observer observer)
Deletes an observer from the internally managed list of observers of this observable.

Parameters:
observer - the observer to delete from the internal list.

setChanged

public void setChanged()
Sets the state to changed and notifies all registered observers.


setChanged

public void setChanged(java.lang.Object arg)
Sets the state to changed and notifies all registered observers with the given arg.

Parameters:
arg - additional argument to pass to the observers.

getAttributes

public AttributeSet getAttributes()
Description copied from interface: AttributableOnSet
Returns an AttributeSet consisting of all attributes of this AttributableOnSet.

Specified by:
getAttributes in interface AttributableOnSet
Returns:
AttributeSet an AttributeSet with all attributes.

setAttributes

public void setAttributes(AttributeSet set)
Description copied from interface: AttributableOnSet
Searches within the AttributeSet given by attributes for attributes that have the same name as the attributes of this AttributableOnSet holds. The value of every attribute that has the same name is used as the new value for the corresponding attribute of this AttributableOnSet. An Attribute within the given AttributeSet that is not an attribute of the object that implements the AttributableOnSet interface is not handled by nor added to the specific implementor of the AttributableOnSet interface.

Specified by:
setAttributes in interface AttributableOnSet
Parameters:
set - the AttributeSet consisting of the attributes whose values to set.

getAttributesTree

public AttributeSet getAttributesTree()
Description copied from interface: AttributableOnSet
Returns an AttributeSet containing all Attributes of this AttributableOnSet in a treelike structure.
Treelike means that each attribute can have a subset that contains subsequent Attributes for an Attribute of this AttributableOnSet.
Since an Attribute can only have one value (in this case an object or the Attributes for an object) the subsequent attributes are plugged into the returned AttributeSet as a new Attribute with the same name and the AttributableOnSet.TREE_SUBSET_POSTFIX.

Specified by:
getAttributesTree in interface AttributableOnSet
Returns:
AttributeSet an AttributeSet with the attributes in a treelike structure

getAttributesTree

public final AttributeSet getAttributesTree(java.lang.String nodeContext,
                                            java.lang.String edgeContext)
This method returns an AttributeSet that consist of common options, attributes of the specified by nodeContext and edgeContext.
Notice: Usually this method is not invoked directly by the client. Instead it is invoked by the framework internally.

Parameters:
nodeContext - The node layout context of which the attribute is requested.
edgeContext - The edge layout context of which the attribute is requested.
Returns:
The attributes of the specified nodeContext and edgeContext and the current setting of the class instance.

getNodeLayoutContextConstraint

public Constraint getNodeLayoutContextConstraint()
Returns an EnumConstraint that contains all valid node layout contexts

Returns:
an EnumConstraint that contains all valid node layout contexts

getEdgeLayoutContextConstraint

public Constraint getEdgeLayoutContextConstraint()
Returns an EnumConstraint that contains all valid edge layout contexts

Returns:
an EnumConstraint that contains all valid edge layout contexts

setAttributesTree

public void setAttributesTree(AttributeSet attributes)
Description copied from interface: AttributableOnSet
Performs the same operation as the AttributableOnSet.setAttributes(com.tensegrity.generic.attribute.AttributeSet) method with the difference that the AttributeSet given to this method must provide the treelike structure mentioned in the documentation of the AttributableOnSet.getAttributesTree().

Specified by:
setAttributesTree in interface AttributableOnSet
Parameters:
attributes - the AttributeSet containing the attributes whose values to set.

setAttributesTree

public void setAttributesTree(AttributeSet attributes,
                              VisualSubgraph subgraph)
This method use the input attributes to configure the layout contexts specified by nodeContext, edgeContext and itself.
Notice: Usually this method is not invoked directly by the client. Instead it is invoked by the framework internally.

Parameters:
attributes - The attributes with the necessary information.
subgraph - The subgraph of which the context should be set.

addAttributableOnSetListener

public void addAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
Description copied from interface: AttributableOnSet
Adds a listener to the attributable on set instance.

Specified by:
addAttributableOnSetListener in interface AttributableOnSet
Parameters:
attributableOnSetListener - an AttributableOnSet listener listening for changes

removeAttributableOnSetListener

public void removeAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
Description copied from interface: AttributableOnSet
Removes a listener from the attributable on set instance.

Specified by:
removeAttributableOnSetListener in interface AttributableOnSet
Parameters:
attributableOnSetListener - the AttributableOnSet to be removed from the list of listeners.

enableAttributableEvents

public void enableAttributableEvents()
Description copied from interface: AttributableOnSet
Enables the transmission of events to registered listeners.

Specified by:
enableAttributableEvents in interface AttributableOnSet

disableAttributableEvents

public void disableAttributableEvents()
Description copied from interface: AttributableOnSet
Disables events for the registered listeners.

Specified by:
disableAttributableEvents in interface AttributableOnSet

areAttributableEventsEnabled

public boolean areAttributableEventsEnabled()
Description copied from interface: AttributableOnSet
Returns a boolean that indicates whether generating of events is enabled or not.

Specified by:
areAttributableEventsEnabled in interface AttributableOnSet
Returns:
boolean flag that indicates whether event generation is active or not

getAttribute

public Attribute getAttribute(java.lang.String name)
Description copied from interface: Attributable
Returns the attribute with the given name or null if there is no Attribute with the given name.

Specified by:
getAttribute in interface Attributable
Parameters:
name - name of the attribute to return.
Returns:
the attribute with the given name or null.

setAttribute

public void setAttribute(Attribute attribute)
                  throws IllegalValueException,
                         ConstraintViolationException
Description copied from interface: Attributable
Sets the value of the attribute with the same name to the value of the given attribute.
Notice: If the specific implementor of the Attributable interface doesn't support an Attribute with the name of the Attribute given by attribute, the given attribute is not handled by nor added to the attributes of the Attributable.

Specified by:
setAttribute in interface Attributable
Parameters:
attribute - the attribute to be set.
Throws:
ConstraintViolationException - is thrown when the value of the given Attribute violates the constraint of the Attribute to set.
IllegalValueException - is thrown when the value of the given Attribute is illegal (for instance when it is null).

getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String name)
Description copied from interface: Attributable
Return the value of the attribute with the given name.

Specified by:
getAttributeValue in interface Attributable
Parameters:
name - the name of the attribute to return the value from.
Returns:
the value of the attribute with the given name.

setAttributeValue

public void setAttributeValue(java.lang.String name,
                              java.lang.Object value)
                       throws IllegalValueException,
                              ConstraintViolationException
Description copied from interface: Attributable
Sets the value of the attribute with the name to the given value.
Notice: If the specific implementor of the Attributable interface doesn't support an Attribute with the name given by name, the attribute given through name and value is not handled nor created by Attributable.

Specified by:
setAttributeValue in interface Attributable
Parameters:
name - the name of the attribute.
value - the value to set the attributes value to.
Throws:
ConstraintViolationException - is thrown when the given value violates the constraint of the Attribute to set.
IllegalValueException - is thrown when the given value is illegal (for instance when it is null).

getAttributeType

public AttributeType getAttributeType(java.lang.String name)
Description copied from interface: Attributable
Returns the AttributeType of the attribute with the given name.

Specified by:
getAttributeType in interface Attributable
Parameters:
name - the name of the attribute.
Returns:
the attribute type with given name.

registerLayoutEngine

public boolean registerLayoutEngine(NodeLayout layoutEngine)
Deprecated. Please use registerLayout(NodeLayout) instead. The method is about to be removed in future releases.

This method can be used to add a new Layout for nodes into the node layout pool.

Parameters:
layoutEngine - The new Layout that should be registered.
Returns:
true if the registering was successful.

registerLayout

public boolean registerLayout(NodeLayout nodeLayout)
This method should be used to add a new NodeLayout object into the node layout pool.
Notice: The LayoutController allows clients to access a Layout only by an alias name, the so-called layout context. The method addLayoutContext(String, String) must be used to create at least one valid alias. *

Parameters:
nodeLayout - The new NodeLayout that should be registered.
Returns:
true if the registration was successful.

Find more information in the class documentation


registerLayoutEngine

public boolean registerLayoutEngine(EdgeLayout edgeLayout)
Deprecated. Please use registerLayout(EdgeLayout) instead. The method is about to be removed in future releases.

This method should be used to add a new EdgeLayout into the edge layout pool.

Parameters:
edgeLayout - The new Layout that should be registered.
Returns:
true if the registering was successful.

registerLayout

public boolean registerLayout(EdgeLayout edgeLayout)
This method should be used to add a new EdgeLayout object into the edge layout pool.
Notice: The LayoutController allows clients to access a Layout by an alias name, the so-called layout context.. The method addLayoutContext(String, String) must be used to create at least one valid alias.

Parameters:
edgeLayout - The new EdgeLayout that should be registered.
Returns:
true if the registering was successful.

Find more information in the class documentation


addLayoutContext

public boolean addLayoutContext(java.lang.String baseLayouter,
                                java.lang.String layoutContext)
Creates a new layout context and adds it to the pool of layout contexts. The specified baseLayouter can be either a NodeLayout or an EdgeLayout.

Parameters:
baseLayouter - The name of base Layout . The Layout should be registered earlier. See registerLayout(NodeLayout) or registerLayout(EdgeLayout).
layoutContext - The name for the new layout context Node: A new layout context must be unique. You can use the method isValidLayoutContext(String) to check whether the provided name already exists.
Returns:
true if the function was successful, or false if the name of the specified layout context already exists or the specified baseLayouter is not valid.
See Also:
registerLayout(EdgeLayout), registerLayout(NodeLayout), removeLayoutContext(String), duplicateLayoutContext(String, String)

Find more information in the class documentation


duplicateLayoutContext

public AttributeSet duplicateLayoutContext(java.lang.String templateLayoutContext,
                                           java.lang.String newLayoutContext)
Creates a copy of an existing layout context.

Parameters:
templateLayoutContext - The layout context that should be copied.
newLayoutContext - The name of the new copy.
Returns:
the AttributeSet of the created layout context.

Find more information in the class documentation


removeLayoutContext

public boolean removeLayoutContext(java.lang.String layoutContext)
Removes the specified layout context.

Parameters:
layoutContext - The layout context that should be removed.
Returns:
true if the operation was successful

Find more information in the class documentation


isValidLayoutContext

public boolean isValidLayoutContext(java.lang.String layoutContext)
Checks whether the specified layout context is valid.

Parameters:
layoutContext - layout context that is to verify.
Returns:
true if the specified layout context is valid; otherwise false.

getBaseLayoutEngine

public java.lang.String getBaseLayoutEngine(java.lang.String layoutContext)
Deprecated. Please use getBaseLayouter(String) instead. The method is about to be removed in future releases.

This method returns the base Layout of an specified layout contexts.

Parameters:
layoutContext - The layout context of which the base Layout is requested.
Returns:
The base layouter that the specified layout context underlies. The return value is null if the specified layout context is not valid.

getBaseLayouter

public java.lang.String getBaseLayouter(java.lang.String layoutContext)
This method returns the base Layout of an specified layout contexts.

Parameters:
layoutContext - The layout context of which the base Layout is requested.
Returns:
The base layouter that the specified layout context underlies. The return value is null if the specified layoutContext is not valid.

getLayoutContextList

public java.lang.String[] getLayoutContextList()
This method returns an array of all defined layout contexts. It includes both node layout contexts and edge layout contexts.
Notice: The method isNodeLayoutContext(String) can be used to find out whether a specified layout context is associated with a NodeLayout or with an EdgeLayout.

Returns:
a string array which contains the list of all existing layout contexts.
See Also:
getLayoutContextList(String), getNodeLayoutContextList(), getEdgeLayoutContextList()

Find more information in the class documentation


getLayoutContextList

public java.lang.String[] getLayoutContextList(java.lang.String baseLayouter)
This method returns the list of defined layout contexts that associate with a particular Layout .

Parameters:
baseLayouter - The Layout of which the associated layout contexts is requested.
Returns:
a list of the layout contexts that associate with the Layout specified by baseLayouter.

getNodeLayoutContextList

public java.lang.String[] getNodeLayoutContextList()
This method returns the list of all defined node layout contexts.

Returns:
a string array which contains the list of all node layout contexts.

Find more information in the class documentation


getEdgeLayoutContextList

public java.lang.String[] getEdgeLayoutContextList()
This method returns the list of all defined edge layout contexts.

Returns:
a String array which contains the list of all edge layout contexts.

Find more information in the class documentation


isNodeLayoutContext

public boolean isNodeLayoutContext(java.lang.String layoutContext)
Returns true if the specified layoutContext is associated with a NodeLayout, otherwise false.

Parameters:
layoutContext - the context that should be checked.
Returns:
true if the specified layoutContext is associated with a NodeLayout otherwise false.

getNodeLayouterList

public java.lang.String[] getNodeLayouterList()
This method returns an array of unique names of all registered node layout contexts.

Returns:
string array of registered node layout contexts.
See Also:
getEdgeLayouterList()

Find more information in the class documentation


getEdgeLayouterList

public java.lang.String[] getEdgeLayouterList()
This method returns an array of unique names of all registered edge layout contexts.

Returns:
a String array of registered edge layout contexts.
See Also:
getNodeLayouterList()

Find more information in the class documentation


getNodeLayoutContext

public final java.lang.String getNodeLayoutContext()
Gets the current node layout context. Please note that the return value is dependent on the current layout domain and thus could be dependent on current selection. You can also obtain the node layout context of a graph directly by invoking method Layoutable.getNodeLayoutContext()

Returns:
a String identifying the currently used node layout context.
See Also:
getLayoutDomain(), getEdgeLayoutContext()

Find more information in the class documentation


setNodeLayoutContext

public void setNodeLayoutContext(java.lang.String layoutContext)
This helper method can be used to set the node layout context for a VisualGraph. Please note that this method changes the edge layout context according to the current layout domain and thus can be dependent on the current selection. You can also set the layout context of a graph directly by using invoking method Layoutable.setNodeLayoutContext(String)

Parameters:
layoutContext - the layout-context to use.
See Also:
setLayoutDomain(int)

Find more information in the class documentation


getPreviousNodeLayoutAttributeMap

public final java.util.Map getPreviousNodeLayoutAttributeMap()

getPreviousNodeLayoutContextMap

public final java.util.Map getPreviousNodeLayoutContextMap()

getEdgeLayoutContext

public final java.lang.String getEdgeLayoutContext()
Gets the current edge layout context. Please note that the return value is dependent on the current layout domain and thus could be dependent on current selection. You can also obtain the edge layout context of a graph directly by invoking method Layoutable.getEdgeLayoutContext()

Returns:
the current edge layout context.
See Also:
getLayoutDomain(), getNodeLayoutContext()

Find more information in the class documentation


setEdgeLayoutContext

public void setEdgeLayoutContext(java.lang.String layoutContext)
This helper method can be used to set the edge layout context for a VisualGraph. Please note that this method changes the edge layout context according to the current layout domain and thus can be dependent on the current selection. You can also set the layout context of a graph directly by invoking method Layoutable.setEdgeLayoutContext(String)

Parameters:
layoutContext - the layout-context to use.
See Also:
setLayoutDomain(int)

Find more information in the class documentation


getPreviousEdgeLayoutAttributeMap

public final java.util.Map getPreviousEdgeLayoutAttributeMap()

getPreviousEdgeLayoutContextMap

public final java.util.Map getPreviousEdgeLayoutContextMap()

getNodeDefaultLayoutAttributes

public AttributeSet getNodeDefaultLayoutAttributes(java.lang.String layoutContext)
This method returns the default node attributes of the Layout which underlies the specified layoutContext.
Notice: The default node attributes are not to be confused with layout attributes which can set by setLayoutAttribute(String, String, Object) and setLayoutAttributeSet(String, AttributeSet). The layout attributes configure the layout as a whole. But some Layout also accept configuration of nodes to allow different treatment.

Parameters:
layoutContext - specifies the layout context.
Returns:
the default AttributeSet which the associated Layout provides. The return value may be null since some Layout do not offer special attributes for nodes.
See Also:
AttributeSet, getEdgeDefaultLayoutAttributes(String)

getEdgeDefaultLayoutAttributes

public AttributeSet getEdgeDefaultLayoutAttributes(java.lang.String layoutContext)
This method returns the default edge attributes of the Layout which underlies the specified layoutContext.
Notice: The default egde attributes are not to be confused with layout attributes which can set by setLayoutAttribute(String, String, Object) and setLayoutAttributeSet(String, AttributeSet). The layout attributes configure the layout as a whole. But some Layout also accept configuration of edges to allow different treatment.

Parameters:
layoutContext - specifies the layout context.
Returns:
the default AttributeSet which the associated Layout provides. The return value may be null since some Layout do not offer special attributes for edges.
See Also:
AttributeSet, getNodeDefaultLayoutAttributes(String)

getLayoutAttributeSet

public AttributeSet getLayoutAttributeSet(java.lang.String layoutContext)
Returns the AttributeSet of the specified layout context.

Parameters:
layoutContext - The layout context of which the attribute set is requested.
Returns:
the AttributeSet of specified layout context.
See Also:
setLayoutAttribute(String, String, Object), AttributeSet

Find more information in the class documentation


setLayoutAttributeSet

public boolean setLayoutAttributeSet(java.lang.String layoutContext,
                                     AttributeSet attributeSet)
Sets the AttributeSet of the specified layout context. The LayoutController ensures that the modified AttributeSet will be updated by the corresponding Layout. A Layout may change the AttributeSet if necessary. A TreeLayout, for example, may change the attribute layer distance to radius if the user changes the arrangement type from plan to radial. However, you can update layout attributes anytime using updateLayoutAttributeSet(String, AttributeSet)

Parameters:
layoutContext - layout context of which the AttributeSet is to be set.
attributeSet - The new AttributeSet
Returns:
true if the setting of attributes was successful.
See Also:
setLayoutAttributeSet(String, AttributeSet), AttributeSet

Find more information in the class documentation


setLayoutAttribute

public boolean setLayoutAttribute(java.lang.String layoutContext,
                                  java.lang.String key,
                                  java.lang.Object value)
This method may be used to change the value of a particular attribute of a layout context.

Parameters:
layoutContext - The layout context which attribute is to be changed.
key - The name of attribute which is to be set.
value - The new value for the specified attribute.
Returns:
true if the setting of attributes was successful.
See Also:
setLayoutAttributeSet(String, AttributeSet)

Find more information in the class documentation


getLayoutAttribute

public java.lang.Object getLayoutAttribute(java.lang.String layoutContext,
                                           java.lang.String key)
Obtains the value of a particular attribute of a specified layout context.

Parameters:
layoutContext - The layout context of which the attribute is requested.
key - The name of the requested attribute.
Returns:
the value of the attribute that is specified by key
See Also:
getLayoutAttributeSet(String)

Find more information in the class documentation


updateLayoutAttributeSet

public void updateLayoutAttributeSet(java.lang.String layoutContext,
                                     AttributeSet layoutAttribute)
This method updates the specified AttributeSet by modifying the attributes that depend on the current layout style. The result of invoking this method is a consistent AttributeSet that has non-conflicting attribute values. Under normal circumstance, this method is internally invoked and should not be called by client code. A TreeLayout, for example, may change the attribute layer distance to radius if the user changes the arrangement type from plan to radial.

Parameters:
layoutContext - The according layout context
layoutAttribute - The AttributeSet which should be updated

error

public boolean error()
Returns true if an error has occurred; otherwise false. You can use getErrorMessage() to obtain a description text about the last occurred error.

Returns:
true if an error has occurred; otherwise false.

Find more information in the class documentation


getErrorMessage

public java.lang.String getErrorMessage()
Returns the error message if an error has occurred, which can be determined by invoking method error().

Returns:
the error description

Find more information in the class documentation


getLayoutReport

public AttributeSet getLayoutReport(java.lang.String layoutContext)
This method provides a detailed report about the last layout process and typically contains the calculation durations of different processing steps.

Parameters:
layoutContext - The layout context for which the report is to be based upon.
Returns:
an AttributeSet which contains the report or null, if no report is available
See Also:
AttributeSet

Find more information in the class documentation


addProgressListener

public void addProgressListener(ProgressListener progresslistener)
Adds a ProgressListener. The progress bar will update during the layout process.

Parameters:
progresslistener - a ProgressListener

removeProgressListener

public void removeProgressListener(ProgressListener progresslistener)
Removes the specified Progress-listener.

Parameters:
progresslistener - the ProgressListener that is to be removed.

setBorder

protected void setBorder(VisualSubgraph visualsubgraph)
This method may be used for a subgraph to ensure that the associated edge layouter keeps edges inside subgraph area.

Parameters:
visualsubgraph - the subgraph of which the area is to be considered.

considerCurrentEdgesRoute

public void considerCurrentEdgesRoute()
Call this method to keep the current edge's route. The layout controller will consider it while an edge layouter arranges edges.



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