Displaying Fields Backed By Dynamic Expression

It is possible to enrich List View, Quick View and Show View with results of the entity accessor methods calls, entity transient fields, or data from an associated entity.

Due to the nature of transient fields, it is most reasonable to show transient fields whose values are based on persistent field values

This is done using FieldSetConfigurationUnitBuilder.dynamic() method:

  • dynamic( “[entity accessor method name without 'get' prefix]” );
  • dynamic( “[entity transient field name]” );
  • dynamic( “[associated entity name].[entity field name]” ).

See the usage example below.


public class BookingAdministration extends AdministrationConfiguration<Booking> {

	public FieldSetConfigurationUnit listView( final FieldSetConfigurationUnitBuilder fragmentBuilder ) {
		return fragmentBuilder
				.field( "user" ).caption( "Customer" )
				.dynamic( "hotel.name" ).caption( "Hotel Name" )
				.field( "smoking" ).caption( "Smoking" )
				.field( "beds" ).caption( "Beds" )
				.dynamic( "total" ).caption( "Total" ).build();
	}

	public FieldSetConfigurationUnit quickView( final FieldSetConfigurationUnitBuilder fragmentBuilder ) {
		return fragmentBuilder
				.dynamic( "hotel.price" ).caption( "Hotel Price" )
				.field( "checkinDate" ).caption( "Check-In Date" )
				.field( "checkoutDate" ).caption( "Check-Out Date" )
				.dynamic( "nights" ).caption( "Nights" )
				.dynamic( "description" ).caption( "Booking Description" ).build();
	}
}

Fields with custom content: Hotel Name, Total, Hotel Price, Nights, Booking Description