<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>I also like the idea of having some kind of Validation in JavaFX.<br/>
But I'm also unsure how/what to implement.</div>
<div> </div>
<div>What I implemented for my application is some kind of Validator framework, which is:</div>
<div>- Binding itself to the textProperty() of TextInputControls</div>
<div>- Binding itself to the selected item for ComboBoxes</div>
<div> </div>
<div>
<div>I also implemented some kind of validation for tables, where cells report back to the table if there are invalid/valid, so that we can easily know if a table is considered valid or not.</div>
<div>The user modified idea froma Michael is a good first start for an idea where JavaFX may help (in this case I can always bind to one property, making the Validator code at least easier). I still may need to implement when this property is set (for some Controls as least).</div>
<div> </div>
<div>Another usecase we often need is to show a graphic when a Control is considered invalid. This is actually very tricky.</div>
<div>If you check ValidatorFX, it injects a so called GraphicDecorationStackPane as scene root (replacing your own root) in order to manage the error graphics that are shown when a Control is invalid.</div>
<div>We use another approach (which I think I saw at ControlsFX - not sure though) where we 'hope' that the Control has a SkinBase skin, and if so access the children via #getChildren() to add our (unmanaged) graphic node and relocate it where needed (mostly bottom left, with a Tooltip attached to the graphic).</div>
<div>It would be nice if JavaFX can help here as well so that we do not need to do rather questionable checks for SkinBase and that stuff.</div>
<div> </div>
<div>TLDR:</div>
<div>- user modified API or something similar is a good first step</div>
<div>- an easy way to add an e.g. error graphic node to an invalid Control, like in ControlsFX or ValidatorFX, without handling much ourself.</div>
<div> </div>
<div>- Marius</div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Freitag, 01. März 2024 um 11:59 Uhr<br/>
<b>Von:</b> "Dirk Lemmermann" <dlemmermann@gmail.com><br/>
<b>An:</b> "openjfx-dev" <openjfx-dev@openjdk.org><br/>
<b>Betreff:</b> Validation Support</div>
<div name="quoted-content">
<div>Hi everyone,
<div> </div>
<div>I updated the validation framework ValidatorFX today in our project to the latest release and I really like it a lot. It is a small compact API and works with any observable as opposed to the validation support provided by ControlsFX. </div>
<div> </div>
<div>Using it made me wonder whether it would make sense to bundle it or something like it directly with JavaFX. Developers often mention missing validation support as a drawback of using JavaFX. Adding this would take one item off from the list of arguments against using JavaFX. </div>
<div> </div>
<div>Many UI frameworks do have built-in validation support, e.g. Vaadin [0], Angular, [1], or QT [2]</div>
<div> </div>
<div>What do you think?</div>
<div> </div>
<div>—Dirk</div>
<div> </div>
<div>[0] <a href="https://vaadin.com/docs/latest/binding-data/components-binder-validation" target="_blank">https://vaadin.com/docs/latest/binding-data/components-binder-validation</a></div>
<div>[1] <a href="https://angular.io/guide/form-validation" target="_blank">https://angular.io/guide/form-validation</a></div>
<div>[2] <a href="https://doc.qt.io/qt-6/qtquick-input-textinput.html" target="_blank">https://doc.qt.io/qt-6/qtquick-input-textinput.html</a></div>
<div> </div>
</div>
</div>
</div>
</div>
</div></div></body></html>