Interface WidgetInstanceFacade

  • All Known Implementing Classes:
    AdminWidgetInstanceFacade, DefaultWidgetInstanceFacade

    public interface WidgetInstanceFacade
    A facade for managing widget instances. This interface is designed to be used by the widget engine. Implementation can contain lazy loading of widget instances and hide the details from the engine.
    • Method Detail

      • getRootWidgetInstance

        WidgetInstance getRootWidgetInstance​(Widget widget)
        Returns a widget instance for the given root widget.
        Parameters:
        widget - the widget from which root is returned
        Returns:
        the root widget instance
      • getWidgetInstances

        java.util.List<WidgetInstance> getWidgetInstances​(WidgetInstance parent)
        Returns a list of all child widget instances of the given parent.
        Parameters:
        parent - WidgetInstance based on which child instances are returned
        Returns:
        child widget instances
      • getWidgetInstances

        java.util.List<WidgetInstance> getWidgetInstances​(WidgetInstance parent,
                                                          java.lang.String slotId,
                                                          boolean isSingleSlot)
        Returns a list of all instances of the given widget belonging to the given parent and assigned to the given slotId.
        Parameters:
        isSingleSlot - whether slot is single or not
        parent - the WidgetInstance from which Widget Instances will be returned
        slotId - assigned slotId from which slot instances will be returned
        Returns:
        list of all instances of the given widget belonging to the given parent and assigned to the given slotId
      • getWidgetInstances

        java.util.List<WidgetInstance> getWidgetInstances​(Widget widget,
                                                          WidgetInstance parent)
        Returns a list of all instances of the given widget belonging to the given parent.
        Parameters:
        parent - the WidgetInstance from which Widget Instances will be returned
        widget - the parent from which instances will be returned
        Returns:
        child widget instances
      • createWidgetInstance

        WidgetInstance createWidgetInstance​(Widget widget,
                                            WidgetInstance parent)
        Creates new widget instance as a child of the given parent.
        Parameters:
        parent - Widget Instance in which new widget instance will be created
        widget - a widget to create widget instance
        Returns:
        created Widget Instance
      • createWidgetInstance

        WidgetInstance createWidgetInstance​(Widget widget,
                                            WidgetInstance parentInstance,
                                            java.lang.Object creator)
        Creates new widget instance as a child of the given parent with assigned creator.
        Parameters:
        creator - assigned creator
        parentInstance - Widget Instance in which new widget instance will be created
        widget - a widget to create widget instance
        Returns:
        created Widget Instance
      • removeWidgetInstance

        void removeWidgetInstance​(WidgetInstance instance)
        Removes given widget instance from the widget tree. View model will be removed as well. All child instances will be removed as well.
        Parameters:
        instance - Widget Instance to be removed form the widget tree
      • canCreateInstance

        boolean canCreateInstance​(Widget widget,
                                  WidgetInstance parentInstance)
        Checks if a new instance of the given widget can be created. It might be disabled by user visibility rule.
        Parameters:
        widget - check will be done if this widget can be created
        parentInstance - Widget Instance in which creation possibility will be tested
        Returns:
        true if a given widget instance can be created
      • canRemoveInstance

        boolean canRemoveInstance​(WidgetInstance instance)
        Checks if the given instance can be removed.
        Parameters:
        instance - test if this instance can be removed
        Returns:
        true if removal is possible
      • getPossibleWidgets

        java.util.List<Widget> getPossibleWidgets​(WidgetInstance parentInstance,
                                                  java.lang.String slotId)
        Returns a list of all possible widgets that instances can be created of.
        Parameters:
        parentInstance - Widget Instance in which Widgets could be possibly created
        slotId - slotId name in which Widgets could be possibly created
        Returns:
        a list of all possible widgets that instances can be created of