|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbibliothek.gui.dock.common.intern.CommonSingleDockableFactory
public class CommonSingleDockableFactory
This factory is used to create new SingleCDockables using various
SingleCDockableBackupFactorys. 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. |
|
| Method Summary | |
|---|---|
void |
add(String id,
SingleCDockableBackupFactory factory)
Registers a new factory that will load SingleCDockables with
the unique id id. |
void |
estimateLocations(String layout,
LocationEstimationMap children)
Tries to estimate the DockablePropertys of the children of the
station which is represented by layout. |
SingleCDockableBackupFactory |
getFactory(String id)
Searches the factory which was registered for id. |
Set<String> |
getFactoryIds()
Gets the set of keys for all factories known to this. |
String |
getID()
Gets the unique name of this converter. |
String |
getLayout(CommonDockable element,
Map<Dockable,Integer> children)
Gets the layout of element. |
CommonDockable |
layout(String layout)
Creates a new DockElement and changes the layout of the new
element such that is matches layout. |
CommonDockable |
layout(String layout,
Map<Integer,Dockable> children)
Creates a new DockElement and changes the layout of the new
element such that is matches layout. |
String[] |
listFactories()
Gets a list of keys for all factories known to this. |
String |
read(DataInputStream in,
PlaceholderStrategy placeholders)
Reads a layout from a stream. |
String |
read(XElement element,
PlaceholderStrategy placeholders)
Reads a layout from an xml-element. |
void |
remove(String id)
Removes a factory from this. |
void |
setLayout(CommonDockable element,
String layout)
Reads the contents of layout and changes the layout of
element accordingly. |
void |
setLayout(CommonDockable element,
String layout,
Map<Integer,Dockable> children)
Reads the contents of layout and changes the layout of
element accordingly. |
void |
write(String layout,
DataOutputStream out)
Writes the contents of layout into out. |
void |
write(String 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 control| Method Detail |
|---|
public void add(String id,
SingleCDockableBackupFactory factory)
SingleCDockables with
the unique id id.
id - the unique id of the dockables which factory will createfactory - the new factorypublic void remove(String id)
id - the name of the factory to removepublic SingleCDockableBackupFactory getFactory(String id)
id.
id - the name of a factory
nullpublic String getID()
DockConverter
getID in interface DockConverter<CommonDockable,String>public String[] listFactories()
public Set<String> getFactoryIds()
public void estimateLocations(String layout,
LocationEstimationMap children)
DockFactoryDockablePropertys of the children of the
station which is represented by layout.children.getChild( ... ), this
factory may also access the leafs in the tree of Dockables through
children.getSubChild(...).DockableProperty,
it is the callers responsibility to handle chains of stations.
estimateLocations in interface DockFactory<CommonDockable,String>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 possible
public String getLayout(CommonDockable element,
Map<Dockable,Integer> children)
DockConverterelement. 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,String>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(String layout,
Map<Integer,Dockable> children)
DockFactoryDockElement and changes the layout of the new
element such that is matches layout.
layout in interface DockFactory<CommonDockable,String>layout - the new layoutchildren - some children, note that the map may not contain all elements
which were present when the layout was created.
null if layout can't be usedpublic CommonDockable layout(String layout)
DockFactoryDockElement 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,String>layout - the new layout
null if layout can't be used
public String read(DataInputStream in,
PlaceholderStrategy placeholders)
throws IOException
DockConverter
read in interface DockConverter<CommonDockable,String>in - the stream to read fromplaceholders - a strategy to detect invalid placeholders, can be null.
Factories loading only Dockables but no DockStations can safely ignore this argument.
null if the layout
should be discarded
IOException - if an I/O-error occurs
public String read(XElement element,
PlaceholderStrategy placeholders)
DockConverter
read in interface DockConverter<CommonDockable,String>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 Dockables but no DockStations can safely ignore this argument.
null if the layout
should be discarded
public void setLayout(CommonDockable element,
String layout,
Map<Integer,Dockable> children)
DockConverterlayout and changes the layout of
element accordingly. This method should remove all
children from element and add new children.
setLayout in interface DockConverter<CommonDockable,String>element - the element whose content and children will be rearranged.layout - the new layout of elementchildren - some children, note that the map may not contain all elements
which were present when the layout was created.
public void setLayout(CommonDockable element,
String layout)
DockConverterlayout and changes the layout of
element accordingly. This method should not add or remove
children to or from element.
setLayout in interface DockConverter<CommonDockable,String>element - the element whose properties will be changedlayout - the new set of properties
public void write(String layout,
DataOutputStream out)
throws IOException
DockConverterlayout into out.
write in interface DockConverter<CommonDockable,String>layout - the layout to storeout - the stream to write into
IOException - if an I/O-error occurs
public void write(String layout,
XElement element)
DockConverterlayout into element.
write in interface DockConverter<CommonDockable,String>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 | |||||||||