Class DefaultWidgetService

  • All Implemented Interfaces:
    WidgetService

    public class DefaultWidgetService
    extends java.lang.Object
    implements WidgetService
    Default implementation of WidgetService. Provides methods dealing with creating and removing widgets, creating composed widgets, creating connections.
    • Constructor Detail

      • DefaultWidgetService

        public DefaultWidgetService()
    • Method Detail

      • createWidget

        public Widget createWidget​(Widget parent,
                                   java.lang.String id,
                                   java.lang.String slotId,
                                   java.lang.String definitionId)
        Description copied from interface: WidgetService
        Creates widget's instance
        Specified by:
        createWidget in interface WidgetService
        Parameters:
        parent - of given widget
        id - of newly created widget
        slotId - in parent widget where newly created widget will be put
        definitionId - of widget
        Returns:
        newly created widget
      • createComposedWidget

        public Widget createComposedWidget​(Widget parent,
                                           java.lang.String id,
                                           java.lang.String slotId,
                                           java.lang.String definitionId,
                                           Widget rootNode)
        Description copied from interface: WidgetService
        Creates a widget that is composed of one or more widgets.
        Specified by:
        createComposedWidget in interface WidgetService
        Parameters:
        parent - of given widget
        id - of newly created widget
        slotId - in parent widget where newly created widget will be put
        definitionId - of widget
        rootNode - a template widget from which all the settings and properties are cloned
        Returns:
        composed widget
      • loadComposedChildren

        public void loadComposedChildren​(Widget composedWidget,
                                         Widget templateNode)
        Description copied from interface: WidgetService
        Clones all the settings and properties from a template widget and creates composed root widget which is assigned to composed widget
        Specified by:
        loadComposedChildren in interface WidgetService
        Parameters:
        composedWidget - a composed widget
        templateNode - a template widget from which all the settings and properties are cloned
      • getAllDescendants

        public java.util.Set<Widget> getAllDescendants​(Widget widget)
        Description copied from interface: WidgetService
        Returns set of descendants for given composed widget
        Specified by:
        getAllDescendants in interface WidgetService
        Parameters:
        widget - composed widget
        Returns:
        set of descendants for given composed widget
      • getWidgetConnectionsForOutputWidgetAndSocketID

        public java.util.List<WidgetConnection> getWidgetConnectionsForOutputWidgetAndSocketID​(Widget widget,
                                                                                               java.lang.String outputId)
        Description copied from interface: WidgetService
        Gets all connections of widget's socket
        Specified by:
        getWidgetConnectionsForOutputWidgetAndSocketID in interface WidgetService
        Parameters:
        widget - a widget's instance
        outputId - id of socket
        Returns:
        list of all connections related to given socket id
      • createWidgetConnection

        public WidgetConnection createWidgetConnection​(Widget sourceWidget,
                                                       Widget targetWidget,
                                                       java.lang.String inputId,
                                                       java.lang.String outputId)
        Description copied from interface: WidgetService
        Creates a connection between widgets
        Specified by:
        createWidgetConnection in interface WidgetService
        Parameters:
        sourceWidget - Widget from which the connection will be made
        targetWidget - Widget to which the connection will be made
        inputId - socket name of target widget
        outputId - socket name of source widget
        Returns:
        connection between two widgets
      • moveWidget

        public void moveWidget​(Widget widget,
                               Widget newParent)
        Description copied from interface: WidgetService
        Moves widget to another one
        Specified by:
        moveWidget in interface WidgetService
        Parameters:
        widget - which should be moved
        newParent - new parent for the widget