bibliothek.gui.dock.common.intern
Class RootStationAdjacentFactory

java.lang.Object
  extended by bibliothek.gui.dock.common.intern.RootStationAdjacentFactory
All Implemented Interfaces:
AdjacentDockFactory<Path>, DockConverter<DockElement,PerspectiveElement,Path>

public class RootStationAdjacentFactory
extends Object
implements AdjacentDockFactory<Path>

This factory stores the property CStation.getTypeId() for any CStation that is found.

Author:
Benjamin Sigg

Field Summary
static String FACTORY_ID
          The unique identifier of this factory
 
Constructor Summary
RootStationAdjacentFactory()
           
 
Method Summary
 String getID()
          Gets the unique name of this converter.
 Path getLayout(DockElement element, Map<Dockable,Integer> children)
          Gets the layout of element.
 Path getPerspectiveLayout(PerspectiveElement element, Map<PerspectiveDockable,Integer> children)
          Gets the layout information that is associated with element.
 boolean interested(DockElement element)
          Tells whether this factory is interested in storing information for element.
 boolean interested(PerspectiveElement element)
          Tells whether this factory is interested in storing information for element.
 Path read(DataInputStream in, PlaceholderStrategy placeholders)
          Reads a layout from a stream.
 Path read(XElement element, PlaceholderStrategy placeholders)
          Reads a layout from an xml-element.
 void setLayout(DockElement element, Path layout, Map<Integer,Dockable> children, PlaceholderStrategy placeholders)
          Reads the contents of layout and changes the layout of element accordingly.
 void setLayout(DockElement element, Path layout, PlaceholderStrategy placeholders)
          Reads the contents of layout and changes the layout of element accordingly.
 void write(Path layout, DataOutputStream out)
          Writes the contents of layout into out.
 void write(Path 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

FACTORY_ID

public static final String FACTORY_ID
The unique identifier of this factory

See Also:
Constant Field Values
Constructor Detail

RootStationAdjacentFactory

public RootStationAdjacentFactory()
Method Detail

interested

public boolean interested(DockElement element)
Description copied from interface: AdjacentDockFactory
Tells whether this factory is interested in storing information for element.

Specified by:
interested in interface AdjacentDockFactory<Path>
Parameters:
element - the element which might be stored by this factory
Returns:
true if the factory wants to store element

interested

public boolean interested(PerspectiveElement element)
Description copied from interface: AdjacentDockFactory
Tells whether this factory is interested in storing information for element.

Specified by:
interested in interface AdjacentDockFactory<Path>
Parameters:
element - the element which might be stored by this factory
Returns:
true if the factory wants to store element

getID

public String getID()
Description copied from interface: DockConverter
Gets the unique name of this converter. Please note that unique identifiers starting with "dock." should not be used by clients.

Specified by:
getID in interface DockConverter<DockElement,PerspectiveElement,Path>
Returns:
the id

getLayout

public Path getLayout(DockElement element,
                      Map<Dockable,Integer> children)
Description copied from interface: DockConverter
Gets the layout of 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.

Specified by:
getLayout in interface DockConverter<DockElement,PerspectiveElement,Path>
Parameters:
element - the element for which a new layout should be created
children - 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.
The identifiers are in the range from 0 (incl.) to children.size() (excl.). The same identifiers will be used as indices by a LocationEstimationMap. See also DockFactory.estimateLocations(Object, LocationEstimationMap).
Returns:
the newly created, independent layout object.

getPerspectiveLayout

public Path getPerspectiveLayout(PerspectiveElement element,
                                 Map<PerspectiveDockable,Integer> children)
Description copied from interface: DockConverter
Gets the layout information that is associated with 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.

Specified by:
getPerspectiveLayout in interface DockConverter<DockElement,PerspectiveElement,Path>
Parameters:
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.
Returns:
the layout information, may be null if this converter does not support perspectives

read

public Path read(DataInputStream in,
                 PlaceholderStrategy placeholders)
          throws IOException
Description copied from interface: DockConverter
Reads a layout from a stream.

Specified by:
read in interface DockConverter<DockElement,PerspectiveElement,Path>
Parameters:
in - the stream to read from
placeholders - a strategy to detect invalid placeholders, can be null. Factories loading only Dockables but no DockStations can safely ignore this argument.
Returns:
the new layout, can be null if the layout should be discarded
Throws:
IOException - if an I/O-error occurs

read

public Path read(XElement element,
                 PlaceholderStrategy placeholders)
Description copied from interface: DockConverter
Reads a layout from an xml-element.

Specified by:
read in interface DockConverter<DockElement,PerspectiveElement,Path>
Parameters:
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.
Returns:
the new layout, can be null if the layout should be discarded

setLayout

public void setLayout(DockElement element,
                      Path layout,
                      Map<Integer,Dockable> children,
                      PlaceholderStrategy placeholders)
Description copied from interface: DockConverter
Reads the contents of layout and changes the layout of element accordingly. This method should remove all children from element and add new children.

Specified by:
setLayout in interface DockConverter<DockElement,PerspectiveElement,Path>
Parameters:
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 Dockables but no DockStations can safely ignore this argument.

setLayout

public void setLayout(DockElement element,
                      Path layout,
                      PlaceholderStrategy placeholders)
Description copied from interface: DockConverter
Reads the contents of layout and changes the layout of element accordingly. This method should not add or remove children to or from element.

Specified by:
setLayout in interface DockConverter<DockElement,PerspectiveElement,Path>
Parameters:
element - the element whose properties will be changed
layout - the new set of properties
placeholders - a strategy to detect invalid placeholders, can be null. Factories loading only Dockables but no DockStations can safely ignore this argument.

write

public void write(Path layout,
                  DataOutputStream out)
           throws IOException
Description copied from interface: DockConverter
Writes the contents of layout into out.

Specified by:
write in interface DockConverter<DockElement,PerspectiveElement,Path>
Parameters:
layout - the layout to store
out - the stream to write into
Throws:
IOException - if an I/O-error occurs

write

public void write(Path layout,
                  XElement element)
Description copied from interface: DockConverter
Writes the contents of layout into element.

Specified by:
write in interface DockConverter<DockElement,PerspectiveElement,Path>
Parameters:
layout - the layout to store
element - an xml-element into which this method should write, the attributes of element should not be changed.