|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.frontend.DefaultLayoutChangeStrategy
public class DefaultLayoutChangeStrategy
This default implementation of a LayoutChangeStrategy
heavily depends on the methods of PredefinedDockSituation
. It
also offers a set of methods that may be interesting for subclasses which do not use a PredefinedDockSituation
.
Nested Class Summary | |
---|---|
protected class |
DefaultLayoutChangeStrategy.SettingAccess
A wrapper around a Setting , allows algorithms access to the settings
but also allows to modify the data without changing the setting. |
Constructor Summary | |
---|---|
DefaultLayoutChangeStrategy()
|
Method Summary | |
---|---|
protected void |
applyInvisibleLayout(DockFrontendInternals frontend,
DockSituation situation,
DefaultLayoutChangeStrategy.SettingAccess setting)
Applies setting to the invisible elements. |
protected void |
applyLayout(DockFrontendInternals frontend,
DockSituation situation,
DefaultLayoutChangeStrategy.SettingAccess setting,
boolean entry)
Applies the layout described in setting to the visible elements. |
protected Collection<Dockable> |
approveClosing(DockFrontendInternals frontend,
DockSituation situation,
DefaultLayoutChangeStrategy.SettingAccess setting)
Asks the VetoManager whether some Dockable s can be hidden. |
protected DefaultLayoutChangeStrategy.SettingAccess |
createAccess(DockFrontendInternals frontend,
Setting setting)
Creates a wrapper around setting that allows the algorithm of this
LayoutChangeStrategy to access the setting. |
DockFrontendPerspective |
createPerspective(DockFrontendInternals frontend,
boolean entry,
FrontendPerspectiveCache cache)
Creates a Perspective that is used to read and write perspectives related to frontend . |
PredefinedDockSituation |
createSituation(DockFrontendInternals frontend,
boolean entry)
Forwards to createSituation(DockFrontendInternals, boolean, boolean) with the
last argument set to false . |
protected PredefinedDockSituation |
createSituation(DockFrontendInternals frontend,
boolean entry,
boolean onSetLayout)
Creates a DockSituation which represents all the knowledge
frontend currently has. |
PropertyTransformer |
createTransformer(DockFrontendInternals frontend)
Creates a converter for reading and writing DockableProperty s. |
void |
estimateLocations(DockFrontendInternals frontend,
DockSituation situation,
DockLayoutComposition layout)
Tries to fill the property location
for each element in layout . |
protected 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 Collection<Dockable> |
getClosingDockables(DockFrontendInternals frontend,
Set<Dockable> visible)
Creates a collection of all the Dockable s that are about to be closed. |
PlaceholderStrategy |
getPlaceholderStrategy(DockFrontendInternals frontend)
Gets the default PlaceholderStrategy which should be used to filter placeholders by frontend . |
protected Map<String,DockableProperty> |
listEstimateLocations(DockSituation situation,
DockLayoutComposition layout)
Tries to estimate the location of missing Dockable s. |
protected Map<String,DockLayoutComposition> |
listLayouts(DockSituation situation,
DockLayoutComposition layout)
Tries to estimate the layouts of missing Dockable s. |
boolean |
setLayout(DockFrontendInternals frontend,
Setting setting,
boolean entry)
Changes the layout of frontend by reading and applying setting . |
protected boolean |
shouldPredefine(Dockable dockable)
Tells whether the element dockable should be added as predefined element to the PredefinedDockSituation
that is created by createSituation(DockFrontendInternals, boolean, boolean) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultLayoutChangeStrategy()
Method Detail |
---|
public boolean setLayout(DockFrontendInternals frontend, Setting setting, boolean entry) throws IOException, XException
LayoutChangeStrategy
frontend
by reading and applying setting
.
The DockRegister
is stalled
while this method runs.VetoManager
provided by frontend
to ensure
that all operations are legal.
setLayout
in interface LayoutChangeStrategy
frontend
- internal information about a DockFrontend
setting
- the layout to read and applyentry
- true
if setting
contains only little information about
the layout, false
if there is much information abut the layout.
true
if the layout has been applied, false
if
the operation was canceled due of any reason
IOException
- in case of some stream that cannot be read
XException
- in case of some XElement
that cannot be readprotected DefaultLayoutChangeStrategy.SettingAccess createAccess(DockFrontendInternals frontend, Setting setting)
setting
that allows the algorithm of this
LayoutChangeStrategy
to access the setting.
frontend
- the caller of this methodsetting
- the setting to hide
public PredefinedDockSituation createSituation(DockFrontendInternals frontend, boolean entry)
createSituation(DockFrontendInternals, boolean, boolean)
with the
last argument set to false
.
createSituation
in interface LayoutChangeStrategy
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.
protected PredefinedDockSituation createSituation(DockFrontendInternals frontend, boolean entry, boolean onSetLayout)
DockSituation
which represents all the knowledge
frontend
currently has.
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 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 layout
PredefinedDockSituation
, subclasses
may override and return other situations.protected boolean shouldPredefine(Dockable dockable)
dockable
should be added as predefined element to the PredefinedDockSituation
that is created by createSituation(DockFrontendInternals, boolean, boolean)
.
dockable
- the element which may need to be predefined
true
if dockable
is to be predefinedpublic DockFrontendPerspective createPerspective(DockFrontendInternals frontend, boolean entry, FrontendPerspectiveCache cache)
LayoutChangeStrategy
Perspective
that is used to read and write perspectives related to frontend
.
createPerspective
in interface LayoutChangeStrategy
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.cache
- a cache that takes DockElement
s and returns the matching PerspectiveElement
. The cache
also offers methods to convert ids and PerspectiveElement
s directly
public PropertyTransformer createTransformer(DockFrontendInternals frontend)
LayoutChangeStrategy
DockableProperty
s.
createTransformer
in interface LayoutChangeStrategy
frontend
- the frontend for which the converter is required
protected void applyLayout(DockFrontendInternals frontend, DockSituation situation, DefaultLayoutChangeStrategy.SettingAccess setting, boolean entry) throws IOException, XException
setting
to the visible elements.
This implementation tries to estimate the location of missing dockables using
listEstimateLocations(DockSituation, DockLayoutComposition)
.
frontend
- the caller of this methodsituation
- used to convert the layoutsetting
- the new layoutentry
- whether the layout is a full or regular layout
IOException
- if the layout cannot be converted
XException
- if the layout cannot be convertedprotected void applyInvisibleLayout(DockFrontendInternals frontend, DockSituation situation, DefaultLayoutChangeStrategy.SettingAccess setting) throws IOException, XException
setting
to the invisible elements.
frontend
- the caller of this methodsituation
- to convert the layoutsetting
- the new layout
IOException
- if the layout cannot be converted
XException
- if the layout cannot be convertedprotected Map<String,DockLayoutComposition> listLayouts(DockSituation situation, DockLayoutComposition layout)
Dockable
s. The
default implementation works with any PredefinedDockSituation
.
situation
- the situation to use for transforming informationlayout
- the layout to analyze
Dockable
-names as key or null
protected Map<String,DockableProperty> listEstimateLocations(DockSituation situation, DockLayoutComposition layout)
Dockable
s. The
default implementation works with any PredefinedDockSituation
.
situation
- the situation to use for transforming informationlayout
- the layout to analyze
Dockable
-names as key or null
public void estimateLocations(DockFrontendInternals frontend, DockSituation situation, DockLayoutComposition layout)
LayoutChangeStrategy
location
for each element in layout
.
estimateLocations
in interface LayoutChangeStrategy
frontend
- the frontend which calls this methodsituation
- the situation to use for transforming informationlayout
- the layout to estimateprotected Collection<Dockable> approveClosing(DockFrontendInternals frontend, DockSituation situation, DefaultLayoutChangeStrategy.SettingAccess setting)
VetoManager
whether some Dockable
s can be hidden. Only Dockable
s that
are returned by DockFrontendInternals.getDockables()
are checked by this method.
frontend
- the caller of this methodsituation
- the situation that will convert the layoutsetting
- the new layout
null
if the operation should be canceledprotected Collection<Dockable> getClosingDockables(DockFrontendInternals frontend, Set<Dockable> visible)
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.
frontend
- the caller of this methodvisible
- the elements that remain visible as told by estimateVisible(DockFrontendInternals, DockSituation, DockLayoutComposition)
.
null
, may be emptyprotected Set<Dockable> estimateVisible(DockFrontendInternals frontend, DockSituation situation, DockLayoutComposition layout)
Dockable
s will
still be visible if layout
is applied to frontend
. The
default implementation assumes that situation
is a PredefinedDockSituation
.
frontend
- the caller of this methodsituation
- algorithm used to convert layout
layout
- the layout that will be applied
null
public PlaceholderStrategy getPlaceholderStrategy(DockFrontendInternals frontend)
LayoutChangeStrategy
PlaceholderStrategy
which should be used to filter placeholders by frontend
.
getPlaceholderStrategy
in interface LayoutChangeStrategy
frontend
- information about the DockFrontend
that needs the strategy
null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |