public abstract class DockTitleRequest extends ResourceRequest<DockTitle>
DockTitle
from a DockTitleFactory
.Constructor and Description |
---|
DockTitleRequest(DockStation parent,
Dockable target,
DockTitleVersion version)
Creates a new request.
|
Modifier and Type | Method and Description |
---|---|
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. |
answer, getAnswer, isAnswered, requestNull
public DockTitleRequest(DockStation parent, Dockable target, DockTitleVersion version)
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
public void request()
ResourceRequest
ResourceRequest.answer(Object, Object)
. This method
is made protected, subclasses can expose it, or write another method requiring additional
parameters, that calls this method.request
in class ResourceRequest<DockTitle>
public void install()
ResourceRequest.answer(Object,Object)
may
be called at any time. Please note that installing does not automatically trigger a call
to request()
.public void uninstall()
ResourceRequest.answer(Object, Object)
will no longer happen.public boolean isInstalled()
version
.true
if this request is activepublic Dockable getTarget()
Dockable
for which the title is requested.public DockStation getParent()
null
if the title is shown outside any station.getTarget()
or null
public DockTitleVersion getVersion()
null
protected void executeRequestList()
DockTitle
, stops as soon
as one source called answer(DockTitle)
.executeRequestList
in class ResourceRequest<DockTitle>
public void requestDockTitle(DockTitleRequest request)
request
will be this
, but subclasses may forward the request
to other DockTitleRequest
. The default behavior of this
method is to do nothing.request
- the request to answerpublic void answer(DockTitle title)
title
should be shown. This method
can be called more than once to show different titles.target
of this request must be the same Dockable
as DockTitle.getDockable()
.version
must match the origin
of the title.Dockable.bind(DockTitle)
-method of the target Dockable
before using the title. Note that a client must not call the
bind-method of DockTitle
Dockable.unbind(DockTitle)
-method when he no
longer needs the title. Note that the client must not call the
unbind-method of DockTitle
answer
in class ResourceRequest<DockTitle>
title
- the new title or null
to show no title at allIllegalArgumentException
- if the title does not met the specifications described aboveIllegalStateException
- if request()
is not currently executingprotected void validate(DockTitle resource)
ResourceRequest
ResourceRequest.answer(Object)
, this method ensure that resource
is a valid answer. The method
throws an IllegalArgumentException
if not.validate
in class ResourceRequest<DockTitle>
resource
- the resource to check