Control Models as Bound Components

From Apache OpenOffice Wiki
Jump to: navigation, search

You expect that the control displays the current data of the column it is tied to. Current data means the data in the row that the is currently located on. Now, the control does not know about data-awareness, only the control model does, but we already have a connection between the model and control: As described in the chapter about model-view interaction, Model-View Interaction, the control listens for changes to the model properties, as well as updates them when a user interacts with the control directly.

For instance, you know the Text property of a simple text input field, is updated by the control when the user enters text. When the property is updated through any other means, the control reacts appropriately and adjusts the text it displays.

This mechanism is found in all controls. The only difference is the property used to determine the contents to be displayed. For instance, numeric controls have a property Value representing the current numerical value to be displayed.Although the name differs, all control models have a dedicated content property.

This is where the data-awareness comes in. A data-aware control model bound to a data column uses its content property to exchange data with this column. As soon as the column value changes, the model forwards the new value to its content property, and notifies its listeners. One of these listeners is the control that updates its display:

Control fetching data
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages