bibliothek.gui.dock.station
Class DisplayerCollection

java.lang.Object
  extended by bibliothek.gui.dock.station.DisplayerCollection
All Implemented Interfaces:
Iterable<DockableDisplayer>

public class DisplayerCollection
extends Object
implements Iterable<DockableDisplayer>

A set of DockableDisplayers. Clients may fetch a new displayer at any time. They should release a displayer which is no longer used. The collection ensures that various properties of the displayers are set in the proper order.

Author:
Benjamin Sigg

Constructor Summary
DisplayerCollection(DockStation station, DefaultDisplayerFactoryValue factory, String displayerId)
          Creates a new collection
DisplayerCollection(DockStation station, DisplayerFactory factory, String displayerId)
          Creates a new collection
 
Method Summary
 void addDockableDisplayerListener(DockableDisplayerListener listener)
          Adds listener to all DockableDisplayers that are in this collection.
 DockableDisplayer fetch(Dockable dockable, DockTitle title)
          Creates a new DockableDisplayer using the factory of this collection.
 boolean isDisplayerComponent(Component component)
          Tells whether component is the root component of any DockableDisplayer.
 Iterator<DockableDisplayer> iterator()
           
 void release(DockableDisplayer displayer)
          Releases a displayer that was created by this collection.
 void removeDockableDisplayerListener(DockableDisplayerListener listener)
          Removes listener from all DockableDisplayers that are in this collection.
 void setController(DockController controller)
          Sets the current DockController, that controller will be made known to all DockableDisplayer created by this collection.
 void setFactory(DisplayerFactory factory)
          Sets the factory that will create new DockableDisplayer when needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisplayerCollection

public DisplayerCollection(DockStation station,
                           DisplayerFactory factory,
                           String displayerId)
Creates a new collection

Parameters:
station - the station for which DockableDisplayer will be created
factory - the factory that is initially used to create displayers
displayerId - an identifier depending on station, this identifier is forwarded to Extensions allowing them an easy solution to filter uninteresting requests

DisplayerCollection

public DisplayerCollection(DockStation station,
                           DefaultDisplayerFactoryValue factory,
                           String displayerId)
Creates a new collection

Parameters:
station - the station for which DockableDisplayers will be created
factory - the factory that is used create displayers
displayerId - an identifier depending on station, this identifier is forwarded to Extensions allowing them an easy solution to filter uninteresting requests
Method Detail

addDockableDisplayerListener

public void addDockableDisplayerListener(DockableDisplayerListener listener)
Adds listener to all DockableDisplayers that are in this collection.

Parameters:
listener - a new listener, not null

removeDockableDisplayerListener

public void removeDockableDisplayerListener(DockableDisplayerListener listener)
Removes listener from all DockableDisplayers that are in this collection.

Parameters:
listener - the listener to remove

isDisplayerComponent

public boolean isDisplayerComponent(Component component)
Tells whether component is the root component of any DockableDisplayer.

Parameters:
component - the component to search
Returns:
true if at least one DockableDisplayer.getComponent() returns component

iterator

public Iterator<DockableDisplayer> iterator()
Specified by:
iterator in interface Iterable<DockableDisplayer>

fetch

public DockableDisplayer fetch(Dockable dockable,
                               DockTitle title)
Creates a new DockableDisplayer using the factory of this collection. This method also sets the title, station and the controller property of the displayer.
If the displayer is no longer needed, then it should be released

Parameters:
dockable - the Dockable which will be shown on the displayer.
title - the title which will be shown on the displayer, might be null
Returns:
the new displayer

release

public void release(DockableDisplayer displayer)
Releases a displayer that was created by this collection.

Parameters:
displayer - the displayer to release

setFactory

public void setFactory(DisplayerFactory factory)
Sets the factory that will create new DockableDisplayer when needed.

Parameters:
factory - the new factory, not null

setController

public void setController(DockController controller)
Sets the current DockController, that controller will be made known to all DockableDisplayer created by this collection.

Parameters:
controller - the new controller, can be null