bibliothek.gui.dock.layout.location
Class DefaultAsideRequest

java.lang.Object
  extended by bibliothek.gui.dock.layout.location.DefaultAsideRequest
All Implemented Interfaces:
AsideRequest

public class DefaultAsideRequest
extends Object
implements AsideRequest

The default implementation of an AsideRequest, it does not modify any properties or layouts.

Author:
Benjamin Sigg

Nested Class Summary
protected static class DefaultAsideRequest.CombinerForward
          An adapter mapping Combiner to DefaultAsideRequest.Forward.
protected static class DefaultAsideRequest.DockStationForward
          An adapter mapping DockStation to DefaultAsideRequest.Forward.
protected static interface DefaultAsideRequest.Forward
          All the information required to create a new request and forward the call to a new DockStation or Combiner.
 
Field Summary
 
Fields inherited from interface bibliothek.gui.dock.layout.location.AsideRequest
REQUEST_FACTORY
 
Constructor Summary
DefaultAsideRequest(DockableProperty location, Path placeholder)
          Creates a new AsideRequest
 
Method Summary
 void answer()
          Shortcut for calling AsideRequest.answer(DockableProperty) with a value of null.
 void answer(DockableProperty location)
          Sets the result of this request, location will be merged with other results from the parent and children stations using the successor property.
 void answer(DockableProperty location, PlaceholderMap station)
          Sets the result of this request, and tells how the layout of a non-existent stations looks after the request has been handled.
 void answer(PlaceholderMap station)
          Tells this request how the layout of a non-existent station looks after the request has been handled.
protected  DefaultAsideRequest createForwardRequest(DockableProperty location)
          Creates a new AsideRequest which is used to examine the next child DockStation.
protected  AsideAnswer execute()
          Makes a call to DockStation.aside(AsideRequest) or Combiner.aside(AsideRequest).
 AsideAnswer execute(DockStation station)
          Executes this request calling the aside method of station.
 AsideAnswer forward(Combiner combiner)
          Calls the Combiner.aside(AsideRequest) method of combiner with the successor of the current location.
 AsideAnswer forward(Combiner combiner, PlaceholderMap layout)
          Calls the Combiner.aside(AsideRequest) method of combiner with the successor of the current location.
protected  AsideAnswer forward(DefaultAsideRequest.Forward forward)
           
 AsideAnswer forward(DockStation station)
          Calls the DockStation.aside(AsideRequest) method of station with the successor of the current location.
 PlaceholderMap getLayout()
          Gets the layout of the current non-existent station.
 DockableProperty getLocation()
          Gets the old location, the location whose neighbor is searched.
 DockStation getParentStation()
          Gets the DockStation that is the parent of the current DockStation or Combiner.
 Path getPlaceholder()
          The placeholder that should be used for the new location.
protected  void setCurrent(DefaultAsideRequest.Forward current)
          Sets all the information required to process a DockStation or Combiner.
protected  void setParentStation(DockStation parent)
          Sets the result of getParentStation().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAsideRequest

public DefaultAsideRequest(DockableProperty location,
                           Path placeholder)
Creates a new AsideRequest

Parameters:
location - the location of an existing Dockable, must not be null
placeholder - the unique identifier of the Dockable to insert, the algorithms work much better if this arguments is not null
Method Detail

createForwardRequest

protected DefaultAsideRequest createForwardRequest(DockableProperty location)
Creates a new AsideRequest which is used to examine the next child DockStation.

Parameters:
location - the location on the child station
Returns:
the new aside request, must not be null nor this

getLocation

public DockableProperty getLocation()
Description copied from interface: AsideRequest
Gets the old location, the location whose neighbor is searched. The property may have a successor.

Specified by:
getLocation in interface AsideRequest
Returns:
the old location, can be null

getPlaceholder

public Path getPlaceholder()
Description copied from interface: AsideRequest
The placeholder that should be used for the new location.

Specified by:
getPlaceholder in interface AsideRequest
Returns:
the placeholder, may be null

getLayout

public PlaceholderMap getLayout()
Description copied from interface: AsideRequest
Gets the layout of the current non-existent station. The layout is only set in situations where no DockStation is available, and it is only set if it is known.

