Release NeitzelLib 1.0.1 with declarative DataGrid controls and saved setups
This commit is contained in:
@@ -0,0 +1,193 @@
|
||||
# DataGrid layout, grouping and saved application setups
|
||||
|
||||
These features extend the opt-in queried DataGrid. Standalone collection/FXML
|
||||
Table behavior is unchanged. Use Java 25 and call grid operations on the JavaFX
|
||||
application thread.
|
||||
|
||||
## Group a returned page
|
||||
|
||||
Declare group values explicitly; never derive them from a rendered cell. A text
|
||||
mapping is convenient for labels, while the full constructor supports integers,
|
||||
exact decimals and booleans using `FilterValue` and `MemoryColumn.Kind`.
|
||||
|
||||
```java
|
||||
// grid already has stable ResultColumn IDs and a source, as in data-grid.md.
|
||||
grid.configureGrouping(
|
||||
List.of(GroupColumn.<Person>text("name", Person::name),
|
||||
GroupColumn.<Person>text("type", Person::type)),
|
||||
true, // developer enables grouping
|
||||
List.of("type"), // outer-to-inner default grouping columns
|
||||
true, // unseen groups start collapsed
|
||||
1000); // inactive expansion choices retained
|
||||
```
|
||||
|
||||
`GroupColumn`, `GroupPath`, `GroupingSetup` and the projection/history models live
|
||||
in `de.neitzel.grid`. All eligible values/labels are captured when a page publishes,
|
||||
even for columns not currently grouped. `setGroupingColumns(List.of("type","name"))`
|
||||
rearranges existing page components using those snapshots and issues no query.
|
||||
`regroup()` explicitly recaptures group values after an application data update;
|
||||
it does not change page membership. `refresh()` instead queries the source.
|
||||
|
||||
Text equality is exact, including case and whitespace; missing and empty text
|
||||
are distinct. Decimal 1.0 and 1.00 share identity. Groups sort ascending, text
|
||||
ignoring case with an exact tie-breaker, booleans false then true, missing last.
|
||||
Rows within a leaf group retain their source order. Custom domains must map to
|
||||
one declared scalar type; changing identity/normalization semantics requires a
|
||||
schema migration. Labels never define identity. Invalid mappings fail visibly
|
||||
without replacing the prior grouping.
|
||||
|
||||
Grouping applies only to the loaded page. The same value may recur on another
|
||||
page; counts include collapsed data rows and exclude group headings. Explicit All
|
||||
mode still uses the existing guard/confirmation protocol and retains all returned
|
||||
row components. Collapsing it does not remove that memory cost.
|
||||
|
||||
## Interactions and row ownership
|
||||
|
||||
Drag a column's right boundary to preview a bounded width; release commits that
|
||||
column and Escape restores its previous sizing intent. Drag a header label to
|
||||
move a column, or into the grouping area to add a chip. Insertion feedback and
|
||||
fixed-position constraints apply; invalid/outside drops cancel without sorting.
|
||||
Grouped columns remain visible. Drag chips to reorder levels, and use × to remove
|
||||
a grouping level. A header click still sorts and the separate filter icon opens
|
||||
its editor. The Grid setup menu offers keyboard-operable Column settings.
|
||||
|
||||
Each group has a disclosure triangle. Expansion follows the typed ordered path,
|
||||
not its label or page number. Parent collapse preserves child choices. Current
|
||||
paths are retained along with the configured LRU history of inactive explicit
|
||||
choices; evicted paths return to the default. `setExpanded(path, boolean)` and
|
||||
`resetExpansion()` provide programmatic equivalents. `setGroupingEnabled(false)`
|
||||
hides grouped presentation without erasing valid dormant choices.
|
||||
|
||||
Reorder/regroup/collapse preserve current-page component identity and drafts.
|
||||
Actual page replacement keeps the existing guard/staging/disposal rules. A hidden
|
||||
selected record retains its key but has no actionable `selectedElement`. Expansion
|
||||
never re-enables stale rows. If collapse/reset hides focus, focus moves to a visible
|
||||
group heading. No historical rows are retained merely for expansion history.
|
||||
|
||||
## Attach optional persistence
|
||||
|
||||
`fx` does not depend on Gson. Add `de.neitzel.lib:gson` at the same library version
|
||||
when using the supplied JSON/file integration. The neutral custom-store contracts
|
||||
remain available without Gson.
|
||||
|
||||
```java
|
||||
// Once per application, not per tab. No files/directories are created here.
|
||||
var configuration = GridSetupFiles.forApplication("MyApplication");
|
||||
|
||||
// On each grid, after columns/grouping are configured, before the first query:
|
||||
grid.configureSetups("people.records", 1,
|
||||
Map.of("name", "text.v1", "type", "text.v1"), Map.of());
|
||||
var attachment = grid.attachPersistence(configuration, "people.records");
|
||||
attachment.loadAsync(); // read -> validate/restore or defaults -> one initial query
|
||||
// attachment.ready() completes after initialization or explicit recovery succeeds.
|
||||
```
|
||||
|
||||
Factory: `de.neitzel.gson.grid.GridSetupFiles`. Service/store:
|
||||
`de.neitzel.grid.GridApplicationConfiguration` and `GridSetupStore`. Attachment:
|
||||
`de.neitzel.fx.view.GridPersistenceAttachment`. An attachment overload accepts a
|
||||
context key. `GridSetupFiles.forApplication(name, path)` selects an explicit grid
|
||||
storage directory; another overload accepts pre-registered `GridSetupJson` codecs.
|
||||
Custom stores implement blocking load/revision/conditional-save; the service runs
|
||||
those operations off the FX thread.
|
||||
|
||||
The default directory is `ApplicationDirectories.configurationDirectory(name)`
|
||||
plus `grids`. Grid/context keys map to opaque safe filenames, with identity checked
|
||||
inside each document. Existing application preferences are never migrated.
|
||||
Never-attached grids perform no persistence I/O. Attachments can be closed and
|
||||
replaced; the application service owns accepted saves after detachment.
|
||||
|
||||
A stable grid ID/context shares one stored setup, not live displays. Newly opened
|
||||
grids restore the latest successfully saved snapshot. Open grids keep their own
|
||||
state until `attachment.loadAsync()` or Reload saved setup. The newest committed
|
||||
change replaces the whole saved snapshot; fields from different views are not
|
||||
merged. Closing an unchanged older tab cannot overwrite newer choices.
|
||||
|
||||
## Defaults, formats and recovery
|
||||
|
||||
The existing GridSetup format is extended with grouping and typed expansion
|
||||
choices. Version-one documents remain readable; absent new preferences inherit
|
||||
current developer grouping defaults. Current version-two documents require their
|
||||
complete schema. Definition/type migrations, fixed-position validation, width
|
||||
clamping and custom filter codecs retain their existing strict behavior.
|
||||
Unsupported or incompatible files fail visibly, never by silently dropping fields.
|
||||
|
||||
`configureDefaults(GridSetup)` may configure the full default query/layout without
|
||||
fetching, after definitions/mappings and before attachment/load. Otherwise defaults
|
||||
are captured at attachment. Defaults stay separate from the restored display.
|
||||
|
||||
Committed changes autosave after a configurable debounce (500 ms by default).
|
||||
`committedRevisionProperty()` is the FX notification seam; previews, cancelled
|
||||
operations, drafts and failed/pending queries do not become saves. Query preferences
|
||||
are saved only after successful publication. Saving/encoding failures retain the
|
||||
latest unsaved snapshot and last good file. The grid shows nonmodal settings
|
||||
feedback with Retry/Reload/Reset/Overwrite actions, separate from query status.
|
||||
|
||||
If no saved file exists, developer defaults apply. An unreadable/incompatible file blocks startup restoration
|
||||
and initial query until retry or explicit reset succeeds. Full Reset setup uses
|
||||
current defaults and the existing edit guard/transactional publication before
|
||||
accepting a replacement save. Reset expansion only clears expansion choices and
|
||||
never queries or resets other preferences.
|
||||
|
||||
The file store uses process coordination, revision-checked writes and atomic
|
||||
replacement. A cross-process conflict requires explicit Reload or Overwrite.
|
||||
Reload retires its abandoned pending generation only after successful guarded
|
||||
restoration and cannot discard a newer change. Overwrite is still conditional
|
||||
against a freshly observed revision. Unsupported atomic filesystem operations
|
||||
fail rather than publishing a partial file.
|
||||
|
||||
## Close and application shutdown
|
||||
|
||||
```java
|
||||
// Tab close, on FX thread:
|
||||
attachment.close();
|
||||
grid.close();
|
||||
|
||||
// Application shutdown: asynchronous; do not block the FX thread.
|
||||
configuration.flushAsync();
|
||||
configuration.closeAsync(); // also flushes; failure leaves the service retryable
|
||||
// Only after explicit user consent to quit without settings:
|
||||
configuration.discardAndCloseAsync();
|
||||
```
|
||||
|
||||
Chain/await completion stages in the application exit coordinator; the snippet
|
||||
lists operations, not permission to ignore their completion. A failed flush must
|
||||
be handled before exit. Close does not own external executors. Explicit discard
|
||||
retires pending work but cannot undo a write already committed. Detaching a grid
|
||||
stops observation/cancels its unfinished restore, not already accepted app saves.
|
||||
|
||||
## Qualification
|
||||
|
||||
Automated component/state, codec, lifecycle and real separate-process storage tests
|
||||
are provided. For native interaction qualification after running DataGridGroupingTest:
|
||||
|
||||
```sh
|
||||
python3 fx/scripts/data-grid-probe.py
|
||||
# macOS bundle for native accessibility tooling:
|
||||
python3 fx/scripts/data-grid-probe.py --app
|
||||
```
|
||||
|
||||
This opens actual JavaFX DataGrid controls with fictional records and a resource/
|
||||
query trace. Use native pointer/keyboard input to qualify the recorded acceptance
|
||||
scenarios; it is not a browser mock and emits no synthetic OS input. It has no
|
||||
application persistence or real DNS/network data. Runtime/platform evidence and
|
||||
remaining limits are recorded in the Workspace implementation record.
|
||||
|
||||
For repeatable macOS held-input checks (Escape during a drag, invalid/outside
|
||||
native drops and timed edge hovering), the separate opt-in fixture uses AWT
|
||||
Robot for pointer/keyboard input and JavaFX Robot for capture. It operates only
|
||||
its fictional-data window and owned popups; no application data or DNS is used.
|
||||
|
||||
```sh
|
||||
./mvnw -pl fx -am -Dtest=DataGridNativeInteractionTest \
|
||||
-Dneitzellib.nativeGridTest=true -Dsurefire.failIfNoSpecifiedTests=false test
|
||||
```
|
||||
|
||||
Without `neitzellib.nativeGridTest=true`, its five native tests are skipped.
|
||||
On macOS the Java launcher and launching terminal or IDE need event-posting
|
||||
permission in Privacy & Security → Accessibility. A permission-denied process
|
||||
fails before posting input; that failure does not establish a gesture failure.
|
||||
Restore any temporary permissions after testing. Keep the desktop idle: checks
|
||||
stop if focus leaves their window and owned popups. Cleanup releases input and
|
||||
disposes retained rows even on failure. Captures go to `fx/target/native-grid`.
|
||||
Cancellation waits for the native drag-completion callback before releasing the
|
||||
button or starting another gesture, including macOS's return animation.
|
||||
+12
-1
@@ -1,5 +1,7 @@
|
||||
# Local DataGrid and request coordination
|
||||
|
||||
For direct declarations, columns and data bindings in FXML, see [FXML controls](fxml-controls.md).
|
||||
|
||||
`DataGrid<K,T>` composes the existing Table result renderer with paging controls and a toolkit-independent coordinator. All UI methods are called on the JavaFX application thread. The legacy Table FXML/collection path is unchanged.
|
||||
|
||||
```java
|
||||
@@ -23,7 +25,8 @@ Use `de.neitzel.grid` for shared models/source types and `de.neitzel.fx.view` fo
|
||||
|
||||
## Operations
|
||||
|
||||
- First/Previous/Next/Last, page-size selection, Refresh and Retry are supplied. Page sizes offer 25/50/100/250 within source limits plus explicit All when supported. The initial page size is 50, bounded by source limits.
|
||||
- Vertical separators mark column boundaries in headers and data rows, follow resizing/reordering, and use the active theme border color. Group headings span the columns.
|
||||
- First/Previous/Next/Last use vector navigation icons with tooltips and accessible page names. Page-size selection, Refresh and Retry are supplied. Page sizes offer 25/50/100/250 within source limits plus explicit All when supported. The initial page size is 50, bounded by source limits.
|
||||
- Header clicks alternate ascending/descending sort for that mapped column; `setSort(null)` clears user sorting. Sorting/filter/page-size changes request the first page (All remains All with fresh consent checks).
|
||||
- `setFilters`, `setSort`, `setPageRequest`, `setSource`, `load`, `refresh`, and `retry` delegate to the coordinator; returned rows are never locally filtered again.
|
||||
- `stateProperty` exposes requested versus displayed query, result, phase and error. Loading/failed rows stay visible but disabled; selected loaded data becomes unavailable while those rows are stale. Query/navigation controls remain usable.
|
||||
@@ -43,3 +46,11 @@ The application must provide a serial owner-thread callback executor when using
|
||||
`close` cancels the active request, invalidates pending callbacks/alerts, closes the renderer and releases displayed rows. It does not close application-owned infrastructure. Observe `disposalFailureProperty` for row cleanup failures.
|
||||
|
||||
FXML filter editors and the opt-in popup host are now available; see [filter editors](filter-editors.md), including the recorded native qualification limitation. [JSON setup restore](saved-setups.md) is available through the optional Gson module. [Shared themes and window propagation](themes.md) are available opt-in. The optional [JDBC adapter and H2 example](../../fx-example/docs/product-grid.md) now demonstrate external execution. The default alert is ordinary JavaFX; native interaction/theme qualification remains part of those acceptance gates. Row mappings, programmatic order/width changes and cleanup retain the foundation guide's constraints in [table-results](table-results.md).
|
||||
|
||||
## Interactive layout and grouping
|
||||
|
||||
Column resize/reorder, grouping chips, disclosure and keyboard Column settings
|
||||
are now opt-in DataGrid features. Application-name-based saved setups are an
|
||||
optional attachment using the existing versioned setup model. See the
|
||||
[layout, grouping and persistence guide](data-grid-layout.md) for mappings,
|
||||
component lifetime, startup/recovery, storage concurrency and shutdown.
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
# Controls in FXML
|
||||
|
||||
Every public visual control supplied by `fx` can be declared in ordinary FXML.
|
||||
`FXMLLoader` constructs the view without a database, DNS connection or injection
|
||||
context. The optional `ViewLoader` applies NeitzelLib binding declarations.
|
||||
|
||||
| Control | FXML configuration | Data and lifetime |
|
||||
| --- | --- | --- |
|
||||
| `de.neitzel.fx.view.DataGrid` | Columns, typed attributes, widths, filters, grouping, page size and setup identity | Bind `items` or `source`; explicitly load after configuration, close with the view |
|
||||
| `de.neitzel.fx.view.Table` | `collection`, `row`, `Column` declarations | Existing ViewLoader collection/Component rows and `selection` binding |
|
||||
| `de.neitzel.fx.control.StatusBar` | `leftItems`, `rightItems` containing ordinary Nodes | Bind the properties of the contained controls |
|
||||
| `de.neitzel.fx.docking.DockPane` | `initialLayout`, `DockLayout`, group/split definitions | Attach a DockingManager to open application-owned content |
|
||||
| `de.neitzel.fx.control.NonNegativeIntegerSpinner` | `minimum`, `maximum`, `initialValue` constructor attributes | Bind writable `number`, which shares the value factory's property |
|
||||
| `javafx.scene.control.ToolBar` | Standard `items` and `orientation` | Standard JavaFX control, deliberately reused by the library |
|
||||
|
||||
Supporting objects such as coordinators, sources, setup stores, popup hosts,
|
||||
result renderers, theme managers and tray integrations are application/runtime
|
||||
objects, rather than controls to insert in a scene graph.
|
||||
|
||||
## DataGrid
|
||||
|
||||
```xml
|
||||
<?import de.neitzel.fx.view.*?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<VBox xmlns:fx="http://javafx.com/fxml/1">
|
||||
<fx:define>
|
||||
<BindingList>
|
||||
<DirectBinding control="people" property="items"
|
||||
path="people" direction="view"/>
|
||||
</BindingList>
|
||||
</fx:define>
|
||||
<DataGrid fx:id="people" keyAttribute="id" pageSize="50"
|
||||
maximumPageSize="250" groupingEnabled="true" groupBy="department"
|
||||
groupsCollapsed="false" setupId="people" setupVersion="1">
|
||||
<columns>
|
||||
<DataGridColumn id="name" header="Name" width="200"
|
||||
checklist="SOURCE_WIDE"/>
|
||||
<DataGridColumn id="department" header="Department" width="180"/>
|
||||
<DataGridColumn id="age" header="Age" kind="INTEGER"/>
|
||||
</columns>
|
||||
</DataGrid>
|
||||
</VBox>
|
||||
```
|
||||
|
||||
Initialize the model's `List<Person> people` before loading. Bean and Java record
|
||||
rows are supported. After `ViewLoader.load`, call the injected grid's `load()` or
|
||||
`loadAsync()` on the FX thread. The data binding shares the model's observable
|
||||
list. Add, remove, replace, permute or use an extractor update on that list to
|
||||
request a refresh immediately, invalidating older pending results. The existing
|
||||
query (filters/sort/page) is retained; use `setAll` for a single batch update. Replacing `grid.items` detaches
|
||||
the old list. Rows are snapshots: mutating a field without an observable update
|
||||
requires `refresh()`.
|
||||
|
||||
Configure before the first runtime operation. `initialize()` completes setup
|
||||
without querying, allowing an application to attach persistence before calling
|
||||
`loadAsync()`. Nothing loads in the constructor, and FXML without data displays
|
||||
column headers in a query-free preview. State is null until initialization.
|
||||
|
||||
For ordinary `FXMLLoader`, provide the list in its namespace and use
|
||||
`items="$people"`, or assign/bind `itemsProperty()` after loading. The same
|
||||
explicit loading and closing contract applies. `DirectBinding` requires
|
||||
`ViewLoader`; the usual collection-binding limitations in the main reference
|
||||
still apply, including replacing model attributes through the ViewModel.
|
||||
|
||||
A local grid requires a stable unique row key: `keyAttribute="id"` reads a public
|
||||
bean getter or record accessor. Alternatively supply `keyFactory` and
|
||||
`keyComparator` in Java before initialization. Keys must be comparable when no
|
||||
comparator is supplied. Duplicate/null keys fail the query visibly. The local
|
||||
grid owns its virtual-thread executor and releases it on `close()`.
|
||||
|
||||
For an external queried grid, bind `source` instead of `items`. Column IDs must
|
||||
match the source mappings. The source and executor remain application-owned.
|
||||
Changing an initialized source starts a request using the current filters/sort
|
||||
and first page, as with the programmatic interface. External checklist filters
|
||||
need an explicitly supplied `candidates` provider; local sources supply one.
|
||||
|
||||
Column defaults: `attribute` uses `id`, `kind="TEXT"`, width 150, minimum 80,
|
||||
maximum 1200, fixed position -1 (movable), filterable true, checklist disabled.
|
||||
Kinds are `TEXT`, `INTEGER`, `DECIMAL`, `BOOLEAN`. Text and numeric filter editors
|
||||
are built in; boolean values can render/group and use programmatic conditions,
|
||||
but have no built-in editor. Set `filterable="false"` for display-only columns.
|
||||
`groupAttribute` optionally separates stable group values from displayed/filter
|
||||
values; `groupLabels` maps those values to display labels without changing group
|
||||
identity. `type` supplies a stable schema type for saved setups; the default is
|
||||
`neitzel.<kind>.v1`. Keep type IDs and setup versions stable across upgrades.
|
||||
|
||||
The default row factory creates labels. Supply a Java `rowFactory` for custom
|
||||
nodes, styles, tooltips or actions; use `DataGridColumn.getValue(row)` to share
|
||||
the FXML mappings. FXML can also reference factories using `$factory` namespace
|
||||
values. Selection is available through the stable read-only
|
||||
`selectedKeyProperty()` and `selectedElementProperty()`; call `select(key)` to
|
||||
change it. Existing programmatic constructor and queried-grid behavior remain
|
||||
supported.
|
||||
|
||||
## Bounded integer spinner
|
||||
|
||||
```xml
|
||||
<?import de.neitzel.fx.control.NonNegativeIntegerSpinner?>
|
||||
<NonNegativeIntegerSpinner xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:id="quantity" minimum="0" maximum="100"
|
||||
initialValue="1"/>
|
||||
```
|
||||
|
||||
Use `<DirectBinding control="quantity" property="number" path="quantity"
|
||||
direction="both"/>` in a ViewLoader binding list. Valid typing commits
|
||||
immediately; invalid typing and bounds follow [bounded integer inputs](integer-spinners.md).
|
||||
The original `IntegerSpinners.nonNegative(...)` factory remains available.
|
||||
|
||||
See [bars](bars.md), [docking](docking.md) and the main [FXML reference](../README.md)
|
||||
for the existing controls. The host designer needs the updated library on its
|
||||
classpath; this feature does not replace a separately pinned Designer runtime.
|
||||
@@ -24,3 +24,10 @@ container.getChildren().add(quantity);
|
||||
```
|
||||
|
||||
Import `javafx.scene.control.Spinner` and `de.neitzel.fx.control.IntegerSpinners`; `container` is your Pane. Read `quantity.getValue()` to obtain the committed number. Set a programmatic value through `quantity.getValueFactory().setValue(...)`. Use the factory's bounds as UI constraints and keep independent business validation where the value is saved. The helper does not add an FXML binding declaration or create a Model Attribute automatically.
|
||||
|
||||
## FXML
|
||||
|
||||
Declare `NonNegativeIntegerSpinner` with `minimum`, `maximum`, and `initialValue`
|
||||
constructor attributes. Bind its writable `number` property with `DirectBinding`;
|
||||
it shares the value factory property and supports both directions. See the
|
||||
[FXML controls guide](fxml-controls.md#bounded-integer-spinner).
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# Your first JavaFX application
|
||||
|
||||
This walkthrough creates a complete Maven project with one editable name and a label that follows it. It uses Java 25, JavaFX 27.0.1 and NeitzelLib 1.0. The source build below uses the matching release tag.
|
||||
This walkthrough creates a complete Maven project with one editable name and a label that follows it. It uses Java 25, JavaFX 27.0.1 and NeitzelLib 1.0.1. The source build below uses the matching release tag.
|
||||
|
||||
## Prepare the library
|
||||
|
||||
Install a JDK 25. Use the library's Maven wrapper (3.9.11), or a separate Maven installation version 3.9.11 or newer. Check `java -version` and `./mvnw -version` before building; on macOS, select the JDK with `export JAVA_HOME=$(/usr/libexec/java_home -v 25)` if necessary.
|
||||
|
||||
```bash
|
||||
git clone --branch v1.0 https://gitea.neitzel.de/konrad/NeitzelLib.git
|
||||
git clone --branch v1.0.1 https://gitea.neitzel.de/konrad/NeitzelLib.git
|
||||
cd NeitzelLib
|
||||
./mvnw -pl fx-example -am install
|
||||
./mvnw -f fx-example/pom.xml javafx:run
|
||||
@@ -66,7 +66,7 @@ hello-fx/
|
||||
<dependency>
|
||||
<groupId>de.neitzel.lib</groupId>
|
||||
<artifactId>fx</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -190,7 +190,7 @@ For a named-module application, see the [module and lifecycle notes](architectur
|
||||
|
||||
| Symptom | Check |
|
||||
| --- | --- |
|
||||
| Maven cannot resolve `de.neitzel.lib:fx:1.0` or its parent | Install the library reactor first; use the same Maven local repository for both projects. For direct downloads, see the [Maven repository setup](../../README.md#use-a-release-from-maven). |
|
||||
| Maven cannot resolve `de.neitzel.lib:fx:1.0.1` or its parent | Install the library reactor first; use the same Maven local repository for both projects. For direct downloads, see the [Maven repository setup](../../README.md#use-a-release-from-maven). |
|
||||
| `No plugin found for prefix 'javafx'` | Invoke the example POM directly, or use the complete application POM above. Do not invoke the goal on the library reactor parent. |
|
||||
| JavaFX runtime/native library failure | Check the JDK version, architecture and JavaFX dependencies actually resolved; avoid mixing native artifacts from different platforms or JavaFX versions. |
|
||||
| `getResource(...)` returns null | The FXML belongs under `src/main/resources` in the matching package; verify it was copied to `target/classes`. Resource names are case-sensitive. |
|
||||
|
||||
+11
-1
@@ -1,6 +1,7 @@
|
||||
# Saved DataGrid setups
|
||||
|
||||
Saved setups are opt-in and preserve the legacy Table path. The `data-grid` module owns immutable models, definition validation and migrations; `fx` stages layout/result publication; the existing optional `gson` module owns JSON encoding. Applications choose storage and save/load timing. The FX library does not depend on Gson.
|
||||
Saved setups are opt-in and preserve the legacy Table path. The `data-grid` module owns immutable models, definition validation and migrations; `fx` stages layout/result publication; the existing optional `gson` module owns JSON encoding. Applications choose storage and save/load timing. The FX library does not depend on Gson. An optional application-owned attachment
|
||||
now supplies automatic storage/timing; see [layout and persistence](data-grid-layout.md).
|
||||
|
||||
## Configure and save
|
||||
|
||||
@@ -48,3 +49,12 @@ Appending a new column does not itself require a migration when the saved defini
|
||||
Implement and register `GridSetupJson.FilterCodec` for a custom stable filter type ID. Declare the write version, readable versions, explicit JSON payload and decoding logic. The codec must preserve the requested column/type identity. `readableVersions` defaults to the current write version; support older payloads only with explicit decoding/migration logic. Missing codecs and unsupported payload versions fail visibly. Codec registration is independent of editor availability and local/adapter execution; successful decoding does not establish that the active source supports the condition.
|
||||
|
||||
Built-in text, number, missing/present and checklist codecs are supplied. The built-in editor registrations now declare persistence support through this optional module. See the [JDBC demonstration](../../fx-example/docs/product-grid.md) and [shared themes](themes.md) for opt-in integration.
|
||||
|
||||
## Grouping format and automatic storage
|
||||
|
||||
Format version 2 adds ordered grouping columns and typed expansion-path choices.
|
||||
The version-one constructor/codec path remains available; compatible old documents
|
||||
inherit developer grouping defaults at restore. Preserve explicit expansion choices
|
||||
even when equal to defaults. The optional file integration wraps the setup in a
|
||||
strict grid/context/revision document and uses conditional atomic replacement.
|
||||
The plain GridSetupJson API remains available for application-managed storage.
|
||||
|
||||
@@ -18,10 +18,15 @@ Factories may supply freshly bound FXML Components as HBox roots. They must map
|
||||
|
||||
The renderer preserves supplied row order and does no local filtering, sorting, fetching or edit observation. The caller validates query results and handles guard approval before calling `show`. It stages new rows before replacing old ones. If construction or mapping validation fails, staged rows are disposed and the old page remains. Factory code that throws before returning a row owns cleanup of its partial construction.
|
||||
|
||||
`setColumnOrder` validates complete stable-ID membership and fixed positions before updating headers and fields. `setColumnWidth` accepts default/explicit intent; it returns the clamped applied width so the coordinator can report adjustments. Row roots must have zero padding (put padding inside mapped fields). Rows use zero inter-field spacing to align with result headers; action controls keep their intrinsic size. This first integration point supplies programmatic ordering/sizing, not drag UI. Header requests can be delegated through `setOnSortRequest`; the renderer never sorts locally.
|
||||
`setColumnOrder` validates complete stable-ID membership and fixed positions before updating headers and fields. `setColumnWidth` accepts default/explicit intent; it returns the clamped applied width so the coordinator can report adjustments. Row roots must have zero padding (put padding inside mapped fields). Rows use zero inter-field spacing to align with result headers; action controls keep their intrinsic size. The result integration now also supplies native resize/reorder and grouping support
|
||||
when composed by DataGrid; the stable programmatic operations remain available. Header requests can be delegated through `setOnSortRequest`; the renderer never sorts locally.
|
||||
|
||||
`select(key)` retains an off-page key; the read-only loaded selected element becomes null until that key returns. Row clicks and blank-body clicks update this separate result selection. The old `Table.selectionProperty()` remains the legacy path and is not the result-mode selection API.
|
||||
|
||||
`close()` is idempotent, removes rows/handlers and disposes row resources. Disposal failures do not undo an already published page; observe `disposalFailureProperty()` to surface them. Explicit close is necessary; attaching/removing a Table from a Scene does not infer application ownership.
|
||||
|
||||
This is a rendering foundation, not the complete DataGrid. [Local DataGrid](data-grid.md) now supplies request coordination and local source execution. [FXML popup editors](filter-editors.md), [setup codecs](saved-setups.md), and [themes](themes.md) are implemented. Ordering and sizing use the documented programmatic API; drag reorder/resize is not supplied by this result renderer.
|
||||
This is a rendering foundation, not the complete DataGrid. [Local DataGrid](data-grid.md) now supplies request coordination and local source execution. [FXML popup editors](filter-editors.md), [setup codecs](saved-setups.md), and [themes](themes.md) are implemented. DataGrid exposes both programmatic layout operations and native resize/reorder interactions over this result renderer.
|
||||
|
||||
[DataGrid layout/grouping](data-grid-layout.md) documents the component-preserving
|
||||
projection path. Local grouping must not call `show` to recreate current-page
|
||||
editors; `show` remains the guarded replacement/publication boundary.
|
||||
|
||||
Reference in New Issue
Block a user