Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to detect (& notify) that the size of a node has changed
How to detect (& notify) that the size of a node has changed [message #536418] Fri, 28 May 2010 06:28
TL is currently offline TLFriend
Messages: 22
Registered: July 2009
Junior Member
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
Previous Topic:Keeping contents of two nodes synchronized
Next Topic:EditHelperAdvice not triggered
Goto Forum:
  


Current Time: Sat May 18 16:16:04 GMT 2024

Powered by FUDForum. Page generated in 0.03983 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top