How to know the position of an element which placed on the edge of a parent element? [message #664508] |
Sun, 10 April 2011 10:02 |
Rahma Messages: 7 Registered: February 2011 |
Junior Member |
|
|
Hi everyone,
I have a DataPort (having the property Affixed Parent Side is NSEW) which placed on the edge of an other element called "systemFeatures" . I want to know the current position of the DataPort, what is the method allows to know the current position of the DataPort?
In the DataPortEditPart, I find the Method in which I try to call my method setPosition that have a parameter represent the current position of the DataPort:
protected void addBorderItem(IFigure borderItemContainer,
IBorderItemEditPart borderItemEditPart) {
if (borderItemEditPart instanceof DataPortNameEditPart) {
BorderItemLocator locator = new
BorderItemLocator(getMainFigure(),
PositionConstants.SOUTH);
locator.setBorderItemOffset(new Dimension(-20, -20));
borderItemContainer.add(borderItemEditPart.getFigure(), locator);
// I call the method setPosition of ModelerPortFigure
((DataPortFigure) primaryShape).setPosition(locator.getCurrentSideOfParent());
} else {
super.addBorderItem(borderItemContainer, borderItemEditPart);
}
}
I try to use locator.getCurrentSideOfParent() but it isn't work
Thanks in advance.
|
|
|
Powered by
FUDForum. Page generated in 0.02946 seconds