Class CmsEditablePositionCalculator

java.lang.Object
org.opencms.ade.editprovider.client.CmsEditablePositionCalculator

This class is used to calculate positions for a set of direct edit buttons so that they don't overlap.

Since:
8.0.0
  • Constructor Details

  • Method Details

    • calculatePositions

      Calculates non-overlapping positions for the button bars and returns them in a map with the element ids as keys.

      Returns:
      the map of non-overlapping positions
    • checkCollision

      protected boolean checkCollision()
      Checks whether a collision occurs and handle it if necessary.

      Returns:
      true if a collision occured
    • handleCollision

      Handles a collision by moving the lower position down.

      Parameters:
      p1 - the first position
      p2 - the second position
    • intersectIntervals

      protected boolean intersectIntervals(int a1, int a2, int b1, int b2)
      Checks for intersection of two one-dimensional intervals.

      Parameters:
      a1 - the left edge of the first interval
      a2 - the right edge of the first interval
      b1 - the left edge of the second interval
      b2 - the right edge of the second interval
      Returns:
      true if the intervals intersect
    • intersectsHorizontally

      Checks whether two positions intersect horizontally.

      Parameters:
      p1 - the first position
      p2 - the second position
      Returns:
      true if the positions intersect horizontally
    • intersectsVertically

      Checks whether two positions intersect vertically.

      Parameters:
      p1 - the first position
      p2 - the second position
      Returns:
      if the positions intersect vertically
    • sortByLeft

      protected void sortByLeft()
      Sorts the internal list of positions by their left edge.