bibliothek.gui.dock.station
Interface PlaceholderMapping

All Known Implementing Classes:
PlaceholderListMapping, SplitDockPlaceholderMapping

public interface PlaceholderMapping

Represents the placeholders of a DockStation. Placeholders are unique identifiers that can be attached to certain locations on a station. During runtime placeholders may be replaced by real Dockables.

Author:
Benjamin Sigg

Method Summary
 void addPlaceholder(Dockable dockable, Path placeholder)
          First searches the location of dockable, then adds placeholder to that location.
 Dockable getDockableAt(Path placeholder)
          Searches for the placeholder placeholder and gets the Dockable that is currently sitting at the location described by placeholder.
 DockableProperty getLocationAt(Path placeholder)
          Gets a DockableProperty that describes the location of placeholder.
 DockStation getStation()
          Gets the DockStation which created this mapping in its DockStation.getPlaceholderMapping().
 boolean hasPlaceholder(Path placeholder)
          Tells whether the station has any reference to placeholder.
 void removePlaceholder(Path placeholder)
          Removes all occurrences of placeholder from this station.
 

Method Detail

getStation

DockStation getStation()
Gets the DockStation which created this mapping in its DockStation.getPlaceholderMapping().

Returns:
the creator and owner of this mapping

addPlaceholder

void addPlaceholder(Dockable dockable,
                    Path placeholder)
First searches the location of dockable, then adds placeholder to that location. If another dockable is dropped on this station, and that item is associated with placeholder, then it will be put at the same position as dockable. This method will remove placeholder from any other position on the station.

Parameters:
dockable - a child of this station, must not be null
placeholder - the placeholder to add, must not be null
Throws:
IllegalArgumentException - if dockable is not a child of this station, or if any argument is null

hasPlaceholder

boolean hasPlaceholder(Path placeholder)
Tells whether the station has any reference to placeholder.

Parameters:
placeholder - the placeholder to search
Returns:
true if placeholder was found

getDockableAt

Dockable getDockableAt(Path placeholder)
Searches for the placeholder placeholder and gets the Dockable that is currently sitting at the location described by placeholder.

Parameters:
placeholder - the placeholder to search
Returns:
the dockable at placeholder, or null either because placeholder could not be found, or because placeholder describes a position that does currently not contain a Dockable

getLocationAt

DockableProperty getLocationAt(Path placeholder)
Gets a DockableProperty that describes the location of placeholder. The result of this method is undefined if placeholder is not found.

Parameters:
placeholder - the placeholder whose location is searched
Returns:
the location, may be null if placeholder is not found

removePlaceholder

void removePlaceholder(Path placeholder)
Removes all occurrences of placeholder from this station.

Parameters:
placeholder - the placeholder to remove, must not be null