Specified by:
getLayout in interface AsideRequest
Returns:
the layout as it was created by DockStation.getPlaceholders(), null if not known or not necessary

getParentStation

public DockStation getParentStation()
Description copied from interface: AsideRequest
Gets the DockStation that is the parent of the current DockStation or Combiner.

Specified by:
getParentStation in interface AsideRequest
Returns:
the parent station, may be null either for a root station or if the recursion of Combiners is too high

setParentStation

protected void setParentStation(DockStation parent)
Sets the result of getParentStation().

Parameters:
parent - the DockStation that should be used as parent station

answer

public void answer()
Description copied from interface: AsideRequest
Shortcut for calling AsideRequest.answer(DockableProperty) with a value of null.

Specified by:
answer in interface AsideRequest

answer

public void answer(DockableProperty location)
Description copied from interface: AsideRequest
Sets the result of this request, location will be merged with other results from the parent and children stations using the successor property. If location already has a successor, then the successor of the last DockableProperty in the chain may be modified by this method.
By not calling this method at all, clients can tell the action that no "neighbor" location was found, in this case the request will be cancled. Note how "not calling" and "calling with null" are two different things.

Specified by:
answer in interface AsideRequest
Parameters:
location - the location describing the "neighbor" of DockableProperty, a value of null indicates that the parent and child request should be merged directly

answer

public void answer(PlaceholderMap station)
Description copied from interface: AsideRequest
Tells this request how the layout of a non-existent station looks after the request has been handled. Calling this method with a value of null indicates that there will be no layout after the request finished. Not calling the method at all indicates that the current layout is not affected.
Note that calling this method does not change the result of AsideRequest.getLayout().

Specified by:
answer in interface AsideRequest
Parameters:
station - the new layout, can be null

answer

public void answer(DockableProperty location,
                   PlaceholderMap station)
Description copied from interface: AsideRequest
Sets the result of this request, and tells how the layout of a non-existent stations looks after the request has been handled. The arguments can be null, as described in AsideRequest.answer(DockableProperty) and AsideRequest.answer(PlaceholderMap).

Specified by:
answer in interface AsideRequest
Parameters:
location - the location describing the "neighbor" of DockableProperty, a value of null indicates that the parent and child request should be merged directly
station - the new layout, can be null

setCurrent

protected void setCurrent(DefaultAsideRequest.Forward current)
Sets all the information required to process a DockStation or Combiner.

Parameters:
current - the current item to work with

execute

public AsideAnswer execute(DockStation station)
Description copied from interface: AsideRequest
Executes this request calling the aside method of station.

Specified by:
execute in interface AsideRequest
Parameters:
station - the station whose aside method is to be called
Returns:
a new location

execute

protected AsideAnswer execute()
Makes a call to DockStation.aside(AsideRequest) or Combiner.aside(AsideRequest). This method should be called only once.

Returns:
the location and layout of the Dockable that is to be inserted

forward

public AsideAnswer forward(DockStation station)
Description copied from interface: AsideRequest
Calls the DockStation.aside(AsideRequest) method of station with the successor of the current location. The aside method is called in any case, even if the current location is null or has no successor.

Specified by:
forward in interface AsideRequest
Parameters:
station - the station on which to continue the request
Returns:
how station reacted to the request

forward

public AsideAnswer forward(Combiner combiner)
Description copied from interface: AsideRequest
Calls the Combiner.aside(AsideRequest) method of combiner with the successor of the current location. The aside method is called in any case, even if the current location is null or has no successor.

Specified by:
forward in interface AsideRequest
Parameters:
combiner - the non-existent station on which to continue the request
Returns:
how combiner reacted to the request

forward

public AsideAnswer forward(Combiner combiner,
                           PlaceholderMap layout)
Description copied from interface: AsideRequest
Calls the Combiner.aside(AsideRequest) method of combiner with the successor of the current location. The aside method is called in any case, even if the current location is null or has no successor.

Specified by:
forward in interface AsideRequest
Parameters:
combiner - the non-existent station on which to continue the request
layout - the layout of the non-existent station, as was created by DockStation.getPlaceholders(). Can be null in which case this method behaves like AsideRequest.forward(Combiner)
Returns:
how combiner reacted to the request

forward

protected AsideAnswer forward(DefaultAsideRequest.Forward forward)