bibliothek.gui.dock.frontend
Interface LayoutChangeStrategy

All Known Implementing Classes:
CLayoutChangeStrategy, DefaultLayoutChangeStrategy

public interface LayoutChangeStrategy

Used by a DockFrontend to read layout information and apply new positions for Dockables.
While this interface (like any other interface in this framework) can be implemented by clients, they are not supposed to do so.

Author:
Benjamin Sigg

Method Summary
 DockFrontendPerspective createPerspective(DockFrontendInternals frontend, boolean entry, FrontendPerspectiveCache cache)
          Creates a Perspective that is used to read and write perspectives related to frontend.
 DockSituation createSituation(DockFrontendInternals frontend, boolean entry)
          Creates a new DockSituation that is used to write and read the current setting from and to a stream.
Note: the result of this method is used to read and write data from a file, the frontend expects that always the same format (i.e.
 PropertyTransformer createTransformer(DockFrontendInternals frontend)
          Creates a converter for reading and writing DockablePropertys.
 void estimateLocations(DockFrontendInternals frontend, DockSituation situation, DockLayoutComposition layout)
          Tries to fill the property location for each element in layout.
 PlaceholderStrategy getPlaceholderStrategy(DockFrontendInternals frontend)
          Gets the default PlaceholderStrategy which should be used to filter placeholders by frontend.
 boolean setLayout(DockFrontendInternals frontend, Setting setting, boolean entry)
          Changes the layout of frontend by reading and applying setting.
 boolean shouldUpdateLayoutOnAdd(Dockable dockable)
          Called when dockable is added to a DockFrontend, and the frontend already knows the layout which should be used for dockable.
 

Method Detail

setLayout

boolean setLayout(DockFrontendInternals frontend,
                  Setting setting,
                  boolean entry)
                  throws IOException,
                         XException
Changes the layout of frontend by reading and applying setting. The DockRegister is stalled while this method runs.
This method should use the VetoManager provided by frontend to ensure that all operations are legal.

Parameters:
frontend - internal information about a DockFrontend
setting - the layout to read and apply
entry - true if setting contains only little information about the layout, false if there is much information abut the layout.
Returns:
true if the layout has been applied, false if the operation was canceled due of any reason
Throws:
IOException - in case of some stream that cannot be read
XException - in case of some XElement that cannot be read
See Also:
shouldUpdateLayoutOnAdd(Dockable)

createSituation

DockSituation createSituation(DockFrontendInternals frontend,
                              boolean entry)
Creates a new DockSituation that is used to write and read the current setting from and to a stream.
Note: the result of this method is used to read and write data from a file, the frontend expects that always the same format (i.e. the same kind of DockSituation) is used.

Parameters:
frontend - the frontend for which the situation is required
entry - true if the situation is used for a regular setting, false if the situation is used as the final setting which will be loaded the next time the application starts.
Returns:
the situation

createPerspective

DockFrontendPerspective createPerspective(DockFrontendInternals frontend,
                                          boolean entry,
                                          FrontendPerspectiveCache cache)
Creates a Perspective that is used to read and write perspectives related to frontend.

Parameters:
frontend - the frontend for which the situation is required
entry - true if the situation is used for a regular setting, false if the situation is used as the final setting which will be loaded the next time the application starts.
cache - a cache that takes DockElements and returns the matching PerspectiveElement. The cache also offers methods to convert ids and PerspectiveElements directly
Returns:
the new perspective

createTransformer

PropertyTransformer createTransformer(DockFrontendInternals frontend)
Creates a converter for reading and writing DockablePropertys.

Parameters:
frontend - the frontend for which the converter is required
Returns:
the new converter

estimateLocations

void estimateLocations(DockFrontendInternals frontend,
                       DockSituation situation,
                       DockLayoutComposition layout)
Tries to fill the property location for each element in layout.

Parameters:
frontend - the frontend which calls this method
situation - the situation to use for transforming information
layout - the layout to estimate

getPlaceholderStrategy

PlaceholderStrategy getPlaceholderStrategy(DockFrontendInternals frontend)
Gets the default PlaceholderStrategy which should be used to filter placeholders by frontend.

Parameters:
frontend - information about the DockFrontend that needs the strategy
Returns:
the strategy, can be null

shouldUpdateLayoutOnAdd

boolean shouldUpdateLayoutOnAdd(Dockable dockable)
Called when dockable is added to a DockFrontend, and the frontend already knows the layout which should be used for dockable. If the result is true, then all children of dockable are removed, and reloaded to apply the layout that is stored in the frontend.
Subclasses may return false if setLayout(DockFrontendInternals, Setting, boolean) is currently executed, preventing concurrent modifications of the dock-tree.

Parameters:
dockable - the dockable that is added to a DockFrontend
Returns:
true if the layout of dockable should be updated.