GridLoaderService (interface)

Provides the ability to load the XML layout (grid) for a domain class.

API

GridLoaderService.java
interface GridLoaderService {
  boolean supportsReloading()     (1)
  void remove(Class<?> domainClass)     (2)
  boolean existsFor(Class<?> domainClass)     (3)
  Grid load(Class<?> domainClass)     (4)
  Grid load(Class<?> domainClass, String layout)     (5)
}
1 supportsReloading()

Whether dynamic reloading of layouts is enabled.

2 remove(Class)

To support metamodel invalidation/rebuilding of spec.

3 existsFor(Class)

Whether any persisted layout metadata (eg a .layout.xml file) exists for this domain class.

4 load(Class)

Returns a new instance of a Grid for the specified domain class, eg from a layout.xml file, else null .

5 load(Class, String)

Loads a specic alternative Grid layout for the specified domain class.

Members

supportsReloading()

Whether dynamic reloading of layouts is enabled.

The default implementation enables reloading for prototyping mode, disables in production

remove(Class)

To support metamodel invalidation/rebuilding of spec.

This is called by the Object_rebuildMetamodel mixin action.

existsFor(Class)

Whether any persisted layout metadata (eg a .layout.xml file) exists for this domain class.

If none exists, will return null (and the calling GridService will use GridSystemService to obtain a default grid for the domain class).

load(Class)

Returns a new instance of a Grid for the specified domain class, eg from a layout.xml file, else null .

load(Class, String)

Loads a specic alternative Grid layout for the specified domain class.

The layout alternative will typically be specified through a layout() method on the domain object, the value of which is used for the suffix of the layout file (eg "Customer-layout.archived.xml" to use a different layout for customers that have been archived).

Implementation

The framework provides a default implementation of this service, namely GridLoaderServiceDefault. This implementation loads the grid from its serialized representation as a .layout.xml file, loaded from the classpath.

For example, the layout for a domain class com.mycompany.myapp.Customer would be loaded from com/mycompany/myapp/Customer.layout.xml.

See also

Related services: