bibliothek.gui.dock.control
Class DefaultFocusController

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

public class DefaultFocusController
extends AbstractFocusController

Default implementation of FocusController.

Author:
Benjamin Sigg

Constructor Summary
DefaultFocusController(DockController controller)
          Creates a new focus-controller
 
Method Summary
 FocusVetoListener.FocusVeto checkFocusedDockable(DockElementRepresentative source)
          Checks whether source can be used to select the next focused Dockable.
 void ensureFocusSet(boolean dockableOnly)
          Ensures that a title or a Component of the currently focused Dockable really has the focus.
 Dockable getFocusedDockable()
          Gets the Dockable which is currently focused.
 boolean isOnFocusing()
          Tells whether one of the methods which change the focus is currently running, or not.
 FocusVetoListener.FocusVeto setFocusedDockable(DockElementRepresentative source, java.awt.Component component, boolean force, boolean ensureFocusSet, boolean ensureDockableFocused)
          Sets the Dockable which should have the focus.
 
Methods inherited from class bibliothek.gui.dock.control.focus.AbstractFocusController
addDockableFocusListener, addVetoListener, dockableFocusListeners, fireDockableFocused, fireVetoDockable, fireVetoTitle, freezeFocus, getController, getStrategy, isFrozen, meltFocus, removeDockableFocusListener, removeVetoListener, setStrategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFocusController

public DefaultFocusController(DockController controller)
Creates a new focus-controller

Parameters:
controller - the owner of this controller
Method Detail

isOnFocusing

public boolean isOnFocusing()
Description copied from interface: FocusController
Tells whether one of the methods which change the focus is currently running, or not. If the result is true, noone should change the focus.

Returns:
true if the focus is currently changing

getFocusedDockable

public Dockable getFocusedDockable()
Description copied from interface: FocusController
Gets the Dockable which is currently focused.

Returns:
the focused element or null

checkFocusedDockable

public FocusVetoListener.FocusVeto checkFocusedDockable(DockElementRepresentative source)
Description copied from interface: FocusController
Checks whether source can be used to select the next focused Dockable.

Parameters:
source - the element which may be focused
Returns:
whether the focus can be transfered, a value of null indicates that source does not represent a Dockable

setFocusedDockable

public FocusVetoListener.FocusVeto setFocusedDockable(DockElementRepresentative source,
                                                      java.awt.Component component,
                                                      boolean force,
                                                      boolean ensureFocusSet,
                                                      boolean ensureDockableFocused)
Description copied from interface: FocusController
Sets the Dockable which should have the focus.

Parameters:
source - the item to focus, may be null
component - the Component which triggered this call for example because the user clicked with the mouse on it. This method can assume that the focus will automatically be transfered to component by the Swing framework itself. Can be null, in which case this method decides on its own which Component to focus. This method may or may not do sanity checks concerning component. An invalid argument will silently be ignored and treated as if it would be null.
force - true if this controller must ensure that all properties are correct, false if some optimations are allowed. Clients normally can set this argument to false.
ensureFocusSet - if true, then this method should make sure that either focusedDockable itself or one of its DockElementRepresentative is the focus owner
ensureDockableFocused - if true, then this method should make sure that focusedDockable is the focus owner. This parameter is stronger that ensureFocusSet
Returns:
whether focus could be transfered, a value of null indicates that FocusController.isOnFocusing() returned true and the call was ignored

ensureFocusSet

public void ensureFocusSet(boolean dockableOnly)
Description copied from interface: FocusController
Ensures that a title or a Component of the currently focused Dockable really has the focus.

Parameters:
dockableOnly - if true, then only the Dockable itself should be focused