Interface WidgetService

  • All Known Implementing Classes:
    DefaultWidgetService

    public interface WidgetService
    Service for managing widget tree with socket connections.
    • Field Detail

      • COMPOSED_ROOT_SLOT_ID

        static final java.lang.String COMPOSED_ROOT_SLOT_ID
        See Also:
        Constant Field Values
    • Method Detail

      • createWidget

        Widget createWidget​(Widget parent,
                            java.lang.String id,
                            java.lang.String slotId,
                            java.lang.String definitionId)
        Creates widget's instance
        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

        Widget createComposedWidget​(Widget parent,
                                    java.lang.String id,
                                    java.lang.String slotId,
                                    java.lang.String definitionId,
                                    Widget rootNode)
        Creates a widget that is composed of one or more widgets.
        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
      • removeWidget

        void removeWidget​(Widget widget)
        Removes widget
        Parameters:
        widget - to remove
      • moveWidget

        void moveWidget​(Widget widget,
                        Widget newParent)
        Moves widget to another one
        Parameters:
        widget - which should be moved
        newParent - new parent for the widget
      • getWidgetConnectionsForOutputWidgetAndSocketID

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

        WidgetConnection createWidgetConnection​(Widget sourceWidget,
                                                Widget targetWidget,
                                                java.lang.String inputId,
                                                java.lang.String outputId)
        Creates a connection between widgets
        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
      • loadComposedChildren

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

        java.util.Set<Widget> getAllDescendants​(Widget composedWidgetRoot)
        Returns set of descendants for given composed widget
        Parameters:
        composedWidgetRoot - composed widget
        Returns:
        set of descendants for given composed widget