Class StandardComponent<M extends IModel,​P extends IParameterization>

    • Constructor Detail

      • StandardComponent

        public StandardComponent​(P parameterization)
        Creates standard component instance.
        Parameters:
        parameterization - the parameterization instance.
    • Method Detail

      • setLayoutData

        public void setLayoutData​(IAefLayoutData layoutData)
        Sets the layout data object.
        Parameters:
        layoutData - the layout data to set, can be null.
      • setEnabled

        public void setEnabled​(boolean enabled)
        Sets the component enable state.
        Parameters:
        enabled - the new value to set.
      • isEnabled

        public boolean isEnabled()
        return true if the component is in enabled state and false otherwise. Children of disabled standard components are considered disabled unconditionally, regardless of the enabled flag.
      • 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.
      • disposeViewModels

        protected void disposeViewModels()
        Description copied from class: Component
        Disposes the view models of this component. Override it to do some additional disposal operations specific to a component.
        Overrides:
        disposeViewModels in class Component<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 IModel instance.
      • 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

        protected void updateViewModelStatus​(ControlViewModel viewModel,
                                             IModel model)
        Updates the validation status of the given view model.
        Parameters:
        viewModel - the view model.
        model - the model to validate.
      • isPassive

        protected boolean isPassive()
        Returns:
        true if 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 default IValue for given view model.
        Parameters:
        viewModel - the view model, cannot be null.
        feature - the feature, cannot be null.
        Returns:
        a newly created IValue instance.
      • createDefaultViewModelList

        protected <T> IViewModelList<T> createDefaultViewModelList​(ControlViewModel viewModel,
                                                                   org.eclipse.emf.ecore.EStructuralFeature feature)
        Creates default IList for given view model.
        Parameters:
        viewModel - the view model, cannot be null.
        feature - the feature, cannot be null.
        Returns:
        a newly created IList instance.
      • bindModel

        protected <DM extends IModel,​DMR,​VMM extends IViewModelModel,​VMR> VMM bindModel​(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 given model to view model.
        Type Parameters:
        DM - the type of given model.
        DMR - the type of resulting object from model.
        VMM - the type of creating IModel of view model.
        VMR - the type of result object from view model.
        Parameters:
        model - the model of domain object to bind, cannot be null.
        viewModel - the view model, cannot be null.
        feature - the feature of the view model to access, cannot be null.
        viewModelModelCreator - the function that creates the IModel for given view model, cannot be null.
        modelGetter - the function that returns the object represented by model, cannot be null.
        modelSetter - the consumer that sets new value (obtained from view model) to model, can be null if the direction equal to StandardComponent.BindingDirection.MODEL_TO_VIEW only.
        viewModelGetter - the function that returns the object represented by created view model IModel instance, can be null if the direction equal to StandardComponent.BindingDirection.MODEL_TO_VIEW only.
        viewModelSetter - the consumer that sets new value (obtained from domain model) to view model IModel instance, cannot be null.
        direction - the direction of binding represented by set of StandardComponent.BindingDirection.
        Returns:
        a bound view model IModel instance.
      • handleExternalValidationEvent

        protected void handleExternalValidationEvent​(ExternalValidationEvent event)
        Handles inbound external validation event.
        Parameters:
        event - the event, cannot be null.