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

java.lang.Object
  extended by org.eclipse.gmf.runtime.lite.figures.SideAffixedElementPositioner
      extended by org.eclipse.gmf.runtime.lite.figures.BorderItemLocator
All Implemented Interfaces:
org.eclipse.draw2d.Locator

public class BorderItemLocator
extends SideAffixedElementPositioner
implements org.eclipse.draw2d.Locator


Constructor Summary
BorderItemLocator(org.eclipse.gef.GraphicalEditPart editPart)
          Constructs an instance of BorderItemLocator.
 
Method Summary
protected  org.eclipse.draw2d.geometry.Dimension getBorderItemSize()
          Gets the size of the border item figure.
 int getCurrentSideOfParent()
           
 org.eclipse.draw2d.IFigure getHostFigure()
          getter for the parent figure
 org.eclipse.draw2d.geometry.Rectangle getModelConstraint()
           
protected  org.eclipse.draw2d.geometry.Rectangle getPreferredLocation()
          Get the preferred location.
protected  org.eclipse.draw2d.geometry.Rectangle getPreferredLocation(int side)
          Get an initial location based on the side.
 int getPreferredSideOfParent()
          Returns the preferred side of the parent figure on which to place this border item.
protected  Collection<? extends org.eclipse.draw2d.IFigure> getSiblings()
           
protected  org.eclipse.draw2d.IFigure getTargetFigure()
           
 void relocate(org.eclipse.draw2d.IFigure borderItem)
           
 void setCurrentSideOfParent(int side)
          Sets the side of the parent figure on which the border item should appear.
 void setModelConstraint(org.eclipse.draw2d.geometry.Rectangle rectangle)
           
 void setPreferredSideOfParent(int preferredSide)
          Sets the preferred side of the parent figure on which to place this border item.
 org.eclipse.draw2d.geometry.Rectangle toContainerCoordinates(org.eclipse.draw2d.geometry.Rectangle relativeOffset)
          Convert the relative coordinates in the model to ones that are relative to the container.
 
Methods inherited from class org.eclipse.gmf.runtime.lite.figures.SideAffixedElementPositioner
conflicts, findClosestSideOfParent, getBorderItemOffset, getGap, getParentBorder, getValidLocation, locateOnBorder, setBorderItemOffset, setGap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BorderItemLocator

public BorderItemLocator(org.eclipse.gef.GraphicalEditPart editPart)
Constructs an instance of BorderItemLocator.

Parameters:
editPart - the side affixed edit part
Method Detail

setModelConstraint

public void setModelConstraint(org.eclipse.draw2d.geometry.Rectangle rectangle)

getTargetFigure

protected final org.eclipse.draw2d.IFigure getTargetFigure()

getModelConstraint

public org.eclipse.draw2d.geometry.Rectangle getModelConstraint()

getPreferredLocation

protected org.eclipse.draw2d.geometry.Rectangle getPreferredLocation()
Get the preferred location. If none has been previously set, use the preferred side to take an initial guess.

Returns:
Rectangle A new rectangle representing the preferred location.

getPreferredLocation

protected org.eclipse.draw2d.geometry.Rectangle getPreferredLocation(int side)
Get an initial location based on the side. ( choose middle of the side )

Parameters:
side - the preferred side of the parent figure on which to place this border item as defined in PositionConstants
Returns:
point

toContainerCoordinates

public org.eclipse.draw2d.geometry.Rectangle toContainerCoordinates(org.eclipse.draw2d.geometry.Rectangle relativeOffset)
Convert the relative coordinates in the model to ones that are relative to the container. This is an auxiliary method.

Parameters:
relativeOffset -
Returns:
point

relocate

public void relocate(org.eclipse.draw2d.IFigure borderItem)
Specified by:
relocate in interface org.eclipse.draw2d.Locator

getHostFigure

public org.eclipse.draw2d.IFigure getHostFigure()
getter for the parent figure

Specified by:
getHostFigure in class SideAffixedElementPositioner
Returns:
IFigure

getPreferredSideOfParent

public int getPreferredSideOfParent()
Returns the preferred side of the parent figure on which to place this border item.

Returns:
the preferred side of the parent figure on which to place this border item as defined in PositionConstants

setPreferredSideOfParent

public void setPreferredSideOfParent(int preferredSide)
Sets the preferred side of the parent figure on which to place this border item.

Parameters:
preferredSide - the preferred side of the parent figure on which to place this border item as defined in PositionConstants

getCurrentSideOfParent

public int getCurrentSideOfParent()

setCurrentSideOfParent

public void setCurrentSideOfParent(int side)
Sets the side of the parent figure on which the border item should appear.

Parameters:
side - the side on which this border item appears as defined in PositionConstants

getBorderItemSize

protected org.eclipse.draw2d.geometry.Dimension getBorderItemSize()
Gets the size of the border item figure.

Specified by:
getBorderItemSize in class SideAffixedElementPositioner
Parameters:
borderItem -
Returns:
the size of the border item figure.

getSiblings

protected Collection<? extends org.eclipse.draw2d.IFigure> getSiblings()
Specified by:
getSiblings in class SideAffixedElementPositioner


Copyright © 2012. All Rights Reserved.