VR - The visual root node of the UI toolkit this
AbstractVisualPart is used in, e.g. javafx.scene.Node in
case of JavaFX.V - The visual node used by this AbstractVisualPart.public abstract class AbstractVisualPart<VR,V extends VR> extends java.lang.Object implements IVisualPart<VR,V>
AbstractVisualPart is an abstract implementation of the
IVisualPart interface.IAdaptable.Bound<A extends IAdaptable>| Modifier and Type | Field and Description |
|---|---|
protected java.beans.PropertyChangeSupport |
pcs
A
PropertyChangeSupport that is used as a delegate to notify
listeners about changes to this object. |
ANCHORAGES_PROPERTY, ANCHOREDS_PROPERTY, CHILDREN_PROPERTY, PARENT_PROPERTYADAPTERS_PROPERTYACTIVE_PROPERTY| Constructor and Description |
|---|
AbstractVisualPart()
Creates a new
AbstractVisualPart instance, setting the
AdaptableScope for each of its IAdaptable-compliant types
(super classes implementing IAdaptable and super-interfaces
extending IAdaptable) to the newly created instance (see
AdaptableScopes#scopeTo(IAdaptable)). |
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
Activates this
IVisualPart (if it is not already active) by
setting (and propagating) the new active state first and delegating to
doActivate() afterwards. |
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.
|
protected void |
addChildVisual(IVisualPart<VR,? extends VR> child,
int index)
Performs the addition of the child's visual to this
IVisualPart's visual. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
protected void |
attachToAnchorageVisual(IVisualPart<VR,? extends VR> anchorage,
java.lang.String role)
Attaches this part's visual to the visual of the given anchorage.
|
protected abstract V |
createVisual()
Creates this part's visual.
|
void |
deactivate()
Deactivates this
IVisualPart (if it is active) by delegating to
doDeactivate() first and setting (and propagating) the new
active state afterwards. |
protected void |
detachFromAnchorageVisual(IVisualPart<VR,? extends VR> anchorage,
java.lang.String role)
Detaches this part's visual from the visual of the given anchorage.
|
void |
dispose() |
protected void |
doActivate()
Post
activate() hook that activates this part's children. |
protected void |
doDeactivate()
Pre
deactivate() hook that deactivates this part's children. |
protected abstract void |
doRefreshVisual(V visual)
Refreshes this part's visualization based on this part's content.
|
<T> T |
getAdapter(AdapterKey<? super T> key) |
<T> T |
getAdapter(java.lang.Class<? super T> classKey) |
<T> T |
getAdapter(com.google.common.reflect.TypeToken<? super T> key) |
<T> java.util.Map<AdapterKey<? extends T>,T> |
getAdapters(java.lang.Class<? super T> classKey) |
<T> java.util.Map<AdapterKey<? extends T>,T> |
getAdapters(com.google.common.reflect.TypeToken<? super T> key) |
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. |
protected IViewer<VR> |
getViewer()
Returns the
IViewer that contains this part. |
V |
getVisual()
Returns this part's visual.
|
boolean |
isActive() |
boolean |
isRefreshVisual()
Returns
true if this part is allowed to refresh its
visualization based on its content. |
void |
refreshVisual()
Refreshes this
IVisualPart's visuals. |
protected void |
register(IViewer<VR> viewer)
Called when a link to the Viewer is obtained.
|
protected void |
registerAtVisualPartMap(IViewer<VR> viewer,
V visual)
Registers this part for the given visual in the visual-part-map of the
given
IViewer. |
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. |
protected void |
removeChildVisual(IVisualPart<VR,? extends VR> child,
int index)
Removes the child's visual from this
IVisualPart's visual. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
reorderChild(IVisualPart<VR,? extends VR> child,
int index)
Moves a child
IVisualPart into a lower index than it currently
occupies. |
<T> void |
setAdapter(AdapterKey<? super T> key,
T adapter) |
<T> void |
setAdapter(java.lang.Class<? super T> key,
T adapter) |
<T> void |
setAdapter(com.google.common.reflect.TypeToken<? super T> key,
T adapter) |
void |
setAdapters(java.util.Map<AdapterKey<?>,java.lang.Object> adaptersWithKeys)
Adds the set of adapters to this
IAdaptable. |
void |
setParent(IVisualPart<VR,? extends VR> newParent)
Sets the parent
IVisualPart. |
void |
setRefreshVisual(boolean isRefreshVisual)
Allows to temporarily turn
IVisualPart.refreshVisual() into a no-op
operation. |
protected void |
unregister(IViewer<VR> viewer)
Called when the link to the Viewer is lost.
|
protected void |
unregisterFromVisualPartMap(IViewer<VR> viewer,
V visual)
Removes the given visual from the visual-part-map of the given viewer.
|
<T> T |
unsetAdapter(AdapterKey<? super T> key) |
protected java.beans.PropertyChangeSupport pcs
PropertyChangeSupport that is used as a delegate to notify
listeners about changes to this object. May be used by subclasses to
trigger the notification of listeners.public AbstractVisualPart()
AbstractVisualPart instance, setting the
AdaptableScope for each of its IAdaptable-compliant types
(super classes implementing IAdaptable and super-interfaces
extending IAdaptable) to the newly created instance (see
AdaptableScopes#scopeTo(IAdaptable)).public final void activate()
IVisualPart (if it is not already active) by
setting (and propagating) the new active state first and delegating to
doActivate() afterwards. During the call to
doActivate(), isActive() will thus already return
true. If the IVisualPart is already active, this
operation will be a no-op.activate in interface IActivatabledeactivate(),
isActive()public void addAnchorage(IVisualPart<VR,? extends VR> anchorage)
IVisualPartIVisualPart to the anchorages of this
IVisualPart under the "default" role.addAnchorage in interface IVisualPart<VR,V extends VR>anchorage - The IVisualPart which is added to this part's
anchorages.public void addAnchorage(IVisualPart<VR,? extends VR> anchorage, java.lang.String role)
IVisualPartIVisualPart to the anchorages of this
IVisualPart under the given role.addAnchorage in interface IVisualPart<VR,V extends VR>anchorage - The IVisualPart which is added to this part's
anchorages.role - The role under which the anchorage is added, or
null.public void addAnchored(IVisualPart<VR,? extends VR> anchored)
IVisualPartIVisualPart 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 IVisualPart.addAnchorage(IVisualPart) and
IVisualPart.addAnchorage(IVisualPart, String) operations, which will
indirectly lead to a call here.
addAnchored in interface IVisualPart<VR,V extends VR>anchored - An IVisualPart to attach to this anchorage
IVisualPart as anchored.public void addChild(IVisualPart<VR,? extends VR> child)
IVisualPartaddChild in interface IVisualPart<VR,V extends VR>child - The IVisualPart which is added to the list of this
part's children.public void addChild(IVisualPart<VR,? extends VR> child, int index)
IVisualPartaddChild in interface IVisualPart<VR,V extends VR>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.public void addChildren(java.util.List<? extends IVisualPart<VR,? extends VR>> children)
IVisualPartaddChildren in interface IVisualPart<VR,V extends VR>children - The IVisualParts which are added to the list of this
part's children.public void addChildren(java.util.List<? extends IVisualPart<VR,? extends VR>> children, int index)
IVisualPartaddChildren in interface IVisualPart<VR,V extends VR>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.protected void addChildVisual(IVisualPart<VR,? extends VR> child, int index)
IVisualPart's visual.child - The IVisualPart being addedindex - The child's positionaddChild(IVisualPart, int)public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface IPropertyChangeNotifierprotected void attachToAnchorageVisual(IVisualPart<VR,? extends VR> anchorage, java.lang.String role)
anchorage - The anchorage IVisualPart.role - The anchorage role.protected abstract V createVisual()
public final void deactivate()
IVisualPart (if it is active) by delegating to
doDeactivate() first and setting (and propagating) the new
active state afterwards. During the call to doDeactivate(),
isActive() will thus still return true. If the
IVisualPart is not active, this operation will be a no-op.deactivate in interface IActivatableactivate(),
isActive()protected void detachFromAnchorageVisual(IVisualPart<VR,? extends VR> anchorage, java.lang.String role)
anchorage - The anchorage IVisualPart.role - The anchorage role.public void dispose()
dispose in interface IDisposableprotected void doActivate()
activate() hook that activates this part's children.protected void doDeactivate()
deactivate() hook that deactivates this part's children.protected abstract void doRefreshVisual(V visual)
visual - This part's visual.public <T> T getAdapter(AdapterKey<? super T> key)
getAdapter in interface IAdaptablepublic <T> T getAdapter(java.lang.Class<? super T> classKey)
getAdapter in interface IAdaptablepublic <T> T getAdapter(com.google.common.reflect.TypeToken<? super T> key)
getAdapter in interface IAdaptablepublic <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(java.lang.Class<? super T> classKey)
getAdapters in interface IAdaptablepublic <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(com.google.common.reflect.TypeToken<? super T> key)
getAdapters in interface IAdaptablepublic com.google.common.collect.SetMultimap<IVisualPart<VR,? extends VR>,java.lang.String> getAnchorages()
IVisualPartSetMultimap of this part's anchorages and their
corresponding roles.getAnchorages in interface IVisualPart<VR,V extends VR>SetMultimap of this part's anchorages and their
corresponding roles.public com.google.common.collect.Multiset<IVisualPart<VR,? extends VR>> getAnchoreds()
IVisualPartMultiset of this part's anchoreds.getAnchoreds in interface IVisualPart<VR,V extends VR>Multiset of this part's anchoreds.public java.util.Map<AdapterKey<? extends IBehavior<VR>>,IBehavior<VR>> getBehaviors()
IVisualPartMap of this part's behaviors and their corresponding
AdapterKeys.getBehaviors in interface IVisualPart<VR,V extends VR>Map of this part's behaviors and their corresponding
AdapterKeys.public java.util.List<IVisualPart<VR,? extends VR>> getChildren()
IVisualPartList of this part's children.getChildren in interface IVisualPart<VR,V extends VR>List of this part's children.public IVisualPart<VR,? extends VR> getParent()
IVisualPartgetParent in interface IVisualPart<VR,V extends VR>public java.util.Map<AdapterKey<? extends IPolicy<VR>>,IPolicy<VR>> getPolicies()
IVisualPartMap of this part's policies and their corresponding
AdapterKeys.getPolicies in interface IVisualPart<VR,V extends VR>Map of this part's policies and their corresponding
AdapterKeys.public IRootPart<VR,? extends VR> getRoot()
IVisualPartIRootPart. This method should only be called
internally or by helpers such as edit policies. The root can be used to
get the viewer.protected IViewer<VR> getViewer()
IViewer that contains this part.IViewer that contains this part.public V getVisual()
IVisualPartgetVisual in interface IVisualPart<VR,V extends VR>public boolean isActive()
isActive in interface IActivatabletrue if this IVisualPart is active.public boolean isRefreshVisual()
IVisualParttrue if this part is allowed to refresh its
visualization based on its content. Otherwise returns false.isRefreshVisual in interface IVisualPart<VR,V extends VR>true if this part is allowed to refresh its
visualization based on its content, otherwise false.public final void refreshVisual()
IVisualPart's visuals. Delegates to
doRefreshVisual(Object) in case isRefreshVisual() is
not set to false.refreshVisual in interface IVisualPart<VR,V extends VR>protected void register(IViewer<VR> viewer)
viewer - The viewer to register at.protected void registerAtVisualPartMap(IViewer<VR> viewer, V visual)
IViewer.viewer - The IViewer of which the visual-part-map is extended.visual - The visual for which this part is registered in the viewer's
visual-part-map.public void removeAnchorage(IVisualPart<VR,? extends VR> anchorage)
IVisualPartIVisualPart from the map of this part's
anchorages.removeAnchorage in interface IVisualPart<VR,V extends VR>anchorage - The IVisualPart which is removed from this part's
anchorages.public void removeAnchorage(IVisualPart<VR,? extends VR> anchorage, java.lang.String role)
IVisualPartIVisualPart and role from the map of this
part's anchorages.removeAnchorage in interface IVisualPart<VR,V extends VR>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.public void removeAnchored(IVisualPart<VR,? extends VR> anchored)
IVisualPartIVisualPart 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 IVisualPart.removeAnchorage(IVisualPart)
or IVisualPart.removeAnchorage(IVisualPart, String) operations, which will
indirectly lead to a call here.
removeAnchored in interface IVisualPart<VR,V extends VR>anchored - An IVisualPart (currently attached as anchored to this
anchorage IVisualPart) to detach from this anchorage
IVisualPart as anchored.public void removeChild(IVisualPart<VR,? extends VR> child)
IVisualPartIVisualPart from the list of this part's
children.removeChild in interface IVisualPart<VR,V extends VR>child - The IVisualPart which is removed from the list of this
part's children.public void removeChildren(java.util.List<? extends IVisualPart<VR,? extends VR>> children)
IVisualPartIVisualParts from the list of this part's
children.removeChildren in interface IVisualPart<VR,V extends VR>children - The IVisualParts which are removed from the list of
this part's children.protected void removeChildVisual(IVisualPart<VR,? extends VR> child, int index)
IVisualPart's visual.child - The child IVisualPart.index - The index of the child whose visual is to be removed.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface IPropertyChangeNotifierpublic void reorderChild(IVisualPart<VR,? extends VR> child, int index)
IVisualPart into a lower index than it currently
occupies.reorderChild in interface IVisualPart<VR,V extends VR>child - the child IVisualPart being reorderedindex - new index for the childpublic <T> void setAdapter(AdapterKey<? super T> key, T adapter)
setAdapter in interface IAdaptablepublic <T> void setAdapter(java.lang.Class<? super T> key,
T adapter)
setAdapter in interface IAdaptablepublic <T> void setAdapter(com.google.common.reflect.TypeToken<? super T> key,
T adapter)
setAdapter in interface IAdaptable@Inject(optional=true) public void setAdapters(@AdapterMap java.util.Map<AdapterKey<?>,java.lang.Object> adaptersWithKeys)
IAdaptable. This method should
not be used by clients but is intended for injection of adapters by means
of an AdapterMapInjector.
IMPORTANT: If sub-classes override this method, they will have to transfer the inject annotation to the overwritten method to ensure that adapter map injection is still functional.
adaptersWithKeys - The adapters to add to this IAdaptable (by means of
injection)AdapterMappublic void setParent(IVisualPart<VR,? extends VR> newParent)
IVisualPart.setParent in interface IVisualPart<VR,V extends VR>newParent - The new parent IVisualPart or null.public void setRefreshVisual(boolean isRefreshVisual)
IVisualPartIVisualPart.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.setRefreshVisual in interface IVisualPart<VR,V extends VR>isRefreshVisual - Whether IVisualPart.refreshVisual() should perform updates of the
visual (true) or behave like a no-op operation (
false).protected void unregister(IViewer<VR> viewer)
viewer - The viewer to unregister from.protected void unregisterFromVisualPartMap(IViewer<VR> viewer, V visual)
viewer - The IViewer of which the visual-part-map is changed.visual - The visual which is removed from the visual-part-map.public <T> T unsetAdapter(AdapterKey<? super T> key)
unsetAdapter in interface IAdaptableCopyright (c) 2014 itemis AG and others. All rights reserved.