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

java.lang.Object
com._1c.g5.aef2.views.View<P,VM,NC>
All Implemented Interfaces:
IView<P,VM,NC>
Direct Known Subclasses:
LwtView, SwtView

public abstract class View<P extends IRenderingParameters,VM extends IControlViewModel,NC> extends Object implements IView<P,VM,NC>
Base IView implementation.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    bind(VM viewModel, NC nativeControl)
    Binds the view model and native control together to this view.
    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.
    final void
    bindNativeControl(NC nativeControl)
    Binds the native control to this view.
    protected final void
    bindValue(org.eclipse.core.databinding.observable.value.IObservableValue<?> modelObservable, org.eclipse.core.databinding.observable.value.IObservableValue<?> controlObservable)
    Binds two observables.
    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.
    final void
    bindViewModel(VM viewModel)
    Binds the view model to this view.
    final NC
    Gets the bound native control for this view.
    protected final P
     
    final VM
    Gets the bound view model for this view.
    protected void
    handleEventChannelEvent(IEvent event, VM viewModel, NC control)
    Handles events from IEventChannel.
    protected abstract void
    handleFocusEvent(FocusEvent event, VM viewModel, NC control)
    Handles FocusEvent.
    void
    initialize(P parameters)
    Initializes this view with parameters.
    protected abstract boolean
    Returns true if native control is disposed.
    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.
    protected final void
    Queues and waits event to the IEventChannel.
    protected final void
    Queues event to the IEventChannel.
    protected final void
    Registers the specified listener for view model IEventChannel.
    NOTE: #handleEventChannelEvent(IEvent) can be used to process event channel events.
    protected void
    unbind(VM viewModel, NC nativeControl)
    Unbinds the view model and the native control from this view.
    final void
    Unbinds the native control from this view, if any.
    final void
    Unbinds the bound view mode form this view, if any.
    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.
    protected final void
    Unregisters the specified listener.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • View

      public View()
  • Method Details

    • initialize

      public void initialize(P parameters)
      Description copied from interface: IView
      Initializes this view with parameters.
      Specified by:
      initialize in interface IView<P extends IRenderingParameters,VM extends IControlViewModel,NC>
      Parameters:
      parameters - the parameters to initialize with.
    • bindViewModel

      public final void bindViewModel(VM viewModel)
      Description copied from interface: IView
      Binds the view model to this view.
      Specified by:
      bindViewModel in interface IView<P extends IRenderingParameters,VM extends IControlViewModel,NC>
      Parameters:
      viewModel - the view model to bind.
    • getViewModel

      public final VM getViewModel()
      Description copied from interface: IView
      Gets the bound view model for this view.
      Specified by:
      getViewModel in interface IView<P extends IRenderingParameters,VM extends IControlViewModel,NC>
      Returns:
      the view model or null if no view model is bound.
    • unbindViewModel

      public final void unbindViewModel()
      Description copied from interface: IView
      Unbinds the bound view mode form this view, if any.
      Specified by:
      unbindViewModel in interface IView<P extends IRenderingParameters,VM extends IControlViewModel,NC>
    • bindNativeControl

      public final void bindNativeControl(NC nativeControl)
      Description copied from interface: IView
      Binds the native control to this view.
      Specified by:
      bindNativeControl in interface IView<P extends IRenderingParameters,VM extends IControlViewModel,NC>
      Parameters:
      nativeControl - the control to bind.
    • getNativeControl

      public final NC getNativeControl()
      Description copied from interface: IView
      Gets the bound native control for this view.
      Specified by:
      getNativeControl in interface IView<P extends IRenderingParameters,VM extends IControlViewModel,NC>
      Returns:
      the native control or null if no native control is bound.
    • unbindNativeControl

      public final void unbindNativeControl()
      Description copied from interface: IView
      Unbinds the native control from this view, if any.
      Specified by:
      unbindNativeControl in interface IView<P extends IRenderingParameters,VM extends IControlViewModel,NC>
    • 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.