org.eclipse.gef.mvc.fx.parts

## Class PartUtils

- java.lang.Object
- - org.eclipse.gef.mvc.fx.parts.PartUtils

    public class PartUtils
    extends Object

Provides utilities needed in the context of `IVisualPart`s.

### Constructor Summary

Constructors
Constructor and Description
`PartUtils()`

### Method Summary

All Methods Static Methods Concrete Methods
`static <T extends IVisualPart<? extends Node>> List<T>` `filterParts(Collection<? extends IVisualPart<? extends Node>> parts, Class<T> type)` Searches the given collection of `IVisualPart`s for elements of the specified type.
`static <T extends IVisualPart<? extends Node>> List<T>` `filterParts(Collection<? extends IVisualPart<? extends Node>> parts, Predicate<? super IVisualPart<? extends Node>> filter)` Searches the given collection of `IVisualPart`s for elements of the specified type.
`static List<IVisualPart<? extends Node>>` `getAnchoreds(Collection<? extends IVisualPart<? extends Node>> anchorages)` Collects the anchoreds of all given `IVisualPart`s.
`static Set<IVisualPart<? extends Node>>` `getAnchoreds(IVisualPart<? extends Node> anchorage, String role)` Collects the anchoreds of the given `IVisualPart` which are registered under the specified role.
`static Rectangle` `getUnionedVisualBoundsInScene(Collection<? extends IVisualPart<? extends Node>> parts)` Returns the unioned visual bounds of the given `IVisualPart`s in the coordinate system of the `Scene`.
`static IViewer` `retrieveViewer(IDomain domain, Node target)` Returns the `IViewer` of the given `IDomain` in which the given `Node` is contained, or `null` if the given `Node` is not contained within an `IViewer` of the given `IDomain`.
`static IVisualPart<? extends Node>` `retrieveVisualPart(IViewer viewer, Node target)` Returns the first `IVisualPart` in the visual hierarchy of the given `Node`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PartUtils

    public PartUtils()

### Method Detail

#### filterParts

    public static <T extends IVisualPart<? extends Node>> List<T> filterParts(Collection<? extends IVisualPart<? extends Node>> parts,
                                                                              Class<T> type)

Searches the given collection of `IVisualPart`s for elements of the specified type.

Type Parameters:
  `T` - The type of returned elements.
Parameters:
  `parts` - The collection of parts which is filtered.
  `type` - The type of returned elements.
Returns:
  A list of all elements of the specified type.

#### filterParts

    public static <T extends IVisualPart<? extends Node>> List<T> filterParts(Collection<? extends IVisualPart<? extends Node>> parts,
                                                                              Predicate<? super IVisualPart<? extends Node>> filter)

Searches the given collection of `IVisualPart`s for elements of the specified type.

Type Parameters:
  `T` - The type of returned elements.
Parameters:
  `parts` - The collection of parts which is filtered.
  `filter` - The type of returned elements.
Returns:
  A list of all elements of the specified type.

#### getAnchoreds

    public static List<IVisualPart<? extends Node>> getAnchoreds(Collection<? extends IVisualPart<? extends Node>> anchorages)

Collects the anchoreds of all given `IVisualPart`s.

Parameters:
  `anchorages` - The collection of `IVisualPart`s for which the anchoreds are collected.
Returns:
  A list of all the anchoreds of all the given `IVisualPart` s.

#### getAnchoreds

    public static Set<IVisualPart<? extends Node>> getAnchoreds(IVisualPart<? extends Node> anchorage,
                                                                String role)

Collects the anchoreds of the given `IVisualPart` which are registered under the specified role.

Parameters:
  `anchorage` - The `IVisualPart` for which the anchoreds are collected.
  `role` - The role under which the anchoreds have to be registered to be collected.
Returns:
  A list of the anchoreds of the given `IVisualPart` which are registered under the specified role.

#### getUnionedVisualBoundsInScene

    public static Rectangle getUnionedVisualBoundsInScene(Collection<? extends IVisualPart<? extends Node>> parts)

Returns the unioned visual bounds of the given `IVisualPart`s in the coordinate system of the `Scene`.

Parameters:
  `parts` - The `IVisualPart`s for which the unioned bounds are computed.
Returns:
  The unioned visual bounds of the given `IVisualPart`s in the coordinate system of the `Scene`.

#### retrieveViewer

    public static IViewer retrieveViewer(IDomain domain,
                                         Node target)

Returns the `IViewer` of the given `IDomain` in which the given `Node` is contained, or `null` if the given `Node` is not contained within an `IViewer` of the given `IDomain`.

Parameters:
  `domain` - The `IDomain` that contains the `IViewer`s that are tested to contain the given target `Node`.
  `target` - The `Node` for which to determine the containg `IViewer`.
Returns:
  The `IViewer` in which the given target `Node` is contained, or `null`.

#### retrieveVisualPart

    public static IVisualPart<? extends Node> retrieveVisualPart(IViewer viewer,
                                                                 Node target)

Returns the first `IVisualPart` in the visual hierarchy of the given `Node`. If no `IVisualPart` can be found within the visual hierarchy of the `Node`, the `IRootPart` of the given `IViewer` is returned.

Parameters:
  `viewer` - The `IViewer` in which the `IVisualPart` is searched.
  `target` - The `Node` for which the corresponding `IVisualPart` is to be returned.
Returns:
  The first `IVisualPart` in the visual hierarchy of the given `Node`, or the `IRootPart` of the given `IViewer`.