Class Component<M extends IModel,​P extends IParameterization>

    • Constructor Detail

      • Component

        protected Component​(P parameterization)
        Creates a component.
        Parameters:
        parameterization - the parameterization instance.
    • Method Detail

      • getScene

        public IScene getScene()
        Specified by:
        getScene in interface IComponent<M extends IModel>
        Returns:
        the scene this component belongs to or null if component doesn't belong to a scene yet.
      • setScene

        public void setScene​(IScene scene)
        Specified by:
        setScene in interface IComponent<M extends IModel>
        Parameters:
        scene - the scene to place this component in.
      • setParent

        public void setParent​(IComponent<?> parent)
        Specified by:
        setParent in interface IComponent<M extends IModel>
        Parameters:
        parent - a component to set as the parent component.
      • dispose

        public void dispose()
        Description copied from interface: IComponent
        Disposes this component, its view models and its child components.
        Specified by:
        dispose in interface IComponent<M extends IModel>
      • isDisposed

        public boolean isDisposed()
        Specified by:
        isDisposed in interface IComponent<M extends IModel>
        Returns:
        true if the component was disposed, false otherwise.
      • setModel

        public final void setModel​(M model)
        Description copied from interface: IComponent
        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: IComponent.getComponents() or IComponent.getViewModels() invocation.
        Specified by:
        setModel in interface IComponent<M extends IModel>
        Parameters:
        model - the model to set.
      • getModel

        public final M getModel()
        Specified by:
        getModel in interface IComponent<M extends IModel>
        Returns:
        the model of this component or null if component has no associated model.
      • commit

        public void commit()
        Description copied from interface: IComponent
        Commits this component changes to the model.
        Specified by:
        commit in interface IComponent<M extends IModel>
      • areChildCommitsEnabled

        public boolean areChildCommitsEnabled()
        Specified by:
        areChildCommitsEnabled in interface IComponent<M extends IModel>
        Returns:
        true if child commits are allowed, false if child commits are inhibited and this component handles a commit by itself.
      • areChildRefreshEnabled

        public boolean areChildRefreshEnabled()
        Specified by:
        areChildRefreshEnabled in interface IComponent<M extends IModel>
        Returns:
        true if child refreshing are allowed, false if child refreshing are inhibited and this component handles a refresh by itself.
      • queueAndWaitEvent

        public final void queueAndWaitEvent​(IEvent event)
        Description copied from interface: IEventChannel
        Queues the event to this channel and waits for its processing done. Typically, events created as a result of the user interaction with the UI should be processed synchronously using this method.
        Specified by:
        queueAndWaitEvent in interface IEventChannel
        Parameters:
        event - the event to queue.
        See Also:
        IEventChannel.queueEvent(IEvent)
      • getParameterization

        public P getParameterization()
        Returns the parameterization of the component.
        Returns:
        the parameterization of the component.
      • createComponents

        protected void createComponents()
        Creates the child components of this component. Override it to fill a component with a child components.

        Method can be called multiple times.

      • createViewModels

        protected void createViewModels()
        Creates the view models of this component. Override it to provide a view models of this component.
      • attachToModel

        protected void attachToModel()
        Attaches this component to the model. Override it to add some listeners to the model.
      • detachFromModel

        protected void detachFromModel()
        Detaches this component from the model. Override it to remove listeners from the model.
      • addComponent

        protected <C extends IComponent<?>> C addComponent​(C component)
        Adds the child component.
        Returns:
        the added component.
      • removeComponent

        protected void removeComponent​(IComponent<?> component)
        Removes the child component.
        Parameters:
        component - the component to remove.
      • disposeComponents

        protected void disposeComponents()
        Disposes the child components. Override it to do some additional disposal operations specific to a component.
      • addViewModel

        protected void addViewModel​(IViewModel viewModel)
        Adds the view model to the view models of this component.
        Parameters:
        viewModel - the view model to add.
      • removeViewModel

        protected void removeViewModel​(IViewModel viewModel)
        Removes the view model from the view models of this component.
        Parameters:
        viewModel - the view model to remove.
      • disposeViewModels

        protected void disposeViewModels()
        Disposes the view models of this component. Override it to do some additional disposal operations specific to a component.
      • areComponentsCreated

        protected final boolean areComponentsCreated()
        Returns:
        true if child components have been created, false otherwise
      • checkComponents

        protected final void checkComponents()
        Checks that the child components are actually created.
      • checkViewModels

        protected final void checkViewModels()
        Checks that the view models of this components are actually created.
      • subscribeOnEvents

        protected final void subscribeOnEvents​(Class<? extends IServiceEvent> eventClass)
        Subscribes on events which is instances of the given class.
        Parameters:
        eventClass - the class of events.
      • subscribeOnEvents

        protected final void subscribeOnEvents​(IServiceEventQualifier eventQualifier)
        Subscribes on events which is covered by the given qualifier.
        Parameters:
        eventQualifier - the IServiceEventQualifier instance, cannot be null.
      • unsubscribeOnEvents

        protected final void unsubscribeOnEvents​(IServiceEventQualifier eventQualifier)
        Unsubscribes on events which is covered by the given qualifier.
        Parameters:
        eventQualifier - the IServiceEventQualifier instance, cannot be null.