Customizing Entity Name Display

In some cases it may be convenient to define your own name for the menu item, domain window title, etc., other than the entity name which is used by default.

It can be done in EntityMetadataConfigurationUnit and ScreenContextConfigurationUnit units of an entity administration.

ScreenContextConfigurationUnit unit defines the window title for the domain view (figure 1 on the screenshot below)
EntityMetadataConfigurationUnit unit has two methods which affect specific elements of LightAdmin interface:

  • singularName is displayed on the following elements (figures 2 and 3 on the screenshot below):
    • create window: singular name of the domain on the view title and breadcrumb
  • pluralName is displayed on the following elements (figures 4-10 on the screenshot below):
    • menu item name
    • domain name on the Dashboard
    • domain name in the breadcrumb on all views (List View, Show View, Form View)
    • domain name on the ListView

Customizing Domain Name Throughout LightAdmin Interface

The views on the screenshot is the result of the configuration below. Please note that with this configuration, the original entity name (User) is not displayed on the LightAdmin interface, it is visible only in the URL.

Section Customizing Global Entity Representation explains how to display more meaningful information about an entity item instead of the “Customer #2″ on the screenshot above

...
public class CustomerAdministration extends AdministrationConfiguration<User> {

	public EntityMetadataConfigurationUnit configuration( EntityMetadataConfigurationUnitBuilder configurationBuilder ) {
		return configurationBuilder
				.singularName( "Customer" )
				.pluralName( "Customers" ).build();
	}

	public ScreenContextConfigurationUnit screenContext( ScreenContextConfigurationUnitBuilder screenContextBuilder ) {
		return screenContextBuilder.screenName( "Customers Administration" ).build();
	}

}