Create a controller widget

A controller widget is a widget that controls other widgets in the widget pool. The HeaderController widget in the FoldableTheme is an example of a controller widget. A controller widget is usually added as part of a theme.

The controller widget can be created in the same way as other widgets with the following additions:

  • Add the jimu/PoolControllerMixin class.

    This class provides the following methods:

    MethodDescription

    getWidgetConfigs

    Returns all the widgets configured in the widget pool and does not include any widgets in the group.

    getGroupConfigs

    Returns all the groups configured in the widget pool.

    getAllConfigs

    Returns all the groups and widgets configured in the widget pool.

    getConfigById

    Gets the config section by ID.

    In the Builder environment, the class also provides the following methods to override if needed:

    MethodDescription

    getOpenedIds

    Returns IDs for all open widgets and groups.

    setOpenedIds

    Opens the widgets and groups defined by the parameter.

  • Create a control menu based on the configuration in the widget pool.
Note:

There are two types of widgets: in-panel and off-panel. Be sure to open the widget correctly.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.