Skip to main content

2) Connecting UI views to data

CREATE A VIEW
CREATE DATA MODELS (AND VALUE OBJECTS)
BIND VIEW ELEMENTS TO DATA


2.1) Create a view that contains all of the data and functions that need to be presented to the end user simultaneously (examples: LoginScreenView, ListAllEmployeesView). Each view needs to have bindable access to the ModelLocator as well as the required imports.

2.2) Create data models that contain the data that is accessed by the view (for example, an employees ArrayCollection).

When representing entities that are a composite of properties (for example Employee) create a value object class to represent those composite objects (EmployeeVO).

The models are public properties of the bindable ModelLocator class.

2.3) Bind elements of the view to elements of the data models, so that when the data model is updated, the view changes. The view nust contain a reference to the AppModelLocator:

[Bindable]
private var model:AppModelLocator = AppModelLocator.getInstance()
Thus allowing bindings of the kind {model.propert}