|providing visual feedback depending on state during connection [message #896964]
||Fri, 20 July 2012 14:57
| Henrik Rentz-Reichert
Registered: July 2009
I've tried the new feature with the connection state in eTrice.
I want to highlight ports that can be connected with the port where the connection starts.
Besides that I realized that the connection state wasn't properly implemented for dragging a connection (cf.
https://git.eclipse.org/r/6893) I'm facing further problems.
I want to turn the colors of all ports that can be connected to be shown in green.
This requires a change of the pictogram model and thus has to be done in a write transaction.
I used a RecordingCommand for this purpose.
Now when attachedToSource is called in my AbstractCreateConnectionFeature-derived class I execute this command on the command stack.
(I would have preferred not to put this on the stack but when I call execute directly on the command I receive an exception.)
This works fine, the ports turn green.
But now when the connection is created or the process of connecting is aborted (canceledAttaching/endConnecting) I want to revert
this change and show the ports in their original color.
So I do
But this has no effect. The ports stay green. Maybe it interferes with the creation of the connection?
What would the proper way be to achieve what I want?
|Re: providing visual feedback depending on state during connection [message #902198 is a reply to message #900782]
||Thu, 16 August 2012 10:13
| Rui Domingues
Registered: October 2010
I think this is going to against my need of visual feedback when I'm creating objects.
When I am creating an object I'm drawing some lines in diagram at the place where the object is really going to be placed. (Because I have a restrictive layout) - grid based - but I am not allowed to have "guide dashed"-lines allways in the diagram. My requirement is not to show any lines, unless the user is "creating an object"; In that situation I draw the lines at the right place. This is very tricky, but easily I could layout the lines when "canCreate" is invoked, however, undraw them when creation is cancelled or the mouse goes out of the diagram is difficult.
I got a solution with threads that is working fine (so far), that is when canCreate is not invoked after 2 seconds, one thing out of three happened ( or creation was cancelled, or mouse is out of diagram, or mouse is over diagram with no motion).In this case thread calls layout in order to "erase" the lines.
This is not ideal, but works.
Can you tell me how are you detecting that object creation (not connection) is cancelled or mouse is no longer over diagram?
Thanks. Any solution without threads (actually I use only one thread), is welcome, once I predict this is troubly. My question is how do you proceed to know when color must change, and how are you drawing and undrawing.
Thanks in advance
[Updated on: Thu, 16 August 2012 10:34]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.04252 seconds