VR
- The visual root node of the UI toolkit used, e.g.
javafx.scene.Node in case of JavaFX.public interface IContentPartFactory<VR>
IContentPart
s. The IViewer
can be
configured with an IContentPartFactory
. Whenever a behavior of an
IContentPart
in that viewer needs to create another child
IContentPart
, it can use the viewer's IContentPartFactory
,
passing in itself as context behavior.Modifier and Type | Method and Description |
---|---|
IContentPart<VR,? extends VR> |
createContentPart(java.lang.Object content,
IBehavior<VR> contextBehavior,
java.util.Map<java.lang.Object,java.lang.Object> contextMap)
Creates a specific
IContentPart for the given content. |
IContentPart<VR,? extends VR> createContentPart(java.lang.Object content, IBehavior<VR> contextBehavior, java.util.Map<java.lang.Object,java.lang.Object> contextMap)
IContentPart
for the given content. As
additional information might be needed by the IContentPartFactory
to identify the creation context, the initiating contextBehavior
is expected to pass in a reference to itself as well as a
contextMap.
The contextMap may either directly contain the additional information needed by the factory, or it may be used as a reference to identify the creation context, in case the factory needs to query back the initiating contextBehavior for such information.
This mechanism is needed because all IBehavior
s are expected to
be stateless, so only the information within the contextMap will
allow the contextBehavior to identify the respective creation
context. A contract between a (concrete) IBehavior
and a
(concrete) IContentPartFactory
that is based on such a query may
be realized as follows:
IContentPart createContentPart(Object content, IBehavior contextBehavior, Map<Object, Object> contextMap) { if (contextBehavior instanceof ConcreteBehavior) { SomeAdditionalInformation i = ((ConcreteBehavior) contextBehavior) .giveSomeAdditionalInformation(contextMap); ... } }
content
- The model Object
for which an IContentPart
is
to be created.contextBehavior
- The context IBehavior
which initiates the creation.contextMap
- A map in which the state-less context IBehavior
) may
place additional context information for the creation process.
It may either directly contain additional information needed
by the IContentPartFactory
, or may be passed back by
the IContentPartFactory
to the calling context
IBehavior
to query such kind of information (in which
case it will allow the context IBehavior
to identify
the creation context).IContentPart
for the given content and context.Copyright (c) 2014 itemis AG and others. All rights reserved.