Implementation
The framework provides a single grid implementation, o.a.c.core.metamodel.services.grid.bootstrap.GridSystemServiceBootstrap,
which supports Bootstrap3 (https://causeway.apache.org/applib/layout/grid/bootstrap3/bootstrap3.xsd).
A SPI is provided via nested interface FallbackLayoutDataSource,
that allows to customize layout fallback behavior on a per class basis.
(Without having to override the heavy weight GridSystemServiceBootstrap.)
interface FallbackLayoutDataSource {
Try<String> tryLoadAsStringUtf8(Class<?> domainClass); (1)
}
-
Provides custom default for given
domainClassor return anTry.empty()if indifferent.
@Service
public class FallbackLayoutForManager implements FallbackLayoutDataSource {
@Override
public Try<String> tryLoadAsStringUtf8(final Class<?> domainClass) {
return domainClass.getSimpleName().endsWith("Manager")
? DataSource.ofResource(getClass(), "ManagerLayout.xml") (1)
.tryReadAsStringUtf8()
: Try.empty(); (2)
}
}
-
Provides a custom layout for all domain classes that have a name ending with 'Manager'.
-
Indifferent for given domain type. Tells the framework to fall through.
(The framework also provides Web UI (Wicket viewer) components that are capable of interpreting and rendering this metadata.