Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Force Connection refresh/redraw(Force a redraw/update of the connection)
Force Connection refresh/redraw [message #1230352] Sat, 11 January 2014 19:07 Go to next message
Sebastian Hochgatterer is currently offline Sebastian HochgattererFriend
Messages: 9
Registered: October 2013
Junior Member
hey

I have problem to understand the binding, between EMF "change listeners" and update features.
I have a parent element which can be connected to other parent elements, each parent have childs.
The ConnectionDeclaration shows the the child-names of the source (parent)
Example.: SParent-----child1,child2-------TParent

I implement an Updatefeature, which recognized if a new child is added (emf model transaction). This works fine. The problem is, if I rename a child, the editor doesn't notify the change (emf change), and wouldn't update the view.

However, if I clicked on the connection the the UpdateFeature, shows me that an update is needed (red lines).

The Question is can I force an update, when I'm editing the children's name of a parent with a propertysheet?. (E.g.: source.getConnection().refresh()).

Thx, for your help!

[Updated on: Sat, 11 January 2014 22:31]

Report message to a moderator

Re: Connection forcing refresh/redraw [message #1231007 is a reply to message #1230352] Mon, 13 January 2014 15:41 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1921
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Sebastian,

not sure, but I gues what's missing here is a reference from the graphical
representation to the domain model object. Graphiti has an EMF change
listener registered that should be triggered on the rename (I assume this is
a change on the EMF model only). I case such a change is done, Graphiti
checks if the changed object is anyhow linked to a representation on the
diagram. In case there is such a link the diagram will be updated, otherwise
not.

There's also a way to force the update (DiagramBehavior.refresh(),
refreshContent()), but I think you should first investigate on the above
mentioned link.

Michael
Re: Connection forcing refresh/redraw [message #1231084 is a reply to message #1231007] Mon, 13 January 2014 19:52 Go to previous messageGo to next message
Sebastian Hochgatterer is currently offline Sebastian HochgattererFriend
Messages: 9
Registered: October 2013
Junior Member
thx Michael for your quick reply!

I found the problem hopefully, but I haven't got a solution yet.

The problem is that the connection is linked with Object A. When I edit the properties I modify the Object B, which is a containment of Object A. Can this indirect modification be a problem?
How I can forward the changes, that the parent object recognized them?
Should I add a adapter to object B and A, with notifychanges?

Sorry I'm very new in EMF and Graphiti!


regards
sebastian



Re: Connection forcing refresh/redraw [message #1232205 is a reply to message #1231084] Thu, 16 January 2014 12:39 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1921
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Sebastian,

that is the reason for the missing update. Containment relations are not
checked.

I see several options how to solve this:
1) Adding an adapter on EMF level is possible but would be rather low level.
I would not recommend that
2) You may link the connection also to object B. Then you will get update
notifications, but this might have some side-effect on other features you
built.
3) Youcould an in the update feature for A a delegation to the update
feature for B, if you detect a change in that property.

Not sure what is best in your scenario though...

Michael
Re: Connection forcing refresh/redraw [message #1235812 is a reply to message #1232205] Sat, 25 January 2014 10:49 Go to previous message
Sebastian Hochgatterer is currently offline Sebastian HochgattererFriend
Messages: 9
Registered: October 2013
Junior Member
thx for your reply,

Finally I chose the first option, because it is wired.
The Model recognized the change and mark it with the red line.
When I force a manual update(rightclick update, ctr+f5)...it works fine Sad



Previous Topic:Create new element and prefill it
Next Topic:Draw Dashed Line for connections
Goto Forum:
  


Current Time: Tue Aug 04 09:19:38 GMT 2020

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

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

Back to the top