JHotDraw 6.0b1

org.jhotdraw.contrib
Class StandardLayouter

java.lang.Object
  extended by org.jhotdraw.contrib.SimpleLayouter
      extended by org.jhotdraw.contrib.StandardLayouter
All Implemented Interfaces:
java.io.Serializable, Layouter, Storable

public class StandardLayouter
extends SimpleLayouter

A StandardLayouter contains standard algorithm for layouting a Layoutable. As a standard behaviour all child components of a Layoutable are laid out underneath each other starting from top to bottom while the x position of all child components stays the same and the width is forced to the width of the maximum width. At the end the presentation figure of the Layoutable is set to the maximum x and y size to encompass all contained child components graphically as well.

See Also:
Serialized Form

Constructor Summary
StandardLayouter()
          Default constructor which is needed for the Storable mechanism.
StandardLayouter(Layoutable newLayoutable)
          Constructor which associates a StandardLayouter with a certain Layoutable.
 
Method Summary
 java.awt.Rectangle calculateLayout(java.awt.Point origin, java.awt.Point corner)
          Calculate the layout for the figure and all its subelements.
 Layouter create(Layoutable newLayoutable)
          Create a new instance of this type and sets the layoutable
 java.awt.Rectangle layout(java.awt.Point origin, java.awt.Point corner)
          Method which lays out a figure.
 
Methods inherited from class org.jhotdraw.contrib.SimpleLayouter
getInsets, getLayoutable, read, setInsets, setLayoutable, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardLayouter

public StandardLayouter()
Default constructor which is needed for the Storable mechanism. Usually, the constructor which takes a Layoutable should be used as each StandardLayouter is associated with exactly one Layoutable.


StandardLayouter

public StandardLayouter(Layoutable newLayoutable)
Constructor which associates a StandardLayouter with a certain Layoutable.

Parameters:
newLayoutable - Layoutable to be laid out
Method Detail

create

public Layouter create(Layoutable newLayoutable)
Create a new instance of this type and sets the layoutable

Specified by:
create in interface Layouter
Overrides:
create in class SimpleLayouter

calculateLayout

public java.awt.Rectangle calculateLayout(java.awt.Point origin,
                                          java.awt.Point corner)
Calculate the layout for the figure and all its subelements. The layout is not actually performed but just its dimensions are calculated. The insets for this figure are included in the return value.

Specified by:
calculateLayout in interface Layouter
Overrides:
calculateLayout in class SimpleLayouter
Parameters:
origin - start point for the layout
corner - minimum corner point for the layout
Returns:
size including space for insets

layout

public java.awt.Rectangle layout(java.awt.Point origin,
                                 java.awt.Point corner)
Method which lays out a figure. It is called by the figure if a layout task is to be performed. First, the layout dimension for the figure is calculated and then the figure is arranged newly. All child component are place beneath another. The figure and all its children are forced to the minimium width

Specified by:
layout in interface Layouter
Overrides:
layout in class SimpleLayouter
Parameters:
origin - start point for the layout
corner - minimum corner point for the layout

JHotDraw 6.0b1