com.pietschy.command
Class BindingSupport

java.lang.Object
  extended by com.pietschy.command.BindingSupport
All Implemented Interfaces:
Bindable

public class BindingSupport
extends java.lang.Object
implements Bindable

Support class for Bindables.


Constructor Summary
BindingSupport(BindingSupportCallback callback)
          Creates a new instance with the specified callback.
 
Method Summary
 void addCommandContainerListener(CommandContainerListener listener)
           
protected  void attachToClosestParent()
          Discovers and binds to the nearest CommandContainer bound to our components swing heirarchy.
 void bind()
          Binds to the global command container.
 void bind(CommandContainer container)
          Binds to the specified CommandContainer.
 void bind(java.awt.Component component)
          Binds to the specified component.
(package private)  CommandContainer findClosestParent()
          Finds the closest command container in the export components swing heirarchy.
 CommandContainer getCommandContainer()
          Gets the currently bound CommandContainer.
 boolean isBound()
          Checks if currently bound to either a component or container.
 void rebind()
          Re-evaluates the current binding.
 void removeCommandContainerListener(CommandContainerListener listener)
           
 void unbind()
          Unbinds from the current container or component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BindingSupport

public BindingSupport(BindingSupportCallback callback)
Creates a new instance with the specified callback.

Parameters:
callback - to call back that will handle the instance specific binding operations.
Method Detail

bind

public void bind()
Description copied from interface: Bindable
Binds to the global command container.

Specified by:
bind in interface Bindable
See Also:
CommandContainer.globalInstance()

bind

public void bind(CommandContainer container)
Description copied from interface: Bindable
Binds to the specified CommandContainer.

Specified by:
bind in interface Bindable
Parameters:
container - the container to bind to.

bind

public void bind(java.awt.Component component)
Description copied from interface: Bindable
Binds to the specified component. The component heirarhy will be traversed to locate the nearest bound CommandContainer.

Specified by:
bind in interface Bindable
Parameters:
component - the component to bind to.
See Also:
CommandContainer.bind(Component)

rebind

public void rebind()
Description copied from interface: Bindable
Re-evaluates the current binding. This is only relevant for component bindings.

Specified by:
rebind in interface Bindable

unbind

public void unbind()
Description copied from interface: Bindable
Unbinds from the current container or component.

Specified by:
unbind in interface Bindable

getCommandContainer

public CommandContainer getCommandContainer()
Gets the currently bound CommandContainer. May return null.

Returns:
the currently bound container which may be null.

isBound

public boolean isBound()
Checks if currently bound to either a component or container.

Returns:
true if bound, false otherwise.

attachToClosestParent

protected void attachToClosestParent()
Discovers and binds to the nearest CommandContainer bound to our components swing heirarchy. This method is only relevant for component bindings.


findClosestParent

CommandContainer findClosestParent()
Finds the closest command container in the export components swing heirarchy.

Returns:
the closest command container in the export components swing heirarchy.

addCommandContainerListener

public void addCommandContainerListener(CommandContainerListener listener)

removeCommandContainerListener

public void removeCommandContainerListener(CommandContainerListener listener)


Copyright © 2006 - 2007 Andrew Pietsch