You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom type mappings can be registered globally or per-grid instance.
33
33
34
+
**Boolean rendering:**`Boolean` columns render as the string literals `"true"` or `"false"` by default. Any other representation ("Yes"/"No", "On"/"Off", localised strings, etc.) requires a custom formatter — typically one that delegates to an application i18n provider.
35
+
36
+
**Enum rendering:** Enum columns render using `Enum.toString()`, not `Enum.name()`. Per the Java documentation for `Enum.name()`: *"Most programmers should use the toString method in preference to this one, as the toString method may return a more user-friendly name."* Enums that need human-readable labels should override `toString()` accordingly.
37
+
34
38
### 2.3 Sorting
35
39
36
40
All columns backed by `Comparable` property types are sortable by default. Multi-column sorting is supported.
See [FEATURE_ROW_ACTIONS.md](FEATURE_ROW_ACTIONS.md).
141
145
142
-
### 3.5 Global Type Configuration
146
+
### 3.5 Type Configuration Tree
147
+
148
+
Column display configuration is resolved through a three-level tree, from most to least specific:
149
+
150
+
| Level | API | Scope |
151
+
|---|---|---|
152
+
|**Column**|`EasyColumn` setters | One specific column |
153
+
|**Instance**|`EasyGrid.forType(Class)`| All columns of that type in one grid |
154
+
|**Global**|`GlobalEasyGridConfiguration.forType(Class)`| All grids in the application |
155
+
156
+
Within each level the class hierarchy is walked before the tree falls through to the next level (scope-first). The full resolution order for a `Foo extends Entity` column is:
The first non-`null` value found wins. See [CONFIGURATION_RESOLUTION.md](CONFIGURATION_RESOLUTION.md) for the rationale behind scope-first ordering.
166
+
167
+
**Column level** — `EasyGrid.addColumn(…)` returns an `EasyColumn` whose setters write into an isolated configuration node at the top of the chain for that column only:
**Instance level** — `EasyGrid.forType(Class)` returns the instance-level `ColumnConfiguration` for a type. Changes apply to every column of that type on this grid:
**Global level** — `GlobalEasyGridConfiguration.forType(Class)` returns the application-wide `ColumnConfiguration`. Call `GlobalEasyGridConfiguration.freeze()` after startup to prevent further modifications:
Register custom column configurations that apply to all `EasyGrid` instances:
191
+
The `nullRepresentation` property controls what is displayed when a column value is `null`. The built-in global default registers `""` (empty string) on `Object.class`, so every column starts with an empty cell for `null` values. Override it at any level:
Formatters that receive a `ColumnConfiguration` parameter can call `getNullRepresentation()` to produce consistent output.
202
+
203
+
#### Type Hierarchy Support
204
+
205
+
Inside each scope level, `EasyGridConfigurationClassMap` walks the Java class hierarchy. When a configuration is requested for `Foo` and none exists, it is created with `Foo`'s superclass configuration as its parent, continuing up to `Object`. Primitive types are mapped to their boxed counterparts before hierarchy walking (`int` → `Integer`, `boolean` → `Boolean`, etc.).
206
+
207
+
A global `Number.class` renderer factory is therefore automatically inherited by `Integer`, `Long`, `BigDecimal`, and every other `Number` subtype unless a more specific configuration overrides it.
208
+
209
+
#### Renderer Utility Classes
210
+
211
+
Three `@UtilityClass` types in `com.flowingcode.vaadin.addons.easygrid.renderers` produce `RendererFactory` instances for common value types:
212
+
213
+
-**`LocalDateRenderers`** — wraps `LocalDateRenderer`; overloads accept a format pattern, locale, null representation, or a `DateTimeFormatter` supplier.
214
+
-**`LocalDateTimeRenderers`** — wraps `LocalDateTimeRenderer`; same overloads as `LocalDateRenderers`.
215
+
-**`NumberRenderers`** — wraps `NumberRenderer`; overloads accept a `NumberFormat`, a `Locale`, or a `Formatter` pattern string with optional locale and null representation.
0 commit comments