# 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, `selectionMode` 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.control.AutoCompleteTextField` | Standard TextField attributes, fixed `suggestions` and a bindable `suggestionsSource` of type `ObservableList` | Type a prefix, use arrow keys and Enter or select with the mouse. Selecting emits the normal text-field action | | `de.neitzel.fx.control.HtmlViewer` | `mediaButtonVisible`, `mediaLoadText`, `mediaReloadText`, `mediaTooltipText`, `noExternalMediaText` | Bind local text to `html` or use `load` / `loadHtml` / `display`; call `close()` when disposed. See [HTML viewer](html-viewer.md) | | `de.neitzel.fx.control.TagChip` | `text`, `removable` (false by default), `onRemove` | The action handler owns removing the tag from its model | | `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 | | `de.neitzel.fx.control.ToolBarPane` | `items`, `dismissible`, `dismissText`, `onDismiss` | Uses a JavaFX ToolBar and keeps the optional dismissal button outside overflow | 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 ``` Initialize the model's `List 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..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 ``` Use `` 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. ### Model-driven suggestions Use `` for an observable list of strings. A non-null source (including an empty list) takes precedence over the fixed FXML entries in `getSuggestions()`. The popup follows replacements and edits to the active list while the field is attached. Choosing a match sets the field text and fires its action. Setting the source to null or unbinding `suggestionsSourceProperty()` restores the fixed entries. Closing a managed DirectBinding restores its previous list source. Removing the field from its scene dismisses the popup and detaches its list listener.