bibliothek.gui.dock.station.support
Class DockablePlaceholderList<P extends PlaceholderListItem<Dockable>>

java.lang.Object
  extended by bibliothek.gui.dock.station.support.PlaceholderList<Dockable,DockStation,P>
      extended by bibliothek.gui.dock.station.support.DockablePlaceholderList<P>
Type Parameters:
P - the kind of object that represents a Dockable

public class DockablePlaceholderList<P extends PlaceholderListItem<Dockable>>
extends PlaceholderList<Dockable,DockStation,P>

A PlaceholderList that works with real Dockables.

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
DockablePlaceholderList()
          Creates a new and empty list.
DockablePlaceholderList(PlaceholderMap map)
          Creates a new list reading all the data that is stored in map.
DockablePlaceholderList(PlaceholderMap map, PlaceholderListItemConverter<Dockable,P> converter)
          Creates a new list reading all the data that is stored in map.
 
Method Summary
protected  Dockable[] getChildren(DockStation station)
          Gets all the children of station.
protected  Path getPlaceholder(Dockable dockable)
          Gets the placeholder which matches dockable.
protected  PlaceholderMap getPlaceholders(DockStation station)
          Gets all the placeholders that are used by station.
protected  void setPlaceholders(DockStation station, PlaceholderMap map)
          Sets all the placeholders that should be used by station.
static
<P extends PlaceholderListItem<Dockable>>
void
simulatedRead(PlaceholderMap map, PlaceholderListItemConverter<Dockable,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  DockStation toStation(Dockable dockable)
          Converts dockable to the representation of a DockStation.
protected  String toString(Dockable dockable)
          Gets a representation of dockable as string.
 
Methods inherited from class bibliothek.gui.dock.station.support.PlaceholderList
addPlaceholder, baseToLevel, bind, clear, dockables, getDockableAt, getDockableIndex, getItem, getItem, getListIndex, getListIndex, getMap, getMetaMap, getNextListIndex, 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

DockablePlaceholderList

public DockablePlaceholderList()
Creates a new and empty list.


DockablePlaceholderList

public DockablePlaceholderList(PlaceholderMap map)
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
Throws:
IllegalArgumentException - if map was not written by a PlaceholderList

DockablePlaceholderList

public DockablePlaceholderList(PlaceholderMap map,
                               PlaceholderListItemConverter<Dockable,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<Dockable>> void simulatedRead(PlaceholderMap map,
                                                                           PlaceholderListItemConverter<Dockable,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(Dockable dockable)
Description copied from class: PlaceholderList
Gets the placeholder which matches dockable.

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

toStation

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

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

getChildren

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

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

getPlaceholders

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

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

setPlaceholders

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

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

toString

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

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