Class GlobalEasyGridConfiguration
java.lang.Object
com.flowingcode.vaadin.addons.easygrid.config.GlobalEasyGridConfiguration
System-wide
EasyGrid configuration. Configurations registered here apply to all
EasyGrid instances across all sessions.
Use forType(Class) to obtain a configuration for a given type:
GlobalEasyGridConfiguration.forType(LocalDate.class).setRendererFactory(...);
Startup and thread safety: This class is a mutable static singleton shared
across all user sessions. All calls to forType(Class) must be made during application
startup, before any session is created, to avoid data races between concurrent sessions. Call
freeze() at the end of startup to lock the configuration and prevent accidental
post-startup modifications. Omitting freeze() is a stability risk: any code that runs
after startup — including request-handling code — could inadvertently alter rendering for every
active session.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> ColumnConfiguration<V>Returns theColumnConfigurationfor the given type at the global level, creating it if it does not yet exist.static voidfreeze()Freezes the global configuration, preventing further calls toforType(Class), which will throwIllegalStateExceptiononce frozen.<V> ColumnConfiguration<V>Returns the effectiveColumnConfigurationfor the given type.
-
Constructor Details
-
GlobalEasyGridConfiguration
public GlobalEasyGridConfiguration()
-
-
Method Details
-
freeze
public static void freeze()Freezes the global configuration, preventing further calls toforType(Class), which will throwIllegalStateExceptiononce frozen. Freezing is irreversible. This method should be called at the end of application startup, after all type configurations have been registered. -
forType
Returns theColumnConfigurationfor the given type at the global level, creating it if it does not yet exist. Modifications to the returned configuration take effect immediately.- Parameters:
type- the column value type- Returns:
- the
ColumnConfigurationfor the given type - Throws:
IllegalStateException- if the global configuration has been frozen viafreeze()
-
resolve
Returns the effectiveColumnConfigurationfor the given type. When frozen, returns the nearest registered configuration walking the class hierarchy, ornullif none. When not frozen, creates a configuration if one does not yet exist.- Parameters:
type- the column value type- Returns:
- the resolved configuration, or
nullwhen frozen and no config was registered
-