public class HierarchyInspector extends Object
Modifier and Type | Method and Description |
---|---|
static int |
countMaxDepth(Widget widget)
Counts the maximum depth of the child hierarchy of a widget.
|
static int |
countNumberOfContainers(Widget widget)
Counts the number of containers in the child hierarchy of a widget.
|
static int |
countNumberOfWidgets(Widget widget)
Counts the number of widgets in the child hierarchy of a widget.
|
static String |
hierarchyToString(Widget widget)
Prints the hierarchy of the given widget.
|
static String |
pathToWidgetToString(Widget widget)
Prints the path to the given widget with
> separator. |
static String |
pathToWidgetToString(Widget widget,
char separator)
Prints the path to the given widget.
|
public static int countMaxDepth(Widget widget)
The method is recursive: if the given widget is a container, it browses its children.
widget
- the root widget.public static int countNumberOfContainers(Widget widget)
The method is recursive: if the given widget is a container, it browses its children.
widget
- the root widget.public static int countNumberOfWidgets(Widget widget)
The method is recursive: if the given widget is a container, it browses its children.
widget
- the root widget.public static String hierarchyToString(Widget widget)
Prints the widget and its children recursively in a tree format.
widget
- the widget.public static String pathToWidgetToString(Widget widget)
>
separator.widget
- the widget to inspect.pathToWidgetToString(Widget, char)
public static String pathToWidgetToString(Widget widget, char separator)
Prints the containers from the root (including the desktop) to the widget, separated with the given separator.
Example: Desktop > Scroll > ScrollableList > Label
widget
- the widget to inspect.separator
- the separator between the items.