|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator
BorderItemLocator works closely with border items in determining position. BorderItemLocators use a figure as the bounds around which the borderItemFigure can be placed. This figure may not necessarily be the main figure.
BorderItemLocator allows intial placement ( N/W/S/E ) and is used in conjunction with BorderItemSelectionEditPolicy for feedback.
Collision detection is provided so that border items cannot overlap and therefore be hidden.
Border item movement is restricted along border of bordered shape.
| Constructor Summary | |
BorderItemLocator(IFigure parentFigure)
The preferred side determines placement of figure. |
|
BorderItemLocator(IFigure borderItem,
IFigure parentFigure,
Rectangle constraint)
The preferred location overrides the preferred side. |
|
BorderItemLocator(IFigure parentFigure,
int preferredSide)
The preferred side determines placement of figure. |
|
| Method Summary | |
static int |
findClosestSideOfParent(Rectangle proposedLocation,
Rectangle parentBorder)
Find the closest side when x,y is inside parent. |
protected Point |
getAbsoluteToBorder(Point ptRelativeOffset)
Convert the relative coords in the model to ones that are Relative to the container (absolute in respect to the main figure) |
Dimension |
getBorderItemOffset()
|
protected Rectangle |
getConstraint()
Accessor to return the constraint location of the border item. |
int |
getCurrentSideOfParent()
Returns the side of the parent figure on which the border item is currently on. |
protected Rectangle |
getParentBorder()
Utility to calculate the parent bounds with consideration for the handle bounds inset. |
IFigure |
getParentFigure()
getter for the parent figure |
protected Point |
getPreferredLocation(IFigure borderItem)
Get the preferred location. |
protected Point |
getPreferredLocation(int side,
IFigure borderItem)
Get an initial location based on the side. ( choose middle of the side ) |
int |
getPreferredSideOfParent()
Returns the preferred side of the parent figure on which to place this border item. |
Rectangle |
getValidLocation(Rectangle proposedLocation,
IFigure borderItem)
Returns a suitable location for the border item given a proposed location. |
void |
relocate(IFigure borderItem)
|
void |
setBorderItemOffset(Dimension borderItemOffset)
|
void |
setConstraint(Rectangle theConstraint)
Sets the constraint for the location of this border item. |
void |
setCurrentSideOfParent(int side)
Sets the side of the parent figure on which the border item should appear. |
void |
setPreferredSideOfParent(int preferredSide)
Sets the preferred side of the parent figure on which to place this border item. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BorderItemLocator(IFigure parentFigure)
parentFigure -
public BorderItemLocator(IFigure parentFigure,
int preferredSide)
parentFigure - preferredSide - the preferred side of the parent figure on which to place this
border item as defined in PositionConstants
public BorderItemLocator(IFigure borderItem,
IFigure parentFigure,
Rectangle constraint)
parentFigure - constraint - | Method Detail |
protected Rectangle getConstraint()
public void setConstraint(Rectangle theConstraint)
IBorderItemLocator
setConstraint in interface IBorderItemLocatortheConstraint - the position and optionally sizeprotected Point getPreferredLocation(IFigure borderItem)
protected Rectangle getParentBorder()
Rectangle that is the bounds of the parent.
protected Point getPreferredLocation(int side,
IFigure borderItem)
side - the preferred side of the parent figure on which to place this
border item as defined in PositionConstants
protected Point getAbsoluteToBorder(Point ptRelativeOffset)
ptRelativeOffset -
public Rectangle getValidLocation(Rectangle proposedLocation,
IFigure borderItem)
IBorderItemLocatorFor example, if the border item is restricted to being on the border of its parent shape, when the user attempts to move the border item outside the border of the parent shape (the proposed location), the feedback will always show the border item on the border. In this case, this method would return a location on the border close to the proposed location.
getValidLocation in interface IBorderItemLocatorproposedLocation - a proposed location and optionally sizeborderItem - the border item in question
public static int findClosestSideOfParent(Rectangle proposedLocation,
Rectangle parentBorder)
proposedLocation - parentBorder -
public void relocate(IFigure borderItem)
relocate in interface Locatorpublic IFigure getParentFigure()
IFigurepublic Dimension getBorderItemOffset()
public void setBorderItemOffset(Dimension borderItemOffset)
borderItemOffset - The borderItemOffset to set.public int getPreferredSideOfParent()
PositionConstantspublic void setPreferredSideOfParent(int preferredSide)
preferredSide - the preferred side of the parent figure on which to place this
border item as defined in PositionConstantspublic int getCurrentSideOfParent()
IBorderItemLocator
getCurrentSideOfParent in interface IBorderItemLocatorPositionConstantspublic void setCurrentSideOfParent(int side)
side - the side on which this border item appears as defined in
PositionConstants
|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.