org.eclipse.gmf.runtime.lite.figures
Class SideAffixedElementPositioner

java.lang.Object
  extended by org.eclipse.gmf.runtime.lite.figures.SideAffixedElementPositioner
Direct Known Subclasses:
BorderItemLocator, SideAffixedFeedbackPositioner

public abstract class SideAffixedElementPositioner
extends Object

Defines position for side-affixed elements. Used both for already created elements (by BorderItemLocator and for feedback positioning while creating the element (by SideAffixedLayoutEditPolicy).

Author:
bblajer

Constructor Summary
SideAffixedElementPositioner()
           
 
Method Summary
protected  boolean conflicts(org.eclipse.draw2d.geometry.Rectangle recommendedLocation)
          Determine if the the given rectangle conflicts with the position of an existing borderItemFigure.
static int findClosestSideOfParent(org.eclipse.draw2d.geometry.Rectangle proposedLocation, org.eclipse.draw2d.geometry.Rectangle parentBorder)
          Find the closest side when x,y is inside parent.
 org.eclipse.draw2d.geometry.Dimension getBorderItemOffset()
           
protected abstract  org.eclipse.draw2d.geometry.Dimension getBorderItemSize()
           
protected  org.eclipse.draw2d.geometry.Dimension getGap()
          Returns the gap to introduce if a side-affixed element conflicts to its sibling.
protected abstract  org.eclipse.draw2d.IFigure getHostFigure()
           
protected  org.eclipse.draw2d.geometry.Rectangle getParentBorder()
          Utility to calculate the parent bounds with consideration for the handle bounds inset.
protected abstract  Collection<? extends org.eclipse.draw2d.IFigure> getSiblings()
           
 org.eclipse.draw2d.geometry.Rectangle getValidLocation(org.eclipse.draw2d.geometry.Rectangle proposedLocation)
          Returns the valid location that is as close as possible to the given location.
protected  org.eclipse.draw2d.geometry.Rectangle locateOnBorder(org.eclipse.draw2d.geometry.Rectangle suggestedLocation, int suggestedSide, int circuitCount)
          The preferred side takes precedence.
 void setBorderItemOffset(org.eclipse.draw2d.geometry.Dimension borderItemOffset)
           
protected  void setGap(org.eclipse.draw2d.geometry.Dimension gap)
          Sets the gap to introduce if a side-affixed element conflicts to its sibling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SideAffixedElementPositioner

public SideAffixedElementPositioner()
Method Detail

getBorderItemOffset

public org.eclipse.draw2d.geometry.Dimension getBorderItemOffset()
Returns:
Returns the borderItemOffset.

setBorderItemOffset

public void setBorderItemOffset(org.eclipse.draw2d.geometry.Dimension borderItemOffset)
Parameters:
borderItemOffset - The borderItemOffset to set.

getParentBorder

protected org.eclipse.draw2d.geometry.Rectangle getParentBorder()
Utility to calculate the parent bounds with consideration for the handle bounds inset.

Returns:
Rectangle that is the bounds of the parent.

locateOnBorder

protected final org.eclipse.draw2d.geometry.Rectangle locateOnBorder(org.eclipse.draw2d.geometry.Rectangle suggestedLocation,
                                                                     int suggestedSide,
                                                                     int circuitCount)
The preferred side takes precedence.

Parameters:
suggestedLocation -
suggestedSide -
circuitCount - recursion count to avoid an infinite loop
Returns:
point

conflicts

protected boolean conflicts(org.eclipse.draw2d.geometry.Rectangle recommendedLocation)
Determine if the the given rectangle conflicts with the position of an existing borderItemFigure.

Parameters:
recommendedLocation -
Returns:
true or false

getSiblings

protected abstract Collection<? extends org.eclipse.draw2d.IFigure> getSiblings()

getGap

protected org.eclipse.draw2d.geometry.Dimension getGap()
Returns the gap to introduce if a side-affixed element conflicts to its sibling.


setGap

protected void setGap(org.eclipse.draw2d.geometry.Dimension gap)
Sets the gap to introduce if a side-affixed element conflicts to its sibling.

Parameters:
gap -

getValidLocation

public org.eclipse.draw2d.geometry.Rectangle getValidLocation(org.eclipse.draw2d.geometry.Rectangle proposedLocation)
Returns the valid location that is as close as possible to the given location. The given argument will not be modified.

Parameters:
proposedLocation - proposed location.

findClosestSideOfParent

public static int findClosestSideOfParent(org.eclipse.draw2d.geometry.Rectangle proposedLocation,
                                          org.eclipse.draw2d.geometry.Rectangle parentBorder)
Find the closest side when x,y is inside parent.

Parameters:
proposedLocation -
parentBorder -
Returns:
draw constant

getHostFigure

protected abstract org.eclipse.draw2d.IFigure getHostFigure()

getBorderItemSize

protected abstract org.eclipse.draw2d.geometry.Dimension getBorderItemSize()


Copyright © 2012. All Rights Reserved.