Class View<P extends IRenderingParameters,​VM extends IControlViewModel,​NC>

    • Constructor Detail

      • View

        public View()
    • Method Detail

      • getParameters

        protected final P getParameters()
        Returns:
        this view rendering parameters.
      • bind

        protected void bind​(VM viewModel,
                            NC nativeControl)
        Binds the view model and native control together to this view. Override this method to customize the binding.
        Parameters:
        viewModel - the view model to bind.
        nativeControl - the native control to bind.
      • unbind

        protected void unbind​(VM viewModel,
                              NC nativeControl)
        Unbinds the view model and the native control from this view. Override this method to customize the unbinding.
        Parameters:
        viewModel - the view mode to unbind.
        nativeControl - the native control to unbind.
      • bindValue

        protected final void bindValue​(org.eclipse.core.databinding.observable.value.IObservableValue<?> modelObservable,
                                       org.eclipse.core.databinding.observable.value.IObservableValue<?> controlObservable)
        Binds two observables.
        Parameters:
        modelObservable - the view model observable to bind, cannot be null
        controlObservable - the native control observable to bind, cannot be null
      • bindValue

        protected final void bindValue​(org.eclipse.core.databinding.observable.value.IObservableValue<?> modelObservable,
                                       org.eclipse.core.databinding.observable.value.IObservableValue<?> controlObservable,
                                       org.eclipse.core.databinding.UpdateValueStrategy modelToControl,
                                       org.eclipse.core.databinding.UpdateValueStrategy controlToModel)
        Binds two observables.
        Parameters:
        modelObservable - view model observable to bind, cannot be null
        controlObservable - native control observable to bind, cannot be null
        modelToControl - the view model to native control update strategy, can be null
        controlToModel - the native control to view model update strategy, can be null
      • manageObservable

        protected final void manageObservable​(org.eclipse.core.databinding.observable.IObservable observable)
        Adds the specified observable to the view context and manages it throughout the view lifecycle.
        Parameters:
        observable - the observable to manage, cannot be null.
      • unmanageObservable

        protected final void unmanageObservable​(org.eclipse.core.databinding.observable.IObservable observable)
        Excludes the specified observable from the view context and stoppes its managing throughout the view lifecycle.
        Parameters:
        observable - the observable to unmanage, cannot be null.
      • bindListener

        protected final <T> void bindListener​(T listener,
                                              BiConsumer<NC,​T> bindAction,
                                              BiConsumer<NC,​T> undindAction)
        Binds the specified listener for the native control using the given bindAction. It will be automatically unbound within unbind(IControlViewModel, Object) using the given unbindAction.
        Parameters:
        listener - the native control listener, cannot be null.
        bindAction - the action for binding listener to native control, cannot be null.
        undindAction - the action for unbinding listener from native control, cannot be null.
      • registerEventChannelListener

        protected final void registerEventChannelListener​(IEventChannelListener listener)
        Registers the specified listener for view model IEventChannel.
        NOTE: #handleEventChannelEvent(IEvent) can be used to process event channel events. The specified method should be used only in case of custom event processing lifecycle.
        Parameters:
        listener - the listener, cannot be null.
      • unregisterEventChannelListener

        protected final void unregisterEventChannelListener​(IEventChannelListener listener)
        Unregisters the specified listener.
        Parameters:
        listener - the listener, cannot be null.
      • queueAndWaitEvent

        protected final void queueAndWaitEvent​(IEvent event)
        Queues and waits event to the IEventChannel.
        Parameters:
        event - the event, cannot be null.
      • queueEvent

        protected final void queueEvent​(IEvent event)
        Queues event to the IEventChannel.
        Parameters:
        event - the event, cannot be null.
      • handleEventChannelEvent

        protected void handleEventChannelEvent​(IEvent event,
                                               VM viewModel,
                                               NC control)
        Handles events from IEventChannel. By default handles only focus events.
        Parameters:
        event - the event, cannot be null.
        viewModel - the view model, cannot be null.
        control - the control, cannot be null.
      • handleFocusEvent

        protected abstract void handleFocusEvent​(FocusEvent event,
                                                 VM viewModel,
                                                 NC control)
        Handles FocusEvent.
        Parameters:
        event - the focus event, cannot be null.
        viewModel - the view model, cannot be null.
        control - the native control, cannot be null.
      • isControlDisposed

        protected abstract boolean isControlDisposed​(NC control)
        Returns true if native control is disposed.
        Parameters:
        control - the native control, cannot be null.
        Returns:
        true if native control is disposed, false - otherwise.