|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Dock
A dock is where Dockables can be docked.
How a dockable is docked in the dock, depends on the location where the dockable is added.
There are docks that have child docks (CompositeDocks)
and there are docks that only contain dockables (LeafDocks).
The UI of an application contains tree structures of docks. Every dock
has a parent composite dock. The parent composite dock of the root dock is null.
Information on using docks is in How to Use Laef Docks and How to Use Composite Docks in The Sanaware Developer Guide.
A dock can be empty. This means that it doesn't have any dockables docked in it, or it doesn't have any child docks if it is a composite dock. If a dock becomes empty, it should inform the parent composite dock, that it is empty. A parent composite dock can then decide to remove the empty child dock.
A dock can also be full. This means that no dockables can be added. If a composite dock is full, no child docks can be added. This does not necessarily mean that all of its child docks are full!
When a dockable is dragged, depending on the location of the mouse, the dockable can be docked
in different ways in the dock. For example,
if the location is at the left side of a dock, the dockable can be docked left. if the location is in the center
of a dock, the dockable can be docked in the center. Every mouse location has a priority for docking
a dockable. The priority constants are defined in Priority.
| Method Summary | |
|---|---|
boolean |
addDockable(Dockable dockable,
java.awt.Point relativeLocation,
java.awt.Point dockableOffset)
Adds a dockable to this dock. |
void |
addDockingListener(DockingListener listener)
Adds a listener for DockingEvents of this dock. |
int |
getDockPriority(Dockable dockable,
java.awt.Point relativeLocation)
Determines if a dockable can be added to this dock at the specified location. |
CompositeDock |
getParentDock()
Gets the parent dock of this dock. |
boolean |
isEmpty()
Determines if this dock doesn't have any dockables docked in it, or doesn't have any child docks docked in it. |
boolean |
isFull()
Determines if any more dockables can be added to this dock. |
void |
loadProperties(java.lang.String prefix,
java.util.Properties properties,
java.util.Map childDocks,
java.util.Map dockablesMap,
java.awt.Window owner)
Loads the properties for this dock. |
void |
removeDockingListener(DockingListener listener)
Removes a listener for docking events of this dock. |
int |
retrieveDockingRectangle(Dockable dockable,
java.awt.Point relativeLocation,
java.awt.Point dockableOffset,
java.awt.Rectangle rectangle)
Sets the given rectangle to the position and size of the graphical content component of the dockable, when it will be docked in this dock. |
void |
saveProperties(java.lang.String prefix,
java.util.Properties properties,
java.util.Map childDockKeys)
Saves the properties of this dock in the given properties object. |
void |
setParentDock(CompositeDock parentDock)
Sets the specified dock as new parent dock of this dock. |
| Method Detail |
|---|
int getDockPriority(Dockable dockable,
java.awt.Point relativeLocation)
Determines if a dockable can be added to this dock at the specified location.
The priority constants are defined in Priority.
If the dockable cannot be added, it returns Priority.CANNOT_DOCK. If a dockable cannot be added to
this dock, it is still possible that it can be added to a child dock of this dock, if it is a composite dock.
The higher the integer that is returned, the more this dock wants this dockable to be docked here. Some predefined return values with ascending priority are:
Priority.CAN_DOCK_AS_LASTPriority.CAN_DOCKPriority.CAN_DOCK_WITH_PRIORITYPriority.CAN_DOCK_WITH_HIGH_PRIORITY
dockable - The dockable that will be added.relativeLocation - The location where the dockable will be added.
int retrieveDockingRectangle(Dockable dockable,
java.awt.Point relativeLocation,
java.awt.Point dockableOffset,
java.awt.Rectangle rectangle)
Sets the given rectangle to the position and size of the graphical content component of the dockable, when it will be docked in this dock.
Determines if the dockable can be added to this dock. If the dockable cannot be added,
it returns Priority.CANNOT_DOCK and the given rectangle is not changed.
dockable - The dockable that will be added.relativeLocation - The location where the dockable will be added.dockableOffset - The mouse location where the dragging started, relatively to the previous dock of the dockable.rectangle - This rectangle will be set to the location and size of the graphical component of the dockable
when it will be docked in this dock. The rectangle is relative to this dock.
Priority.CANNOT_DOCK is returned, otherwise a positive integer.
boolean addDockable(Dockable dockable,
java.awt.Point relativeLocation,
java.awt.Point dockableOffset)
Adds a dockable to this dock.
First it determines if the dockable can be added with getDockPriority(Dockable, Point).
If this method returns CANNOT_DOCK, the dockable is not added.
dockable - The dockable that will be added.relativeLocation - The location where the dockable will be added.dockableOffset - The mouse location where the dragging started, relatively to the previous dock of the dockable.
boolean isEmpty()
boolean isFull()
CompositeDock getParentDock()
void setParentDock(CompositeDock parentDock)
parentDock - The parent dock of this dock.
void saveProperties(java.lang.String prefix,
java.util.Properties properties,
java.util.Map childDockKeys)
Saves the properties of this dock in the given properties object.
The property names for this dock should start with the given prefix.
prefix - The prefix for the property names.properties - The properties object to which the properties should be added.childDockKeys - A mapping between the child docks that are already saved and the keys that are used for the save.
Dock).
void loadProperties(java.lang.String prefix,
java.util.Properties properties,
java.util.Map childDocks,
java.util.Map dockablesMap,
java.awt.Window owner)
throws java.io.IOException
Loads the properties for this dock. The properties can be found in the given properties object. The property names for this dock start with the given prefix.
The dockables that should be docked in this dock are added to this dock. They can be found in the given dockables mapping. The docks that should be docked inside this dock are added to this dock. They can be found in the given childDocks mapping.
This method should be called after the empty constructor to create the content of the dock. Don't call this method for a dock that already has a content.
prefix - The prefix of the names of the properties that have been intended for this dock.properties - The properties object that contains the properties for this dock. It can contain also
properties for other objects, but they will have another prefix.childDocks - A mapping between the dock keys of the child docks that are already loaded and the docks.
Dock).dockablesMap - A mapping that contains the available dockables.
Dockable).owner - The owner window of the dock in the dock model (DockModel).
java.io.IOException - If an error occures while decoding the properties.void addDockingListener(DockingListener listener)
DockingEvents of this dock.
The listener will be informed before and after
adding, moving or removing dockables or child docks from this dock.
listener - A docking listener that will be notified when a dockable or child dock is added, moved, or removed.void removeDockingListener(DockingListener listener)
listener - The docking listener to remove.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||