A LeafDock is a Dock that contains Dockable objects.
The most simple leaf dock is a SingleDock. This type of dock can contain 0 or one dockables. When the dock has already a dockable, no other dockable can be docked in this dock anymore.
In the folowing example the single dock is created and the dockable is added:
The dockable can be dragged from the left dock to the right and back.// Create the single docks. SingleDock leftDock = new SingleDock(); SingleDock rightDock = new SingleDock(); // Add the dockable to the dock. leftDock.addDockable(dockable1, new Position(0));
The most useful leaf dock is the TabDock. This dock can contain multiple dockables. There is tab for every dockable.
In the folowing example 2 tab docks are created and the dockables are added to the left tab dock:
The dockables can be dragged to the other dock. They can be dragged alone or together. The tabs can also be moved in the same tab dock.// Create the tab docks. TabDock leftDock = new TabDock(); TabDock rightDock = new TabDock(); // Add the dockables to the left tab dock. leftDock.addDockable(dockable1, new Position(0)); leftDock.addDockable(dockable2, new Position(1));
A special leaf dock that organizes its dockables in a line, is a LineDock.
In the folowing example 2 line docks are created:
// Create the line docks. LineDock topDock = new LineDock(); LineDock bottomDock = new LineDock(); // Add the dockables to these line docks. topDock.addDockable(dockable1, new Position(0)); topDock.addDockable(dockable2, new Position(1)); topDock.addDockable(dockable3, new Position(2)); bottomDock.addDockable(dockable4, new Position(0)); bottomDock.addDockable(dockable5, new Position(1)); bottomDock.addDockable(dockable6, new Position(2));
Another special leaf dock that organizes its dockables in a grid, is a GridDock.
In the folowing example 1 grid dock is created:
// Create the grid dock. GridDock dock = new GridDock(); // Add the dockables to the grid dock. dock.addDockable(dockable1, new Position(0)); dock.addDockable(dockable2, new Position(1)); dock.addDockable(dockable3, new Position(2)); dock.addDockable(dockable4, new Position(3)); dock.addDockable(dockable5, new Position(4)); dock.addDockable(dockable6, new Position(5));
SingleDocks | Shows the use of single docks. |
TabDocks | Shows the use of tab docks. |
LineDocks | Shows the use of line docks. |
GridDocks | Shows the use of grid docks. |