com.javadocking.model
Class FloatDockModel

java.lang.Object
  extended by com.javadocking.model.DefaultDockModel
      extended by com.javadocking.model.FloatDockModel
All Implemented Interfaces:
DockModel

public class FloatDockModel
extends DefaultDockModel

This dock model adds for every owner window automatically a FloatDock and a FloatExternalizer.

Information on using float dock models is in How to Use Dock Models in The Sanaware Developer Guide.

If another float dock is added to the dock model, the key for the float dock of that owner has to be used. This key can be retrieved with getFloatDockKey(Window).

Author:
Heidi Rakels.

Field Summary
static java.lang.String FLOAT_DOCK_KEY
          The suffix for the keys of the float root docks.
 
Constructor Summary
FloatDockModel()
          Constructs a float dock model.
FloatDockModel(FloatDockFactory floatDockFactory)
          Constructs a float dock model with the given factory for creating the default float docks of this model.
FloatDockModel(java.lang.String source)
          Constructs a float dock model with the given source.
FloatDockModel(java.lang.String source, FloatDockFactory floatDockFactory)
          Constructs a float dock model with the given source and the given factory for creating the default float docks of this model.
 
Method Summary
 void addOwner(java.lang.String ownerId, java.awt.Window ownerWindow)
          Adds the owner window and its ID.
 void addRootDock(java.lang.String rootKey, Dock dock, java.awt.Window owner)
          Checks that the appropriate key is used (getFloatDockKey(Window)), when the root dock is a FloatDock.
 FloatDock getFloatDock(java.awt.Window owner)
          Gets the root dock that is the float dock of the given owner window.
 FloatDockFactory getFloatDockFactory()
          Gets the factory of the float docks.
 java.lang.String getFloatDockKey(java.awt.Window owner)
          Creates the key for a float dock with the given owner ID.
 void loadProperties(java.lang.String sourceName, java.lang.String prefix, java.util.Properties properties, java.util.Map dockablesMap, java.util.Map ownersMap, java.util.Map docks, java.util.Map visualizersMap)
           Loads the properties for this dock model.
 void saveProperties(java.lang.String prefix, java.util.Properties properties, java.util.Map docks)
           Saves the properties of this dock model in the given properties object.
 void setFloatDockFactory(FloatDockFactory floatDockProvider)
          Sets the factory of the float docks.
 
Methods inherited from class com.javadocking.model.DefaultDockModel
addVisualizer, getOwner, getOwnerCount, getOwnerID, getRootDock, getRootKeys, getSource, getVisualizer, getVisualizerKeys, isLoadOwnerRectangle, removeOwner, removeRootDock, removeVisualizer, setLoadOwnerRectangle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLOAT_DOCK_KEY

public static final java.lang.String FLOAT_DOCK_KEY
The suffix for the keys of the float root docks.

See Also:
Constant Field Values
Constructor Detail

FloatDockModel

public FloatDockModel()
Constructs a float dock model.


FloatDockModel

public FloatDockModel(java.lang.String source)
Constructs a float dock model with the given source.

Parameters:
source - The name of the data source for this dock model.

FloatDockModel

public FloatDockModel(FloatDockFactory floatDockFactory)
Constructs a float dock model with the given factory for creating the default float docks of this model.

Parameters:
floatDockFactory - This factory creates the default float docks for this dock model.

FloatDockModel

public FloatDockModel(java.lang.String source,
                      FloatDockFactory floatDockFactory)
Constructs a float dock model with the given source and the given factory for creating the default float docks of this model.

Parameters:
source - The name of the data source for this dock model.
floatDockFactory - This factory creates the default float docks for this dock model.
Method Detail

addOwner

public void addOwner(java.lang.String ownerId,
                     java.awt.Window ownerWindow)
Adds the owner window and its ID. Adds also a root dock for this owner window that is a FloatDock created with the floatDockFactory.

Specified by:
addOwner in interface DockModel
Overrides:
addOwner in class DefaultDockModel
Parameters:
ownerId - The ID for the owner. All the owner window IDs have to be different.
ownerWindow - The owner window.

