com.tensegrity.graph.layout
Interface Layout

All Known Subinterfaces:
EdgeLayout, NodeLayout
All Known Implementing Classes:
CircularLayout, DefaultEdgeLayout, EnergyLayout, HierarchicalLayout, OrgChartLayout, RandomLayout, SwimlaneLayout, TreeLayout

public interface Layout

This is the general interface for any Layout class which uses a graph drawing algorithm to perform a layout operation on the visual elements of a graph.

This interface consolidates the common methods that would have been duplicated in interfaces NodeLayout and EdgeLayout.

Layout specifies one particular part of the contract to a LayoutController by providing methods that deal with life cycle issues, such as initialization and configuration by attribute. Moreover, this interface specifies methods which allows implementations to be notified before and after a layout operation. Finally, Layout classes should provide a report of the last performed layout operation.

A Layout instance holds the nodes and edges of the graph that is to be arranged. Those nodes and edges implement type EdgeLayout and NodeLayout respectively. A Layout is only allowed to move nodes, reassign ports and change the edge path according to its implemented layout algorithm.

Version:
$Id: Layout.java,v 1.64 2005/04/27 09:50:29 AndreasEbbert Exp $
Author:
Sharokh Khani

Method Summary
 void afterLayoutHandler()
          This method will be called after the arrangement of the graph is completed.
 void beforeLayoutHandler()
          This method will be called before performing layout to allow the layout class to do initialization work.
 boolean error()
          Returns true if an error has occurred; otherwise false.
 java.lang.String getErrorMessage()
          Returns the error-message if an error has occurred.
 AttributeSet getLayoutAttributesTemplate()
          This method return an AttributeSet which contains all properties supported by this Layout.
 java.lang.String getName()
          Returns the name of the Layout.
 AttributeSet getReport()
          This method submits a report about the last layout process.
 void init()
          An instance of this class may be used to arrange different graphs.
 void updateAttributeSet(AttributeSet layoutAttributs)
          This method updates a given AttributeSet with the view of consistency.
 void useAttribute(AttributeSet layoutAttributs)
          This method can be used to configure a layout class.
 

Method Detail

init

public void init()
An instance of this class may be used to arrange different graphs. Since the constructor of this class is called only once, this method must be called to allow a Layout instance to do initialization work before a new graph is assigned.

Find more information in the class documentation


getName

public java.lang.String getName()
Returns the name of the Layout. This name will be used to identify a layout and must be unique.

Returns:
String The name of this layout class.

Find more information in the class documentation


getLayoutAttributesTemplate

public AttributeSet getLayoutAttributesTemplate()
This method return an AttributeSet which contains all properties supported by this Layout. The provided AttributeSet can be modified to configure this Layout.The method useAttribute(AttributeSet) will be used to put a modified copy of this AttributeSet.

Returns:
Returns a the default AttributeSet of this Layout if any; otherwise null.

Find more information in the class documentation


useAttribute

public void useAttribute(AttributeSet layoutAttributs)
This method can be used to configure a layout class. The method Layout#getLayoutAttributesTemplate() can be used to obtained a copy of default AttributeSet that contains all properties supported by this Layout.

Parameters:
layoutAttributs - The attributes that are to be used in the next layout process.

Find more information in the class documentation


updateAttributeSet

public void updateAttributeSet(AttributeSet layoutAttributs)
This method updates a given AttributeSet with the view of consistency.
A tree layout class for example may change the attribute layer distance to radius if the user changes the arrangement type from plan to radial.

Notice: The given AttributeSet must contains valid properties supported by this Layout. Please see getLayoutAttributesTemplate() for more details.

Parameters:
layoutAttributs - the attributes that are to be updated.
See Also:
getLayoutAttributesTemplate()

Find more information in the class documentation


beforeLayoutHandler

public void beforeLayoutHandler()
This method will be called before performing layout to allow the layout class to do initialization work.

Find more information in the class documentation


afterLayoutHandler

public void afterLayoutHandler()
This method will be called after the arrangement of the graph is completed. It allows the layout class to do post-initialization work.

Find more information in the class documentation


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:
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. You can use error() to find out whether an error has occurred.

Returns:
Returns the error description

Find more information in the class documentation


getReport

public AttributeSet getReport()
This method submits a report about the last layout process. It provides detail information accordingly.A report contains typically the calculation durations of different processing steps.

Returns:
Returns an AttributeSet which contains the report.

Find more information in the class documentation



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