GridService
Loads the layout (grid) for any domain class. Also supports various formats LayoutExportStyle for export.
Using DTOs based on
API
interface GridService {
boolean supportsReloading() (1)
void invalidate(Class<?> domainClass) (2)
BSGrid load(LayoutKey layoutKey) (3)
EnumSet<CommonMimeType> supportedFormats()
Optional<GridMarshaller> marshaller(CommonMimeType format)
}
| 1 | supportsReloading()
Whether dynamic reloading of layouts is enabled. |
| 2 | invalidate(Class)
To support metamodel invalidation/rebuilding of spec. |
| 3 | load(LayoutKey)
Returns a BSGrid for given LayoutKey . |
Members
supportsReloading()
Whether dynamic reloading of layouts is enabled.
The default implementation enables reloading while prototyping, disables in production.
invalidate(Class)
To support metamodel invalidation/rebuilding of spec.
Acts as a no-op if not #supportsReloading() .
load(LayoutKey)
Returns a BSGrid for given LayoutKey .
The default implementation uses the layout name to search for a differently named layout file, [domainClass].layout.[layout].xml .
When no specific grid layout is found returns a generic fallback.
Implementation
The Core Metamodel module provides a default implementation of this service, refguide:core:index/metamodel/services/grid/GridServiceDefault.adoc.
Caching
Once a grid has been loaded for a domain class, this is cached internally by Apache Causeway' internal meta model (in the GridFacet facet).
If running in prototype mode, any subsequent changes to the XML will be detected and the grid rebuilt. This allows for dynamic reloading of layouts, providing a far faster feedback (eg if tweaking the UI while working with end-users). Dynamic reloading is disabled in production mode.
See also
This service is called by LayoutService, exposed in the UI through LayoutServiceMenu (to download the layout XML as a zip file for all domain objects) and the downloadLayout() mixin (to download the layout XML for a single domain
object).
This service delegates to:
-
to GridLoaderService to load a pre-existing layout for the domain class, if possible
-
to GridSystemService to normalize the grid with respect to Apache Causeway' internal metamodel, in other words to ensure that all of the domain objects' properties, collections and actions are associated with regions of the grid.