com.vlsolutions.swing.docking

Class DockGroup

public class DockGroup extends Object

This class describes a logical group of Dockables.

When a dockable is associated to a DockGroup (via its DockKey) drag and drop operations are limited to dockables of the same group (or new location) or compatible group (a group with a common ancestor see {@link #isCompatibleGroup(DockGroup)} ).

It becomes easy to develop, for example, and MDI program : all documents are given the same DockGroup, and other dockable are given another group so they don't mess with each other.

The DockGroups can be nested to allow some mixing (for example, an editor application can consist of 4 groups : "Formaters" and "Files" the parent of "TextFiles" and "HTMLfile". In that case, Textfiles and Htmlfiles can be part of tha same tabbed container whereas Formaters are kept outside.

Since: 2.0

See Also: setDockGroup

Constructor Summary
DockGroup(String name)
Constructs a new dockgroup with a given name.
DockGroup(String name, DockGroup parent)
Constructs a new dockgroup with a given name and a parent group.
Method Summary
static booleanareGroupsCompatible(DockGroup g1, DockGroup g2)
convenience method to check compatibility between groups
booleanequals(Object o)
overriden for storage/comparisons with the "name" property
StringgetName()
returns the name of this group (which is used as an internal key)
DockGroupgetParent()
returns the parent of this group (may be null)
inthashCode()
overriden for storage/comparisons with the "name" property
booleanisAncestorOf(DockGroup g)
returns true if this group is the ancestor of group g.
booleanisCompatibleGroup(DockGroup g)
returns true is this group is compatible with the given parameter.
voidsetParent(DockGroup parent)
Updates the parent of this group

Constructor Detail

DockGroup

public DockGroup(String name)
Constructs a new dockgroup with a given name.

Note that names must be unique (this feature is not controlled by the framework) through all DockGroups.

DockGroup

public DockGroup(String name, DockGroup parent)
Constructs a new dockgroup with a given name and a parent group.

Note that names must be unique (this feature is not controlled by the framework) through all DockGroups.

Method Detail

areGroupsCompatible

public static boolean areGroupsCompatible(DockGroup g1, DockGroup g2)
convenience method to check compatibility between groups

equals

public boolean equals(Object o)
overriden for storage/comparisons with the "name" property

getName

public String getName()
returns the name of this group (which is used as an internal key)

getParent

public DockGroup getParent()
returns the parent of this group (may be null)

hashCode

public int hashCode()
overriden for storage/comparisons with the "name" property

isAncestorOf

public boolean isAncestorOf(DockGroup g)
returns true if this group is the ancestor of group g. To be an ancestor, this group must be either equel to g, or to one of g's parents chain.

isCompatibleGroup

public boolean isCompatibleGroup(DockGroup g)
returns true is this group is compatible with the given parameter.

two groups are compatible if they share the same ancestor or if one is the ancestor of the other.

When compatibility is found, dockables of those groups can be docked in the same tab container.

setParent

public void setParent(DockGroup parent)
Updates the parent of this group
© Copyright 2004-2005 VLSolutions. All Rights Reserved.
www.vlsolutions.com : Java Components - Smart Client Applications