bibliothek.gui.dock.station.support
Interface PlaceholderListItemConverter<D,P extends PlaceholderListItem<D>>

Type Parameters:
D - the kind of item representing a Dockable
P - the kind of item this converter supports
All Known Implementing Classes:
PerspectivePlaceholderListItemConverter, PlaceholderListItemAdapter, StrategyPlaceholderListItemConverter

public interface PlaceholderListItemConverter<D,P extends PlaceholderListItem<D>>

Used by a PlaceholderList to read and write to a PlaceholderMap.
Implementations can assume that the list will both convert methods call with items in the order of which the items are found in the list (meaning ordered by their location).

Author:
Benjamin Sigg

Method Summary
 void added(P dockable)
          Called as soon as the result of convert(ConvertedPlaceholderListItem) has been added to the list.
 P convert(ConvertedPlaceholderListItem item)
          Given some data that was written by some PlaceholderListItemConverter, this method returns the dockable that belongs to that data.
 ConvertedPlaceholderListItem convert(int index, P dockable)
          Given some non-null dockable, this method converts the element into some data that can be stored persistently.
 

Method Detail

convert

ConvertedPlaceholderListItem convert(int index,
                                     P dockable)
Given some non-null dockable, this method converts the element into some data that can be stored persistently.

Parameters:
index - the index of dockable in the dockables-list
dockable - the element to store
Returns:
the converted item, can be null to indicate that this element should not be stored

convert

P convert(ConvertedPlaceholderListItem item)
Given some data that was written by some PlaceholderListItemConverter, this method returns the dockable that belongs to that data. It is the clients responsibility to ensure that the same PlaceholderListItemConverter is used for reading and writing.
The placeholder property of item will always be null, the map property may not be the same as was associated when calling convert(int,PlaceholderListItem).

Parameters:
item - the item to read
Returns:
the corresponding element, can be null

added

void added(P dockable)
Called as soon as the result of convert(ConvertedPlaceholderListItem) has been added to the list.

Parameters:
dockable - the added element, not null