Class StandardComponent<M extends IModel,P extends IParameterization>
java.lang.Object
com._1c.g5.aef2.components.Component<M,P>
com._1c.g5.aef2.standard.components.StandardComponent<M,P>
- All Implemented Interfaces:
IComponent<M>,IEventChannel
- Direct Known Subclasses:
AbstractControlComponent,ContainerComponent,NotSupportedComponent
Base
IComponent class for all of the components that use EMF-based ControlViewModel implementation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe enum that describes the direction of binding with theStandardComponent. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final <DMR,VMR> IList<VMR> bindList(IList<DMR> modelValue, ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature viewModelFeature, IMapper<DMR, VMR> mapper) Binds model value and view model feature together.protected <DM extends IModel,DMR, VMM extends IViewModelModel, VMR>
VMMbindModel(DM model, ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature feature, BiFunction<ControlViewModel, org.eclipse.emf.ecore.EStructuralFeature, VMM> viewModelModelCreator, Function<DM, DMR> modelGetter, BiConsumer<DM, VMR> modelSetter, Function<VMM, VMR> viewModelGetter, BiConsumer<VMM, DMR> viewModelSetter, EnumSet<StandardComponent.BindingDirection> direction) Binds the givenmodelto view model.protected final <DMR,VMR> IValue<VMR> bindValue(IValue<DMR> modelValue, ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature viewModelFeature) Binds model value and view model feature together.protected final <DMR,VMR> IValue<VMR> bindValue(IValue<DMR> modelValue, ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature viewModelFeature, IMapper<DMR, VMR> mapper) Binds model value and view model feature together.protected <T> IViewModelList<T>createDefaultViewModelList(ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature feature) Creates defaultIListfor given view model.protected <T> IViewModelValue<T>createDefaultViewModelValue(ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature feature) Creates defaultIValuefor given view model.protected voidCreates the view models of this component.protected voidDisposes the view models of this component.Returns theIAefLayoutDatainstance.protected voidHandles inbound external validationevent.booleanreturntrueif the component is in enabled state andfalseotherwise.protected booleanvoidsetEnabled(boolean enabled) Sets the component enable state.voidsetFocus()Queues a focus event to the first view model of the component.voidsetLayoutData(IAefLayoutData layoutData) Sets the layout data object.voidUpdates view models of the component.protected voidupdateViewModelStatus(ControlViewModel viewModel, IModel model) Updates the validation status of the given view model.Methods inherited from class com._1c.g5.aef2.components.Component
addComponent, addListener, addViewModel, areChildCommitsEnabled, areChildRefreshEnabled, areComponentsCreated, attachToModel, beginExternalUpdate, checkComponents, checkViewModels, commit, createComponents, detachFromModel, dispose, disposeComponents, endExternalUpdate, getComponents, getModel, getParameterization, getParent, getRunnableQueue, getScene, getServiceEventQualifiers, getViewModels, isDisposed, isInExternalUpdate, queueAndWaitEvent, queueEvent, removeComponent, removeListener, removeViewModel, setChildCommitsEnabled, setChildRefreshEnable, setModel, setParent, setScene, subscribeOnEvents, subscribeOnEvents, unsubscribeOnEvents
-
Constructor Details
-
StandardComponent
Creates standard component instance.- Parameters:
parameterization- the parameterization instance.
-
-
Method Details
-
setLayoutData
Sets the layout data object.- Parameters:
layoutData- the layout data to set, can benull.
-
getLayoutData
Returns theIAefLayoutDatainstance.- Returns:
- the layout date or
null.
-
setEnabled
public void setEnabled(boolean enabled) Sets the component enable state.- Parameters:
enabled- the new value to set.
-
isEnabled
public boolean isEnabled()returntrueif the component is in enabled state andfalseotherwise. Children of disabled standard components are considered disabled unconditionally, regardless of theenabledflag. -
setFocus
public void setFocus()Queues a focus event to the first view model of the component. -
updateViewModels
public void updateViewModels()Updates view models of the component. Override it to update view model properties according to current state of the component. -
createViewModels
protected void createViewModels()Description copied from class:ComponentCreates the view models of this component. Override it to provide a view models of this component.- Overrides:
createViewModelsin classComponent<M extends IModel,P extends IParameterization>
-
disposeViewModels
protected void disposeViewModels()Description copied from class:ComponentDisposes the view models of this component. Override it to do some additional disposal operations specific to a component.- Overrides:
disposeViewModelsin classComponent<M extends IModel,P extends IParameterization>
-
bindValue
protected final <DMR,VMR> IValue<VMR> bindValue(IValue<DMR> modelValue, ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature viewModelFeature) Binds model value and view model feature together.- Type Parameters:
DMR- the type of objects from model.VMR- the type of objects from view model.- Parameters:
modelValue- the model value to bind.viewModel- the view model to bind to.viewModelFeature- view model's feature to bind.- Returns:
- a bound view model
IModelinstance.
-
bindValue
protected final <DMR,VMR> IValue<VMR> bindValue(IValue<DMR> modelValue, ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature viewModelFeature, IMapper<DMR, VMR> mapper) Binds model value and view model feature together.- Type Parameters:
DMR- the type of objects from model.VMR- the type of objects from view model.- Parameters:
modelValue- the model value to bind.viewModel- the view model to bind to.viewModelfeature- the view model's feature to bind.mapper- the mapper to map between mode and view model representation.- Returns:
- a bound view model value.
-
bindList
protected final <DMR,VMR> IList<VMR> bindList(IList<DMR> modelValue, ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature viewModelFeature, IMapper<DMR, VMR> mapper) Binds model value and view model feature together.- Type Parameters:
DMR- the type of objects from model.VMR- the type of objects from view model.- Parameters:
modelValue- the model value to bind.viewModel- the view model to bind to.viewModelfeature- the view model's feature to bind.mapper- the mapper to map between mode and view model representation.- Returns:
- a bound view model list.
-
updateViewModelStatus
Updates the validation status of the given view model.- Parameters:
viewModel- the view model.model- the model to validate.
-
isPassive
protected boolean isPassive()- Returns:
trueif the component is passive, that is the component is not refreshing itself,false- otherwise.
-
createDefaultViewModelValue
protected <T> IViewModelValue<T> createDefaultViewModelValue(ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature feature) Creates defaultIValuefor given view model.- Parameters:
viewModel- the view model, cannot benull.feature- the feature, cannot benull.- Returns:
- a newly created
IValueinstance.
-
createDefaultViewModelList
protected <T> IViewModelList<T> createDefaultViewModelList(ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature feature) Creates defaultIListfor given view model.- Parameters:
viewModel- the view model, cannot benull.feature- the feature, cannot benull.- Returns:
- a newly created
IListinstance.
-
bindModel
protected <DM extends IModel,DMR, VMM bindModelVMM extends IViewModelModel, VMR> (DM model, ControlViewModel viewModel, org.eclipse.emf.ecore.EStructuralFeature feature, BiFunction<ControlViewModel, org.eclipse.emf.ecore.EStructuralFeature, VMM> viewModelModelCreator, Function<DM, DMR> modelGetter, BiConsumer<DM, VMR> modelSetter, Function<VMM, VMR> viewModelGetter, BiConsumer<VMM, DMR> viewModelSetter, EnumSet<StandardComponent.BindingDirection> direction) Binds the givenmodelto view model.- Type Parameters:
DM- the type of givenmodel.DMR- the type of resulting object frommodel.VMM- the type of creatingIModelof view model.VMR- the type of result object from view model.- Parameters:
model- the model of domain object to bind, cannot benull.viewModel- the view model, cannot benull.feature- the feature of the view model to access, cannot benull.viewModelModelCreator- the function that creates theIModelfor given view model, cannot benull.modelGetter- the function that returns the object represented bymodel, cannot benull.modelSetter- the consumer that sets new value (obtained from view model) to model, can benullif thedirectionequal toStandardComponent.BindingDirection.MODEL_TO_VIEWonly.viewModelGetter- the function that returns the object represented by created view modelIModelinstance, can benullif thedirectionequal toStandardComponent.BindingDirection.MODEL_TO_VIEWonly.viewModelSetter- the consumer that sets new value (obtained from domain model) to view modelIModelinstance, cannot benull.direction- the direction of binding represented by set ofStandardComponent.BindingDirection.- Returns:
- a bound view model
IModelinstance.
-
handleExternalValidationEvent
Handles inbound external validationevent.- Parameters:
event- the event, cannot benull.
-