org.jhotdraw.draw
Interface Layouter

All Known Implementing Classes:
AbstractLayouter, HorizontalLayouter, LocatorLayouter, VerticalLayouter

public interface Layouter

A Layouter encapsulates a algorithm to layout a CompositeFigure. It is passed on to a figure which delegates the layout task to the Layouter's layout method. The Layouter might need access to some information specific to a certain figure in order to layout it out properly.


Design Patterns

Strategy
Composite figures can be laid out using different layout algorithms which are implemented by layouters.
Context: CompositeFigure; Strategy: Layouter.


Version:
$Id: Layouter.java 527 2009-06-07 14:28:19Z rawcoder $
Author:
Werner Randelshofer

Method Summary
 java.awt.geom.Rectangle2D.Double calculateLayout(CompositeFigure compositeFigure, java.awt.geom.Point2D.Double anchor, java.awt.geom.Point2D.Double lead)
          Calculate the layout for the figure and all its subelements.
 java.awt.geom.Rectangle2D.Double layout(CompositeFigure compositeFigure, java.awt.geom.Point2D.Double anchor, java.awt.geom.Point2D.Double lead)
          Method which lays out a figure.
 

Method Detail

calculateLayout

java.awt.geom.Rectangle2D.Double calculateLayout(CompositeFigure compositeFigure,
                                                 java.awt.geom.Point2D.Double anchor,
                                                 java.awt.geom.Point2D.Double lead)
Calculate the layout for the figure and all its subelements. The layout is not actually performed but just its dimensions are calculated.

Parameters:
anchor - start point for the layout
lead - minimum lead point for the layout

layout

java.awt.geom.Rectangle2D.Double layout(CompositeFigure compositeFigure,
                                        java.awt.geom.Point2D.Double anchor,
                                        java.awt.geom.Point2D.Double lead)
Method which lays out a figure. It is called by the figure if a layout task is to be performed. Implementing classes specify a certain layout algorithm in this method.

Parameters:
anchor - start point for the layout
lead - minimum lead point for the layout