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>
Base
IView implementation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidBinds the view model and native control together to this view.protected final <T> voidbindListener(T listener, BiConsumer<NC, T> bindAction, BiConsumer<NC, T> undindAction) Binds the specifiedlistenerfor the native control using the givenbindAction.final voidbindNativeControl(NC nativeControl) Binds the native control to this view.protected final voidbindValue(org.eclipse.core.databinding.observable.value.IObservableValue<?> modelObservable, org.eclipse.core.databinding.observable.value.IObservableValue<?> controlObservable) Binds two observables.protected final 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.final voidbindViewModel(VM viewModel) Binds the view model to this view.final NCGets the bound native control for this view.protected final Pfinal VMGets 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 final voidmanageObservable(org.eclipse.core.databinding.observable.IObservable observable) Adds the specified observable to the view context and manages it throughout the view lifecycle.protected final voidqueueAndWaitEvent(IEvent event) Queues and waits event to theIEventChannel.protected final voidqueueEvent(IEvent event) Queues event to theIEventChannel.protected final voidRegisters the specified listener for view modelIEventChannel.
NOTE:#handleEventChannelEvent(IEvent)can be used to process event channel events.protected voidUnbinds the view model and the native control from this view.final voidUnbinds the native control from this view, if any.final voidUnbinds the bound view mode form this view, if any.protected final 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 final voidUnregisters the specified listener.
-
Constructor Details
-
View
public View()
-
-
Method Details
-
initialize
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
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
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
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
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
- Returns:
- this view rendering parameters.
-
bind
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
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
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
Unregisters the specified listener.- Parameters:
listener- the listener, cannot benull.
-
queueAndWaitEvent
Queues and waits event to theIEventChannel.- Parameters:
event- the event, cannot benull.
-
queueEvent
Queues event to theIEventChannel.- Parameters:
event- the event, cannot benull.
-
handleEventChannelEvent
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
HandlesFocusEvent.- Parameters:
event- the focus event, cannot benull.viewModel- the view model, cannot benull.control- the native control, cannot benull.
-
isControlDisposed
Returnstrueif native control is disposed.- Parameters:
control- the native control, cannot benull.- Returns:
trueif native control is disposed,false- otherwise.
-