bibliothek.gui.dock.control.focus
Class DefaultFocusHistory

java.lang.Object
  extended by bibliothek.gui.dock.control.focus.DefaultFocusHistory
All Implemented Interfaces:
FocusHistory

public class DefaultFocusHistory
extends Object
implements FocusHistory

The default implementation of FocusHistory adds listeners to a DockController to keep the history up to date. Only Dockables that are actually registered at the controller are reported in the history

Author:
Benjamin Sigg

Constructor Summary
DefaultFocusHistory()
           
 
Method Summary
 Dockable getFirst(Filter<Dockable> filter)
          Traverses the history in reverse and returns the first Dockable matching filter.
 Dockable[] getHistory()
          Gets an array containing all known Dockables which may have had the focus.
 Dockable getNewestOn(DockStation... parents)
          Searches the one Dockable that had the focus lately, and that is a child of one of parent.
 void setController(DockController controller)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFocusHistory

public DefaultFocusHistory()
Method Detail

setController

public void setController(DockController controller)

getHistory

public Dockable[] getHistory()
Description copied from interface: FocusHistory
Gets an array containing all known Dockables which may have had the focus. The first element in the array did not have the focus for the longest time, while the last element in the array is the element that may have the focus right now.
The result may contain Dockables that were never focused, these items will always be at the beginning of the array.

Specified by:
getHistory in interface FocusHistory
Returns:
a copy of the history

getNewestOn

public Dockable getNewestOn(DockStation... parents)
Description copied from interface: FocusHistory
Searches the one Dockable that had the focus lately, and that is a child of one of parent.

Specified by:
getNewestOn in interface FocusHistory
Parameters:
parents - the stations whose child is searched
Returns:
a Dockable that had the focus and which is a child of one of the parents, or null if no such Dockable can be found

getFirst

public Dockable getFirst(Filter<Dockable> filter)
Description copied from interface: FocusHistory
Traverses the history in reverse and returns the first Dockable matching filter.

Specified by:
getFirst in interface FocusHistory
Parameters:
filter - the filter to apply, not null
Returns:
the newest Dockable having focus and matching filter, or null