com.javadocking.model.codec
Class DockModelPropertiesDecoder

java.lang.Object
  extended by com.javadocking.model.codec.DockModelPropertiesDecoder
All Implemented Interfaces:
DockModelDecoder

public class DockModelPropertiesDecoder
extends java.lang.Object
implements DockModelDecoder

This class reads the .dck file generated by the DockModelPropertiesEncoder, into a java.util.Properties object. After that, it decodes this properties object into a DockModel and DockingPathModel.

Author:
Heidi Rakels.

Constructor Summary
DockModelPropertiesDecoder()
           
 
Method Summary
 boolean canDecodeSource(java.lang.String sourceName)
          Checks whether this decoder can decode the given data into a dock model.
 DockModel decode(java.lang.String sourceName, java.util.Map dockablesMap, java.util.Map ownersMap, java.util.Map visualizersMap)
          Creates a new dock model from the data found in the given data source, and adds the given dockables to the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockModelPropertiesDecoder

public DockModelPropertiesDecoder()
Method Detail

canDecodeSource

public boolean canDecodeSource(java.lang.String sourceName)
Description copied from interface: DockModelDecoder
Checks whether this decoder can decode the given data into a dock model. Often this will only be a simple test, e.g. checking the file extension of a file.

Specified by:
canDecodeSource in interface DockModelDecoder
Parameters:
sourceName - The name of a data source; typically a file name or a URL.

decode

public DockModel decode(java.lang.String sourceName,
                        java.util.Map dockablesMap,
                        java.util.Map ownersMap,
                        java.util.Map visualizersMap)
                 throws java.io.IOException
Description copied from interface: DockModelDecoder
Creates a new dock model from the data found in the given data source, and adds the given dockables to the model. The decoded dock model is given to the docking manager (DockingManager.setDockModel(DockModel)).

Specified by:
decode in interface DockModelDecoder
Parameters:
sourceName - The name of a data source; typically a file name or a URL.
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).
visualizersMap - A map with the visualizers.
  • map key: the key of the visualizer (java.lang.String).
  • map value: the visualizer (java.awt.window).
Returns:
The dock model with the decoded docks and the given dockables.
Throws:
java.io.IOException - If an error occurs while retrieving the source, reading the source or decoding the data.