bibliothek.gui.dock.common
Interface MultipleCDockableFactory<F extends MultipleCDockable,L extends MultipleCDockableLayout>

Type Parameters:
F - the kind of dockable that is managed by this factory
L - the kind of meta-data this factory reads and writes about F
All Known Implementing Classes:
EmptyMultipleCDockableFactory, NullMultipleCDockableFactory

public interface MultipleCDockableFactory<F extends MultipleCDockable,L extends MultipleCDockableLayout>

A factory that can create and store MultipleCDockables. This factory converts a MultipleCDockable in a MultipleCDockableLayout and then writes the layout in various forms (like xml).

Author:
Benjamin Sigg

Method Summary
 L create()
          Creates a new, empty layout.
 boolean match(F dockable, L layout)
          Tells whether the meta-data layout belongs to dockable, meaning write( dockable ) would produce layout and read( layout ) would produce dockable.
This method is used to create a pairing of dockables and meta-data.
 F read(L layout)
          Creates a MultipleCDockable that gets its layout from layout.
 L write(F dockable)
          Collects all the properties of dockable and writes them into a new MultipleCDockableLayout.
 

Method Detail

write

L write(F dockable)
Collects all the properties of dockable and writes them into a new MultipleCDockableLayout.

Parameters:
dockable - the element whose properties should be collected
Returns:
the layout that has been written

read

F read(L layout)
Creates a MultipleCDockable that gets its layout from layout.

Parameters:
layout - the set of properties that can be used to create the new CDockable.
Returns:
the new dockable or null if the layout can't be read

match

boolean match(F dockable,
              L layout)
Tells whether the meta-data layout belongs to dockable, meaning write( dockable ) would produce layout and read( layout ) would produce dockable.
This method is used to create a pairing of dockables and meta-data. Dockables without partner are most likely deleted. If a dockable or some meta-data has more than one potential partner, then one pair is randomly chosen.
This method is primarily used for optimization: assume dockable is shown or known to the view and layout has been read from a file. Normally all dockables produced by this factory would be removed and replaced by newly created dockables. If however this method finds a match between a layout and a dockable, then the dockable can be reused.
The second goal of this method is to help prevent unnecessary events to the CVetoClosingListener for dockables that just get replaced by a "clone".

Parameters:
dockable - some element that is shown or known to the view
layout - some layout that will be applied
Returns:
true if dockable would be produced by read(layout).

create

L create()
Creates a new, empty layout. The contents of the layout will be set using one of the read-methods of MultipleCDockableLayout.

Returns:
the new empty layout