Skip to content

Inspector

Since 2.2.1

Inspector is a property-editor panel. It accepts any IConfigurable object and renders its configurable properties inside a ScrollerView. Changes to properties are optionally recorded in an undo/redo history stack.

INFO

Everything documented on UIElement (layout, styles, events, data bindings, etc.) applies here too.


Usage

java
var inspector = new Inspector();
parent.addChild(inspector);

// Inspect an object (any IConfigurable):
inspector.inspect(myObject);

// Inspect with a change listener:
inspector.inspect(myObject, configurator -> {
    System.out.println("Changed: " + configurator.getLabel());
});

// Inspect with change listener + close callback:
inspector.inspect(myObject,
    configurator -> System.out.println("Changed"),
    () -> System.out.println("Closed")
);

// Clear the inspector:
inspector.clear();

Internal Structure

FieldDescription
scrollerViewThe ScrollerView that hosts the generated configurator group. ID: _inspector_scroller-view_.

Fields

NameTypeAccessDescription
scrollerViewScrollerViewpublic finalThe scroller containing the configurator UI.
historyStackIHistoryStack (nullable)getter/setterOptional undo/redo stack. When set, property changes are recorded.
inspectedConfigurableIConfigurable (nullable)private (getter)The currently inspected object.

Methods

MethodReturnsDescription
inspect(IConfigurable)ConfiguratorGroupInspects an object and populates the panel. Returns the generated group.
inspect(IConfigurable, Consumer<Configurator>)ConfiguratorGroupInspects with a listener called on every property change.
inspect(IConfigurable, Consumer<Configurator>, Runnable)ConfiguratorGroupInspects with a change listener and an on-close callback.
inspect(T, Consumer<Configurator>, Runnable, Consumer<T>)ConfiguratorGroupFull overload with history action callback for undo/redo.
clear()voidClears the current inspection, runs the on-close callback, and empties the panel.

Released under the MIT License.