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>>
- java.lang.Object
-
- com._1c.g5.v8.dt.form.presentation.core.projection.extensible.ExtensibleProjection<D,DA,DR,DP,DC,M,MA,MR,MP,MC,C>
-
- 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 classDP
- 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 classMP
- 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 Summary
Constructors Constructor Description ExtensibleProjection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addListener(IObjectTreeListener<M,MA,MR,MP,MC> listener)
Adds the given listener.protected abstract void
addModelTreeChild(MP parent, MC child, int index)
void
attributeChanged(D object, DA attribute, Object oldValue, Object newValue)
void
changeRoot(DR newRoot)
Changes the root domain object.protected abstract C
createContext()
void
dispose()
Disposes the model with participants.protected C
getContext()
D
getDomain(M model)
Returns a domain model for the given projection model.protected abstract D
getDomainParent(D domain)
protected abstract DA
getDomainParentAttribute(D domain)
DR
getDomainRoot()
Returns the domain model root.M
getModel(D domain)
Returns a projection model for the given domain model.protected abstract Iterable<M>
getModelContents(M model)
protected abstract M
getModelParent(M model)
MR
getModelRoot()
Returns the projection model root.MC
getModelTreeNode(DC domain)
Returns a projection model tree node by the given domain.Stream<? extends MC>
getModelTreeNodeChildren(MP model)
Returns children nodes of the given projection model.MP
getModelTreeNodeParent(MC model)
Returns a parent projection model node by the given projection model.protected void
handleDisposeProjectionTree(ProjectionTree tree, MR oldModelRoot)
Handles theProjectionTree
disposal operation.void
listItemAdded(D object, DA attribute, int index, Object item)
void
listItemMoved(D object, DA attribute, int oldIndex, int newIndex, Object item)
void
listItemRemoved(D object, DA attribute, int index, Object item)
void
listItemReplaced(D object, DA attribute, int index, Object oldItem, Object newItem)
void
mapItemAdded(D object, DA attribute, Object key, Object value)
void
mapItemRemoved(D object, DA attribute, Object key, Object value)
void
mapItemReplaced(D object, DA attribute, Object key, Object oldValue, Object newValue)
void
messageSent(IObjectTreeMessage message)
protected String
nodeObjectToString(Object object)
protected abstract Object
readDomainAttribute(D domain, DA attribute)
protected abstract Object
readModelAttribute(M model, MA attribute)
void
registerParticipant(IClassParticipant<? extends D,? extends M,D,DA,DR,DP,DC,M,MA,MR,MP,MC,C> participant)
Registers a class participant.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.void
removeListener(IObjectTreeListener<M,MA,MR,MP,MC> listener)
Removes the given listener.protected abstract void
removeModelTreeChild(MP parent, int index)
protected abstract D
resolveDomain(D domain, AttributePath<DA> path)
protected abstract M
resolveModel(M model, AttributePath<MA> path)
void
rootChanged(DR oldRoot, DR newRoot)
void
rootSet(DR root)
void
rootUnset(DR root)
void
setItemAdded(D object, DA attribute, Object item)
void
setItemRemoved(D object, DA attribute, Object item)
String
toString()
void
treeItemAdded(DP parent, int index, DC item)
void
treeItemMoved(DP parent, int oldIndex, int newIndex, DC item)
void
treeItemRemoved(DP parent, int index, DC item)
void
treeItemReplaced(DP parent, int index, DC oldItem, DC newItem)
protected abstract Object
writeModelAttribute(M model, MA attribute, Object newValue)
-
-
-
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 benull
-
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 benull
objectParticipants
- the object participants, cannot benull
-
messageSent
public void messageSent(IObjectTreeMessage message)
- Specified by:
messageSent
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
rootSet
public void rootSet(DR root)
-
rootChanged
public void rootChanged(DR oldRoot, DR newRoot)
- Specified by:
rootChanged
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
handleDisposeProjectionTree
protected void handleDisposeProjectionTree(ProjectionTree tree, MR oldModelRoot)
Handles theProjectionTree
disposal operation.- Parameters:
tree
- theProjectionTree
that should be disposed, can't benull
oldModelRoot
- the model root for projection tree, can't benull
-
rootUnset
public void rootUnset(DR root)
-
attributeChanged
public void attributeChanged(D object, DA attribute, Object oldValue, Object newValue)
- Specified by:
attributeChanged
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
listItemAdded
public void listItemAdded(D object, DA attribute, int index, Object item)
- Specified by:
listItemAdded
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
listItemMoved
public void listItemMoved(D object, DA attribute, int oldIndex, int newIndex, Object item)
- Specified by:
listItemMoved
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
listItemReplaced
public void listItemReplaced(D object, DA attribute, int index, Object oldItem, Object newItem)
- Specified by:
listItemReplaced
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
listItemRemoved
public void listItemRemoved(D object, DA attribute, int index, Object item)
- Specified by:
listItemRemoved
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
mapItemAdded
public void mapItemAdded(D object, DA attribute, Object key, Object value)
- Specified by:
mapItemAdded
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
mapItemReplaced
public void mapItemReplaced(D object, DA attribute, Object key, Object oldValue, Object newValue)
- Specified by:
mapItemReplaced
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
mapItemRemoved
public void mapItemRemoved(D object, DA attribute, Object key, Object value)
- Specified by:
mapItemRemoved
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
setItemAdded
public void setItemAdded(D object, DA attribute, Object item)
- Specified by:
setItemAdded
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
setItemRemoved
public void setItemRemoved(D object, DA attribute, Object item)
- Specified by:
setItemRemoved
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
treeItemAdded
public void treeItemAdded(DP parent, int index, DC item)
- Specified by:
treeItemAdded
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
treeItemMoved
public void treeItemMoved(DP parent, int oldIndex, int newIndex, DC item)
- Specified by:
treeItemMoved
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
treeItemReplaced
public void treeItemReplaced(DP parent, int index, DC oldItem, DC newItem)
- Specified by:
treeItemReplaced
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
treeItemRemoved
public void treeItemRemoved(DP parent, int index, DC item)
- Specified by:
treeItemRemoved
in interfaceIObjectTreeListener<D,DA,DR extends D,DP extends D,DC extends D>
-
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.
-
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.
-
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.
-
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.
-
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.
-
addListener
public void addListener(IObjectTreeListener<M,MA,MR,MP,MC> listener)
Description copied from interface:IObjectTreeProjection
Adds the given listener.
-
removeListener
public void removeListener(IObjectTreeListener<M,MA,MR,MP,MC> listener)
Description copied from interface:IObjectTreeProjection
Removes the given listener.
-
getModelTreeNode
public MC getModelTreeNode(DC domain)
Description copied from interface:IObjectTreeProjection
Returns a projection model tree node by the given domain.
-
getModelTreeNodeParent
public MP getModelTreeNodeParent(MC model)
Description copied from interface:IObjectTreeProjection
Returns a parent projection model node by the given projection model.
-
getModelTreeNodeChildren
public Stream<? extends MC> getModelTreeNodeChildren(MP model)
Description copied from interface:IObjectTreeProjection
Returns children nodes of the given projection model.
-
dispose
public void dispose()
Description copied from interface:IObjectTreeProjection
Disposes the model with participants.
-
getContext
protected C getContext()
-
createContext
protected abstract C createContext()
-
resolveModel
protected abstract M resolveModel(M model, AttributePath<MA> path)
-
removeModelTreeChild
protected abstract void removeModelTreeChild(MP parent, int index)
-
writeModelAttribute
protected abstract Object writeModelAttribute(M model, MA attribute, Object newValue)
-
resolveDomain
protected abstract D resolveDomain(D domain, AttributePath<DA> path)
-
-