|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.common.intern.CommonSingleDockableFactory
public class CommonSingleDockableFactory
This factory is used to create new SingleCDockable
s using various
SingleCDockableFactory
s. This factory is accessed when a single
dockable is missing in the cache of its owning CControl
.
Field Summary | |
---|---|
static String |
BACKUP_FACTORY_ID
|
Constructor Summary | |
---|---|
CommonSingleDockableFactory(CControl control)
Creates a new factory. |
|
CommonSingleDockableFactory(CControl control,
CPerspective perspective)
Creates a new factory. |
Method Summary | |
---|---|
void |
add(Filter<String> ids,
SingleCDockableFactory factory)
Registers a new factory that will load SingleCDockable with
unique identifiers that are included by ids . |
void |
add(String id,
SingleCDockableFactory factory)
Registers a new factory that will load SingleCDockable s with
the unique id id . |
void |
estimateLocations(CommonSingleDockableLayout layout,
LocationEstimationMap children)
Tries to estimate the DockableProperty s of the children of the
station which is represented by layout .The children of this station are accessible through children.getChild( ... |
SingleCDockableFactory |
getFactory(String id)
Searches the factory which handles id . |
Set<String> |
getFactoryIds()
Gets the set of keys for all factories known to this. |
String |
getID()
Gets the unique name of this converter. |
CommonSingleDockableLayout |
getLayout(CommonDockable element,
Map<Dockable,Integer> children)
Gets the layout of element . |
CommonSingleDockableLayout |
getPerspectiveLayout(CommonElementPerspective element,
Map<PerspectiveDockable,Integer> children)
Gets the layout information that is associated with element . |
CommonDockable |
layout(CommonSingleDockableLayout layout,
Map<Integer,Dockable> children,
PlaceholderStrategy placeholders)
Creates a new DockElement and changes the layout of the new
element such that is matches layout . |
CommonDockable |
layout(CommonSingleDockableLayout layout,
PlaceholderStrategy placeholders)
Creates a new DockElement and changes the layout of the new
element such that is matches layout . |
void |
layoutPerspective(CommonElementPerspective perspective,
CommonSingleDockableLayout layout,
Map<Integer,PerspectiveDockable> children)
Updates the contents of perspective such that it reflects the contents of layout . |
CommonElementPerspective |
layoutPerspective(CommonSingleDockableLayout layout,
Map<Integer,PerspectiveDockable> children)
Creates an element that can be used by a Perspective to create a layout
without creating any DockElement s. |
String[] |
listFactories()
Gets a list of keys for all factories known to this. |
CommonSingleDockableLayout |
read(DataInputStream in,
PlaceholderStrategy placeholders)
Reads a layout from a stream. |
CommonSingleDockableLayout |
read(XElement element,
PlaceholderStrategy placeholders)
Reads a layout from an xml-element. |
void |
remove(SingleCDockableFactory factory)
Removes any occurrence of factory . |
void |
remove(String id)
Removes a factory from this. |
void |
setLayout(CommonDockable element,
CommonSingleDockableLayout layout,
Map<Integer,Dockable> children,
PlaceholderStrategy placeholders)
Reads the contents of layout and changes the layout of
element accordingly. |
void |
setLayout(CommonDockable element,
CommonSingleDockableLayout layout,
PlaceholderStrategy placeholders)
Reads the contents of layout and changes the layout of
element accordingly. |
void |
write(CommonSingleDockableLayout layout,
DataOutputStream out)
Writes the contents of layout into out . |
void |
write(CommonSingleDockableLayout layout,
XElement element)
Writes the contents of layout into element . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String BACKUP_FACTORY_ID
Constructor Detail |
---|
public CommonSingleDockableFactory(CControl control)
control
- the owner of the factory, the factory will add SingleCDockable
to this controlpublic CommonSingleDockableFactory(CControl control, CPerspective perspective)
control
- the owner of the factory, the factory will add SingleCDockable
to this controlperspective
- the perspective which is used to load perspective related contentMethod Detail |
---|
public void add(String id, SingleCDockableFactory factory)
SingleCDockable
s with
the unique id id
.
id
- the unique id of the dockables which factory
will createfactory
- the new factorypublic void add(Filter<String> ids, SingleCDockableFactory factory)
SingleCDockable
with
unique identifiers that are included by ids
.
ids
- the identifiers that are includedfactory
- the new factorypublic void remove(String id)
id
- the name of the factory to removepublic void remove(SingleCDockableFactory factory)
factory
.
factory
- the factory to removepublic SingleCDockableFactory getFactory(String id)
id
.
id
- the name of a factory
null
public String getID()
DockConverter
getID
in interface DockConverter<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
public String[] listFactories()
public Set<String> getFactoryIds()
public void estimateLocations(CommonSingleDockableLayout layout, LocationEstimationMap children)
DockFactory
DockableProperty
s of the children of the
station which is represented by layout
.children.getChild( ... )
, this
factory may also access the leafs in the tree of Dockable
s through
children.getSubChild(...)
.DockableProperty
,
it is the callers responsibility to handle chains of stations.
estimateLocations
in interface DockFactory<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
layout
- this stationchildren
- the children of the station, this method should call
DockLayoutInfo.setLocation(DockableProperty)
or LocationEstimationMap.setLocation(int, DockableProperty)
and
LocationEstimationMap.setLocation(int, int, DockableProperty)
for as many children as possiblepublic CommonSingleDockableLayout getLayout(CommonDockable element, Map<Dockable,Integer> children)
DockConverter
element
. This method should create
a new instance of the layout object, that new object should not be
tied to element
in any way. A layout can be living for
a long period of time and might be used on another dockable
object.
getLayout
in interface DockConverter<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
element
- the element for which a new layout should be createdchildren
- a map containing unique identifiers for the children
of the element. Children which are not in this map should not be
stored in the layout.children.size()
(excl.). The
same identifiers will be used as indices by a LocationEstimationMap
. See
also DockFactory.estimateLocations(Object, LocationEstimationMap)
.
public CommonDockable layout(CommonSingleDockableLayout layout, Map<Integer,Dockable> children, PlaceholderStrategy placeholders)
DockFactory
DockElement
and changes the layout of the new
element such that is matches layout
.
layout
in interface DockFactory<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
layout
- the new layoutchildren
- some children, note that the map may not contain all elements
which were present when the layout was created.placeholders
- a strategy to detect invalid placeholders, can be null
.
Factories loading only Dockable
s but no DockStation
s can safely ignore this argument.
null
if layout can't be usedpublic CommonDockable layout(CommonSingleDockableLayout layout, PlaceholderStrategy placeholders)
DockFactory
DockElement
and changes the layout of the new
element such that is matches layout
. This method should
not add any children to the element.
layout
in interface DockFactory<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
layout
- the new layoutplaceholders
- a strategy to detect invalid placeholders, can be null
.
Factories loading only Dockable
s but no DockStation
s can safely ignore this argument.
null
if layout can't be usedpublic CommonElementPerspective layoutPerspective(CommonSingleDockableLayout layout, Map<Integer,PerspectiveDockable> children)
DockFactory
Perspective
to create a layout
without creating any DockElement
s. This method may return null
only
if the client is guaranteed not to use a Perspective
.
layoutPerspective
in interface DockFactory<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
layout
- the new layoutchildren
- some children, note that the map may not contain all elements
which were present when the layout was created. Is null
if the children of this
station are going to be ignored.
null
, the return value of PerspectiveElement.getFactoryID()
should
be equal to DockConverter.getID()
public void layoutPerspective(CommonElementPerspective perspective, CommonSingleDockableLayout layout, Map<Integer,PerspectiveDockable> children)
DockFactory
perspective
such that it reflects the contents of layout
.
layoutPerspective
in interface DockFactory<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
perspective
- the perspective that is to be updatedlayout
- the layout to applychildren
- the new children of perspective
, is null
if the children of this
station are going to be ignored.public CommonSingleDockableLayout getPerspectiveLayout(CommonElementPerspective element, Map<PerspectiveDockable,Integer> children)
DockConverter
element
.
The layout information can be any Object
. The only restriction
of the object is, that the associated DockFactory
understands
how to read that object.
getPerspectiveLayout
in interface DockConverter<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
element
- the element whose layout information is asked.children
- a map providing identifiers for the children of this element. The
identifiers are in the range from 0 (incl.) to children.size()
(excl.),
the exact same identifiers would be given to DockConverter.getLayout(bibliothek.gui.dock.DockElement, Map)
.
Is null
if the children of this station should be ignored.
null
if this converter does not support perspectivespublic CommonSingleDockableLayout read(DataInputStream in, PlaceholderStrategy placeholders) throws IOException
DockConverter
read
in interface DockConverter<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
in
- the stream to read fromplaceholders
- a strategy to detect invalid placeholders, can be null
.
Factories loading only Dockable
s but no DockStation
s can safely ignore this argument.
null
if the layout
should be discarded
IOException
- if an I/O-error occurspublic CommonSingleDockableLayout read(XElement element, PlaceholderStrategy placeholders)
DockConverter
read
in interface DockConverter<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
element
- the element to read, should not be changed by this
method.placeholders
- a strategy to detect invalid placeholders, can be null
.
Factories loading only Dockable
s but no DockStation
s can safely ignore this argument.
null
if the layout
should be discardedpublic void setLayout(CommonDockable element, CommonSingleDockableLayout layout, Map<Integer,Dockable> children, PlaceholderStrategy placeholders)
DockConverter
layout
and changes the layout of
element
accordingly. This method should remove all
children from element
and add new children.
setLayout
in interface DockConverter<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
element
- the element whose content and children will be rearranged.layout
- the new layout of element
children
- some children, note that the map may not contain all elements
which were present when the layout was created.placeholders
- a strategy to detect invalid placeholders, can be null
.
Factories loading only Dockable
s but no DockStation
s can safely ignore this argument.public void setLayout(CommonDockable element, CommonSingleDockableLayout layout, PlaceholderStrategy placeholders)
DockConverter
layout
and changes the layout of
element
accordingly. This method should not add or remove
children to or from element
.
setLayout
in interface DockConverter<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
element
- the element whose properties will be changedlayout
- the new set of propertiesplaceholders
- a strategy to detect invalid placeholders, can be null
.
Factories loading only Dockable
s but no DockStation
s can safely ignore this argument.public void write(CommonSingleDockableLayout layout, DataOutputStream out) throws IOException
DockConverter
layout
into out
.
write
in interface DockConverter<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
layout
- the layout to storeout
- the stream to write into
IOException
- if an I/O-error occurspublic void write(CommonSingleDockableLayout layout, XElement element)
DockConverter
layout
into element
.
write
in interface DockConverter<CommonDockable,CommonElementPerspective,CommonSingleDockableLayout>
layout
- the layout to storeelement
- an xml-element into which this method should write, the
attributes of element
should not be changed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |