VR - The visual root node of the UI toolkit this IVisualPart is
used in, e.g. javafx.scene.Node in case of JavaFX.V - The visual node used by this IVisualPart.public interface IVisualPart<VR,V extends VR> extends IAdaptable, IActivatable, IPropertyChangeNotifier, IDisposable
IVisualPart plays the controller role in the model-view-controller
architecture. While it does not have to bound to a model (actually only
IContentParts are bound to model elements, IFeedbackParts and
IHandleParts do not refer to model elements), an IVisualPart
controls a visual and is responsible of handling user interaction.
Within an IViewer, IVisualPart are organized in a hierarchy
via a [1:n] parent-children relationship (getParent(),
getChildren()), which roots in an IRootPart. Furthermore a
[n:m] anchorage-anchored relationship ( getAnchorages()
, getAnchoreds()) may be established between IVisualParts
located at arbitrary places within the hierarchy.
An IVisualPart is adaptable (IAdaptable). Usually,
IPolicys and IBehaviors are adapted to it (but arbitrary
adapters may indeed be registered as needed). IPolicys are usually
required in case the IVisualPart is directly involved in user
interaction (e.g. the user clicks on its controlled visual). They may be
accessed type-safe by ITools or other IPolicys (
IPolicys may delegate to other IPolicys) via their class key
(see IAdaptable). IBehaviors are used to react to changes of
the attached model (in case of an IContentParts), the viewer models,
or others sources (e.g. adapters of the IViewer or IDomain),
thereby reacting to changes of the interactive state.
IVisualParts are activatable (IActivatable), and an
activation/deactivation of an IVisualPart will result in the
activation/deactivation of all registered adapters (i.e. IPolicys and
IBehaviors).
AbstractVisualPart should be subclassed.IAdaptable.Bound<A extends IAdaptable>| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ANCHORAGES_PROPERTY
Name of the property storing this part's anchorages.
|
static java.lang.String |
ANCHOREDS_PROPERTY
Name of the property storing this part's anchoreds.
|
static java.lang.String |
CHILDREN_PROPERTY
Name of the property storing this part's children.
|
static java.lang.String |
PARENT_PROPERTY
Name of the property storing this part's parent.
|
ADAPTERS_PROPERTYACTIVE_PROPERTY| Modifier and Type | Method and Description |
|---|---|
void |
addAnchorage(IVisualPart<VR,? extends VR> anchorage)
Adds the given
IVisualPart to the anchorages of this
IVisualPart under the "default" role. |
void |
addAnchorage(IVisualPart<VR,? extends VR> anchorage,
java.lang.String role)
Adds the given
IVisualPart to the anchorages of this
IVisualPart under the given role. |
void |
addAnchored(IVisualPart<VR,? extends VR> anchored)
Used by an anchored
IVisualPart to establish an
anchorage-anchored relationship with this anchorage IVisualPart. |
void |
addChild(IVisualPart<VR,? extends VR> child)
Adds the given child to the list of this part's children.
|
void |
addChild(IVisualPart<VR,? extends VR> child,
int index)
Adds the given child to the list of this part's children at the specified
index.
|
void |
addChildren(java.util.List<? extends IVisualPart<VR,? extends VR>> children)
Adds the given children to the list of this part's children.
|
void |
addChildren(java.util.List<? extends IVisualPart<VR,? extends VR>> children,
int index)
Adds the given children to the list of this part's children at the
specified index.
|
com.google.common.collect.SetMultimap<IVisualPart<VR,? extends VR>,java.lang.String> |
getAnchorages()
Returns a
SetMultimap of this part's anchorages and their
corresponding roles. |
com.google.common.collect.Multiset<IVisualPart<VR,? extends VR>> |
getAnchoreds()
Returns a
Multiset of this part's anchoreds. |
java.util.Map<AdapterKey<? extends IBehavior<VR>>,IBehavior<VR>> |
getBehaviors()
Returns a
Map of this part's behaviors and their corresponding
AdapterKeys. |
java.util.List<IVisualPart<VR,? extends VR>> |
getChildren()
Returns a
List of this part's children. |
IVisualPart<VR,? extends VR> |
getParent()
Returns the parent of this part.
|
java.util.Map<AdapterKey<? extends IPolicy<VR>>,IPolicy<VR>> |
getPolicies()
Returns a
Map of this part's policies and their corresponding
AdapterKeys. |
IRootPart<VR,? extends VR> |
getRoot()
Returns the
IRootPart. |
V |
getVisual()
Returns this part's visual.
|
boolean |
isRefreshVisual()
Returns
true if this part is allowed to refresh its
visualization based on its content. |
void |
refreshVisual()
Refreshes this part's visualization based on this part's content.
|
void |
removeAnchorage(IVisualPart<VR,? extends VR> anchorage)
Removes the given
IVisualPart from the map of this part's
anchorages. |
void |
removeAnchorage(IVisualPart<VR,? extends VR> anchorage,
java.lang.String role)
Removes the given
IVisualPart and role from the map of this
part's anchorages. |
void |
removeAnchored(IVisualPart<VR,? extends VR> anchored)
Used by an anchored
IVisualPart to unestablish an
anchorage-anchored relationship with this anchorage IVisualPart. |
void |
removeChild(IVisualPart<VR,? extends VR> child)
Removes the given
IVisualPart from the list of this part's
children. |
void |
removeChildren(java.util.List<? extends IVisualPart<VR,? extends VR>> children)
Removes the given
IVisualParts from the list of this part's
children. |
void |
reorderChild(IVisualPart<VR,? extends VR> child,
int index)
Swaps the given
IVisualPart with the part at the given index
position within this part's list of children. |
void |
setParent(IVisualPart<VR,? extends VR> parent)
Used by a parent
IVisualPart to establish/unestablish a
parent-child relationship with this child IVisualPart. |
void |
setRefreshVisual(boolean refreshVisual)
Allows to temporarily turn
refreshVisual() into a no-op
operation. |
getAdapter, getAdapter, getAdapter, getAdapters, getAdapters, setAdapter, setAdapter, setAdapter, unsetAdapteractivate, deactivate, isActiveaddPropertyChangeListener, removePropertyChangeListenerdisposestatic final java.lang.String PARENT_PROPERTY
static final java.lang.String CHILDREN_PROPERTY
static final java.lang.String ANCHORAGES_PROPERTY
static final java.lang.String ANCHOREDS_PROPERTY
void addAnchorage(IVisualPart<VR,? extends VR> anchorage)
IVisualPart to the anchorages of this
IVisualPart under the "default" role.anchorage - The IVisualPart which is added to this part's
anchorages.void addAnchorage(IVisualPart<VR,? extends VR> anchorage, java.lang.String role)
IVisualPart to the anchorages of this
IVisualPart under the given role.anchorage - The IVisualPart which is added to this part's
anchorages.role - The role under which the anchorage is added, or
null.void addAnchored(IVisualPart<VR,? extends VR> anchored)
IVisualPart to establish an
anchorage-anchored relationship with this anchorage IVisualPart.
Clients should never call this operation directly but instead add the
anchorage to its anchored via the addAnchorage(IVisualPart) and
addAnchorage(IVisualPart, String) operations, which will
indirectly lead to a call here.
anchored - An IVisualPart to attach to this anchorage
IVisualPart as anchored.addAnchorage(IVisualPart),
addAnchorage(IVisualPart, String) instead to
establish an anchored-anchorage relationship.void addChild(IVisualPart<VR,? extends VR> child)
child - The IVisualPart which is added to the list of this
part's children.void addChild(IVisualPart<VR,? extends VR> child, int index)
child - The IVisualPart which is added to the list of this
part's children.index - The index at which the given IVisualPart is inserted
into this part's children list.void addChildren(java.util.List<? extends IVisualPart<VR,? extends VR>> children)
children - The IVisualParts which are added to the list of this
part's children.void addChildren(java.util.List<? extends IVisualPart<VR,? extends VR>> children, int index)
children - The IVisualParts which are added to the list of this
part's children.index - The index at which the given IVisualParts are inserted
into this part's children list.com.google.common.collect.SetMultimap<IVisualPart<VR,? extends VR>,java.lang.String> getAnchorages()
SetMultimap of this part's anchorages and their
corresponding roles.SetMultimap of this part's anchorages and their
corresponding roles.com.google.common.collect.Multiset<IVisualPart<VR,? extends VR>> getAnchoreds()
Multiset of this part's anchoreds.Multiset of this part's anchoreds.java.util.Map<AdapterKey<? extends IBehavior<VR>>,IBehavior<VR>> getBehaviors()
Map of this part's behaviors and their corresponding
AdapterKeys.Map of this part's behaviors and their corresponding
AdapterKeys.java.util.List<IVisualPart<VR,? extends VR>> getChildren()
List of this part's children.List of this part's children.IVisualPart<VR,? extends VR> getParent()
java.util.Map<AdapterKey<? extends IPolicy<VR>>,IPolicy<VR>> getPolicies()
Map of this part's policies and their corresponding
AdapterKeys.Map of this part's policies and their corresponding
AdapterKeys.IRootPart<VR,? extends VR> getRoot()
IRootPart. This method should only be called
internally or by helpers such as edit policies. The root can be used to
get the viewer.null or the IRootPartV getVisual()
boolean isRefreshVisual()
true if this part is allowed to refresh its
visualization based on its content. Otherwise returns false.true if this part is allowed to refresh its
visualization based on its content, otherwise false.void refreshVisual()
void removeAnchorage(IVisualPart<VR,? extends VR> anchorage)
IVisualPart from the map of this part's
anchorages.anchorage - The IVisualPart which is removed from this part's
anchorages.void removeAnchorage(IVisualPart<VR,? extends VR> anchorage, java.lang.String role)
IVisualPart and role from the map of this
part's anchorages.anchorage - The IVisualPart which is removed from this part's
anchorages.role - The role under which the IVisualPart can be found in
this part's anchorages.void removeAnchored(IVisualPart<VR,? extends VR> anchored)
IVisualPart to unestablish an
anchorage-anchored relationship with this anchorage IVisualPart.
Clients should never call this operation directly but instead remove the
anchorage from its anchored via the removeAnchorage(IVisualPart)
or removeAnchorage(IVisualPart, String) operations, which will
indirectly lead to a call here.
anchored - An IVisualPart (currently attached as anchored to this
anchorage IVisualPart) to detach from this anchorage
IVisualPart as anchored.removeAnchorage(IVisualPart) or
removeAnchorage(IVisualPart, String) instead to
unestablish an anchored-anchorage relationship.void removeChild(IVisualPart<VR,? extends VR> child)
IVisualPart from the list of this part's
children.child - The IVisualPart which is removed from the list of this
part's children.void removeChildren(java.util.List<? extends IVisualPart<VR,? extends VR>> children)
IVisualParts from the list of this part's
children.children - The IVisualParts which are removed from the list of
this part's children.void reorderChild(IVisualPart<VR,? extends VR> child, int index)
IVisualPart with the part at the given index
position within this part's list of children.child - The IVisualPart which is reordered.index - The index to which the part is reordered.void setParent(IVisualPart<VR,? extends VR> parent)
IVisualPart to establish/unestablish a
parent-child relationship with this child IVisualPart.
Clients should never call this operation directly but instead add the
children to its parent via the addChild(IVisualPart),
addChild(IVisualPart, int), addChildren(List), or
addChildren(List, int) or remove it via the
removeChild(IVisualPart) or removeChildren(List)
operations, which will indirectly lead to a call here.
parent - The new parent IVisualPart or null.addChild(IVisualPart),
addChild(IVisualPart, int),
addChildren(List), addChildren(List, int),
removeChild(IVisualPart), or
removeChildren(List) to establish/unestablish a
parent-child relationship instead.void setRefreshVisual(boolean refreshVisual)
refreshVisual() into a no-op
operation. This may for instance be used to disable visual updates that
are initiated by the model (in case of IContentParts) while
interacting with the IVisualPart.refreshVisual - Whether refreshVisual() should perform updates of the
visual (true) or behave like a no-op operation (
false).Copyright (c) 2014 itemis AG and others. All rights reserved.