Let a Direct binding convert a value and keep one failure Message.
A bad control value must leave the previous Attribute in place, and the ViewModel should keep a single error for that Path until the value is fixed. An info notice stays on the ViewModel and is not written to the log. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import de.neitzel.fx.view.BindingList?>
|
||||
<?import de.neitzel.fx.view.DirectBinding?>
|
||||
|
||||
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
|
||||
<fx:define>
|
||||
<BindingList>
|
||||
<DirectBinding control="ageField" property="text" path="age" direction="both"
|
||||
converter="de.neitzel.fx.view.fixture.PrefixedAgeConverter"/>
|
||||
<DirectBinding control="ageLabel" property="text" path="age" direction="view"
|
||||
converter="de.neitzel.fx.view.fixture.ShownAgeConverter"/>
|
||||
</BindingList>
|
||||
</fx:define>
|
||||
<TextField fx:id="ageField" id="ageField"/>
|
||||
<Label fx:id="ageLabel" id="ageLabel"/>
|
||||
</VBox>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import de.neitzel.fx.view.BindingList?>
|
||||
<?import de.neitzel.fx.view.DirectBinding?>
|
||||
|
||||
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
|
||||
<fx:define>
|
||||
<BindingList>
|
||||
<DirectBinding control="ageField" property="text" path="age" direction="both"
|
||||
converter="de.neitzel.fx.view.fixture.PrefixedAgeConverter"/>
|
||||
</BindingList>
|
||||
</fx:define>
|
||||
<TextField fx:id="ageField" id="ageField"/>
|
||||
</VBox>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import de.neitzel.fx.view.BindingList?>
|
||||
<?import de.neitzel.fx.view.DirectBinding?>
|
||||
|
||||
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
|
||||
<fx:define>
|
||||
<BindingList>
|
||||
<DirectBinding control="ageField" property="text" path="age" direction="model"
|
||||
converter="de.neitzel.fx.view.fixture.PrefixedAgeConverter"/>
|
||||
</BindingList>
|
||||
</fx:define>
|
||||
<TextField fx:id="ageField" id="ageField"/>
|
||||
</VBox>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import de.neitzel.fx.view.BindingList?>
|
||||
<?import de.neitzel.fx.view.DirectBinding?>
|
||||
|
||||
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
|
||||
<fx:define>
|
||||
<BindingList>
|
||||
<DirectBinding control="ageLabel" property="text" path="age" direction="view"
|
||||
converter="de.neitzel.fx.view.fixture.ShownAgeConverter"/>
|
||||
</BindingList>
|
||||
</fx:define>
|
||||
<Label fx:id="ageLabel" id="ageLabel"/>
|
||||
</VBox>
|
||||
Reference in New Issue
Block a user