Programming Dialogs and Dialog Controls
The dialogs and dialog controls are UNO components that provide a graphical user interface belonging to the module com.sun.star.awt. The Toolkit controls follow the Model-View-Controller (MVC) paradigm, which separates the component into three logical units, the model, view, and controller. The model represents the data and the low-level behavior of the component. It has no specific knowledge of its controllers or its views. The view manages the visual display of the state represented by the model. The controller manages the user interaction with the model.
|Note, that the Toolkit controls combine the view and the controller into one logical unit, which forms the user interface for the component.
The following example of a text field illustrates the separation into model, view and controller.
The model contains the data which describes the text field; for example, the text to be displayed, text color and maximum text length. The text field model is implemented by the com.sun.star.awt.UnoControlEditModel service that extends the com.sun.star.awt.UnoControlModel service. All aspects of the model are described as a set of properties which are accessible through the com.sun.star.beans.XPropertySet interface.
The view is responsible for the display of the text field and its content. It is possible in general to have multiple views for the same model, but not for Toolkit dialogs. The view is notified about model changes; for example, changes to the text color property causes the text field to be repainted.
The controller handles the user input provided through the keyboard and mouse. If the user changes the text in the text field, the controller updates the corresponding model property. In addition, the controller updates the view; for example, if the user presses the delete button on the keyboard, the marked text in the text field is deleted. A more detailed description of the MVC paradigm can be found in the chapter about Forms.
The base for all the Toolkit controls is the com.sun.star.awt.UnoControl service that exports the following interfaces:
- The com.sun.star.awt.XControl interface specifies control basics. For example, it gives access to the model, view and context of a control.
- The com.sun.star.awt.XWindow interface specifies operations for a window component.
- The com.sun.star.awt.XView interface provides methods for attaching an output device and drawing an object.
|Content on this page is licensed under the Public Documentation License (PDL).