bibliothek.gui.dock.facile.station.split
Class DefaultConflictResolver<T>

java.lang.Object
  extended by bibliothek.gui.dock.facile.station.split.DefaultConflictResolver<T>
All Implemented Interfaces:
ConflictResolver<T>
Direct Known Subclasses:
FullLockConflictResolver

public class DefaultConflictResolver<T>
extends Object
implements ConflictResolver<T>

A conflict resolver that tries to distribute space in conflicts equally to all parties

Author:
Benjamin Sigg

Constructor Summary
DefaultConflictResolver()
           
 
Method Summary
 ResizeRequest requestHorizontal(ResizeRequest left, ResizeRequest right, ResizeNode<T> node)
          Combines the two request left and right into a new request.
 ResizeRequest requestVertical(ResizeRequest top, ResizeRequest bottom, ResizeNode<T> node)
          Combines the two requests top and bottom into a new request.
 double resolveHorizontal(ResizeNode<T> node, ResizeRequest left, double deltaLeft, ResizeRequest right, double deltaRight)
          Called whenever a node has to grant two resize requests at the same time.
 double resolveVertical(ResizeNode<T> node, ResizeRequest top, double deltaTop, ResizeRequest bottom, double deltaBottom)
          Called whenever a node has to grant two resize requests at the same time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConflictResolver

public DefaultConflictResolver()
Method Detail

requestHorizontal

public ResizeRequest requestHorizontal(ResizeRequest left,
                                       ResizeRequest right,
                                       ResizeNode<T> node)
Description copied from interface: ConflictResolver
Combines the two request left and right into a new request.

Specified by:
requestHorizontal in interface ConflictResolver<T>
Parameters:
left - the request from the left, can be null
right - the request from the right, can be null
node - the node for which the requests have to be merged
Returns:
a new request that somehow represents left and right or null to cancel the requests

requestVertical

public ResizeRequest requestVertical(ResizeRequest top,
                                     ResizeRequest bottom,
                                     ResizeNode<T> node)
Description copied from interface: ConflictResolver
Combines the two requests top and bottom into a new request.

Specified by:
requestVertical in interface ConflictResolver<T>
Parameters:
top - the request from the top, can be null
bottom - the request from the bottom, can be null
node - the node for which the requests have to be merged
Returns:
a new request that somehow represents top and bottom or null to cancel the requests

resolveHorizontal

public double resolveHorizontal(ResizeNode<T> node,
                                ResizeRequest left,
                                double deltaLeft,
                                ResizeRequest right,
                                double deltaRight)
Description copied from interface: ConflictResolver
Called whenever a node has to grant two resize requests at the same time.

Specified by:
resolveHorizontal in interface ConflictResolver<T>
Parameters:
node - the node at which a conflict occurred
left - the request from the left child
deltaLeft - how much the left child would move the divider
right - the request from the right child
deltaRight - how much the right child would move the divider
Returns:
how much the divider should be moved

resolveVertical

public double resolveVertical(ResizeNode<T> node,
                              ResizeRequest top,
                              double deltaTop,
                              ResizeRequest bottom,
                              double deltaBottom)
Description copied from interface: ConflictResolver
Called whenever a node has to grant two resize requests at the same time.

Specified by:
resolveVertical in interface ConflictResolver<T>
Parameters:
node - the node at which a conflict occurred
top - the request from the top child
deltaTop - how much the top child would move the divider
bottom - the request from the bottom child
deltaBottom - how much the bottom child would move the divider
Returns:
how much the divider should be moved