|
Re: Move connected elements together to hold initial position of creation [message #1714789 is a reply to message #1714448] |
Mon, 16 November 2015 16:50 |
V Set Messages: 20 Registered: November 2012 |
Junior Member |
|
|
I resolved this using handleNotificationEvent in both R1EditPart and R2EditPart. R1 sets the 'Location' for R2 by getting the target from the sourceEdge. R2 uses the eventType notification.SET to call refreshBounds.
Tips for getting this.
In R1EditPart handleNotificationEvent(Notification event)
if (event.eventType == Notification.SET)
if (event.getNotifier() instanceof Bounds)
//notifier will have the x and y values.
Bounds notifier = (Bounds) event.getNotifier()
//get the target (R2) from the sourceEdges
edges = ((Node)notifier.eContainer().getSourceEdges()
for (Edge edge: edges)
if edge.getType = xxxx
//Get R2 View
View targetView = (View)edge.getTarget()
Node target = (Node)targetView
//create new location using the values from notifier
Location loc = NotationFactory.eInstance.createLocation();
location.setX(notifier.getX()); location.setY(notifier.getY());
target.setLayoutConstraint(location);
In R2EditPart handleNotificationEvent(Notification event)
if (event.eventType == Notification.SET)
//the location is already set in the node. Just refresh
refreshBounds()
Hope this helps somebody
V Set
[Updated on: Mon, 16 November 2015 17:57] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02351 seconds