com.javadocking.model
Class DefaultDockingPathModel

java.lang.Object
  extended by com.javadocking.model.DefaultDockingPathModel
All Implemented Interfaces:
DockingPathModel

public class DefaultDockingPathModel
extends java.lang.Object
implements DockingPathModel

This is an implementation for DockingPathModel that uses a java.util.HashMap.

Author:
Heidi Rakels.

Field Summary
 java.util.Map dockingPaths
           
 
Constructor Summary
DefaultDockingPathModel()
           
 
Method Summary
 void add(DockingPath dockingPath)
          Adds the given docking path to the model.
 DockingPath getDockingPath(java.lang.String id)
          Gets the docking path of this model that has the given id as ID.
 java.util.Iterator getIDs()
          Gets an iterator that iterates over the IDs of all the docking paths of the model.
 void loadProperties(java.lang.String prefix, java.util.Properties properties, java.util.Map docks)
           Loads the properties for this docking path model.
 void remove(DockingPath dockingPath)
          Removes the given docking path from the model.
 void saveProperties(java.lang.String prefix, java.util.Properties properties, java.util.Map dockKeys)
           Saves the properties of this docking path model in the given properties object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dockingPaths

public java.util.Map dockingPaths
Constructor Detail

DefaultDockingPathModel

public DefaultDockingPathModel()
Method Detail

add

public void add(DockingPath dockingPath)
Description copied from interface: DockingPathModel
Adds the given docking path to the model. If there is already a docking path in the model, with the same ID, then the existing docking path is first removed.

Specified by:
add in interface DockingPathModel
Parameters:
dockingPath - The docking path that is added to the model.

getIDs

public java.util.Iterator getIDs()
Description copied from interface: DockingPathModel
Gets an iterator that iterates over the IDs of all the docking paths of the model.

Specified by:
getIDs in interface DockingPathModel
Returns:
An iterator that iterates over the IDs of the docking paths. The entries of the iterator are java.lang.String objects.

getDockingPath

public DockingPath getDockingPath(java.lang.String id)
Description copied from interface: DockingPathModel
Gets the docking path of this model that has the given id as ID.

Specified by:
getDockingPath in interface DockingPathModel
Parameters:
id - The ID of the docking path that is retrieved.
Returns:
The docking path of this model that has the given id as ID. If there is no docking path for this id, null is returned.

remove

public void remove(DockingPath dockingPath)
Description copied from interface: DockingPathModel
Removes the given docking path from the model.

Specified by:
remove in interface DockingPathModel
Parameters:
dockingPath - The docking path that is removed from the model.

loadProperties

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

Loads the properties for this docking path 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 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 model. Don't call this method for a docking path model that already has a content.

Specified by:
loadProperties in interface DockingPathModel
Parameters:
prefix - The prefix for the property names that have been intended for this docking path model.
properties - The properties object that contains the properties for this docking path model. 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).

saveProperties

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

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

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

Specified by:
saveProperties in interface DockingPathModel
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).