com.javadocking.dock.factory
Class SplitDockFactory

java.lang.Object
  extended by com.javadocking.dock.factory.SplitDockFactory
All Implemented Interfaces:
CompositeDockFactory, DockFactory

public class SplitDockFactory
extends java.lang.Object
implements CompositeDockFactory

This dock factory creates always a split dock. Only when the dockable cannot be added to a split dock it delegates the creation of the dock to the alternative dock factory.

Author:
Heidi Rakels

Constructor Summary
SplitDockFactory()
           
 
Method Summary
 Dock createDock(Dockable dockable, int dockingMode)
          Creates a dock for the given dockable.
 DockFactory getAlternativeDockFactory()
          Gets the alternative dock factory.
 DockFactory getChildDockFactory()
          Gets the leaf child dock factory.
 java.awt.Dimension getDockPreferredSize(Dockable dockable, int dockingMode)
          Gets the preferred size for the dock that will be created by this factory.
 void loadProperties(java.lang.String prefix, java.util.Properties properties)
          Sets the properties for this dock factory.
 void saveProperties(java.lang.String prefix, java.util.Properties properties)
          Saves the properties of this dock factory in the given properties object.
 void setAlternativeDockFactory(DockFactory alternativeDockFactory)
          Sets the alternative dock factory.
 void setChildDockFactory(DockFactory leafChildDockFactory)
          Sets the leaf child dock factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SplitDockFactory

public SplitDockFactory()
Method Detail

createDock

public Dock createDock(Dockable dockable,
                       int dockingMode)
Description copied from interface: DockFactory
Creates a dock for the given dockable.

Specified by:
createDock in interface DockFactory
Parameters:
dockable - The dockable for which the dock is created.
dockingMode - The docking mode that is used for docking the dockable. This integer should be a constant defined by DockingMode.
Returns:
A dock for the given dockable.

getDockPreferredSize

public java.awt.Dimension getDockPreferredSize(Dockable dockable,
                                               int dockingMode)
Description copied from interface: DockFactory
Gets the preferred size for the dock that will be created by this factory.

Specified by:
getDockPreferredSize in interface DockFactory
Parameters:
dockable - The dockable for which the dock is created.
dockingMode - The docking mode that is used for docking the dockable. This integer should be a constant defined by DockingMode.
Returns:
A dock for the given dockable.

saveProperties

public void saveProperties(java.lang.String prefix,
                           java.util.Properties properties)
Description copied from interface: DockFactory
Saves the properties of this dock factory in the given properties object. The property names for this dock factory should start with the given prefix.

Specified by:
saveProperties in interface DockFactory
Parameters:
prefix - The prefix for the property names.
properties - The properties object to which the properties should be added.

loadProperties

public void loadProperties(java.lang.String prefix,
                           java.util.Properties properties)
Description copied from interface: DockFactory
Sets the properties for this dock factory. The properties can be found in the given properties object and the property names for this dock factory start with the given prefix.

Specified by:
loadProperties in interface DockFactory
Parameters:
prefix - The prefix of the names of the properties that have been intended for this dock factory.
properties - The properties object that contains the properties for this dock factory. It can contain also properties for other objects, but they will have another prefix.

getAlternativeDockFactory

public DockFactory getAlternativeDockFactory()
Gets the alternative dock factory. When the dockable cannot be added to a split dock, the creation of the dock is delegated to this alternative dock factory.

Returns:
The alternative dock factory.

setAlternativeDockFactory

public void setAlternativeDockFactory(DockFactory alternativeDockFactory)
Sets the alternative dock factory. When the dockable cannot be added to a split dock, the creation of the dock is delegated to this alternative dock factory.

Parameters:
alternativeDockFactory - The alternative dock factory. Should not be null.
Throws:
java.lang.IllegalArgumentException - When the alternative dock factory is null.

getChildDockFactory

public DockFactory getChildDockFactory()
Gets the leaf child dock factory. This is the factory that is used in the constructor of the SplitDock.SplitDock(DockFactory, CompositeDockFactory) for creating the leaf docks of the split dock.

Specified by:
getChildDockFactory in interface CompositeDockFactory
Returns:
The leaf child dock factory.

setChildDockFactory

public void setChildDockFactory(DockFactory leafChildDockFactory)
Sets the leaf child dock factory. This is the factory that is used in the constructor of the SplitDock.SplitDock(DockFactory, CompositeDockFactory) for creating the leaf docks of the split dock.

Specified by:
setChildDockFactory in interface CompositeDockFactory
Parameters:
leafChildDockFactory - The leaf child dock factory. Should not be null.
Throws:
java.lang.IllegalArgumentException - When the alternative dock factory is null.