addRootDock

public void addRootDock(java.lang.String rootKey,
                        Dock dock,
                        java.awt.Window owner)
Checks that the appropriate key is used (getFloatDockKey(Window)), when the root dock is a FloatDock.

Specified by:
addRootDock in interface DockModel
Overrides:
addRootDock in class DefaultDockModel
Parameters:
rootKey - The key for the root dock. These keys should be different for all root docks and visualizers.
dock - The root dock that is added.
owner - The window that owns this dock.

getFloatDock

public FloatDock getFloatDock(java.awt.Window owner)
Description copied from interface: DockModel
Gets the root dock that is the float dock of the given owner window.

Specified by:
getFloatDock in interface DockModel
Overrides:
getFloatDock in class DefaultDockModel
Parameters:
owner - The owner window of the float dock.
Returns:
The root dock that is a float dock of the given owner window. If there is no root dock that is a float dock for the specified owner, then null is returned.

getFloatDockKey

public java.lang.String getFloatDockKey(java.awt.Window owner)
Creates the key for a float dock with the given owner ID. This is the concatenation of the ownerId and FLOAT_DOCK_KEY.

Specified by:
getFloatDockKey in interface DockModel
Overrides:
getFloatDockKey in class DefaultDockModel
Parameters:
owner - The owner window of the float dock.
Returns:
The key of the root dock that is a float dock of the given owner window. If there is no root dock that is a float dock for the specified owner, then null is returned.

getFloatDockFactory

public FloatDockFactory getFloatDockFactory()
Gets the factory of the float docks. The default is a DefaultFloatDockFactory.

Returns:
The factory of the float docks.

setFloatDockFactory

public void setFloatDockFactory(FloatDockFactory floatDockProvider)
Sets the factory of the float docks.

Parameters:
floatDockProvider - The factory of the float docks.

loadProperties

public void loadProperties(java.lang.String sourceName,
                           java.lang.String prefix,
                           java.util.Properties properties,
                           java.util.Map dockablesMap,
                           java.util.Map ownersMap,
                           java.util.Map docks,
                           java.util.Map visualizersMap)
                    throws java.io.IOException
Description copied from interface: DockModel

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

The dockables that should be docked in this dock model are added to this dock model. They can be found in the given dockables mapping. The owner windows with their IDs can be found in the given owners mapping.

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

Specified by:
loadProperties in interface DockModel
Overrides:
loadProperties in class DefaultDockModel
Parameters:
sourceName - The name of a data source; typically a file name or a URL.
prefix - The prefix for the property names.
properties - The properties object that contains the properties for this dock model. It can contain also properties for other objects, but they will have another prefix.
dockablesMap - A map with the dockables for the model.
  • map key: the ID of the dockable (java.lang.String).
  • map value: the dockable (Dockable).
ownersMap - A map with the owner windows.
  • map key: the ID of the owner window (java.lang.String).
  • map value: the owner window (java.awt.window).
docks - The decoded docks should be added to this map. The keys are the keys that were used for encoding 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).
visualizersMap - A map with the visualizers.
  • map key: the key of the visualizer (java.lang.String).
  • map value: the visualizer (java.awt.window).
Throws:
java.io.IOException - If an error occurs while decoding the data.

saveProperties

public void saveProperties(java.lang.String prefix,
                           java.util.Properties properties,
                           java.util.Map docks)
Description copied from interface: DockModel

Saves the properties of this dock model in the given properties object.

The property names for this dock model should start with the given prefix.

Specified by:
saveProperties in interface DockModel
Overrides:
saveProperties in class DefaultDockModel
Parameters:
prefix - The prefix for the property names.
properties - The properties object to which the properties should be added.
docks - A mapping between the docks that are already saved and the keys that are used for the save. The encoded docks should be added to this map.
  • map key: a dock that is already saved (Dock).
  • map value: the key that is used for saving the dock (java.lang.String).