org.eclipse.zest.layouts

## Interface LayoutAlgorithm

All Known Implementing Classes:
  AbstractLayoutAlgorithm, CompositeLayoutAlgorithm, ContinuousLayoutAlgorithm, DirectedGraphLayoutAlgorithm, GridLayoutAlgorithm, HorizontalLayoutAlgorithm, HorizontalShift, HorizontalTreeLayoutAlgorithm, RadialLayoutAlgorithm, SpringLayoutAlgorithm, TreeLayoutAlgorithm, VerticalLayoutAlgorithm

    public interface LayoutAlgorithm

A simple interface used by all layouts. Each layout Algorithm must implement the applyLayoutInternal method which actually compute the layout

### Method Summary

Methods
`void` `addEntity(LayoutEntity entity)`
`void` `addProgressListener(ProgressListener listener)` A layout algorithm could take an uncomfortable amout of time to complete.
`void` `addRelationship(LayoutRelationship relationship)`
`void` `applyLayout(LayoutEntity[] entitiesToLayout, LayoutRelationship[] relationshipsToConsider, double x, double y, double width, double height, boolean asynchronous, boolean continuous)` Apply the layout to the given entities.
`double` `getEntityAspectRatio()` Returns the width to height ratio this layout will use to set the size of the entities.
`int` `getStyle()`
`boolean` `isRunning()` Returns whether or not the algorithm is currenly running
`void` `removeEntity(LayoutEntity entity)`
`void` `removeProgressListener(ProgressListener listener)` Removes the given progress listener, preventing it from receiving any more updates.
`void` `removeRelationship(LayoutRelationship relationship)`
`void` `removeRelationships(java.util.List relationships)`
`void` `setComparator(java.util.Comparator comparator)` Determines the order in which the objects should be displayed.
`void` `setEntityAspectRatio(double ratio)` Set the width to height ratio you want the entities to use Note: Each layout is responsible for ensuring this ratio is used.
`void` `setFilter(Filter filter)` Filters the entities and relationships to apply the layout on
`void` `setStyle(int style)` Sets the style for this layout algorithm.
`void` `stop()` Makes a request to this layout algorithm to stop running.

### Method Detail

#### applyLayout

    void applyLayout(LayoutEntity[] entitiesToLayout,
                   LayoutRelationship[] relationshipsToConsider,
                   double x,
                   double y,
                   double width,
                   double height,
                   boolean asynchronous,
                   boolean continuous)
                     throws InvalidLayoutConfiguration

Apply the layout to the given entities. The entities will be moved and resized based on the algorithm.

Parameters:
  `entitiesToLayout` - Apply the algorithm to these entities
  `relationshipsToConsider` - Only consider these relationships when applying the algorithm.
  `x` - The left side of the bounds in which the layout can place the entities.
  `y` - The top side of the bounds in which the layout can place the entities.
  `width` - The width of the bounds in which the layout can place the entities.
  `height` - The height of the bounds in which the layout can place the entities.
  `asynchronous` - Should the algorithm run Asynchronously
Throws:
  `InvalidLayoutConfiguration`

#### isRunning

    boolean isRunning()

Returns whether or not the algorithm is currenly running

Returns:
  True if a layout algorithm is currenly running, false otherwise

#### setComparator

    void setComparator(java.util.Comparator comparator)

Determines the order in which the objects should be displayed. Note: Some algorithms force a specific order, in which case this comparator will be ignored.

#### setFilter

    void setFilter(Filter filter)

Filters the entities and relationships to apply the layout on

#### setEntityAspectRatio

    void setEntityAspectRatio(double ratio)

Set the width to height ratio you want the entities to use Note: Each layout is responsible for ensuring this ratio is used. Note: By default the layout will use a ratio of 1.0 for each entity.

#### getEntityAspectRatio

    double getEntityAspectRatio()

Returns the width to height ratio this layout will use to set the size of the entities. Note: By default the layout will use a ratio of 1.0 for each entity.

#### addProgressListener

    void addProgressListener(ProgressListener listener)

A layout algorithm could take an uncomfortable amout of time to complete. To relieve some of the mystery, the layout algorithm will notify each ProgressListener of its progress.

#### removeProgressListener

    void removeProgressListener(ProgressListener listener)

Removes the given progress listener, preventing it from receiving any more updates.

#### stop

    void stop()

Makes a request to this layout algorithm to stop running.

#### setStyle

    void setStyle(int style)

Sets the style for this layout algorithm. This will overwrite any other style set.

Parameters:
  `style` -

#### getStyle

    int getStyle()

Returns:

#### addEntity

    void addEntity(LayoutEntity entity)

#### addRelationship

    void addRelationship(LayoutRelationship relationship)

#### removeEntity

    void removeEntity(LayoutEntity entity)

#### removeRelationship

    void removeRelationship(LayoutRelationship relationship)

#### removeRelationships

    void removeRelationships(java.util.List relationships)