bibliothek.gui.dock.displayer
Class DisplayerRequest

java.lang.Object
  extended by bibliothek.gui.dock.util.ResourceRequest<DockableDisplayer>
      extended by bibliothek.gui.dock.displayer.DisplayerRequest

public abstract class DisplayerRequest
extends ResourceRequest<DockableDisplayer>

A DisplayerRequest is an object that can create new DockableDisplayers by calling several factories.

Author:
Benjamin Sigg

Constructor Summary
DisplayerRequest(DockStation parent, Dockable target, DisplayerFactory defaultFactory, String displayerId)
          Creates a new request.
 
Method Summary
 void answer(DockableDisplayer displayer)
          Sets the DockableDisplayer which should be shown.
protected  void executeRequestList()
          Asks all sources for a new resource, needs to stop as soon as one source called ResourceRequest.answer(Object) (this can be queried with ResourceRequest.isAnswered()).
 DockController getController()
          Gets the controller in whose realm this request is issued.
 DockStation getParent()
          Gets the DockStation which is going to show the DockableDisplayer.
 Dockable getTarget()
          Gets the Dockable which is going to be shown in the DockableDisplayer.
 DockTitle getTitle()
          Gets the title that should be shown on the displayer.
 void request(DockTitle title)
          Creates a new DockableDisplayer.
 void setController(DockController controller)
          Sets the DockController in whose realm this DisplayerRequest is used.
protected  void validate(DockableDisplayer resource)
          Called by ResourceRequest.answer(Object), this method ensure that resource is a valid answer.
 
Methods inherited from class bibliothek.gui.dock.util.ResourceRequest
answer, getAnswer, isAnswered, request, requestNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisplayerRequest

public DisplayerRequest(DockStation parent,
                        Dockable target,
                        DisplayerFactory defaultFactory,
                        String displayerId)
Creates a new request.

Parameters:
parent - the station which is going to show the DockableDisplayer.
target - the element which is going to be shown in the displayer
defaultFactory - the default factory, to be used if no other way was found to create the DockableDisplayer
displayerId - a unique identifier that depends on the type of parent, this identifier will be forwarded to Extensions allowing them an easy way to filter uninteresting DisplayerRequests, must not be null
Method Detail

setController

public void setController(DockController controller)
Sets the DockController in whose realm this DisplayerRequest is used. The DockController can be used to load extensions.

Parameters:
controller - the controller, can be null

getController

public DockController getController()
Gets the controller in whose realm this request is issued.

Returns:
the controller, might be null

request

public void request(DockTitle title)
Creates a new DockableDisplayer.

Parameters:
title - the title that should be shown on the displayer, may be null

getTarget

public Dockable getTarget()
Gets the Dockable which is going to be shown in the DockableDisplayer.

Returns:
the dockable, not null

getParent

public DockStation getParent()
Gets the DockStation which is going to show the DockableDisplayer.

Returns:
the station, not null

getTitle

public DockTitle getTitle()
Gets the title that should be shown on the displayer.

Returns:
the title to show, or null

answer

public void answer(DockableDisplayer displayer)
Sets the DockableDisplayer which should be shown. A valid displayer must meet the following conditions:

Overrides:
answer in class ResourceRequest<DockableDisplayer>
Parameters:
displayer - the new resource or null
Throws:
IllegalStateException - if ResourceRequest.request() was not called
IllegalArgumentException - if displayer is null

executeRequestList

protected void executeRequestList()
Description copied from class: ResourceRequest
Asks all sources for a new resource, needs to stop as soon as one source called ResourceRequest.answer(Object) (this can be queried with ResourceRequest.isAnswered()).

Specified by:
executeRequestList in class ResourceRequest<DockableDisplayer>

validate

protected void validate(DockableDisplayer resource)
Description copied from class: ResourceRequest
Called by ResourceRequest.answer(Object), this method ensure that resource is a valid answer. The method throws an IllegalArgumentException if not.

Specified by:
validate in class ResourceRequest<DockableDisplayer>
Parameters:
resource - the resource to check