CoreMedia Studio - based on Ext JS - consists of UI components. Each component is responsible for the user interaction of a local part of the whole Studio UI. The components are organized in the component hierarchy and the state of a component can depend on its place in the hierarchy. For example the publish button in the actions toolbar publishes the current content of the work area. The publish button in the library view however publishes the selected items in the library. So the content state of the publish button must be transferred from the outer container (the library or a premular) to the button. Even more: the state of the outer container must be synchronized with the state of child components when it changes.
A straight approach for the requirement combines the Ext JS configuration and the event mechanism: The container defines a value expression of the state and hands it down the component hierarchy - until the target component (the publish button in the example) is finally configured to use the value expression. This approach has two major drawbacks:
Many components along the way from the container to the component just pass the state configuration from one hierarchy level to the next without being interested in the state by themselves. This leads to a bunch of boilerplate, error-prone code. For example an intermediate container might forget to pass the configuration.
Second there are cases where the state configuration of the container is not available for the child components - For example in a plugin rule you want to add a new button to the toolbar of the library which will do some actions on the selected items. Hence, the value expression of the selected items must be passed to the button but you cannot access the value expression in the plugin rule in the standard, well-defined way. Alternatively all containers along the hierarchy could use the
defaults
configuration to apply default settings to all added items. Again it leads to boilerplate, error-prone code.