com.javadocking.model
Interface DockingPath

All Known Implementing Classes:
DefaultDockingPath

public interface DockingPath

Implementations of this interface keep the information about one path in a tree structure of Docks and Dockables.

Information on using docking paths is in How to Use Docking Paths in The Sanaware Developer Guide.

This path can be an existing path in a DockModel. It can be also a path that describes how a dockable that is removed from the model was docked before. With this information the structure can be rebuild as good as possible, when the dockable will be added again.

A dock model can contain several docking trees. This docking path contains also information to identify a root dock of such a tree.

A dockable that is docked in a LeafDock has a specific position in that dock. A dock that is docked in another CompositeDock has also a position. This docking path contains also this information.

Author:
Heidi Rakels.

Method Summary
 Dock getDock(int index)
           Gets the dock with the given index in the path.
 int getDockCount()
          Gets the number of docks in the path.
 java.lang.String getID()
          Gets the ID of this docking path.
 Position getPositionInDock(int index)
          Gets the position of the dockable or child dock in the dock with the given index in the path.
 java.lang.String getRootDockKey()
          Gets the key of the root dock of this path in the DockModel.
 void loadProperties(java.lang.String prefix, java.util.Properties properties, java.util.Map docks)
           Loads the properties for this docking path.
 void saveProperties(java.lang.String prefix, java.util.Properties properties, java.util.Map dockKeys)
           Saves the properties of this docking path in the given properties object.
 

Method Detail

getID

java.lang.String getID()
Gets the ID of this docking path. A docking path usually describes the position of a Dockable in a DockModel. The ID of this docking path can be the ID of this dockable, but this is not obligatory.
WARNING: All the docking paths used in an application should have a different ID.

Returns:
The ID of the docking path. Not null.

getRootDockKey

java.lang.String getRootDockKey()
Gets the key of the root dock of this path in the DockModel. The path belongs to a dock tree. This key defines the root of this tree in the dock model.

Returns:
The key of the root dock of this path. Not null.

getDockCount

int getDockCount()
Gets the number of docks in the path. Can be 0.

Returns:
The number of docks in the path.

getDock

Dock getDock(int index)

Gets the dock with the given index in the path.

The root dock has index 0. The dock with index getDockCount() - 1 can be a LeafDock, but this is not obligatory. The other docks are CompositeDocks.

Parameters:
index - The index of the dock in the path.
Returns:
The dock with the given index in the path. Not null.
Throws:
java.lang.IndexOutOfBoundsException - If the index is out of range (index < 0 || index >= getDockCount()).

getPositionInDock

Position getPositionInDock(int index)
Gets the position of the dockable or child dock in the dock with the given index in the path.

Parameters:
index - The index of the dock in the path.
Returns:
The position of the dock with index index + 1 in the dock with index index if the given index is smaller than getDockCount() - 1. The last position is usually the position of the dockable in the deepest dock of the path, if this deepest dock is a leaf dock. Not null.
Throws:
java.lang.IndexOutOfBoundsException - If the index is out of range (index < 0 || index >= getDockCount()).

saveProperties

void saveProperties(java.lang.String prefix,
                    java.util.Properties properties,
                    java.util.Map dockKeys)

Saves the properties of this docking path in the given properties object.

The property names for this docking path should start with the given prefix.

Parameters:
prefix - The prefix for the property names.
properties - The properties object to which the properties should be added.
dockKeys - A mapping between the docks that are already saved and the keys that are used for the save.
  • map key: a dock that is already saved (Dock).
  • map value: the key that is used for saving the dock (java.lang.String).

loadProperties

void loadProperties(java.lang.String prefix,
                    java.util.Properties properties,
                    java.util.Map docks)

Loads the properties for this docking path. The properties can be found in the given properties object and the property names start with the given prefix.

The docks that should be used inside this docking path can be found in the given docks mapping.

This method should be called after the empty constructor to create the content of the docking path. Don't call this method for a docking path that already has a content.

Parameters:
prefix - The prefix of the names of the properties that have been intended for this docking path.
properties - The properties object that contains the properties for this docking path. It can contain also properties for other objects, but they will have another prefix.
docks - A mapping between the dock keys of the docks that are already loaded and the docks.
  • map key: the key that is used for saving the dock (java.lang.String).
  • map value: a dock that is already loaded (Dock).