Lesson 10 : Compound DockablesThis is the 10th part of the VLDocking Framework for Java Swing applications. This lesson covers the Compound Dockables, which give a means to create nested hierarchy of dockables.
Note : this lesson will be enhanced in the coming days...
Overview
This feature adds support for nested containers, for example a Tabbed container in which would be nested splitted dockables.
How does it work ?VLDocking now contains a specialized Dockable, called CompoundDockable. Unlike Dockable which is an interface, CompondDockable is a class, and it comes with an associated Component : the CompoundDockingPanel. There shouldn't be any need to subclass CompoundDockable. You interact with CompoundDockable through its DockKey, which gives you a means to name it, to give it an icon and a tooltip (as that what's DockKeys are meant to be...).
Nesting dockables is performed with the new DockingDesktop method
Example : creating a tab containing two dockable (horizontal split)
DockingDesktop desk = ...
Dockable tab1 = ...;
Dockable tab2 = ...;
CompoundDockable compound = new CompoundDockable(new DockKey("Nested"));
Dockable nested1 = ...;
Dockable nested2 = ...;
desk.addDockable(tab1);
desk.createTab(tab1, tab2, 1);
desk.createTab(tab1, compound, 2); // compound is added as a tab
desk.addDockable(compound, nested1); // now we insert nested1
desk.split(nested1, nested2, DockingConstants.SPLIT_RIGHT); // and we split it
Of course, another way of dealing with nested dockable is to use the Workspace Manager Application and load directly your layout from a workspace XML stream.
|