Interface IComponent<M extends IModel>

    • Method Detail

      • getScene

        IScene getScene()
        Returns:
        the scene this component belongs to or null if component doesn't belong to a scene yet.
      • setScene

        void setScene​(IScene scene)
        Parameters:
        scene - the scene to place this component in.
      • getParent

        IComponent<?> getParent()
        Returns:
        the parent component.
      • setParent

        void setParent​(IComponent<?> component)
        Parameters:
        component - a component to set as the parent component.
      • getComponents

        Iterable<IComponent<?>> getComponents()
        Returns:
        the child components of this component.
      • getViewModels

        Iterable<IViewModel> getViewModels()
        Returns:
        the view models produced by this component.
      • setModel

        void setModel​(M model)
        Sets the model for this component. Component implementation may also accept the model from a constructor and call this method internally. Attaching listeners to the model should be postponed as long as possible, usually there are two safe points to start model listening: getComponents() or getViewModels() invocation.
        Parameters:
        model - the model to set.
      • getModel

        M getModel()
        Returns:
        the model of this component or null if component has no associated model.
      • commit

        void commit()
        Commits this component changes to the model.
      • areChildCommitsEnabled

        boolean areChildCommitsEnabled()
        Returns:
        true if child commits are allowed, false if child commits are inhibited and this component handles a commit by itself.
      • setChildCommitsEnabled

        void setChildCommitsEnabled​(boolean value)
        Parameters:
        value - true to enable child commits, false to disable them.
        See Also:
        areChildCommitsEnabled()
      • areChildRefreshEnabled

        boolean areChildRefreshEnabled()
        Returns:
        true if child refreshing are allowed, false if child refreshing are inhibited and this component handles a refresh by itself.
      • setChildRefreshEnable

        void setChildRefreshEnable​(boolean value)
        Parameters:
        value - true to enable child refreshing, false to disable them.
        See Also:
        areChildRefreshEnabled()
      • beginExternalUpdate

        void beginExternalUpdate()
        Begins the external update operation. All direct changes of the models associated with this component are marked as ChangeOrigin.External. End the operation with endExternalUpdate() call, external update operations may be nested. All model direct write changes are marked as ChangeOrigin.Internal if no external update is in progress.
      • isInExternalUpdate

        boolean isInExternalUpdate()
        Returns:
        true if external update operation is in progress, false otherwise.
        See Also:
        beginExternalUpdate()
      • endExternalUpdate

        void endExternalUpdate()
        Ends the external update operation.
        See Also:
        beginExternalUpdate()
      • dispose

        void dispose()
        Disposes this component, its view models and its child components.
      • isDisposed

        boolean isDisposed()
        Returns:
        true if the component was disposed, false otherwise.