|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.station.support.PlaceholderList<D>
D
- the type which represents a Dockable
public class PlaceholderList<D extends PlaceholderListItem>
A list consisting of Dockable
s and sets of Path
s as placeholder.
Uses a PlaceholderStrategy
to automatically create and dispose
of placeholders.
Clients should call bind()
and unbind()
to manage the
lifecycle of this list.
A PlaceholderList
is not thread-safe.
Nested Class Summary | |
---|---|
static interface |
PlaceholderList.Filter<M>
A sublist of a PlaceholderList , the elements in this
list are filtered by a strategy that is defined by the
PlaceholderList . |
class |
PlaceholderList.Item
A single item in a PlaceholderList |
static class |
PlaceholderList.Level
identifiers for the various sublists this list consists of |
Constructor Summary | |
---|---|
PlaceholderList()
Creates a new and empty list. |
|
PlaceholderList(PlaceholderMap map)
Creates a new list reading all the data that is stored in map . |
|
PlaceholderList(PlaceholderMap map,
PlaceholderListItemConverter<D> converter)
Creates a new list reading all the data that is stored in map . |
Method Summary | ||
---|---|---|
int |
baseToLevel(int index,
PlaceholderList.Level level)
Searches the base entry at index and returns
its location in sublist level . |
|
void |
bind()
Connects this list with its strategy. |
|
PlaceholderList.Filter<D> |
dockables()
Gets a mutable view of all Dockable s of this list. |
|
D |
getDockableAt(Path placeholder)
Searches the first occurrence of placeholder and returns the Dockable
that is stored at that location. |
|
int |
getDockableIndex(Path placeholder)
Emulates the insertion of a Dockable at location placeholder and
returns the index that the inserted dockable would have in the dockable-list. |
|
PlaceholderMetaMap |
getMetaMap(Path placeholder)
Gets the meta-map that is associated with the set of placeholders that include placeholder . |
|
PlaceholderStrategy |
getStrategy()
Gets the current strategy of this list. |
|
boolean |
hasPlaceholder(Path placeholder)
Tells whether this list contains a reference to placeholder . |
|
void |
insertAllPlaceholders()
Inserts a placeholder for all Dockable s that are stored in this list. |
|
int |
levelToBase(int index,
PlaceholderList.Level level)
Searches the base entry at index in the sublist level and returns
its location in the base list. |
|
PlaceholderList.Filter<PlaceholderList.Item> |
list()
Gets a mutable view of all elements of this list. |
|
PlaceholderList.Filter<Set<Path>> |
listPlaceholders()
Gets a mutable view of all elements of this list. |
|
PlaceholderList.Filter<Set<Path>> |
purePlaceholders()
Gets a mutable view of all pure placeholders of this list. |
|
boolean |
put(D dockable,
Path placeholder)
Searches for the entry containing dockable and adds placeholder to the
placeholder set. |
|
int |
put(Path placeholder,
D dockable)
Searches for the first occurrence of placeholder and replaces
it with dockable . |
|
void |
read(PlaceholderMap map,
PlaceholderListItemConverter<D> converter)
Reads the contents of map and adds them at the end of this list. |
|
Path |
remove(D dockable)
Searches for dockable and replaces it by a placeholder. |
|
Path |
remove(int index)
Removes the index 'th Dockable from this list were
index is an index used in dockables() . |
|
void |
removeAll(Path placeholder)
Checks all entries of this list and removes all occurrences of all placeholder . |
|
void |
removeAll(Set<Path> placeholders)
Checks all entries of this list and removes all occurrences of all paths stored in placeholders . |
|
void |
setStrategy(PlaceholderStrategy strategy)
Sets the new strategy of this list. |
|
static
|
simulatedRead(PlaceholderMap map,
PlaceholderListItemConverter<D> converter)
Simulates a call to 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 . |
|
PlaceholderMap |
toMap(PlaceholderListItemConverter<? super D> converter)
Converts this list into a PlaceholderMap , any remaining Dockable or
DockStation will be converted using converter . |
|
String |
toString()
|
|
void |
unbind()
Disconnects this list from its strategy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PlaceholderList()
public PlaceholderList(PlaceholderMap map)
map
. This
constructor stores all placeholders that are described in map
, obsolete
placeholders may be deleted as soon as a PlaceholderStrategy
is set.
map
- the map to read, not null
IllegalArgumentException
- if map
was not written by a PlaceholderList
public PlaceholderList(PlaceholderMap map, PlaceholderListItemConverter<D> converter)
map
. This
constructor stores all placeholders that are described in map
, obsolete
placeholders may be deleted as soon as a PlaceholderStrategy
is set.
map
- the map to read, not null
converter
- used to convert items back to dockables, not null
IllegalArgumentException
- if map
was not written by a PlaceholderList
Method Detail |
---|
public static <D extends PlaceholderListItem> void simulatedRead(PlaceholderMap map, PlaceholderListItemConverter<D> converter)
read(PlaceholderMap, PlaceholderListItemConverter)
and makes all calls to converter
that would be made in a real read as well.
D
- the kind of data converter
handlesmap
- the map to readconverter
- used to convert items back to dockables, not null
public void read(PlaceholderMap map, PlaceholderListItemConverter<D> converter)
map
and adds them at the end of this list.
map
- the map to readconverter
- used to convert items back to dockables, not null
IllegalArgumentException
- if the map is in the wrong formatpublic PlaceholderMap toMap()
PlaceholderMap
, any remaining Dockable
or
DockStation
will be converted into its placeholder using the currently installed
PlaceholderStrategy
.
null
public PlaceholderMap toMap(PlaceholderListItemConverter<? super D> converter)
PlaceholderMap
, any remaining Dockable
or
DockStation
will be converted using converter
.
converter
- converter to translate dockables into persistent data, not null
null
public void bind()
public void unbind()
public PlaceholderStrategy getStrategy()
public void setStrategy(PlaceholderStrategy strategy)
null
,
then all current placeholders are checked and the invalid placeholders
are removed.
strategy
- the new strategypublic void insertAllPlaceholders()
Dockable
s that are stored in this list.
public PlaceholderList.Filter<D> dockables()
Dockable
s of this list.
public PlaceholderList.Filter<Set<Path>> purePlaceholders()
null
public PlaceholderList.Filter<PlaceholderList.Item> list()
public PlaceholderList.Filter<Set<Path>> listPlaceholders()
public void removeAll(Set<Path> placeholders)
placeholders
. If an entry remains with
0 placeholders and no Dockable
it is removed.
placeholders
- the placeholders to removepublic void removeAll(Path placeholder)
placeholder
. If an entry remains with 0 placeholders
and no Dockable
it is removed.
placeholder
- the placeholder to removepublic Path remove(int index)
index
'th Dockable
from this list were
index
is an index used in dockables()
.
index
- the index of the element to remove
null
public Path remove(D dockable)
dockable
and replaces it by a placeholder. If dockable
is a DockStation
, then its PlaceholderMap
is stored.
dockable
- the element to remove
null
if the current strategy does
not assign a placeholder to dockable
or if dockable
was not found in this listpublic int put(Path placeholder, D dockable)
placeholder
and replaces
it with dockable
. If there is already another dockable stored at that
location, then the other dockable is replaced silently. If dockable
is a
DockStation
and a PlaceholderMap
is set, then this map is transfered to
dockable
and removed from this list.placeholder
and the placeholder that is assigned
by the current PlaceholderStrategy
from this list.
placeholder
- the placeholder to search, not null
dockable
- the element which will replace placeholder
, not null
dockables()
where dockable
was inserted or -1 if
placeholder
was not foundpublic int getDockableIndex(Path placeholder)
Dockable
at location placeholder
and
returns the index that the inserted dockable would have in the dockable-list.
placeholder
- the placeholder of the element to insert
placeholder
was not foundpublic boolean hasPlaceholder(Path placeholder)
placeholder
.
placeholder
- the placeholder to search
public boolean put(D dockable, Path placeholder)
dockable
and adds placeholder
to the
placeholder set. This method removes placeholder
from all the other entries.
dockable
- the keyplaceholder
- the placeholder to insert
true
if dockable
was found, false
otherwisepublic D getDockableAt(Path placeholder)
placeholder
and returns the Dockable
that is stored at that location.
placeholder
- the placeholder to search
null
if there is no dockable stored or
placeholder
is not foundpublic PlaceholderMetaMap getMetaMap(Path placeholder)
placeholder
.
placeholder
- some placeholder to search
placeholder
, can be null
public int baseToLevel(int index, PlaceholderList.Level level)
index
and returns
its location in sublist level
.
index
- the index of some entrylevel
- the sublist
level
IndexOutOfBoundsException
- if index
is illegalpublic int levelToBase(int index, PlaceholderList.Level level)
index
in the sublist level
and returns
its location in the base list.
index
- the index of some entrylevel
- the sublist
IndexOutOfBoundsException
- if index
is illegalpublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |