Package bibliothek.gui.dock.common
Class EmptyMultipleCDockableFactory<F extends MultipleCDockable>
java.lang.Object
bibliothek.gui.dock.common.EmptyMultipleCDockableFactory<F>
- Type Parameters:
F- the type of dockable this factory handles.
- All Implemented Interfaces:
MultipleCDockableFactory<F,MultipleCDockableLayout>
- Direct Known Subclasses:
NullMultipleCDockableFactory
public abstract class EmptyMultipleCDockableFactory<F extends MultipleCDockable>
extends Object
implements MultipleCDockableFactory<F,MultipleCDockableLayout>
A factory that does not store anything.
- Author:
- Benjamin Sigg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates a new, empty layout.abstract FCreates a new instance of theMultipleCDockablethat is represented by this factory.booleanmatch(F dockable, MultipleCDockableLayout layout) Tells whether the meta-datalayoutbelongs todockable, meaningwrite( dockable )would producelayoutandread( layout )would producedockable.
This method is used to create a pairing of dockables and meta-data.read(MultipleCDockableLayout layout) Creates aMultipleCDockablethat gets its layout fromlayout.Collects all the properties ofdockableand writes them into a newMultipleCDockableLayout.
-
Constructor Details
-
EmptyMultipleCDockableFactory
public EmptyMultipleCDockableFactory()
-
-
Method Details
-
createDockable
Creates a new instance of theMultipleCDockablethat is represented by this factory.- Returns:
- the new dockable, might be
null
-
create
Description copied from interface:MultipleCDockableFactoryCreates a new, empty layout. The contents of the layout will be set using one of theread-methods ofMultipleCDockableLayout.- Specified by:
createin interfaceMultipleCDockableFactory<F extends MultipleCDockable,MultipleCDockableLayout> - Returns:
- the new empty layout
-
read
Description copied from interface:MultipleCDockableFactoryCreates aMultipleCDockablethat gets its layout fromlayout.- Specified by:
readin interfaceMultipleCDockableFactory<F extends MultipleCDockable,MultipleCDockableLayout> - Parameters:
layout- the set of properties that can be used to create the newCDockable.- Returns:
- the new dockable or
nullif the layout can't be read
-
write
Description copied from interface:MultipleCDockableFactoryCollects all the properties ofdockableand writes them into a newMultipleCDockableLayout.- Specified by:
writein interfaceMultipleCDockableFactory<F extends MultipleCDockable,MultipleCDockableLayout> - Parameters:
dockable- the element whose properties should be collected- Returns:
- the layout that has been written
-
match
Description copied from interface:MultipleCDockableFactoryTells whether the meta-datalayoutbelongs todockable, meaningwrite( dockable )would producelayoutandread( layout )would producedockable.
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: assumedockableis shown or known to the view andlayouthas 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 theCVetoClosingListenerfor dockables that just get replaced by a "clone".- Specified by:
matchin interfaceMultipleCDockableFactory<F extends MultipleCDockable,MultipleCDockableLayout> - Parameters:
dockable- some element that is shown or known to the viewlayout- some layout that will be applied- Returns:
trueifdockablewould be produced byread(layout).
-