public class CmsEditablePositionCalculator
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
protected class |
CmsEditablePositionCalculator.LeftComparator
A comparator class which compares position beans by their left edge.
|
构造器和说明 |
---|
CmsEditablePositionCalculator(java.util.Map<java.lang.String,CmsPositionBean> positions)
Creates a new instance.
|
限定符和类型 | 方法和说明 |
---|---|
java.util.Map<java.lang.String,CmsPositionBean> |
calculatePositions()
Calculates non-overlapping positions for the button bars and returns them in a map with
the element ids as keys.
|
protected boolean |
checkCollision()
Checks whether a collision occurs and handle it if necessary.
|
protected void |
handleCollision(CmsPositionBean p1,
CmsPositionBean p2)
Handles a collision by moving the lower position down.
|
protected boolean |
intersectIntervals(int a1,
int a2,
int b1,
int b2)
Checks for intersection of two one-dimensional intervals.
|
protected boolean |
intersectsHorizontally(CmsPositionBean p1,
CmsPositionBean p2)
Checks whether two positions intersect horizontally.
|
protected boolean |
intersectsVertically(CmsPositionBean p1,
CmsPositionBean p2)
Checks whether two positions intersect vertically.
|
protected void |
sortByLeft()
Sorts the internal list of positions by their left edge.
|
public CmsEditablePositionCalculator(java.util.Map<java.lang.String,CmsPositionBean> positions)
positions
- the map of original positions by element id (will not be altered)public java.util.Map<java.lang.String,CmsPositionBean> calculatePositions()
protected boolean checkCollision()
protected void handleCollision(CmsPositionBean p1, CmsPositionBean p2)
p1
- the first positionp2
- the second positionprotected boolean intersectIntervals(int a1, int a2, int b1, int b2)
a1
- the left edge of the first intervala2
- the right edge of the first intervalb1
- the left edge of the second intervalb2
- the right edge of the second intervalprotected boolean intersectsHorizontally(CmsPositionBean p1, CmsPositionBean p2)
p1
- the first positionp2
- the second positionprotected boolean intersectsVertically(CmsPositionBean p1, CmsPositionBean p2)
p1
- the first positionp2
- the second positionprotected void sortByLeft()