Class FullLockConflictResolver

All Implemented Interfaces:
ConflictResolver<RequestDimension>

public class FullLockConflictResolver extends DefaultConflictResolver<RequestDimension>
This ConflictResolver has a alternative strategy how to handle cases where two requests collide and a satisfying solution is not possible: the two affected trees are checked for their "fully locked state" and if one is fully locked but not the other, then the request of the fully locked one is answered. Fully locked means that each child of some node has a request.
Author:
Benjamin Sigg
  • Constructor Details

    • FullLockConflictResolver

      public FullLockConflictResolver()
  • Method Details

    • resolveHorizontal

      public double resolveHorizontal(ResizeNode<RequestDimension> 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<RequestDimension>
      Overrides:
      resolveHorizontal in class DefaultConflictResolver<RequestDimension>
      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<RequestDimension> 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<RequestDimension>
      Overrides:
      resolveVertical in class DefaultConflictResolver<RequestDimension>
      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
    • checkHorizontalFullLock

      protected boolean checkHorizontalFullLock(ResizeElement<RequestDimension> element)
      Checks whether element is fully locked in its horizontal dimension. Fully locked means that:
      • if element is a node: its children have both requests for a change in width and its children are also fully locked
      • if element is a leaf: it has a resize request for the width
      • in any other case: true
      Parameters:
      element - the element to check
      Returns:
      true if the horizontal dimension has very high priority for this node, false otherwise
    • checkVerticalFullLock

      protected boolean checkVerticalFullLock(ResizeElement<RequestDimension> element)
      Checks whether element is fully locked in its vertical dimension. Fully locked means that:
      • if element is a node: its children have both requests for a change in height and its children are also fully locked
      • if element is a leaf: it has a resize request for the height
      • in any other case: true
      Parameters:
      element - the element to check
      Returns:
      true if the vertical dimension has very high priority for this node, false otherwise