How to detect (& notify) that the size of a node has changed [message #536418] |
Fri, 28 May 2010 02:28 |
Eclipse User |
|
|
|
Hi,
I am trying to listen to several changes, which made on one diagram and
to notify the other diagram.
I could easily accomplish the detection of changing the location of a
Node (the x and/or y coordinates). But I have difficulties to detect (I
do not know to and which structure and for what to listen) the changes
in the size of a Node (the width and/or height). Can someone please help me?
Here are more details:
=======================
This is how I get the location and the size of the existing node:
----------------------
Bounds upperLeftPoint = (Bounds) node.getLayoutConstraint();
ILayoutNode size = LayoutService.getInstance().getLayoutNode(node);
int x = upperLeftPoint.getX();
int y = upperLeftPoint.getY();
int width = size.getWidth();
int height = size.getHeight();
----------------------
This is how I listen if a Node was moved:
---------------------- node.getLayoutConstraint().eAdapters().add(
new AdapterImpl() {
public void notifyChanged(Notification notification)
{
Object chagedFeature = notification.getFeature();
if(chagedFeature != null && chagedFeature instanceof EAttribute)
{
EAttribute attribute = (EAttribute)notification.getFeature();
if("x".equals(attribute.getName()))
{
System.out.println("X has changed from '" +
notification.getOldIntValue() + "' to '" +
notification.getNewIntValue() + "'!");
}
if("y".equals(attribute.getName()))
{
System.out.println("Y has changed from '" +
notification.getOldIntValue()+ "' to '" +
notification.getNewIntValue() + "'!");
}
}
}
});
----------------------
How can I listen for size changes? It is not possible to access the
eAdapters() on 'LayoutService.getInstance().getLayoutNode(node)' and
consequently implement an adapter that would listen for size changes.
Can someone please provide info in how to accomplish this?
Tomaz
|
|
|
Powered by
FUDForum. Page generated in 0.03166 seconds