bibliothek.gui.dock.action
Interface ActionOffer

All Known Implementing Classes:
CActionOffer, DefaultActionOffer

public interface ActionOffer

An ActionOffer creates a DockActionSource for a Dockable. An ActionOffer is added to the DockController. When the Dockables method Dockable.getGlobalActionOffers() is called, the Dockable most often will call DockController.listOffers(Dockable) to create the list of actions. This method in return will call getSource(Dockable, DockActionSource, DockActionSource[], DockActionSource, DockActionSource[]) on the first ActionOffer which is interested(Dockable) in the Dockable.

Author:
Benjamin Sigg
See Also:
DockController.addActionOffer(ActionOffer), DockController.removeActionOffer(ActionOffer)

Method Summary
 DockActionSource getSource(Dockable dockable, DockActionSource source, DockActionSource[] guards, DockActionSource parent, DockActionSource[] parents)
          Generates one source of actions for the given Dockable.
 boolean interested(Dockable dockable)
          Tells whether this ActionOffer wants to collect the actions for the dockable, or if this ActionOffer is not interested in the Dockable.
 

Method Detail

interested

boolean interested(Dockable dockable)
Tells whether this ActionOffer wants to collect the actions for the dockable, or if this ActionOffer is not interested in the Dockable.

Parameters:
dockable - The Dockable to test
Returns:
true if this ActionOffer should tell which actions will be associated with the dockable, false otherwise.

getSource

DockActionSource getSource(Dockable dockable,
                           DockActionSource source,
                           DockActionSource[] guards,
                           DockActionSource parent,
                           DockActionSource[] parents)
Generates one source of actions for the given Dockable. The ActionOffer is free how to use the actions that are created by other parts of the system, but it is a good idea to use all of them. Note that each argument, and each element in an array, can be null.

Parameters:
dockable - The Dockable for which the the source has to be created. An invocation of interested should return true, otherwise the behavior of this method is not specified.
source - the DockActionSource derived from dockable
guards - a list of DockActionSources derived from ActionGuards
parent - the DockActionSource derived from the parent of dockable
parents - a list of DockActionSources derived from all parents of dockable
Returns:
The source that was created.