Class ECPAbstractCustomControlSWT

  • Direct Known Subclasses:
    DICustomControlSWT

    public abstract class ECPAbstractCustomControlSWT
    extends java.lang.Object
    Extend this class in order to provide an own implementation of an ECPAbstractCustomControlSWT.
    Since:
    1.2
    Author:
    Eugen Neufeld
    • Field Detail

      • CUSTOM_VARIANT

        protected static final java.lang.String CUSTOM_VARIANT
        Variant constant for indicating RAP controls.
        Since:
        1.3
        See Also:
        Constant Field Values
      • VALIDATION_ERROR_IMAGE

        public static final int VALIDATION_ERROR_IMAGE
        Constant for an validation error image.
        See Also:
        Constant Field Values
      • ADD_IMAGE

        public static final int ADD_IMAGE
        Constant for an add image.
        See Also:
        Constant Field Values
      • DELETE_IMAGE

        public static final int DELETE_IMAGE
        Constant for an delete image.
        See Also:
        Constant Field Values
      • HELP_IMAGE

        public static final int HELP_IMAGE
        Constant for a help image.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ECPAbstractCustomControlSWT

        public ECPAbstractCustomControlSWT()
    • Method Detail

      • postInit

        protected void postInit()
        This method is called after the initialization. Custom controls can overwrite this to execute specific initialization steps.
        Since:
        1.3
      • dispose

        public final void dispose()
        Is called by the framework to trigger a dispose of the control.
      • disposeCustomControl

        protected abstract void disposeCustomControl()
        This method is called during dispose and allows to dispose necessary objects.
        Since:
        1.3
      • getDataBindingContext

        protected final org.eclipse.core.databinding.DataBindingContext getDataBindingContext()
        Returns a DataBindingContext for this control.
        Returns:
        the DataBindingContext
        Since:
        1.3
      • handleContentValidation

        protected abstract void handleContentValidation()
        This is called so that an error can be shown by the user.
        Since:
        1.3
      • createLabel

        protected final org.eclipse.swt.widgets.Control createLabel​(org.eclipse.swt.widgets.Composite parent)
                                                             throws NoPropertyDescriptorFoundExeption
        Create the Control displaying the label of the current VControl.
        Parameters:
        parent - the Composite to render onto
        Returns:
        the created Control or null
        Throws:
        NoPropertyDescriptorFoundExeption - thrown if the EStructuralFeature of the VControl doesn't have a registered IItemPropertyDescriptor
        Since:
        1.3
      • createValidationIcon

        protected final org.eclipse.swt.widgets.Label createValidationIcon​(org.eclipse.swt.widgets.Composite composite)
        Creates a Label which is used to display the validation icon.
        Parameters:
        composite - the Composite to render onto
        Returns:
        the created Label
        Since:
        1.3
      • createViewerBinding

        protected final void createViewerBinding​(VDomainModelReference customControlFeature,
                                                 org.eclipse.jface.viewers.StructuredViewer viewer,
                                                 org.eclipse.core.databinding.property.value.IValueProperty[] labelProperties)
        Creates a binding for a StructuredViewer based on a ECPCustomControlFeature and the array of IValueProperties for labels.
        Parameters:
        customControlFeature - the ECPCustomControlFeature to use
        viewer - the StructuredViewer to bind
        labelProperties - the array if IValueProperties to use for labels
      • getObservableList

        @Deprecated
        protected final org.eclipse.core.databinding.observable.list.IObservableList getObservableList​(VDomainModelReference domainModelReference)
        Deprecated.
        This method is deprecated and must not be used anymore. Use the databinding service instead.
        Return an IObservableList based on a VDomainModelReference.
        Parameters:
        domainModelReference - the VDomainModelReference to use
        Returns:
        the IObservableList
        Since:
        1.3
      • getEditingDomain

        protected final org.eclipse.emf.edit.domain.EditingDomain getEditingDomain​(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
        Returns the EditingDomain for the provided EStructuralFeature.Setting.
        Parameters:
        setting - the provided EStructuralFeature.Setting
        Returns:
        the EditingDomain of this EStructuralFeature.Setting
        Since:
        1.3
      • getControl

        protected final <T extends ECPAbstractControl> T getControl​(java.lang.Class<T> clazz,
                                                                    VDomainModelReference domainModelReference)
        Use this method to get an ECPControl which can be used inside the ECPCustomControl.
        Type Parameters:
        T - the type of the control to retrieve
        Parameters:
        clazz - the Class of the ECPControl to retrieve
        domainModelReference - the VDomainModelReference to retrieve a control for
        Returns:
        the ECPControl that is fitting the most for the ECPCustomControlFeature. Can also be null.
        Since:
        1.3
      • getItemPropertyDescriptor

        protected final org.eclipse.emf.edit.provider.IItemPropertyDescriptor getItemPropertyDescriptor​(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
        Return the IItemPropertyDescriptor describing this EStructuralFeature.Setting.
        Parameters:
        setting - the EStructuralFeature.Setting to use for identifying the IItemPropertyDescriptor.
        Returns:
        the IItemPropertyDescriptor
        Since:
        1.3
      • bindTargetToModel

        protected final org.eclipse.core.databinding.Binding bindTargetToModel​(VDomainModelReference modelFeature,
                                                                               org.eclipse.core.databinding.observable.value.IObservableValue targetValue,
                                                                               org.eclipse.core.databinding.UpdateValueStrategy targetToModel,
                                                                               org.eclipse.core.databinding.UpdateValueStrategy modelToTarget)
        Method for enabling databinding on the reference/attribute of the referenced object. Throws an IllegalStateException if the VDomainModelReference doesn't resolve to exactly one EStructuralFeature.Setting.
        Parameters:
        modelFeature - the VDomainModelReference to bind
        targetValue - the target observerable
        targetToModel - update strategy target to model
        modelToTarget - update strategy model to target
        Returns:
        the resulting binding
        Since:
        1.3
      • getEditingDomain

        protected final org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()
        Provides the EditingDomain for this custom control.
        Returns:
        the EditingDomain for this control
        Since:
        1.3
      • getValue

        protected final java.lang.Object getValue​(VDomainModelReference modelReference)
        Returns the current set value of the feature. Throws an IllegalStateException if the VDomainModelReference doesn't resolve to exactly one EStructuralFeature.Setting.
        Parameters:
        modelReference - the VDomainModelReference to get the value for
        Returns:
        the value
        Since:
        1.3
      • setValue

        protected final void setValue​(VDomainModelReference modelReference,
                                      java.lang.Object newValue)
        Sets the value of the feature to the new value. Throws an IllegalStateException if the VDomainModelReference doesn't resolve to exactly one EStructuralFeature.Setting.
        Parameters:
        modelReference - the VDomainModelReference to get the value for
        newValue - the value to be set
        Since:
        1.3
      • getGridDescription

        public abstract SWTGridDescription getGridDescription()
        Returns the GridDescription for this Renderer.
        Returns:
        the GridDescription
        Since:
        1.6
      • applyValidation

        public final void applyValidation()
        Called by the framework to apply validation changes.
        Since:
        1.3
      • applyReadOnly

        public final void applyReadOnly​(java.util.Map<SWTGridCell,​org.eclipse.swt.widgets.Control> controls)
        Applies the current readOnlyState.
        Parameters:
        controls - the controls provided
        Since:
        1.3
      • setControlEnabled

        protected void setControlEnabled​(SWTGridCell gridCell,
                                         org.eclipse.swt.widgets.Control control,
                                         boolean enabled)
        Override this to control which and how controls should be enabled/disabled.
        Parameters:
        gridCell - the SWTGridCell to enable/disable
        control - the Control to enable/disable
        enabled - true if the control should be enabled false otherwise
        Since:
        1.6
      • applyEnable

        public final void applyEnable​(java.util.Map<SWTGridCell,​org.eclipse.swt.widgets.Control> controls)
        Applies the current enable state.
        Parameters:
        controls - the controls
        Since:
        1.3
      • setEditable

        protected boolean setEditable​(boolean editable)
        Allows custom controls to call specific code for setting controls editable or not. The result indicates whether to call the default editable
        Parameters:
        editable - if the current state is editable
        Returns:
        true if default editable modification should be executed
        Since:
        1.3
      • createSimpleGrid

        protected final SWTGridDescription createSimpleGrid​(int rows,
                                                            int columns)
        Creates a simple grid.
        Parameters:
        rows - the number of rows
        columns - the number of columns
        Returns:
        the GridDescription
        Since:
        1.6
      • canHandleControlProcessor

        protected boolean canHandleControlProcessor()

        Indicates if the given custom control takes the responsibility to call a possibly existing EMFFormsControlProcessorService itself.

        The default implementation returns false.

        Returns:
        true if the custom control can handle the EMFFormsControlProcessorService itself, false otherwise.
        Since:
        1.8