TableColumnOrderService

Provides the ability to reorder columns in both parented- and standalone tables.

If a property is excluded from the returned list, then no column will be rendered, so the API can also be used to suppress columns completely.

There can be multiple implementations of this service registered, ordered as per the Spring org.springframework.core.annotation.Order annotation (or equivalent). The result of the first service implementation to return a non- null value will be used.

If all provided implementations return null , then the framework will fallback to a default implementation.

The similar TableColumnVisibilityService SPI is the preferred way to suppress columns. As noted above, this TableColumnOrderService can also be used to suppress columns. The reason that the TableColumnVisibilityService is needed in addition to this SPI is because of the way that non-null values are handled; as soon as one implementation has an opinion on the order of columns, no other services are consulted. Trying to combine both responsibilities (reordering and filtering only in a single TableColumnOrderService would result in the user needing to take a lot of care in the relative priority of different implementations. Separating out the filter responsibility in the TableColumnVisibilityService SPIs eliminates these difficulties).

API

TableColumnOrderService.java
interface TableColumnOrderService {
  List<String> orderParented(Object parent, String collectionId, Class<?> elementType, List<String> associationIds)     (1)
  List<String> orderStandalone(Class<?> domainType, List<String> associationIds)     (2)
}
1 orderParented(Object, String, Class, List)

For the parent collection owned by the specified parent and collection Id, return a list of association ids to be rendered as columns, in a particular order; those not included will be hidden.

2 orderStandalone(Class, List)

For the standalone collection of the specified type, return a list of association ids to be rendered as columns, in a particular order; those not included will be hidden.

Members

orderParented(Object, String, Class, List)

For the parent collection owned by the specified parent and collection Id, return a list of association ids to be rendered as columns, in a particular order; those not included will be hidden.

orderStandalone(Class, List)

For the standalone collection of the specified type, return a list of association ids to be rendered as columns, in a particular order; those not included will be hidden.

Implementation

The framework provides a fallback implementation of this service, namely o.a.c.core.metamodel.services.tablecol.TableColumnOrderServiceDefault.