@FrameworkOnly public class CLayoutChangeStrategy extends DefaultLayoutChangeStrategy
MultipleCDockableFactory.match(bibliothek.gui.dock.common.MultipleCDockable, bibliothek.gui.dock.common.MultipleCDockableLayout)
and that fires CVetoClosingEvent
s for MultipleCDockable
s as well.Modifier and Type | Class and Description |
---|---|
protected class |
CLayoutChangeStrategy.CSettingAccess
A
DefaultLayoutChangeStrategy.SettingAccess that modifies the roots by calling
replaceMultipleDockables(DockFrontendInternals, CSettingAccess, DockLayoutComposition) . |
DefaultLayoutChangeStrategy.SettingAccess
Constructor and Description |
---|
CLayoutChangeStrategy(CControl control)
Creates a new strategy.
|
Modifier and Type | Method and Description |
---|---|
protected DefaultLayoutChangeStrategy.SettingAccess |
createAccess(DockFrontendInternals frontend,
Setting setting)
Creates a wrapper around
setting that allows the algorithm of this
LayoutChangeStrategy to access the setting. |
protected PredefinedDockSituation |
createSituation(DockFrontendInternals frontend,
boolean entry,
boolean onSetLayout)
Creates a
DockSituation which represents all the knowledge
frontend currently has. |
protected java.util.Set<Dockable> |
estimateVisible(DockFrontendInternals frontend,
DockSituation situation,
DockLayoutComposition layout)
Tries to estimate which of the currently visible
Dockable s will
still be visible if layout is applied to frontend . |
protected java.util.Collection<Dockable> |
getClosingDockables(DockFrontendInternals frontend,
java.util.Set<Dockable> visible)
Creates a collection of all the
Dockable s that are about to be closed. |
protected DockLayoutComposition |
replaceMultipleDockables(DockFrontendInternals frontend,
CLayoutChangeStrategy.CSettingAccess setting,
DockLayoutComposition composition)
Checks the
DockLayout that is associated with composition and may replace
the layout by another layout if a MultipleCDockableFactory finds a match between an existing
item and meta-data about an item. |
protected boolean |
shouldPredefine(Dockable dockable)
Tells whether the element
dockable should be added as predefined element to the PredefinedDockSituation
that is created by DefaultLayoutChangeStrategy.createSituation(DockFrontendInternals, boolean, boolean) . |
applyInvisibleLayout, applyLayout, approveClosing, createPerspective, createSituation, createTransformer, estimateLocations, getPlaceholderStrategy, listEstimateLocations, listLayouts, setLayout, shouldUpdateLayoutOnAdd
public CLayoutChangeStrategy(CControl control)
control
- the control in whose realm this strategy will be usedprotected PredefinedDockSituation createSituation(DockFrontendInternals frontend, boolean entry, boolean onSetLayout)
DefaultLayoutChangeStrategy
DockSituation
which represents all the knowledge
frontend
currently has.createSituation
in class DefaultLayoutChangeStrategy
frontend
- the frontend for which the situation is requiredentry
- 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.onSetLayout
- whether this method is called by DefaultLayoutChangeStrategy.setLayout(DockFrontendInternals, Setting, boolean)
or not. If
true
then the situation is used to apply some layout, otherwise it is used to store or read a layoutPredefinedDockSituation
, subclasses
may override and return other situations.protected boolean shouldPredefine(Dockable dockable)
DefaultLayoutChangeStrategy
dockable
should be added as predefined element to the PredefinedDockSituation
that is created by DefaultLayoutChangeStrategy.createSituation(DockFrontendInternals, boolean, boolean)
.shouldPredefine
in class DefaultLayoutChangeStrategy
dockable
- the element which may need to be predefinedtrue
if dockable
is to be predefinedprotected java.util.Set<Dockable> estimateVisible(DockFrontendInternals frontend, DockSituation situation, DockLayoutComposition layout)
DefaultLayoutChangeStrategy
Dockable
s will
still be visible if layout
is applied to frontend
. The
default implementation assumes that situation
is a PredefinedDockSituation
.estimateVisible
in class DefaultLayoutChangeStrategy
frontend
- the caller of this methodsituation
- algorithm used to convert layout
layout
- the layout that will be appliednull
protected java.util.Collection<Dockable> getClosingDockables(DockFrontendInternals frontend, java.util.Set<Dockable> visible)
DefaultLayoutChangeStrategy
Dockable
s that are about to be closed. Subclasses
may override this method, they should at least check all the Dockable
s that are
registered at frontend
. Subclasses may need to override
estimateVisible
as
well to get the correct set of visible
elements.getClosingDockables
in class DefaultLayoutChangeStrategy
frontend
- the caller of this methodvisible
- the elements that remain visible as told by DefaultLayoutChangeStrategy.estimateVisible(DockFrontendInternals, DockSituation, DockLayoutComposition)
.null
, may be emptyprotected DockLayoutComposition replaceMultipleDockables(DockFrontendInternals frontend, CLayoutChangeStrategy.CSettingAccess setting, DockLayoutComposition composition)
DockLayout
that is associated with composition
and may replace
the layout by another layout if a MultipleCDockableFactory
finds a match between an existing
item and meta-data about an item.frontend
- the caller of this methodsetting
- the layout that is about to be appliedcomposition
- the composition to modify, may be null
null
protected DefaultLayoutChangeStrategy.SettingAccess createAccess(DockFrontendInternals frontend, Setting setting)
DefaultLayoutChangeStrategy
setting
that allows the algorithm of this
LayoutChangeStrategy
to access the setting.createAccess
in class DefaultLayoutChangeStrategy
frontend
- the caller of this methodsetting
- the setting to hide