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<?> collectionType, List<String> propertyIds)     (1)
  List<String> orderStandalone(Class<?> collectionType, List<String> propertyIds)     (2)
}
1 orderParented(Object, String, Class, List)

For the parent collection owned by the specified parent and collection Id, return the set of property ids in the same or other order.

2 orderStandalone(Class, List)

For the standalone collection of the specified type, return the set of property ids in the same or other order.

Members

orderParented(Object, String, Class, List)

For the parent collection owned by the specified parent and collection Id, return the set of property ids in the same or other order.

Return null if has no opinion/provides no reordering for this parent and collection.

orderStandalone(Class, List)

For the standalone collection of the specified type, return the set of property ids in the same or other order.

Return null if has no opinion/provides no reordering for this type.

Implementation

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