Communication Between Widgets
To build a meaningful application out of widgets, the widgets must communicate with each other.
This does not happen directly, as widgets are not aware of other widgets. Rather, a widget outputs a message or data, and then other widgets receive and act on the information if configured to do so. If required and depending on the configuration of the widget, the receiving widgets process the information.
For example, a list component can send out information each time an item in the list is selected by the user. Other widgets can react to this information if configured to do so. For example, a search component can update a results list each time an item is selected. Because of this architecture, widgets can be removed and exchanged, or new widgets can be added, without breaking the application. There are no dependencies.
The following diagram illustrates widgets and their inputs and outputs.
-
In the definition, there is a declaration of all inputs and outputs of a widget, which are called sockets. A socket has an ID and a type definition. This helps with compatibility checking when connecting two widgets. For example, an item list widget could have the output selectedItem of type Item. You can connect this output to any widget that accepts an input of type Item.
-
For the widget instance, there is a representation for each connection established between two widgets. This widget connection has references to the source and target widget as well as the IDs of the input and output sockets. When a widget sends data to one of its outputs, the data is sent to every widget that is connected with that output. All other widgets are not notified. Together with the widget tree structure, the widget connections are part of a Backoffice Application configuration.