net.goui.util
Interface GraphLayout.EdgeConstraint

All Known Implementing Classes:
GoLayout.Row, GraphLayout.Edge
Enclosing interface:
GraphLayout

public static interface GraphLayout.EdgeConstraint

Author:
David Beaumont, Copyright 2005

This interface is used to modify the default constraints for an Edge without needing to create an extra subclass. When passed to the appropriate constructor for GraphLayout.Edge an instance of this interface will be used to determine the size constraints and weighting for the associated edge.

Note that any values returned from these methods are not checked for correctness and it is part of the contract of any implementation of this interface to ensure their validity.


Method Summary
 int getMaxSize()
          An implementation of this method must return a non-negative integer representing the minimum size of the associated edge.
 int getMinSize()
          An implementation of this method must return a non-negative integer representing the minimum size of the associated edge.
 int getWeight()
          An implementation of this method must return a non-negative integer representing the weight of the associated edge.
 void invalidate()
          This method is invoked when the GraphLayout is reset prior to a layout.
 

Method Detail

getWeight

public int getWeight()
An implementation of this method must return a non-negative integer representing the weight of the associated edge. The returned value must remain constant during the course of any layout process.

Note that because internally the weights of many edges are summed during a layout process; as well as ensuring that each individual weight is non-negative it is also required that the cumulative sum of all the weights along any path which is to be laid out must not be allowed to overflow. Thus it is recommended that values returned from this method remain in the range (0 <= x < 65536) to minimise any chance of overflow.

Returns:
The non-negative weight value for the associated edge.

getMinSize

public int getMinSize()
An implementation of this method must return a non-negative integer representing the minimum size of the associated edge. The returned value must remain constant during the course of any layout process.

Note that because internally the sizes of many edges are summed during a layout process; as well as ensuring that each individual size is non-negative it is also required that the cumulative sum of all the sizes along any path which is to be laid out must not be allowed to overflow. Thus it is recommended that values returned from this method remain in the range (0 <= x < 65536) to minimise any chance of overflow.

Returns:
The non-negative minimum size for the associated edge.

getMaxSize

public int getMaxSize()
An implementation of this method must return a non-negative integer representing the minimum size of the associated edge. The returned value must remain constant during the course of any layout process.

Note that unlike getWeight() and getMinSize() there is no issue in returning a boundary value from this method. By default the implementation of this method in the Edge class returns Integer.MAX_VALUE;


invalidate

public void invalidate()
This method is invoked when the GraphLayout is reset prior to a layout. An implementation of this method is responsible for ensuring that any cached data relating to the edge constraints is invalidated.