com.tensegrity.graph.layout
Interface EdgeLayout

All Superinterfaces:
Layout
All Known Implementing Classes:
DefaultEdgeLayout

public interface EdgeLayout
extends Layout

The EdgeLayout interface specifies the contract for classes responsible for laying out the visual edges of a graph only. An instance should take the current edge path into consideration and rearrange edges according to the layout configuration or context. In other words, the attributes used to configure an EdgeLayout instance should have an influence on the strategy used to set the edge paths.

An EdgeLayout is only allowed to arrange the edge elements of a given graph. It should take the current edge path into consideration and rearrange edges as far as it is necessary to satisfy its configuration.

An EdgeLayout class may be used individually or by a LayoutController. To ensure that it is always used properly, the following invocation order is stipulated:

  1. Layout.getLayoutAttributesTemplate()
  2. Layout.init()
  3. Layout.useAttribute(AttributeSet)
  4. storePreferEdgePoints(ArrayList)
  5. Layout.beforeLayoutHandler()
  6. relayout(ArrayList, ArrayList, Boundary)
  7. Layout.afterLayoutHandler()

 
    _____________________________________ 
   |   + getLayoutAttributesTemplate     |
   |_____________________________________|
   |   __________________________________|
   |  |  # init                          |
   |  |__________________________________|
   |  |   _______________________________|
   |  |  |   + useAttribute              |
   |  |  |_______________________________|
   |  |  |   + storePreferEdgePoints     |
   |  |  |_______________________________|
   |  |  |     __________________________|
   |  |  |    | # beforeLayoutHandler    |
   |  |  |    | # relayout               |
   |  |  |    | # afterLayoutHandler     |
   |  |  |    |__________________________|
   |  |  |    | + getReport              |
   |  |  |    |__________________________|
   |  |  |_______________________________|
   |  |__________________________________|
   |_____________________________________|
 
 

Version:
$Id: EdgeLayout.java,v 1.25 2006/01/25 22:09:12 SharokhKhani Exp $
Author:
Sharokh Khani

Method Summary
 AttributeSet getEdgeAttributesTemplate()
          Returns the attribute set for edges which is initialized with default values.
 boolean relayout(java.util.ArrayList edges, java.util.ArrayList hindrances, Boundary border)
          Arranges all specified edges, which may be arranged completely or simply readjusted, taking the current edge paths into consideration.
 boolean storePreferEdgePoints(java.util.ArrayList edges)
          Call this method to store additional edge points.
 boolean storePreferEdgePoints(LayoutableEdge edge, boolean doRemove)
          Call this method to store additional edge points for a specified edge.
 
Methods inherited from interface com.tensegrity.graph.layout.Layout
afterLayoutHandler, beforeLayoutHandler, error, getErrorMessage, getLayoutAttributesTemplate, getName, getReport, init, updateAttributeSet, useAttribute
 

Method Detail

storePreferEdgePoints

public boolean storePreferEdgePoints(java.util.ArrayList edges)
Call this method to store additional edge points. An EdgeLayout should take the current edge paths into consideration because in most cases the edge paths will have already been arranged by a NodeLayout.

Parameters:
edges - a List containing the edges of which the additional points are to be stored.
Returns:
true if the layout was successful; otherwise false.

Find more information in the class documentation


storePreferEdgePoints

public boolean storePreferEdgePoints(LayoutableEdge edge,
                                     boolean doRemove)
Call this method to store additional edge points for a specified edge. An EdgeLayout should take the current edge paths into consideration because in most cases the edge paths will have already been arranged by a NodeLayout.

Parameters:
edge - the edges of which the additional points are to be stored.
doRemove - specifies whether the existing points should be overwritten or not
Returns:
true if the layout was successful; otherwise false.

relayout

public boolean relayout(java.util.ArrayList edges,
                        java.util.ArrayList hindrances,
                        Boundary border)
Arranges all specified edges, which may be arranged completely or simply readjusted, taking the current edge paths into consideration.

Parameters:
edges - All edges that should be rearranged. The elements the ArrayList are from type EdgeMap.
hindrances - A list of hindrances. Each hindrance is an integer array of length 5 containing a node boundary and its identifier, as shown here:
  • left position of the node.
  • top position of the node.
  • right position of the node.
  • bottom position of the node.
  • the identifier of the node.
border - the total available area that can be used by the edge layout
Returns:
true if the layout was successful; otherwise false.

Find more information in the class documentation


getEdgeAttributesTemplate

public AttributeSet getEdgeAttributesTemplate()
Returns the attribute set for edges which is initialized with default values.
Notice: The default edge attributes are not to be confused with layout attributes. The layout attributes configure the layout as a whole. But some layout classes also allow the configuration of edges for alternate treatment.

Returns:
Returns a the default AttributeSet for nodes if any; otherwise null.

Find more information in the class documentation



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