bibliothek.gui.dock.station.support
Class PerspectivePlaceholderList<P extends PlaceholderListItem<PerspectiveDockable>>

java.lang.Object
  extended by bibliothek.gui.dock.station.support.PlaceholderList<PerspectiveDockable,PerspectiveStation,P>
      extended by bibliothek.gui.dock.station.support.PerspectivePlaceholderList<P>
Type Parameters:
P - The kind of object that represents a PerspectiveDockable

public class PerspectivePlaceholderList<P extends PlaceholderListItem<PerspectiveDockable>>
extends PlaceholderList<PerspectiveDockable,PerspectiveStation,P>

A PlaceholderList that works only with PerspectiveElements.
The PlaceholderStrategy of this list is automatically set during construction and there is no need for clients to call PlaceholderList.bind() or PlaceholderList.unbind().

Author:
Benjamin Sigg

Nested Class Summary
 
Nested classes/interfaces inherited from class bibliothek.gui.dock.station.support.PlaceholderList
PlaceholderList.Filter<M>, PlaceholderList.Item, PlaceholderList.Level
 
Constructor Summary
PerspectivePlaceholderList()
          Creates a new and empty list.
PerspectivePlaceholderList(PlaceholderMap map)
          Creates a new list using map to fill in the initial content.
PerspectivePlaceholderList(PlaceholderMap map, PlaceholderListItemConverter<PerspectiveDockable,P> converter)
          Creates a new list reading all the data that is stored in map.
 
Method Summary
protected  PerspectiveDockable[] getChildren(PerspectiveStation station)
          Gets all the children of station.
protected  Path getPlaceholder(PerspectiveDockable dockable)
          Gets the placeholder which matches dockable.
protected  PlaceholderMap getPlaceholders(PerspectiveStation station)
          Gets all the placeholders that are used by station.
protected  void setPlaceholders(PerspectiveStation station, PlaceholderMap map)
          Sets all the placeholders that should be used by station.
static
<P extends PlaceholderListItem<PerspectiveDockable>>
void
simulatedRead(PlaceholderMap map, PlaceholderListItemConverter<PerspectiveDockable,P> converter)
          Simulates a call to PlaceholderList.read(PlaceholderMap, PlaceholderListItemConverter) and makes all calls to converter that would be made in a real read as well.
 PlaceholderMap toMap()
          Converts this list into a PlaceholderMap, any remaining Dockable or DockStation will be converted into its placeholder using the currently installed PlaceholderStrategy.
protected  PerspectiveStation toStation(PerspectiveDockable dockable)
          Converts dockable to the representation of a DockStation.
protected  String toString(PerspectiveDockable dockable)
          Gets a representation of dockable as string.
 
Methods inherited from class bibliothek.gui.dock.station.support.PlaceholderList
baseToLevel, bind, clear, dockables, getDockableAt, getDockableIndex, getListIndex, getMap, getMetaMap, getStrategy, hasPlaceholder, insertAllPlaceholders, levelToBase, list, listPlaceholders, purePlaceholders, put, put, read, read, remove, remove, removeAll, removeAll, setStrategy, size, toMap, toString, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PerspectivePlaceholderList

public PerspectivePlaceholderList()
Creates a new and empty list.


PerspectivePlaceholderList

public PerspectivePlaceholderList(PlaceholderMap map)
Creates a new list using map to fill in the initial content.

Parameters:
map - the map to read

PerspectivePlaceholderList

public PerspectivePlaceholderList(PlaceholderMap map,
                                  PlaceholderListItemConverter<PerspectiveDockable,P> converter)
Creates a new list reading all the data that is stored in map. This constructor stores all placeholders that are described in map, obsolete placeholders may be deleted as soon as a PlaceholderStrategy is set.

Parameters:
map - the map to read, not null
converter - used to convert items back to dockables, not null
Throws:
IllegalArgumentException - if map was not written by a PlaceholderList
Method Detail

simulatedRead

public static <P extends PlaceholderListItem<PerspectiveDockable>> void simulatedRead(PlaceholderMap map,
                                                                                      PlaceholderListItemConverter<PerspectiveDockable,P> converter)
Simulates a call to PlaceholderList.read(PlaceholderMap, PlaceholderListItemConverter) and makes all calls to converter that would be made in a real read as well.

Type Parameters:
P - the kind of data converter handles
Parameters:
map - the map to read
converter - used to convert items back to dockables, not null

toMap

public PlaceholderMap toMap()
Converts this list into a PlaceholderMap, any remaining Dockable or DockStation will be converted into its placeholder using the currently installed PlaceholderStrategy.

Returns:
the new map, not null

getPlaceholder

protected Path getPlaceholder(PerspectiveDockable dockable)
Description copied from class: PlaceholderList
Gets the placeholder which matches dockable.

Specified by:
getPlaceholder in class PlaceholderList<PerspectiveDockable,PerspectiveStation,P extends PlaceholderListItem<PerspectiveDockable>>
Parameters:
dockable - some random dockable
Returns:
the placeholder for dockable, can be null

getPlaceholders

protected PlaceholderMap getPlaceholders(PerspectiveStation station)
Description copied from class: PlaceholderList
Gets all the placeholders that are used by station.

Specified by:
getPlaceholders in class PlaceholderList<PerspectiveDockable,PerspectiveStation,P extends PlaceholderListItem<PerspectiveDockable>>
Parameters:
station - some random representation of a DockStation
Returns:
the placeholders, can be null

setPlaceholders

protected void setPlaceholders(PerspectiveStation station,
                               PlaceholderMap map)
Description copied from class: PlaceholderList
Sets all the placeholders that should be used by station.

Specified by:
setPlaceholders in class PlaceholderList<PerspectiveDockable,PerspectiveStation,P extends PlaceholderListItem<PerspectiveDockable>>
Parameters:
station - a representation of a DockStation
map - the map of placeholders, not null

toStation

protected PerspectiveStation toStation(PerspectiveDockable dockable)
Description copied from class: PlaceholderList
Converts dockable to the representation of a DockStation.

Specified by:
toStation in class PlaceholderList<PerspectiveDockable,PerspectiveStation,P extends PlaceholderListItem<PerspectiveDockable>>
Parameters:
dockable - some random dockable
Returns:
dockable as station, can be null

getChildren

protected PerspectiveDockable[] getChildren(PerspectiveStation station)
Description copied from class: PlaceholderList
Gets all the children of station.

Specified by:
getChildren in class PlaceholderList<PerspectiveDockable,PerspectiveStation,P extends PlaceholderListItem<PerspectiveDockable>>
Parameters:
station - some station whose children are searched
Returns:
the children

toString

protected String toString(PerspectiveDockable dockable)
Description copied from class: PlaceholderList
Gets a representation of dockable as string.

Specified by:
toString in class PlaceholderList<PerspectiveDockable,PerspectiveStation,P extends PlaceholderListItem<PerspectiveDockable>>
Parameters:
dockable - some random dockable, not null
Returns:
the text