Package org.eclipse.draw2d
Class ViewportUtilities
java.lang.Object
org.eclipse.draw2d.ViewportUtilities
Utility class to support working with
Viewport
s.- Since:
- 3.6
-
Method Summary
Modifier and TypeMethodDescriptiongetEnclosingViewportsPath
(IFigure figure) static Viewport
getNearestCommonViewport
(IFigure firstFigure, IFigure secondFigure) static Viewport
getNearestEnclosingViewport
(IFigure figure) static Viewport
getNearestViewport
(IFigure figure) static Viewport
getRootViewport
(IFigure figure) getViewportsPath
(Viewport leafViewport, Viewport rootViewport) getViewportsPath
(Viewport leafViewport, Viewport rootViewport, boolean includeRootViewport)
-
Method Details
-
getEnclosingViewportsPath
-
getViewportsPath
Returns a list containing the provided leafViewport
as the first element, and all its enclosingViewport
s up to the rootViewport
, where the rootViewport
forms the last element of the list.- Parameters:
leafViewport
- TheViewport
, whose parent hierarchy is processed.rootViewport
- an ancestor of the given leafViewport, which marks the end point of the hierarchy to be processed.- Returns:
- A list of
Viewport
s containing the leafViewport
as the first element, the rootViewport
as the last and in between all enclosingViewport
s of the leafViewport
up to the root. Returns an empty list in case leaf or rootViewport
are null or in case the root viewport is not an ancestor of the leafViewport
.
-
getViewportsPath
public static List<Viewport> getViewportsPath(Viewport leafViewport, Viewport rootViewport, boolean includeRootViewport) Returns a list containing the provided leafViewport
as the first element, and all its enclosingViewport
s up to the rootViewport
. The rootViewport
forms the last element of the list, in case includeRootViewport is set to true, otherwise the viewport directly nested below the root viewport will be the last in the list.- Parameters:
leafViewport
- TheViewport
, whose parent hierarchy is processed.rootViewport
- an ancestor of the given leafViewport, which marks the end point of the hierarchy to be processed.includeRootViewport
- whether the provided rootViewport should be included in the list of returned viewports (as the last one) or not.- Returns:
- A list of
Viewport
s containing the leafViewport
as the first element, the rootViewport
as the last and in between all enclosingViewport
s of the leafViewport
up to the root. Returns an empty list in case leaf or rootViewport
are null or in case the root viewport is not an ancestor of the leafViewport
.
-
getNearestCommonViewport
-
getRootViewport
-
getNearestViewport
-
getNearestEnclosingViewport
- Parameters:
figure
-- Returns:
- The nearest enclosing
Viewport
of the given figure, or null if none could be found.
-