Package com._1c.g5.aef2.views
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>
public abstract class View<P extends IRenderingParameters,VM extends IControlViewModel,NC> extends Object implements IView<P,VM,NC>
BaseIViewimplementation.
-
-
Constructor Summary
Constructors Constructor Description View()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidbind(VM viewModel, NC nativeControl)Binds the view model and native control together to this view.protected <T> voidbindListener(T listener, BiConsumer<NC,T> bindAction, BiConsumer<NC,T> undindAction)Binds the specifiedlistenerfor the native control using the givenbindAction.voidbindNativeControl(NC nativeControl)Binds the native control to this view.protected voidbindValue(org.eclipse.core.databinding.observable.value.IObservableValue<?> modelObservable, org.eclipse.core.databinding.observable.value.IObservableValue<?> controlObservable)Binds two observables.protected voidbindValue(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.voidbindViewModel(VM viewModel)Binds the view model to this view.NCgetNativeControl()Gets the bound native control for this view.protected PgetParameters()VMgetViewModel()Gets the bound view model for this view.protected voidhandleEventChannelEvent(IEvent event, VM viewModel, NC control)Handles events fromIEventChannel.protected abstract voidhandleFocusEvent(FocusEvent event, VM viewModel, NC control)HandlesFocusEvent.voidinitialize(P parameters)Initializes this view with parameters.protected abstract booleanisControlDisposed(NC control)Returnstrueif native control is disposed.protected voidmanageObservable(org.eclipse.core.databinding.observable.IObservable observable)Adds the specified observable to the view context and manages it throughout the view lifecycle.protected voidqueueAndWaitEvent(IEvent event)Queues and waits event to theIEventChannel.protected voidqueueEvent(IEvent event)Queues event to theIEventChannel.protected voidregisterEventChannelListener(IEventChannelListener listener)Registers the specified listener for view modelIEventChannel.
NOTE:#handleEventChannelEvent(IEvent)can be used to process event channel events.protected voidunbind(VM viewModel, NC nativeControl)Unbinds the view model and the native control from this view.voidunbindNativeControl()Unbinds the native control from this view, if any.voidunbindViewModel()Unbinds the bound view mode form this view, if any.protected voidunmanageObservable(org.eclipse.core.databinding.observable.IObservable observable)Excludes the specified observable from the view context and stoppes its managing throughout the view lifecycle.protected voidunregisterEventChannelListener(IEventChannelListener listener)Unregisters the specified listener.
-
-
-
Method Detail
-
initialize
public void initialize(P parameters)
Description copied from interface:IViewInitializes this view with parameters.- Specified by:
initializein interfaceIView<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:IViewBinds the view model to this view.- Specified by:
bindViewModelin interfaceIView<P extends IRenderingParameters,VM extends IControlViewModel,NC>- Parameters:
viewModel- the view model to bind.
-
getViewModel
public final VM getViewModel()
Description copied from interface:IViewGets the bound view model for this view.- Specified by:
getViewModelin interfaceIView<P extends IRenderingParameters,VM extends IControlViewModel,NC>- Returns:
- the view model or
nullif no view model is bound.
-
unbindViewModel
public final void unbindViewModel()
Description copied from interface:IViewUnbinds the bound view mode form this view, if any.- Specified by:
unbindViewModelin interfaceIView<P extends IRenderingParameters,VM extends IControlViewModel,NC>
-
bindNativeControl
public final void bindNativeControl(NC nativeControl)
Description copied from interface:IViewBinds the native control to this view.- Specified by:
bindNativeControlin interfaceIView<P extends IRenderingParameters,VM extends IControlViewModel,NC>- Parameters:
nativeControl- the control to bind.
-
getNativeControl
public final NC getNativeControl()
Description copied from interface:IViewGets the bound native control for this view.- Specified by:
getNativeControlin interfaceIView<P extends IRenderingParameters,VM extends IControlViewModel,NC>- Returns:
- the native control or
nullif no native control is bound.
-
unbindNativeControl
public final void unbindNativeControl()
Description copied from interface:IViewUnbinds the native control from this view, if any.- Specified by:
unbindNativeControlin interfaceIView<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 benullcontrolObservable- the native control observable to bind, cannot benull
-
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 benullcontrolObservable- native control observable to bind, cannot benullmodelToControl- the view model to native control update strategy, can benullcontrolToModel- the native control to view model update strategy, can benull
-
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 benull.
-
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 benull.
-
bindListener
protected final <T> void bindListener(T listener, BiConsumer<NC,T> bindAction, BiConsumer<NC,T> undindAction)Binds the specifiedlistenerfor the native control using the givenbindAction. It will be automatically unbound withinunbind(IControlViewModel, Object)using the givenunbindAction.- Parameters:
listener- the native control listener, cannot benull.bindAction- the action for binding listener to native control, cannot benull.undindAction- the action for unbinding listener from native control, cannot benull.
-
registerEventChannelListener
protected final void registerEventChannelListener(IEventChannelListener listener)
Registers the specified listener for view modelIEventChannel.
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 benull.
-
unregisterEventChannelListener
protected final void unregisterEventChannelListener(IEventChannelListener listener)
Unregisters the specified listener.- Parameters:
listener- the listener, cannot benull.
-
queueAndWaitEvent
protected final void queueAndWaitEvent(IEvent event)
Queues and waits event to theIEventChannel.- Parameters:
event- the event, cannot benull.
-
queueEvent
protected final void queueEvent(IEvent event)
Queues event to theIEventChannel.- Parameters:
event- the event, cannot benull.
-
handleEventChannelEvent
protected void handleEventChannelEvent(IEvent event, VM viewModel, NC control)
Handles events fromIEventChannel. By default handles only focus events.- Parameters:
event- the event, cannot benull.viewModel- the view model, cannot benull.control- the control, cannot benull.
-
handleFocusEvent
protected abstract void handleFocusEvent(FocusEvent event, VM viewModel, NC control)
HandlesFocusEvent.- Parameters:
event- the focus event, cannot benull.viewModel- the view model, cannot benull.control- the native control, cannot benull.
-
isControlDisposed
protected abstract boolean isControlDisposed(NC control)
Returnstrueif native control is disposed.- Parameters:
control- the native control, cannot benull.- Returns:
trueif native control is disposed,false- otherwise.
-
-