Runtime

## org.eclipse.gmf.runtime.diagram.ui.figures
Class LayoutHelper

    java.lang.Object
      org.eclipse.gmf.runtime.diagram.ui.figures.LayoutHelper

public class LayoutHelper
extends java.lang.Object

A utility class used to find the location to place an undefined child figure.

Field Summary
`static Rectangle` `UNDEFINED` Constant that represetns an undefined element.

Constructor Summary
`LayoutHelper()` constructor

Method Summary
`IFigure` `findFigureIn(IFigure parent, Rectangle bounds)` Return a child figure that is already occupying the a position within the supplied `bounds` figure.
`Point` `getReferencePosition(IFigure parent)` Return an initial point to position UNDEFINED children.
`java.util.List` `getUnpositionedChildren(IFigure parent)` Return the supplied figures children whose location is `LayoutHelper.UNDEFINED`.
`void` `layoutUndefinedChildren(ICanonicalShapeCompartmentLayout mgr, IFigure parent, java.util.Map registry)` Layout the supplied parent's children whose position is equal to `LayoutHelper.UNDEFINED`.
`Point` `updateClobberedPosition(IFigure clobbered, IFigure newlyAddedChild)` Returns a position not contained with the supplied figures bounds.
`Point` `validatePosition(IFigure parent, Rectangle bounds)` Returns a location inside the supplied `parent` that is currently unoccupied by another figure.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UNDEFINED

    public static final Rectangle UNDEFINED

  Constant that represetns an undefined element.

Constructor Detail

### LayoutHelper

    public LayoutHelper()

  constructor

Method Detail

### layoutUndefinedChildren

    public void layoutUndefinedChildren(ICanonicalShapeCompartmentLayout mgr,
                                        IFigure parent,
                                        java.util.Map registry)

  Layout the supplied parent's children whose position is equal to `LayoutHelper.UNDEFINED`.

  Parameters:
    `mgr` - the calling layout manager
    `parent` - the containing figure.
    `registry` - the [figure,editpart] registry
  See Also:
    `LayoutHelper.getReferencePosition(IFigure)`

### getUnpositionedChildren

    public final java.util.List getUnpositionedChildren(IFigure parent)

  Return the supplied figures children whose location is `LayoutHelper.UNDEFINED`.

  Parameters:
    `parent` - the containing figure.
  Returns:
    list of figures

### getReferencePosition

    public Point getReferencePosition(IFigure parent)

  Return an initial point to position UNDEFINED children.

  Parameters:
    `parent` - the containing figure (typically `layout()`'s input parameter)
  Returns:
    `parent.getBounds().getCenter().getCopy();`
  See Also:
    `LayoutHelper.validatePosition(IFigure, Rectangle)`

### validatePosition

    public Point validatePosition(IFigure parent,
                                  Rectangle bounds)

  Returns a location inside the supplied `parent` that is currently unoccupied by another figure.

  Parameters:
    `parent` - containing figure.
    `bounds` - are being searched.
  Returns:
    an unoccupied position.

### findFigureIn

    public IFigure findFigureIn(IFigure parent,
                                Rectangle bounds)

  Return a child figure that is already occupying the a position within the supplied `bounds` figure.

  Parameters:
    `parent` - The parent figure of the newly added child.
    `bounds` - the area being tested.
  Returns:
    a child figure already occupying the supplied `bounds` or `null` if the bounds are unoccuppied.

### updateClobberedPosition

    public Point updateClobberedPosition(IFigure clobbered,
                                         IFigure newlyAddedChild)

  Returns a position not contained with the supplied figures bounds.

  Parameters:
    `clobbered` - the figure currently occuping the reference position<\i>
    `newlyAddedChild` - the child figure being added. NOTE, MAY BE NULL
  Returns:
    `clobbered.getBounds().getRight().getCopy().translate(30,0);`
  See Also:
    `LayoutHelper.getReferencePosition(IFigure)`, `LayoutHelper.validatePosition(IFigure, Rectangle)`

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.