OOUI/Windows/Window managers

Each window is managed by a  , which is used to open and close the window and control its presentation. Windows are added to the window manager by reference, symbolic name, or explicitly defined symbolic name. If a dialog class is registered with a factory (OO.factory), the factory can be used to instantiate the windows as needed. See Using factories and symbolic names for an example.

Window managers can be configured to prevent interaction outside the window (by setting the  option to  ). For a full list of supported methods and configuration options, please see the code-level documentation.

For more information about the lifecycle of a window and the methods and promises the window manager calls and emits while directing this cycle, please see OOUI/Windows.

Using factories and symbolic names
Most of the examples in this documentation consist of windows that are instantiated and then added to a window manager by reference. Though useful for illustrating how windows are composed and managed, in practice, you will often find it useful to refer to windows by symbolic name instead. A symbolic name is specified with the Dialog class’s static name property or when a window is added by reference to the window manager (in this case, both a static name and the reference are passed like this:, and the two patterns can be used interchangeably).

Window classes must have a static name property in order to be registered with OO.Factory, which creates new window objects referred to by symbolic name, a practice that provides more flexibility than simply instantiating objects directly and referring to them only by reference. For example, a factory is often used in the following scenarios:
 * 1) To reference a concept rather than an instance of it. If an application uses several types of similar windows (a simple and advanced help window, for example), a factory can be used to create and make available the appropriate version of the window as needed. Because the windows are referenced by their symbolic name (‘help’, in this example) the factory will simply create whichever ‘help’ window is requested, replacing an existing ‘help’ window with the new ‘help’ window if a previous version has been made.
 * 2) To create windows only as needed. Windows can be registered with a factory using a symbolic window name as well as the name of the constructor that will be used to create it. The window is not actually instantiated until it is needed (i.e., when the window manager opens the window, the factory creates the new window on the fly).

Example: Referencing windows by symbolic name and using a factory to instantiate the windows as needed. "WindowManager1.png"

Example: Referencing windows by explicitly defined symbolic name

"WindowManager2.png"