Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » GraphicalNodeEditPolicy question
GraphicalNodeEditPolicy question [message #226684] Mon, 20 November 2006 22:34 Go to next message
Eclipse UserFriend
Originally posted by: aleksandr_kravets.iwaysoftware.com

Hello,

I have a GraphicalNodeEditPolicy installed for my EditPart. I implement
getConnectionCreateCommand() method in my class to check if figure
initiating connection is valid. The validation works, but too early -
when I hover over the figure. Does anyone know how to initiate
validation when the figure is clicked on?

thanks,
Alex
Re: GraphicalNodeEditPolicy question [message #226692 is a reply to message #226684] Mon, 20 November 2006 22:56 Go to previous messageGo to next message
Andreas Walter is currently offline Andreas WalterFriend
Messages: 8
Registered: July 2009
Junior Member
Aleksandr Kravets schrieb:
> Hello,
>
> I have a GraphicalNodeEditPolicy installed for my EditPart. I implement
> getConnectionCreateCommand() method in my class to check if figure
> initiating connection is valid. The validation works, but too early -
> when I hover over the figure. Does anyone know how to initiate
> validation when the figure is clicked on?
>
> thanks,
> Alex

As far as I know, this is the intended behaviour. When the figure is
hovered over, the command created in getConnectionCreateCommand() is
stored in the CreateConnectionRequest. If the figure is clicked, the
second part of establishing of a connection, namely completing it, is
initiated. From the moment on when the figure is clicked, the EditPart
targeted by the mouse answers with a 'complete' connection command, but
to be able to do that, the first part of the command must already be
created before clicking the figure. So, validation if the figure
pointed at by the mouse represents a valid connection source has to
happen before it is clicked. If the figure doesn't represent a valid
connection source, it's EditPart has to answer with an unexecutable command.

Greetings,
Andreas
Re: GraphicalNodeEditPolicy question [message #226699 is a reply to message #226692] Mon, 20 November 2006 23:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aleksandr_kravets.iwaysoftware.com

Andreas Walter wrote:
> Aleksandr Kravets schrieb:
>> Hello,
>>
>> I have a GraphicalNodeEditPolicy installed for my EditPart. I
>> implement getConnectionCreateCommand() method in my class to check if
>> figure initiating connection is valid. The validation works, but too
>> early - when I hover over the figure. Does anyone know how to initiate
>> validation when the figure is clicked on?
>>
>> thanks,
>> Alex
>
> As far as I know, this is the intended behaviour. When the figure is
> hovered over, the command created in getConnectionCreateCommand() is
> stored in the CreateConnectionRequest. If the figure is clicked, the
> second part of establishing of a connection, namely completing it, is
> initiated. From the moment on when the figure is clicked, the EditPart
> targeted by the mouse answers with a 'complete' connection command, but
> to be able to do that, the first part of the command must already be
> created before clicking the figure. So, validation if the figure
> pointed at by the mouse represents a valid connection source has to
> happen before it is clicked. If the figure doesn't represent a valid
> connection source, it's EditPart has to answer with an unexecutable
> command.
>
> Greetings,
> Andreas

Thanks Andreas.

Then this behavior cases a problem for me because in my case when I
hover over a particular object I check if this object can initiate
connection ( getConnectionCreateCommand() ), but what if in the path to
the object to be checked there is a object of same type and when I hover
over it, it will fail the validation too.
See what happens when object fails validation an error dialog pops up to
notify user, in this case the error will display upon hovering of wrong
object.
So in my case, is there a way to hold off the creation of ErrorDialog
until the second part of the connection check? I did a test and when
getConnectionCreateCommand() returns null the
getConnectionCompleteCommand() doesn't even gets called (as you said).
May be I can pass a dummy ConnectionCreateCommand object and act on in
in getConnectionCompleteCommand()...

thanks,
Alex
Re: GraphicalNodeEditPolicy question [message #226706 is a reply to message #226699] Mon, 20 November 2006 23:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aleksandr_kravets.iwaysoftware.com

Aleksandr Kravets wrote:

Ok, yeah this worked. I created boolean variable in
ConnectionCreateCommand class to signify that this is a dummy
connection. When validation fails in getConnectionCreateCommand(), I set
this variable to true (dummy). Then when getConnectionCompleteCommand()
method receives the command it checks if the dummy variable is false if
it is, it displays error message, otherwise continues connection.

thanks,
Alex
Re: GraphicalNodeEditPolicy question [message #226734 is a reply to message #226699] Tue, 21 November 2006 09:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ""modica\".$nospam$cs.tu-berlin.de"

Aleksandr Kravets schrieb:
> Andreas Walter wrote:
>> Aleksandr Kravets schrieb:
>>> Hello,
>>>
>>> I have a GraphicalNodeEditPolicy installed for my EditPart. I
>>> implement getConnectionCreateCommand() method in my class to check if
>>> figure initiating connection is valid. The validation works, but too
>>> early - when I hover over the figure. Does anyone know how to
>>> initiate validation when the figure is clicked on?
>>>
>>> thanks,
>>> Alex
>>
>> As far as I know, this is the intended behaviour. When the figure is
>> hovered over, the command created in getConnectionCreateCommand() is
>> stored in the CreateConnectionRequest. If the figure is clicked, the
>> second part of establishing of a connection, namely completing it, is
>> initiated. From the moment on when the figure is clicked, the EditPart
>> targeted by the mouse answers with a 'complete' connection command,
>> but to be able to do that, the first part of the command must already
>> be created before clicking the figure. So, validation if the figure
>> pointed at by the mouse represents a valid connection source has to
>> happen before it is clicked. If the figure doesn't represent a valid
>> connection source, it's EditPart has to answer with an unexecutable
>> command.
>>
>> Greetings,
>> Andreas
>
> Thanks Andreas.
>
> Then this behavior cases a problem for me because in my case when I
> hover over a particular object I check if this object can initiate
> connection ( getConnectionCreateCommand() ), but what if in the path to
> the object to be checked there is a object of same type and when I hover
> over it, it will fail the validation too.
> See what happens when object fails validation an error dialog pops up to
> notify user, in this case the error will display upon hovering of wrong
> object.
> So in my case, is there a way to hold off the creation of ErrorDialog
> until the second part of the connection check? I did a test and when
> getConnectionCreateCommand() returns null the
> getConnectionCompleteCommand() doesn't even gets called (as you said).
> May be I can pass a dummy ConnectionCreateCommand object and act on in
> in getConnectionCompleteCommand()...
>
> thanks,
> Alex

Hi,

I recommend, that you show the error messages (if they are simple enough
to be expressed as a string) in a status line rather than in a dialog.
This also saves the user from permament clicking to get off the dialogs.

Regards,
Tony
Re: GraphicalNodeEditPolicy question [message #226741 is a reply to message #226734] Tue, 21 November 2006 14:40 Go to previous message
Eclipse UserFriend
Originally posted by: aleksandr_kravets.iwaysoftware.com

Tony Modica > wrote:
> Aleksandr Kravets schrieb:
>> Andreas Walter wrote:
>>> Aleksandr Kravets schrieb:
>>>> Hello,
>>>>
>>>> I have a GraphicalNodeEditPolicy installed for my EditPart. I
>>>> implement getConnectionCreateCommand() method in my class to check
>>>> if figure initiating connection is valid. The validation works, but
>>>> too early - when I hover over the figure. Does anyone know how to
>>>> initiate validation when the figure is clicked on?
>>>>
>>>> thanks,
>>>> Alex
>>>
>>> As far as I know, this is the intended behaviour. When the figure is
>>> hovered over, the command created in getConnectionCreateCommand() is
>>> stored in the CreateConnectionRequest. If the figure is clicked, the
>>> second part of establishing of a connection, namely completing it, is
>>> initiated. From the moment on when the figure is clicked, the
>>> EditPart targeted by the mouse answers with a 'complete' connection
>>> command, but to be able to do that, the first part of the command
>>> must already be created before clicking the figure. So, validation if
>>> the figure
>>> pointed at by the mouse represents a valid connection source has to
>>> happen before it is clicked. If the figure doesn't represent a valid
>>> connection source, it's EditPart has to answer with an unexecutable
>>> command.
>>>
>>> Greetings,
>>> Andreas
>>
>> Thanks Andreas.
>>
>> Then this behavior cases a problem for me because in my case when I
>> hover over a particular object I check if this object can initiate
>> connection ( getConnectionCreateCommand() ), but what if in the path
>> to the object to be checked there is a object of same type and when I
>> hover over it, it will fail the validation too.
>> See what happens when object fails validation an error dialog pops up
>> to notify user, in this case the error will display upon hovering of
>> wrong object.
>> So in my case, is there a way to hold off the creation of ErrorDialog
>> until the second part of the connection check? I did a test and when
>> getConnectionCreateCommand() returns null the
>> getConnectionCompleteCommand() doesn't even gets called (as you said).
>> May be I can pass a dummy ConnectionCreateCommand object and act on in
>> in getConnectionCompleteCommand()...
>>
>> thanks,
>> Alex
>
> Hi,
>
> I recommend, that you show the error messages (if they are simple enough
> to be expressed as a string) in a status line rather than in a dialog.
> This also saves the user from permament clicking to get off the dialogs.
>
> Regards,
> Tony

Agreed. And I do that, but this application is a port from MFC version
and error dialog is a "feature" that was present in original application.

thanks,
Alex
Previous Topic:The proper layout - GMF version of datagrid (widget)
Next Topic:Custom GEF Layout - a million $ question
Goto Forum:
  


Current Time: Fri Mar 29 15:20:37 GMT 2024

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

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

Back to the top