com.pietschy.command.delegate
Class DefaultDelegateMediator

java.lang.Object
  extended by com.pietschy.command.delegate.AbstractDelegateMediator
      extended by com.pietschy.command.delegate.DefaultDelegateMediator
All Implemented Interfaces:
DelegateMediator

public class DefaultDelegateMediator
extends AbstractDelegateMediator

Default implementation of DelegateMediator that allows you to set the either a list of ActionCommandExecutors to use or a list of DelegateProviders to use. When set all DelegatingCommands associated with this mediator will update accordingly.


Field Summary
 
Fields inherited from class com.pietschy.command.delegate.AbstractDelegateMediator
EMPTY_PROVIDER_ARRAY
 
Constructor Summary
DefaultDelegateMediator()
           
 
Method Summary
 ActionCommandExecutor getExecutor(java.lang.String id)
          Searches the provider hierarchy and gets the first executor it finds.
 void setDelegateProvider(DelegateProvider provider)
          Sets the current DelegateProvider to be used by all DelegatingCommands associated with this mediator.
 void setDelegateProviders(DelegateProvider[] providers)
          Sets the current DelegateProvider to be used by all DelegatingCommands associated with this mediator.
 void setDelegates(ActionCommandExecutor delegate, ActionCommandExecutor... otherDelegates)
          Sets the current list of delegates to those specified.
 void setDelegates(java.util.Collection<? extends ActionCommandExecutor> delegates)
          Sets the current list of delegates to those specified.
 
Methods inherited from class com.pietschy.command.delegate.AbstractDelegateMediator
addDelegateMediatorListener, fireDelegatesChanged, getExecutor, nullSafeArray, nullSafeArray, removeDelegateMediatorListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDelegateMediator

public DefaultDelegateMediator()
Method Detail

setDelegateProviders

public void setDelegateProviders(DelegateProvider[] providers)
Sets the current DelegateProvider to be used by all DelegatingCommands associated with this mediator.

Parameters:
providers - the providers to use, or null to clear all the providers.

setDelegateProvider

public void setDelegateProvider(DelegateProvider provider)
Sets the current DelegateProvider to be used by all DelegatingCommands associated with this mediator.

Parameters:
provider - the provider to use, or null to clear all the providers.

setDelegates

public void setDelegates(ActionCommandExecutor delegate,
                         ActionCommandExecutor... otherDelegates)
Sets the current list of delegates to those specified. This method clears all existing providers and add a new provider containing the specified delegates.

Parameters:
delegate - the first delegate.
otherDelegates - any additional delegates.

setDelegates

public void setDelegates(java.util.Collection<? extends ActionCommandExecutor> delegates)
Sets the current list of delegates to those specified. This method clears all existing providers and add a new provider containing the specified delegates.

Parameters:
delegates - the new delegates to use.

getExecutor

public ActionCommandExecutor getExecutor(java.lang.String id)
Searches the provider hierarchy and gets the first executor it finds.

Parameters:
id - the id to search for.
Returns:
the first executor in the provider hierarchy or null if non exists.


Copyright © 2006 - 2007 Andrew Pietsch