com.vlsolutions.swing.docking
Class DockGroup

java.lang.Object
  extended by com.vlsolutions.swing.docking.DockGroup

public class DockGroup
extends java.lang.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 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:
DockKey.setDockGroup(DockGroup)

Constructor Summary
DockGroup(java.lang.String name)
          Constructs a new dockgroup with a given name.
DockGroup(java.lang.String name, DockGroup parent)
          Constructs a new dockgroup with a given name and a parent group.
 
Method Summary
static boolean areGroupsCompatible(DockGroup g1, DockGroup g2)
          convenience method to check compatibility between groups
 boolean equals(java.lang.Object o)
          overriden for storage/comparisons with the "name" property
 java.lang.String getName()
          returns the name of this group (which is used as an internal key)
 DockGroup getParent()
          returns the parent of this group (may be null)
 int hashCode()
          overriden for storage/comparisons with the "name" property
 boolean isAncestorOf(DockGroup g)
          returns true if this group is the ancestor of group g.
 boolean isCompatibleGroup(DockGroup g)
          returns true is this group is compatible with the given parameter.
 void setParent(DockGroup parent)
          Updates the parent of this group
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockGroup

public DockGroup(java.lang.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(java.lang.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

getParent

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


setParent

public void setParent(DockGroup parent)
Updates the parent of this group


getName

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


equals

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

Overrides:
equals in class java.lang.Object

hashCode

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

Overrides:
hashCode in class java.lang.Object

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.


areGroupsCompatible

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



© Copyright 2004-2007 VLSolutions. All Rights Reserved.
www.vlsolutions.com : Java Components - Smart Client Applications