org.pietschy.command.delegate
Class DelegateMediator
java.lang.Object
org.pietschy.command.delegate.DelegateMediator
public class DelegateMediator
extends java.lang.Object
DelegateMediators are used by
DelegatingCommand
instances to find their delegates.
Each mediator is bound to a specified window and is associated with a command by
invoking
DelegatingCommand.trackDelegateIn(String, java.awt.Window)
.
DelegateMediator instances can be accessed by calling
DelegateManager.getMediatorFor(java.awt.Component)
and
DelegateManager.getMediatorFor(java.awt.Window)
.
You can customise the creation of mediators by providing a custom
DelegateMediatorFactory
to
the
DelegateManager
.
fireDelegatesChanged
protected void fireDelegatesChanged(DelegateContainer[] containers)
nullSafeArray
protected DelegateContainer[] nullSafeArray(DelegateContainer container)
Creates an array containing the specified container. If container is null this
method returns and empty array.
container
- the container.
- a non
null
array containing the container or an empty array
if the container was null
.
nullSafeArray
protected DelegateContainer[] nullSafeArray(DelegateContainer[] containers)
Returns the specified array or and empty array if containers was null
.
- the specified array or and empty array if containers was
null
.
setDelegateContainer
public void setDelegateContainer(DelegateContainer container)
container
- the container to use or null
to disable all delegates.
setDelegateContainers
public void setDelegateContainers(DelegateContainer[] containers)
containers
- the containers to use, or null
to clear all the containers.