bibliothek.gui.dock.title
Class DockTitleRequest

java.lang.Object
  extended by bibliothek.gui.dock.util.ResourceRequest<DockTitle>
      extended by bibliothek.gui.dock.title.DockTitleRequest

public abstract class DockTitleRequest
extends ResourceRequest<DockTitle>

Set of information and callback used to obtain a DockTitle from a DockTitleFactory.

Author:
Benjamin Sigg

Constructor Summary
DockTitleRequest(DockStation parent, Dockable target, DockTitleVersion version)
          Creates a new request.
 
Method Summary
 void answer(DockTitle title)
          Informs this request that title should be shown.
protected  void executeRequestList()
          Asks all sources for a DockTitle, stops as soon as one source called answer(DockTitle).
 DockStation getParent()
          Gets the station that will show the title.
 Dockable getTarget()
          Gets the Dockable for which the title is requested.
 DockTitleVersion getVersion()
          Gets the usage of the new title.
 void install()
          Makes this request active.
 boolean isInstalled()
          Tells whether this request is currently installed on its version.
 void request()
          Asks for a new resource and may trigger ResourceRequest.answer(Object, Object).
 void requestDockTitle(DockTitleRequest request)
          May answer a request for a title.
 void uninstall()
          Makes this request inactive, calls to ResourceRequest.answer(Object, Object) will no longer happen.
protected  void validate(DockTitle 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, requestNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockTitleRequest

public DockTitleRequest(DockStation parent,
                        Dockable target,
                        DockTitleVersion version)
Creates a new request.

Parameters:
parent - the element which will show the title, can be null
target - the element for which the title will be shown, not null
version - what kind of title is requested, not null
Method Detail

request

public void request()
Description copied from class: ResourceRequest
Asks for a new resource and may trigger ResourceRequest.answer(Object, Object). This method is made protected, subclasses can expose it, or write another method requiering additional parameters, that calls this method.

Overrides:
request in class ResourceRequest<DockTitle>

install

public void install()
Makes this request active. After installation the method ResourceRequest.answer(Object,Object) may be called anytimes. Please note that installing does not automatically trigger a call to request().


uninstall

public void uninstall()
Makes this request inactive, calls to ResourceRequest.answer(Object, Object) will no longer happen.


isInstalled

public boolean isInstalled()
Tells whether this request is currently installed on its version.

Returns:
true if this request is active

getTarget

public Dockable getTarget()
Gets the Dockable for which the title is requested.

Returns:
the target element

getParent

public DockStation getParent()
Gets the station that will show the title. The result might be null if the title is shown outside any station.

Returns:
the parent of getTarget() or null

getVersion

public DockTitleVersion getVersion()
Gets the usage of the new title.

Returns:
the usage, not null

executeRequestList

protected void executeRequestList()
Asks all sources for a DockTitle, stops as soon as one source called answer(DockTitle).

Specified by:
executeRequestList in class ResourceRequest<DockTitle>

requestDockTitle

public void requestDockTitle(DockTitleRequest request)
May answer a request for a title. Normally request will be this, but subclasses may forward the request to other DockTitleRequest. The default behavior of this method is to do nothing.

Parameters:
request - the request to answer

answer

public void answer(DockTitle title)
Informs this request that title should be shown. This method can be called more than once to show different titles.
An answer must fulfill some rules:

Overrides:
answer in class ResourceRequest<DockTitle>
Parameters:
title - the new title or null to show no title at all
Throws:
IllegalArgumentException - if the title does not met the specifications described above
IllegalStateException - if request() is not currently executing

validate

protected void validate(DockTitle 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<DockTitle>
Parameters:
resource - the resource to check