bibliothek.gui.dock.util
Class DockUtilities

java.lang.Object
  extended by bibliothek.gui.dock.util.DockUtilities

public class DockUtilities
extends java.lang.Object

A list of methods which can be used for different purposes. Methods related to the DockTheme can be found in DockUI.

Author:
Benjamin Sigg

Nested Class Summary
static class DockUtilities.DockVisitor
          A visitor used to visit the nodes of a dock-tree.
 
Constructor Summary
DockUtilities()
           
 
Method Summary
static javax.swing.Icon disabledIcon(javax.swing.JComponent parent, javax.swing.Icon icon)
          Gets a "disabled" icon according to the current look and feel.
static DockableProperty getPropertyChain(Dockable dockable)
          Gets a DockableProperty which describes the path from the root to dockable.
static DockableProperty getPropertyChain(DockStation ground, Dockable dockable)
          Creates a DockableProperty describing the path from ground to dockable.
static DockStation getRoot(DockElement element)
          Searches the station which is an anchestor of element and has no parent.
static java.awt.Component getShowingComponent(Dockable dockable)
          Searches a Component which is showing and has something to do with dockable.
static boolean isAnchestor(DockElement anchestor, DockElement child)
          Tells whether child is identical with anchestor or a child of anchestor.
static void visit(Dockable dockable, DockUtilities.DockVisitor visitor)
          Visits dockable and all its children.
static void visit(DockStation station, DockUtilities.DockVisitor visitor)
          Visits station and all its children.
private static void visitDockable(Dockable dockable, DockUtilities.DockVisitor visitor)
          Visits dockable and all its children.
private static void visitStation(DockStation station, DockUtilities.DockVisitor visitor)
          Visits station and all its children.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockUtilities

public DockUtilities()
Method Detail

visit

public static void visit(Dockable dockable,
                         DockUtilities.DockVisitor visitor)
Visits dockable and all its children.

Parameters:
dockable - the first element to visit
visitor - a delegate

visit

public static void visit(DockStation station,
                         DockUtilities.DockVisitor visitor)
Visits station and all its children.

Parameters:
station - the first element to visit
visitor - a delegate

visitDockable

private static void visitDockable(Dockable dockable,
                                  DockUtilities.DockVisitor visitor)
Visits dockable and all its children.

Parameters:
dockable - the first element to visit
visitor - a delegate

visitStation

private static void visitStation(DockStation station,
                                 DockUtilities.DockVisitor visitor)
Visits station and all its children.

Parameters:
station - the first element to visit
visitor - a delegate

isAnchestor

public static boolean isAnchestor(DockElement anchestor,
                                  DockElement child)
Tells whether child is identical with anchestor or a child of anchestor.

Parameters:
anchestor - an element
child - another element
Returns:
true if anchestor is a parent of or identical with child.

getRoot

public static DockStation getRoot(DockElement element)
Searches the station which is an anchestor of element and has no parent.

Parameters:
element - the element whose oldest parent is searched
Returns:
the root, may be null if element has no parent

getPropertyChain

public static DockableProperty getPropertyChain(Dockable dockable)
Gets a DockableProperty which describes the path from the root to dockable.

Parameters:
dockable - a Dockable whose location is searched
Returns:
the properties or null if dockable has no parent

getPropertyChain

public static DockableProperty getPropertyChain(DockStation ground,
                                                Dockable dockable)
Creates a DockableProperty describing the path from ground to dockable.

Parameters:
ground - the base of the property
dockable - an indirect child of ground
Returns:
a property for the path ground to dockable.
Throws:
java.lang.IllegalArgumentException - if ground is not an anchestor of dockable

getShowingComponent

public static java.awt.Component getShowingComponent(Dockable dockable)
Searches a Component which is showing and has something to do with dockable.

Parameters:
dockable - a Dockable for which a Component has to be found
Returns:
a showing component or null

disabledIcon

public static javax.swing.Icon disabledIcon(javax.swing.JComponent parent,
                                            javax.swing.Icon icon)
Gets a "disabled" icon according to the current look and feel.

Parameters:
parent - the component on which the icon will be painted, can be null
icon - an icon or null
Returns:
a disabled version of icon or null