Runtime

## org.eclipse.gmf.runtime.diagram.ui.services.layout
Class LayoutService

    java.lang.Object
      org.eclipse.gmf.runtime.common.core.service.AbstractProvider
          org.eclipse.gmf.runtime.common.core.service.Service
              org.eclipse.gmf.runtime.diagram.ui.services.layout.LayoutService

All Implemented Interfaces:
  java.util.EventListener, ILayoutNodeProvider, IProvider, IProviderChangeListener

public final class LayoutService
extends Service
implements ILayoutNodeProvider

A service that provides for diagram layout.

Nested Class Summary

Nested classes inherited from class org.eclipse.gmf.runtime.common.core.service.Service
`Service.ProviderDescriptor`

Field Summary

Fields inherited from class org.eclipse.gmf.runtime.common.core.service.Service
`INVALID_ELEMENT_MESSAGE_PATTERN`

Method Summary
`static LayoutService` `getInstance()`
`ILayoutNode` `getLayoutNode(Node node)` Gets the `ILayoutNode` in order to retrieve the actual size of the Node object irrespective of the autosize properties.
`java.util.List` `getLayoutNodes(DiagramEditPart diagramEP, java.util.List nodes)`
`void` `layout(View container, java.lang.String hint)` Utility method to layout the children of a view container.
`java.lang.Runnable` `layoutLayoutNodes(java.util.List layoutNodes, boolean offsetFromBoundingBox, IAdaptable layoutHint)` Layout this map of nodes, using the specified layout hint.
`void` `layoutNodes(java.util.List nodes, boolean offsetFromBoundingBox, java.lang.String hint)` Utility method to layout a list of Node children on a diagram.

Methods inherited from class org.eclipse.gmf.runtime.common.core.service.Service
`addProvider, clearCache, configureProviders, configureProviders, createPriorityCache, execute, executeUnique, getAllProviders, getCachingKey, getPriority, getProviders, isOptimistic, isOptimized, newProviderDescriptor, providerChanged, provides, provides, removeProvider`

Methods inherited from class org.eclipse.gmf.runtime.common.core.service.AbstractProvider
`addProviderChangeListener, fireProviderChange, removeProviderChangeListener`

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

Methods inherited from interface org.eclipse.gmf.runtime.common.core.service.IProvider
`addProviderChangeListener, provides, removeProviderChangeListener`

Method Detail

### getInstance

    public static LayoutService getInstance()

### getLayoutNode

    public ILayoutNode getLayoutNode(Node node)

  Gets the `ILayoutNode` in order to retrieve the actual size of the Node object irrespective of the autosize properties.

  Parameters:
    `node` - Node to get the layout node equivalent from
  Returns:
    `ILayoutNode`object
  Throws:
    `java.lang.NullPointerException` - `node` is `null`

### getLayoutNodes

    public java.util.List getLayoutNodes(DiagramEditPart diagramEP,
                                         java.util.List nodes)

  Parameters:
    `diagramEP` - the diagram edit part to use
    `nodes` - List of `Node` objects
  Returns:
    List of `ILayoutNodes` objects

### layout

    public void layout(View container,
                       java.lang.String hint)

  Utility method to layout the children of a view container.

  Parameters:
    `container` - `View` object that is the container whose children will be laid out.
    `hint` - `String` representing a hint for what kind of layout will be applied. Value can be one of `ILayoutType.DEFAULT`, `ILayoutType.RADIAL`. Other values would have to understand by custom providers.
  Throws:
    `java.lang.NullPointerException` - `View` is `null`
    `java.lang.NullPointerException` - `hint` is `null`
  See Also:
    `ILayoutNodeProvider`

### layoutNodes

    public void layoutNodes(java.util.List nodes,
                            boolean offsetFromBoundingBox,
                            java.lang.String hint)

  Utility method to layout a list of Node children on a diagram.

  Parameters:
    `nodes` - `List` of `Node` objects or `List` of `ILayoutNode` objects
    `offsetFromBoundingBox` - `boolean` indicating whether the Nodes should be laid out relative to the bounding box of the Nodes in the nodesToSizes Map.
    `hint` - String representing a hint for what kind of layout will be applied. Value can be one of `ILayoutType.DEFAULT`, `ILayoutType.RADIAL`. Other values can be provided but would have to be understand by custom providers.
  Throws:
    `java.lang.NullPointerException` - `nodes` is `null`
    `java.lang.IllegalArgumentException` - nodes is an empty list
    `java.lang.NullPointerException` - `hint` is `null`
    `java.lang.IllegalArgumentException` - Argument `nodes` contains objects which aren't of type `Node`
    `java.lang.IllegalArgumentException` - Argument `nodes` contains objects which have a different parent containment
  See Also:
    `ILayoutNodeProvider`

### layoutLayoutNodes

    public java.lang.Runnable layoutLayoutNodes(java.util.List layoutNodes,
                                                boolean offsetFromBoundingBox,
                                                IAdaptable layoutHint)

  Description copied from interface: `ILayoutNodeProvider`
  Layout this map of nodes, using the specified layout hint.

  Specified by:
    `layoutLayoutNodes` in interface `ILayoutNodeProvider`
  Parameters:
    `layoutNodes` - List of `ILayoutNode` objects that are to participate in the layout.
    `offsetFromBoundingBox` - `boolean` indicating whether the Nodes should be laid out relative to the bounding box of the Nodes in the nodesToSizes Map.
    `layoutHint` - `IAdaptable` hint to the provider to determine the layout kind. `IAdaptable` will typically adapt to string that can be one of `LayoutType.DEFAULT` or `LayoutType.RADIAL`.
  Returns:
    `Runnable` that contains the layout changes to be executed.

Runtime

Guidelines for using Eclipse APIs.

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