bibliothek.gui.dock
Interface DockFactory<D extends DockElement,P extends PerspectiveElement,L>

Type Parameters:
D - the type of element which can be written and read by this factory
P - the type of PerspectiveElement which can be written and read by this factory
L - the type of object that stores the contents of a D. If clients cannot guarantee that always the same factory will be mapped to the same identifier, then L should be set to Object and the methods which receive a L should use instanceof before casting the argument.
All Superinterfaces:
DockConverter<D,P,L>
All Known Implementing Classes:
CommonDockStationFactory, CommonMultipleDockableFactory, CommonSingleDockableFactory, DefaultDockableFactory, FlapDockStationFactory, RegisteringDockFactory, ReplacementDockFactory, ScreenDockStationFactory, SplitDockStationFactory, StackDockStationFactory

public interface DockFactory<D extends DockElement,P extends PerspectiveElement,L>
extends DockConverter<D,P,L>

A DockConverter which can not only store and load the contents of an element, but also create a new DockElement with the content.

Author:
Benjamin Sigg

Method Summary
 void estimateLocations(L layout, LocationEstimationMap children)
          Tries to estimate the DockablePropertys of the children of the station which is represented by layout.
The children of this station are accessible through children.getChild( ...
 D layout(L layout, Map<Integer,Dockable> children, PlaceholderStrategy placeholders)
          Creates a new DockElement and changes the layout of the new element such that is matches layout.
 D layout(L layout, PlaceholderStrategy placeholders)
          Creates a new DockElement and changes the layout of the new element such that is matches layout.
 P layoutPerspective(L layout, Map<Integer,PerspectiveDockable> children)
          Creates an element that can be used by a Perspective to create a layout without creating any DockElements.
 void layoutPerspective(P perspective, L layout, Map<Integer,PerspectiveDockable> children)
          Updates the contents of perspective such that it reflects the contents of layout.
 
Methods inherited from interface bibliothek.gui.dock.layout.DockConverter
getID, getLayout, getPerspectiveLayout, read, read, setLayout, setLayout, write, write
 

Method Detail

estimateLocations

void estimateLocations(L layout,
                       LocationEstimationMap children)
Tries to estimate the DockablePropertys of the children of the station which is represented by layout.
The children of this station are accessible through children.getChild( ... ), this factory may also access the leafs in the tree of Dockables through children.getSubChild(...).
Note: this method must not set the successor of any DockableProperty, it is the callers responsibility to handle chains of stations.

Parameters:
layout - this station
children - the children of the station, this method should call DockLayoutInfo.setLocation(DockableProperty) or LocationEstimationMap.setLocation(int, DockableProperty) and LocationEstimationMap.setLocation(int, int, DockableProperty) for as many children as possible

layout

D layout(L layout,
         Map<Integer,Dockable> children,
         PlaceholderStrategy placeholders)
Creates a new DockElement and changes the layout of the new element such that is matches layout.

Parameters:
layout - the new layout
placeholders - a strategy to detect invalid placeholders, can be null. Factories loading only Dockables but no DockStations can safely ignore this argument.
children - some children, note that the map may not contain all elements which were present when the layout was created.
Returns:
a new element or null if layout can't be used

layout

D layout(L layout,
         PlaceholderStrategy placeholders)
Creates a new DockElement and changes the layout of the new element such that is matches layout. This method should not add any children to the element.

Parameters:
layout - the new layout
placeholders - a strategy to detect invalid placeholders, can be null. Factories loading only Dockables but no DockStations can safely ignore this argument.
Returns:
a new element or null if layout can't be used

layoutPerspective

P layoutPerspective(L layout,
                    Map<Integer,PerspectiveDockable> children)
Creates an element that can be used by a Perspective to create a layout without creating any DockElements. This method may return null only if the client is guaranteed not to use a Perspective.

Parameters:
layout - the new layout
children - some children, note that the map may not contain all elements which were present when the layout was created. Is null if the children of this station are going to be ignored.
Returns:
the new element, can be null, the return value of PerspectiveElement.getFactoryID() should be equal to DockConverter.getID()

layoutPerspective

void layoutPerspective(P perspective,
                       L layout,
                       Map<Integer,PerspectiveDockable> children)
Updates the contents of perspective such that it reflects the contents of layout.

Parameters:
perspective - the perspective that is to be updated
layout - the layout to apply
children - the new children of perspective, is null if the children of this station are going to be ignored.