Class ExtensibleProjection<D,​DA,​DR extends D,​DP extends D,​DC extends D,​M,​MA,​MR extends M,​MP extends M,​MC extends M,​C extends IProjectionContext<D,​DA,​DR,​DP,​DC,​M,​MA,​MR,​MP,​MC>>

  • Type Parameters:
    D - the base class for all domain objects (EObject)
    DA - the attribute class, whose instances can be addressed for reading/writeing fields of domain objects of class D (EStructuralFeature)
    DR - the root domain object class
    DP - the base container class of domain objects, tree node (FormItemContainer)
    DC - the base class of children of the domain object container (FormItem)
    M - the base class for all projection objects (EObject)
    MA - the attribute class, whose instances can be addressed for reading/writeing fields of projection objects of class M (EStructuralFeature)
    MR - the root projection object class
    MP - the base container class of projection objects, tree node (FormItemContainer)
    MC - the base class of children of the projection object container (FormItem)
    C - the context
    All Implemented Interfaces:
    IObjectTreeListener<D,​DA,​DR,​DP,​DC>, IObjectTreeProjection<D,​DA,​DR,​DP,​DC,​M,​MA,​MR,​MP,​MC>

    public abstract class ExtensibleProjection<D,​DA,​DR extends D,​DP extends D,​DC extends D,​M,​MA,​MR extends M,​MP extends M,​MC extends M,​C extends IProjectionContext<D,​DA,​DR,​DP,​DC,​M,​MA,​MR,​MP,​MC>>
    extends Object
    implements IObjectTreeProjection<D,​DA,​DR,​DP,​DC,​M,​MA,​MR,​MP,​MC>
    The extensible projection that supports parcitiants registration.

    Projection is a complex function and consequently a mechanism is needed for its decomposition into small parts. The current implementation has such possibility by registering extensions, that are called participatnts.

    Participant is a class that specifies rules for transforming a tree (in the general case) of one object (class) of the model into the tree of another object.

    • Constructor Detail

      • ExtensibleProjection

        public ExtensibleProjection()
    • Method Detail

      • registerParticipant

        public void registerParticipant​(IClassParticipant<? extends D,​? extends M,​D,​DA,​DR,​DP,​DC,​M,​MA,​MR,​MP,​MC,​C> participant)
        Registers a class participant.
        Parameters:
        participant - the class participant, cannot be null
      • registerParticipant

        @SafeVarargs
        public final void registerParticipant​(IClassParticipant<? extends D,​? extends M,​D,​DA,​DR,​DP,​DC,​M,​MA,​MR,​MP,​MC,​C> classParticipant,
                                              IObjectParticipant<? extends D,​? extends M,​D,​DA,​DR,​DP,​DC,​M,​MA,​MR,​MP,​MC,​C>... objectParticipants)
        Register a class participant with object participants.
        Parameters:
        classParticipant - the class participant, cannot be null
        objectParticipants - the object participants, cannot be null
      • handleDisposeProjectionTree

        protected void handleDisposeProjectionTree​(ProjectionTree tree,
                                                   MR oldModelRoot)
        Handles the ProjectionTree disposal operation.
        Parameters:
        tree - the ProjectionTree that should be disposed, can't be null
        oldModelRoot - the model root for projection tree, can't be null
      • getDomainRoot

        public DR getDomainRoot()
        Description copied from interface: IObjectTreeProjection
        Returns the domain model root.

        Projections are available root models of the domain and projection tree, these are the objects from which all work begins on creating a projection tree. In case of change of the root domain object, the projection tree is completely reconstructed and it is necessary to get a new root of the projection tree.

        Specified by:
        getDomainRoot in interface IObjectTreeProjection<D,​DA,​DR extends D,​DP extends D,​DC extends D,​M,​MA,​MR extends M,​MP extends M,​MC extends M>
        Returns:
        the domain model root, can be null
      • getModelRoot

        public MR getModelRoot()
        Description copied from interface: IObjectTreeProjection
        Returns the projection model root.

        Projections are available root models of the domain and projection tree, these are the objects from which all work begins on creating a projection tree. In case of change of the root domain object, the projection tree is completely reconstructed and it is necessary to get a new root of the projection tree.

        Specified by:
        getModelRoot in interface IObjectTreeProjection<D,​DA,​DR extends D,​DP extends D,​DC extends D,​M,​MA,​MR extends M,​MP extends M,​MC extends M>
        Returns:
        the projection model root, can be null
      • getModel

        public M getModel​(D domain)
        Description copied from interface: IObjectTreeProjection
        Returns a projection model for the given domain model.

        Projections support the correspondence between domain models and projection models. By the model always possible to get the other and vice versa. This correspondence is unambiguous, i.e. the models correspond to 1-to-1, but not necessarily. Not every domain model has a projection and not every projection model has a domain model.

        Specified by:
        getModel in interface IObjectTreeProjection<D,​DA,​DR extends D,​DP extends D,​DC extends D,​M,​MA,​MR extends M,​MP extends M,​MC extends M>
        Parameters:
        domain - the domain model, cannot be null
        Returns:
        a projection model, can be null
      • getDomain

        public D getDomain​(M model)
        Description copied from interface: IObjectTreeProjection
        Returns a domain model for the given projection model.

        Projections support the correspondence between domain models and projection models. By the model always possible to get the other and vice versa. This correspondence is unambiguous, i.e. the models correspond to 1-to-1, but not necessarily. Not every domain model has a projection and not every projection model has a domain model.

        Specified by:
        getDomain in interface IObjectTreeProjection<D,​DA,​DR extends D,​DP extends D,​DC extends D,​M,​MA,​MR extends M,​MP extends M,​MC extends M>
        Returns:
        a domain model, can be null
      • changeRoot

        public void changeRoot​(DR newRoot)
        Description copied from interface: IObjectTreeProjection
        Changes the root domain object.

        In case of change of the root domain object, the projection tree is completely reconstructed and it is necessary to get a new root of the projection tree.

        Specified by:
        changeRoot in interface IObjectTreeProjection<D,​DA,​DR extends D,​DP extends D,​DC extends D,​M,​MA,​MR extends M,​MP extends M,​MC extends M>
        Parameters:
        newRoot - the new root domain object, can be null
      • getModelTreeNode

        public MC getModelTreeNode​(DC domain)
        Description copied from interface: IObjectTreeProjection
        Returns a projection model tree node by the given domain.
        Specified by:
        getModelTreeNode in interface IObjectTreeProjection<D,​DA,​DR extends D,​DP extends D,​DC extends D,​M,​MA,​MR extends M,​MP extends M,​MC extends M>
        Parameters:
        domain - the domain, cannot be null
        Returns:
        projection model, can be null
      • getModelTreeNodeParent

        public MP getModelTreeNodeParent​(MC model)
        Description copied from interface: IObjectTreeProjection
        Returns a parent projection model node by the given projection model.
        Specified by:
        getModelTreeNodeParent in interface IObjectTreeProjection<D,​DA,​DR extends D,​DP extends D,​DC extends D,​M,​MA,​MR extends M,​MP extends M,​MC extends M>
        Parameters:
        model - the projection model, cannot be null
        Returns:
        parent projection model, can be null
      • getContext

        protected C getContext()
      • nodeObjectToString

        protected String nodeObjectToString​(Object object)
      • createContext

        protected abstract C createContext()
      • getModelParent

        protected abstract M getModelParent​(M model)
      • getModelContents

        protected abstract Iterable<M> getModelContents​(M model)
      • resolveModel

        protected abstract M resolveModel​(M model,
                                          AttributePath<MA> path)
      • addModelTreeChild

        protected abstract void addModelTreeChild​(MP parent,
                                                  MC child,
                                                  int index)
      • removeModelTreeChild

        protected abstract void removeModelTreeChild​(MP parent,
                                                     int index)
      • readModelAttribute

        protected abstract Object readModelAttribute​(M model,
                                                     MA attribute)
      • writeModelAttribute

        protected abstract Object writeModelAttribute​(M model,
                                                      MA attribute,
                                                      Object newValue)
      • getDomainParent

        protected abstract D getDomainParent​(D domain)
      • getDomainParentAttribute

        protected abstract DA getDomainParentAttribute​(D domain)
      • resolveDomain

        protected abstract D resolveDomain​(D domain,
                                           AttributePath<DA> path)
      • readDomainAttribute

        protected abstract Object readDomainAttribute​(D domain,
                                                      DA attribute)