GridSystemService (interface)

Encapsulates a single layout grid system which can be used to customize the layout of domain objects.

In particular this means being able to return a "normalized" form (validating and associating domain object members into the various regions of the grid) and in providing a default grid if there is no other metadata available.

API

GridSystemService.java
interface GridSystemService<G> {
  Class<G> gridImplementation()     (1)
  String tns()     (2)
  String schemaLocation()     (3)
  G defaultGrid(Class<?> domainClass)     (4)
  void normalize(G grid, Class<?> domainClass)     (5)
  void complete(G grid, Class<?> domainClass)     (6)
  void minimal(G grid, Class<?> domainClass)     (7)
}
1 gridImplementation()

The concrete subclass of Grid supported by this implementation.

2 tns()

The target namespace for this grid system.

3 schemaLocation()

The schema location for the XSD.

4 defaultGrid(Class)

A default grid, used when no grid layout can be found for the domain class.

5 normalize(G, Class)

Validates and normalizes a grid, modifying the grid so that all of the domain object’s members (properties, collections, actions) are bound to regions of the grid.

6 complete(G, Class)

Takes a normalized grid and enriches it with all the available metadata (taken from Apache Isis' internal metadata) that can be represented in the layout XML.

7 minimal(G, Class)

Takes a normalized grid and strips out removes all members, leaving only the grid structure.

Members

gridImplementation()

The concrete subclass of Grid supported by this implementation.

There can be multiple implementations of this service, this indicates the base class used by the implementation.

tns()

The target namespace for this grid system.

This is used when generating the XML. The Bootstrap3 grid system provided by the framework returns the value http://isis.apache.org/applib/layout/grid/bootstrap3.

schemaLocation()

The schema location for the XSD.

Every grid system is expected to provide a schema XSD in order to provide code completion in an IDE. The Bootstrap3 grid system provided by the framework returns the value http://isis.apache.org/applib/layout/grid/bootstrap3/bootstrap3.xsd.

defaultGrid(Class)

A default grid, used when no grid layout can be found for the domain class.

For example, this layout could define two columns in ratio 4:8.

normalize(G, Class)

Validates and normalizes a grid, modifying the grid so that all of the domain object’s members (properties, collections, actions) are bound to regions of the grid.

This is done using existing metadata, most notably that of the org.apache.isis.applib.annotation.MemberOrder annotation. Such a grid, if persisted as the layout XML file for the domain class, allows the org.apache.isis.applib.annotation.MemberOrder annotation to be removed from the source code of the domain class (but other annotations must be retained).

complete(G, Class)

Takes a normalized grid and enriches it with all the available metadata (taken from Apache Isis' internal metadata) that can be represented in the layout XML.

Such a grid, if persisted as the layout XML file for the domain class, allows all layout annotations ( org.apache.isis.applib.annotation.ActionLayout , org.apache.isis.applib.annotation.PropertyLayout , org.apache.isis.applib.annotation.CollectionLayout ) to be removed from the source code of the domain class.

minimal(G, Class)

Takes a normalized grid and strips out removes all members, leaving only the grid structure.

Such a grid, if persisted as the layout XML file for the domain class, requires that the org.apache.isis.applib.annotation.MemberOrder annotation is retained in the source code of said class in order to bind members to the regions of the grid.

Implementation

The framework provides a single grid implementation, o.a.i.core.metamodel.services.grid.bootstrap3.GridSystemServiceBS3, which supports Bootstrap3.

(The framework also provides Web UI (Wicket viewer) components that are capable of interpreting and rendering this metadata.

Usage Notes

The framework will check all available implementations of GridSystemService to obtain available grid systems, rather than merely the first implementation found, to determine if a grid is available for the domain object to be rendered; in other words it uses the chain-of-responsibility pattern. Services are called in the order defined by the @javax.annotation.Priority annotation.

Note though that each concrete implementation must also provide corresponding Wicket viewer components capable of interpreting the grid layout. This is therefore a highly specialized and very deep customisation of the framework.

See also

This service is used by GridService.