|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.layout.DockSituation bibliothek.gui.dock.layout.PredefinedDockSituation
public class PredefinedDockSituation
A DockSituation
that does not load or store all DockElements
.
All elements which are registered by put(DockElement)
are stored in an
internal list. On writing, just a unique id is written to the stream.
A DockFactory
is still necessary for these elements, but the factory may
just do nothing.
Constructor Summary | |
---|---|
PredefinedDockSituation()
|
Method Summary | ||
---|---|---|
void |
addBackup(DockFactory<? extends DockElement,?,BackupFactoryData<?>> factory)
Adds a backup factory to this situation. |
|
static java.lang.String |
convertFactoryID(java.lang.String id)
Given the unique identifier of a factory tells what identifier will be used internally. |
|
PredefinedPerspective |
createPerspective()
Creates a new PredefinedPerspective . |
|
protected DockLayoutInfo |
fillMissing(DockLayoutInfo info)
Called by DockSituation.fillMissing(DockLayoutComposition) only for
DockLayoutInfo s which contain a DockLayout . |
|
protected DockFactory<? extends DockElement,?,BackupFactoryData<?>> |
getBackup(java.lang.String id)
Searches a backup factory with the name id . |
|
DockFactory<? extends DockElement,?,?> |
getFactory(java.lang.String id)
Gets the factory which has the given id . |
|
protected java.lang.String |
getFactoryID(java.lang.String id)
Transforms an id read from a stream to the id of the factory which would be used. |
|
java.lang.String |
getID(DockElement dockable)
Gets the id of the factory which is needed to write (and later read) element |
|
protected java.lang.String |
getID(DockFactory<?,?,?> factory)
Gets the id of factory . |
|
protected java.lang.String |
getID(PerspectiveElement element,
PredefinedPerspective perspective)
Gets the identifier that matches element which is part of perspective . |
|
java.util.Map<java.lang.String,DockableProperty> |
listEstimatedLocations(DockLayoutComposition composition,
boolean missingOnly)
Lists for all keys that can be found in composition its
estimated location. |
|
java.util.Map<java.lang.String,DockableProperty> |
listEstimatedLocations(DockLayoutComposition composition,
DockableProperty location,
boolean missingOnly)
Lists for all keys that can be found in composition its
estimated location. |
|
java.util.Map<java.lang.String,DockLayoutComposition> |
listLayouts(DockLayoutComposition composition,
boolean missingOnly)
Gets a map containing some or all of the named layouts. |
|
|
listVisible(java.util.Collection<D> base,
DockLayoutComposition composition)
Given a set of Dockable s this method
estimates which of them will be visible once composition
is applied. |
|
void |
put(DockElement element)
Deprecated. use put(String, DockElement) instead |
|
void |
put(java.lang.String key,
DockElement element)
Registers an element at this situation. |
|
void |
removeBackup(java.lang.String id)
Removes the backup factory with the name id . |
|
protected boolean |
shouldLayout(DockElement element)
Tells whether the layout of element itself should be stored
or loaded, that will not prevent the element from showing
up but from changing its content. |
|
protected boolean |
shouldLayout(PerspectiveElement element,
PredefinedPerspective perspective)
Tells whether the layout of element itself should be stored
or loaded, that will not prevent the element from showing
up but from changing its content. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PredefinedDockSituation()
Method Detail |
---|
public PredefinedPerspective createPerspective()
PredefinedPerspective
. This perspective will write the layout in
such a way that a PredefinedDockSituation
can read it again.DockElement
s using PredefinedPerspective.put(String, PerspectiveElement)
before the perspective can be used. The DockElement
s registered to this
by using put(String, DockElement)
are ignored by the perspective.
createPerspective
in class DockSituation
public void addBackup(DockFactory<? extends DockElement,?,BackupFactoryData<?>> factory)
BackupFactoryData
object, the identifier of that
object does not have to be stored by factory
. The
factory has only to look at the data
-property.
This PredefinedDockSituation
will set the identifier whenever
a method of factory
is called, that has a BackupFactoryData
as parameter.
factory
- a backup factorypublic void removeBackup(java.lang.String id)
id
.
id
- the id of the factory which should be removed@Deprecated public void put(DockElement element)
put(String, DockElement)
instead
element
- the elementpublic void put(java.lang.String key, DockElement element)
key
- the key of the elementelement
- the element
java.lang.IllegalArgumentException
- if the key is already usedprotected boolean shouldLayout(DockElement element)
element
itself should be stored
or loaded, that will not prevent the element
from showing
up but from changing its content. The default implementation returns
always true
. This method is intended to be overridden by
subclasses.
element
- the element whose contents might or might not be stored
or loaded
true
if the contents should be handled, false
if they should be discardedprotected boolean shouldLayout(PerspectiveElement element, PredefinedPerspective perspective)
element
itself should be stored
or loaded, that will not prevent the element
from showing
up but from changing its content. The default implementation uses the maps
of perspective
and this DockSituation
to convert element
into a preset DockElement
and calls shouldLayout(DockElement)
. If the
element is not found, true
is returned.
element
- the element whose contents might or might not be stored
or loadedperspective
- the perspective for which the question has to be answered
true
if the contents should be handled, false
if they should be discardedprotected DockLayoutInfo fillMissing(DockLayoutInfo info)
DockSituation
DockSituation.fillMissing(DockLayoutComposition)
only for
DockLayoutInfo
s which contain a DockLayout
. This method
can apply further updates to info
if necessary. The default
implementation just returns info
.DockFactory
s
and use a DockLayout
even for incomplete data.
fillMissing
in class DockSituation
info
- the info to update
info
if nothing changed or a new
DockLayoutInfo
if additional information could be retrievedpublic <D extends DockElement> java.util.Set<D> listVisible(java.util.Collection<D> base, DockLayoutComposition composition)
Dockable
s this method
estimates which of them will be visible once composition
is applied.
D
- the kind of elements to checkbase
- a collection of Dockable
s in no specific
order and with no restrictionscomposition
- location information for various elements
base
with those elements which will
be visible once this situation converts composition
public java.util.Map<java.lang.String,DockableProperty> listEstimatedLocations(DockLayoutComposition composition, boolean missingOnly)
composition
its
estimated location.DockSituation.estimateLocations(DockLayoutComposition)
to get the most recent locations
composition
- some composition to search for keys and locationsmissingOnly
- if set, then only locations of keys for which
no DockLayout
is set are reported. This are the keys which most
likely will be ignored when calling DockSituation.convert(DockLayoutComposition)
public java.util.Map<java.lang.String,DockableProperty> listEstimatedLocations(DockLayoutComposition composition, DockableProperty location, boolean missingOnly)
composition
its
estimated location.DockSituation.estimateLocations(DockLayoutComposition)
to get the most recent locations
composition
- some composition to search for keys and locationslocation
- the location of composition
itselfmissingOnly
- if set, then only locations of keys for which
no DockLayout
is set are reported. This are the keys which most
likely will be ignored when calling DockSituation.convert(DockLayoutComposition)
public java.util.Map<java.lang.String,DockLayoutComposition> listLayouts(DockLayoutComposition composition, boolean missingOnly)
composition
- some composition to analyzemissingOnly
- if set, then only locations of keys for which
no DockLayout
is set are reported. This are the keys which most
likely will be ignored when calling DockSituation.convert(DockLayoutComposition)
protected java.lang.String getID(PerspectiveElement element, PredefinedPerspective perspective)
element
which is part of perspective
.
element
- some element whose identifier is searchedperspective
- the owner of element
public java.lang.String getID(DockElement dockable)
DockSituation
element
getID
in class DockSituation
dockable
- the element to read
DockSituation.getID(DockFactory)
,
DockSituation.getFactory(String)
protected java.lang.String getID(DockFactory<?,?,?> factory)
DockSituation
factory
. The default behavior is just to
return DockConverter.getID()
. Note that this method should be
a bijection to DockSituation.getFactory(String)
.
getID
in class DockSituation
factory
- the factory whose id is needed
protected java.lang.String getFactoryID(java.lang.String id)
DockSituation
DockFactory factory = ...
factory.getID().equals( getFactoryID( getID( factory )));
getFactoryID
in class DockSituation
id
- the id read from a stream
public static java.lang.String convertFactoryID(java.lang.String id)
DockLayout
manually.
id
- the id of some factory
public DockFactory<? extends DockElement,?,?> getFactory(java.lang.String id)
DockSituation
id
. Note that this
method should be a bijection to DockSituation.getID(DockFactory)
. The
default behavior compares id
with the
DockSituation.getID(DockFactory)
.
getFactory
in class DockSituation
id
- the name of the factory
null
if no factory has this idprotected DockFactory<? extends DockElement,?,BackupFactoryData<?>> getBackup(java.lang.String id)
id
.
id
- the name of the factory
null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |