Mutual Binding

In the PureMVC model, the data are displayed to the user in the view components.

Flex has a binding feature that can simplify the creation of a link between the data and the Flex components. But this binding feature is not mutual.

The ViewComponentUtils is an utility class that can synchronize a property from the data model and a Flex component. You can synchronize a TextInput or a ComboBox to a object property

The ViewComponentUtils contains code to synchronize a TextInput, ComboBox and DateField.

Identifiable

For a ComboBox, there is two kind of synchronisation.

  • You can synchronize the data model object property with the selectedItem of the ComboBox.
  • You can synchronize the data model object property with the ID of the selectedItem in the ComboBox.

    By default, the ViewComponentUtils synchronize the object property with the selectedItem of the ComboBox component.

    The Identifiable interface is there to adress the second model. If the selectedItem is an Identifiable ((comboBox.selectedItem is Identifiable) == true) then the MutualBinding synchronize the ID of the selectedItem and the objet model property