bibliothek.gui.dock.control.focus
Class AbstractFocusController

java.lang.Object
  extended by bibliothek.gui.dock.control.focus.AbstractFocusController
All Implemented Interfaces:
FocusController
Direct Known Subclasses:
DefaultFocusController

public abstract class AbstractFocusController
extends Object
implements FocusController

Abstract implementation of FocusController offering methods to handle the listeners.

Author:
Benjamin Sigg

Constructor Summary
AbstractFocusController(DockController controller)
          Creates a new focus controller
 
Method Summary
 void addDockableFocusListener(DockableFocusListener listener)
          Adds a listener to this controller, the listener will be informed when the focused Dockable changes.
 void addVetoListener(FocusVetoListener listener)
          Adds a listener to this controller which can cancel a call to the DockController.
protected  DockableFocusListener[] dockableFocusListeners()
          Gets an array of currently registered DockableFocusListeners.
protected  void fireDockableFocused(Dockable oldFocused, Dockable newFocused)
          Informs all listeners that dockable has gained the focus.
protected  FocusVetoListener.FocusVeto fireVetoDockable(Dockable dockable)
          Asks all FocusVetoListener through their method FocusVetoListener.vetoFocus(FocusController, Dockable) whether they want cancel a call to the DockController.
protected  FocusVetoListener.FocusVeto fireVetoTitle(DockTitle title)
          Asks all FocusVetoListener through their method FocusVetoListener.vetoFocus(FocusController, DockTitle) whether they want cancel a call to the DockController.
 void freezeFocus()
          Temporarily disables this FocusController.
 DockController getController()
          Gets the DockController whose Dockables are tracked by this observer.
 FocusStrategy getStrategy()
          Gets the strategy that selects the Components to focus.
protected  boolean isFrozen()
          Tells whether this FocusController is temporarily frozen and should not process any events.
 void meltFocus()
          Re-enabls this FocusController after it was temporarility disabled.
 void removeDockableFocusListener(DockableFocusListener listener)
          Removes a listener from this controller.
 void removeVetoListener(FocusVetoListener listener)
          Removes a listener from this controller
 void setStrategy(FocusStrategy strategy)
          Sets the strategy which will be used to focus components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.control.focus.FocusController
checkFocusedDockable, ensureFocusSet, getFocusedDockable, isOnFocusing, setFocusedDockable
 

Constructor Detail

AbstractFocusController

public AbstractFocusController(DockController controller)
Creates a new focus controller

Parameters:
controller - the owner of this controller, not null
Method Detail

setStrategy

public void setStrategy(FocusStrategy strategy)
Description copied from interface: FocusController
Sets the strategy which will be used to focus components.

Specified by:
setStrategy in interface FocusController
Parameters:
strategy - the new strategy, can be null

getStrategy

public FocusStrategy getStrategy()
Description copied from interface: FocusController
Gets the strategy that selects the Components to focus.

Specified by:
getStrategy in interface FocusController
Returns:
the strategy, can be null

freezeFocus

public void freezeFocus()
Description copied from interface: FocusController
Temporarily disables this FocusController. Any call that would lead to a change in the focus is silently ignored.

Specified by:
freezeFocus in interface FocusController

meltFocus

public void meltFocus()
Description copied from interface: FocusController
Re-enabls this FocusController after it was temporarility disabled.

Specified by:
meltFocus in interface FocusController

isFrozen

protected boolean isFrozen()
Tells whether this FocusController is temporarily frozen and should not process any events.

Returns:
true if disabled

addVetoListener

public void addVetoListener(FocusVetoListener listener)
Adds a listener to this controller which can cancel a call to the DockController.

Specified by:
addVetoListener in interface FocusController
Parameters:
listener - the new listener

removeVetoListener

public void removeVetoListener(FocusVetoListener listener)
Removes a listener from this controller

Specified by:
removeVetoListener in interface FocusController
Parameters:
listener - the listener to remove

fireVetoTitle

protected FocusVetoListener.FocusVeto fireVetoTitle(DockTitle title)
Asks all FocusVetoListener through their method FocusVetoListener.vetoFocus(FocusController, DockTitle) whether they want cancel a call to the DockController.

Parameters:
title - the title which is about to be focused
Returns:
the first veto

fireVetoDockable

protected FocusVetoListener.FocusVeto fireVetoDockable(Dockable dockable)
Asks all FocusVetoListener through their method FocusVetoListener.vetoFocus(FocusController, Dockable) whether they want cancel a call to the DockController.

Parameters:
dockable - the Dockable which is about to be focused
Returns:
the first veto

getController

public DockController getController()
Description copied from interface: FocusController
Gets the DockController whose Dockables are tracked by this observer.

Specified by:
getController in interface FocusController
Returns:
the controller

addDockableFocusListener

public void addDockableFocusListener(DockableFocusListener listener)
Adds a listener to this controller, the listener will be informed when the focused Dockable changes.

Specified by:
addDockableFocusListener in interface FocusController
Parameters:
listener - the new listener

removeDockableFocusListener

public void removeDockableFocusListener(DockableFocusListener listener)
Removes a listener from this controller.

Specified by:
removeDockableFocusListener in interface FocusController
Parameters:
listener - the listener to remove

dockableFocusListeners

protected DockableFocusListener[] dockableFocusListeners()
Gets an array of currently registered DockableFocusListeners.

Returns:
the modifiable array

fireDockableFocused

protected void fireDockableFocused(Dockable oldFocused,
                                   Dockable newFocused)
Informs all listeners that dockable has gained the focus.

Parameters:
oldFocused - the old owner of the focus, may be null
newFocused - the owner of the focus, may be null