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 void
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 specifiedlistener
for the native control using the givenbindAction
.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 fromIEventChannel
.protected abstract void
handleFocusEvent
(FocusEvent event, VM viewModel, NC control) HandlesFocusEvent
.void
initialize
(P parameters) Initializes this view with parameters.protected abstract boolean
isControlDisposed
(NC control) Returnstrue
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
queueAndWaitEvent
(IEvent event) Queues and waits event to theIEventChannel
.protected final void
queueEvent
(IEvent event) Queues event to theIEventChannel
.protected final void
Registers the specified listener for view modelIEventChannel
.
NOTE:#handleEventChannelEvent(IEvent)
can be used to process event channel events.protected void
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.
-
Constructor Details
-
View
public View()
-
-
Method Details
-
initialize
Description copied from interface:IView
Initializes this view with parameters.- Specified by:
initialize
in interfaceIView<P extends IRenderingParameters,
VM extends IControlViewModel, NC> - Parameters:
parameters
- the parameters to initialize with.
-
bindViewModel
Description copied from interface:IView
Binds the view model to this view.- Specified by:
bindViewModel
in interfaceIView<P extends IRenderingParameters,
VM extends IControlViewModel, NC> - Parameters:
viewModel
- the view model to bind.
-
getViewModel
Description copied from interface:IView
Gets the bound view model for this view.- Specified by:
getViewModel
in interfaceIView<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 interfaceIView<P extends IRenderingParameters,
VM extends IControlViewModel, NC>
-
bindNativeControl
Description copied from interface:IView
Binds the native control to this view.- Specified by:
bindNativeControl
in interfaceIView<P extends IRenderingParameters,
VM extends IControlViewModel, NC> - Parameters:
nativeControl
- the control to bind.
-
getNativeControl
Description copied from interface:IView
Gets the bound native control for this view.- Specified by:
getNativeControl
in interfaceIView<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 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 benull
controlObservable
- 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 benull
controlObservable
- native control observable to bind, cannot benull
modelToControl
- the view model to native control update strategy, can benull
controlToModel
- 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 specifiedlistener
for 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
Returnstrue
if native control is disposed.- Parameters:
control
- the native control, cannot benull
.- Returns:
true
if native control is disposed,false
- otherwise.
-