bibliothek.gui.dock.station
Class StationChildHandle

java.lang.Object
  extended by bibliothek.gui.dock.station.StationChildHandle
All Implemented Interfaces:
PlaceholderListItem<Dockable>

public class StationChildHandle
extends Object
implements PlaceholderListItem<Dockable>

A support class intended to be used by DockStations. This class creates and handles DockableDisplayer, DockTitleRequest and DockTitles for a Dockable on a specific DockStation.

Author:
Benjamin Sigg

Constructor Summary
StationChildHandle(DockStation station, DisplayerCollection displayers, Dockable dockable, DockTitleVersion title)
          Creates a new handle, initializes a DockTitleRequest but no DockableDisplayer nor a DockTitle.
 
Method Summary
 Dockable asDockable()
          Gets the Dockable that is associated with this item.
 void destroy()
          Deletes all resources that were acquired by this handler.
 DockableDisplayer getDisplayer()
          Gest the current displayer for this handle.
 Dockable getDockable()
          Gets the element that is handled by this handler.
 DockTitle getTitle()
          Gets the title which is currently displayed.
 void requestTitle()
          Requests a new title for this Dockable
 void setTitleRequest(DockTitleVersion version)
          The same as setTitleRequest( version, true );
 void setTitleRequest(DockTitleVersion version, boolean request)
          Updates the DockTitleRequest associated with this Dockable.
 void updateDisplayer()
          Discards the current DockableDisplayer and creates a new one using the same DockTitle as was used for the old one.
protected  void updateTitle(DockTitle title)
          Called if the current DockTitle needs to be exchanged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StationChildHandle

public StationChildHandle(DockStation station,
                          DisplayerCollection displayers,
                          Dockable dockable,
                          DockTitleVersion title)
Creates a new handle, initializes a DockTitleRequest but no DockableDisplayer nor a DockTitle. This constructor also adds a DockableListener to dockable to update the title whenever docakble requests it.
Clients should call updateDisplayer() to initialize the remaining fields of this handler.

Parameters:
station - the owner of this handle, the parent of dockable
displayers - the set of available DockableDisplayers
dockable - the element that will be managed by this handle
title - what kind of title is requested
Method Detail

destroy

public void destroy()
Deletes all resources that were acquired by this handler. This includes the current DockableDisplayer, the current DockTitle and the current DockTitleRequest.


updateDisplayer

public void updateDisplayer()
Discards the current DockableDisplayer and creates a new one using the same DockTitle as was used for the old one. If there is currently no DockableDisplayer in use, then a new DockTitle is created.


getDisplayer

public DockableDisplayer getDisplayer()
Gest the current displayer for this handle.

Returns:
the current displayer, might be null

getDockable

public Dockable getDockable()
Gets the element that is handled by this handler.

Returns:
the handled element, not null

asDockable

public Dockable asDockable()
Description copied from interface: PlaceholderListItem
Gets the Dockable that is associated with this item.

Specified by:
asDockable in interface PlaceholderListItem<Dockable>
Returns:
the dockable, not null

getTitle

public DockTitle getTitle()
Gets the title which is currently displayed.

Returns:
the title or null

setTitleRequest

public void setTitleRequest(DockTitleVersion version)
The same as setTitleRequest( version, true );

Parameters:
version - the new title-version, can be null
See Also:
setTitleRequest(DockTitleVersion, boolean)

setTitleRequest

public void setTitleRequest(DockTitleVersion version,
                            boolean request)
Updates the DockTitleRequest associated with this Dockable. The old title (if there is any) is discarded. If request is true, then a new title is requested. Otherwise a new DockTitleRequest is installed but not triggered.

Parameters:
version - the new title-version, can be null
request - whether to update the current title or not

requestTitle

public void requestTitle()
Requests a new title for this Dockable


updateTitle

protected void updateTitle(DockTitle title)
Called if the current DockTitle needs to be exchanged.

Parameters:
title - the new title, may be null