bibliothek.gui.dock.common
Class EmptyMultipleCDockableFactory<F extends MultipleCDockable>

java.lang.Object
  extended by bibliothek.gui.dock.common.EmptyMultipleCDockableFactory<F>
Type Parameters:
F - the type of dockable this factory handles.
All Implemented Interfaces:
MultipleCDockableFactory<F,MultipleCDockableLayout>

public abstract class EmptyMultipleCDockableFactory<F extends MultipleCDockable>
extends java.lang.Object
implements MultipleCDockableFactory<F,MultipleCDockableLayout>

A factory that does not store anything.

Author:
Benjamin Sigg

Constructor Summary
EmptyMultipleCDockableFactory()
           
 
Method Summary
 MultipleCDockableLayout create()
          Creates a new, empty layout.
abstract  F createDockable()
          Creates a new instance of the MultipleCDockable that is represented by this factory.
 boolean match(F dockable, MultipleCDockableLayout layout)
          Tells whether the meta-data layout belongs to dockable, meaning write( dockable ) would produce layout and read( layout ) would produce dockable.
 F read(MultipleCDockableLayout layout)
          Creates a MultipleCDockable that gets its layout from layout.
 MultipleCDockableLayout write(F dockable)
          Collects all the properties of dockable and writes them into a new MultipleCDockableLayout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyMultipleCDockableFactory

public EmptyMultipleCDockableFactory()
Method Detail

createDockable

public abstract F createDockable()
Creates a new instance of the MultipleCDockable that is represented by this factory.

Returns:
the new dockable, might be null

create

public MultipleCDockableLayout create()
Description copied from interface: MultipleCDockableFactory
Creates a new, empty layout. The contents of the layout will be set using one of the read-methods of MultipleCDockableLayout.

Specified by:
create in interface MultipleCDockableFactory<F extends MultipleCDockable,MultipleCDockableLayout>
Returns:
the new empty layout

read

public F read(MultipleCDockableLayout layout)
Description copied from interface: MultipleCDockableFactory
Creates a MultipleCDockable that gets its layout from layout.

Specified by:
read in interface MultipleCDockableFactory<F extends MultipleCDockable,MultipleCDockableLayout>
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

write

public MultipleCDockableLayout write(F dockable)
Description copied from interface: MultipleCDockableFactory
Collects all the properties of dockable and writes them into a new MultipleCDockableLayout.

Specified by:
write in interface MultipleCDockableFactory<F extends MultipleCDockable,MultipleCDockableLayout>
Parameters:
dockable - the element whose properties should be collected
Returns:
the layout that has been written

match

public boolean match(F dockable,
                     MultipleCDockableLayout layout)
Description copied from interface: MultipleCDockableFactory
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".

Specified by:
match in interface MultipleCDockableFactory<F extends MultipleCDockable,MultipleCDockableLayout>
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).