The difference is in List properties that also have a setter. Take example from RT-17714.
The following FXML will call the handle method, as the items property in ListView contains the list constructed in the FXML:
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.collections.FXCollections?>
<?import javafx.scene.control.ListView?>
<ListView fx:controller="collectioneventshandler.SampleController"
xmlns:fx="http://javafx.com/fxml">
<items>
<FXCollections fx:factory="observableArrayList"
onChange="#handleListChangeEvent">
<String fx:value="ABC"/>
</FXCollections>
</items>
</ListView>
However, using the default property will just add the list content to the items property:
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.collections.FXCollections?>
<?import javafx.scene.control.ListView?>
<ListView fx:controller="collectioneventshandler.SampleController"
xmlns:fx="http://javafx.com/fxml">
<FXCollections fx:factory="observableArrayList"
onChange="#handleListChangeEvent">
<String fx:value="ABC"/>
</FXCollections>
</ListView>
The following FXML will call the handle method, as the items property in ListView contains the list constructed in the FXML:
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.collections.FXCollections?>
<?import javafx.scene.control.ListView?>
<ListView fx:controller="collectioneventshandler.SampleController"
xmlns:fx="http://javafx.com/fxml">
<items>
<FXCollections fx:factory="observableArrayList"
onChange="#handleListChangeEvent">
<String fx:value="ABC"/>
</FXCollections>
</items>
</ListView>
However, using the default property will just add the list content to the items property:
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.collections.FXCollections?>
<?import javafx.scene.control.ListView?>
<ListView fx:controller="collectioneventshandler.SampleController"
xmlns:fx="http://javafx.com/fxml">
<FXCollections fx:factory="observableArrayList"
onChange="#handleListChangeEvent">
<String fx:value="ABC"/>
</FXCollections>
</ListView>
- duplicates
-
JDK-8091276 FXML should auto-coerce to ObservableList
-
- Open
-