public static interface DisplayData.Builder
Modifier and Type | Method and Description |
---|---|
DisplayData.Builder |
add(DisplayData.ItemSpec<?> item)
Register the given display item.
|
<T> DisplayData.Builder |
addIfNotDefault(DisplayData.ItemSpec<T> item,
T defaultValue)
Register the given display item if the value is different than the specified default.
|
DisplayData.Builder |
addIfNotNull(DisplayData.ItemSpec<?> item)
Register the given display item if the value is not null.
|
DisplayData.Builder |
delegate(HasDisplayData component)
Register display data from the specified component on behalf of the current component.
|
DisplayData.Builder |
include(java.lang.String path,
HasDisplayData subComponent)
Register display data from the specified subcomponent at the given path.
|
DisplayData.Builder include(java.lang.String path, HasDisplayData subComponent)
PTransform
which delegates to a user-provided function can implement HasDisplayData
on the function and include it from the PTransform
:
@Override
public void populateDisplayData(DisplayData.Builder builder) {
super.populateDisplayData(builder);
builder
// To register the class name of the userFn
.add(DisplayData.item("userFn", userFn.getClass()))
// To allow the userFn to register additional display data
.include("userFn", userFn);
}
Using include(path, subComponent)
will associate each of the registered items with
the namespace of the subComponent
being registered, with the specified path element
relative to the current path. To register display data in the current path and namespace,
such as from a base class implementation, use subComponent.populateDisplayData(builder)
instead.
DisplayData.Builder delegate(HasDisplayData component)
This is useful for components which simply wrap other components and wish to retain the
display data from the wrapped component. Such components should implement populateDisplayData
as:
@Override
public void populateDisplayData(DisplayData.Builder builder) {
builder.delegate(wrapped);
}
DisplayData.Builder add(DisplayData.ItemSpec<?> item)
DisplayData.Builder addIfNotNull(DisplayData.ItemSpec<?> item)
<T> DisplayData.Builder addIfNotDefault(DisplayData.ItemSpec<T> item, T defaultValue)