Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » constraining node movement/resize
constraining node movement/resize [message #52623] Thu, 21 September 2006 04:20 Go to next message
Eclipse UserFriend
Originally posted by: tivadar.szemethy.netvisor.hu

Hello,

What is the GMF way of constraining how/where can the user move(drag) /
resize Figures (editParts) ?

For example, I want to allow moving/resizing them, but I want to prevent
figures to overlap.
(e.g. in GEF, what I did was to create a SetConstraintCommand, and check
my constraints in canExecute())

How do I achieve something similar in GMF ?

thanks,
Tivadar
Re: constraining node movement/resize [message #52654 is a reply to message #52623] Thu, 21 September 2006 05:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 5d5.mail.ru

You could specify resize constraint in gmfgraph model for the node but
this particular case is different; I'd suggest you to try 'veto
approach': add edit policy that contributes command in cases when
SetConstraintCommand is returned. In this command check that nodes
overlap with the new bounds; if it's so return 'false' from canExecute().

Tivadar Szemethy wrote:
> Hello,
>
> What is the GMF way of constraining how/where can the user move(drag) /
> resize Figures (editParts) ?
>
> For example, I want to allow moving/resizing them, but I want to prevent
> figures to overlap.
> (e.g. in GEF, what I did was to create a SetConstraintCommand, and check
> my constraints in canExecute())
>
> How do I achieve something similar in GMF ?
>
> thanks,
> Tivadar
Re: constraining node movement/resize [message #52708 is a reply to message #52654] Thu, 21 September 2006 05:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tivadar.szemethy.netvisor.hu

Dmitry Stadnik wrote:
> You could specify resize constraint in gmfgraph model for the node but
> this particular case is different; I'd suggest you to try 'veto
> approach': add edit policy that contributes command in cases when
> SetConstraintCommand is returned. In this command check that nodes
> overlap with the new bounds; if it's so return 'false' from canExecute().

Actually I begin to realize this wouldn't work because you can still set
the coordinates through the Properties view.

I think what I need access is the "Layout Constraint" object what is
shown in the Properties/Advanced.

I'll try to figure out how to do that...

T.
Re: constraining node movement/resize [message #54407 is a reply to message #52623] Sat, 23 September 2006 14:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

> (e.g. in GEF, what I did was to create a SetConstraintCommand, and check
> my constraints in canExecute())

Can't you just do the same thing in GMF? It is based on GEF.
Re: constraining node movement/resize [message #54660 is a reply to message #54407] Mon, 25 September 2006 04:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tivadar.szemethy.netvisor.hu

Randy Hudson wrote:
>> (e.g. in GEF, what I did was to create a SetConstraintCommand, and check
>> my constraints in canExecute())
>
> Can't you just do the same thing in GMF? It is based on GEF.
>
>
If the user changes the values (e.g. X, Y) in the properties view, does
it go through the same command infrastructure ? (i.e. will your solution
work in that case ?)

T.
Re: constraining node movement/resize [message #54954 is a reply to message #54660] Mon, 25 September 2006 07:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 5d5.mail.ru

If you are that pretty strict about layout constraint maybe it would be
better to hide it from the properties view? And there is one more way to
change it - modify xml with notation model externally and reopen the
diagram )))

Tivadar Szemethy wrote:
> Randy Hudson wrote:
>>> (e.g. in GEF, what I did was to create a SetConstraintCommand, and
>>> check my constraints in canExecute())
>>
>> Can't you just do the same thing in GMF? It is based on GEF.
>>
> If the user changes the values (e.g. X, Y) in the properties view, does
> it go through the same command infrastructure ? (i.e. will your solution
> work in that case ?)
>
> T.
>
Re: constraining node movement/resize [message #56113 is a reply to message #54954] Wed, 27 September 2006 03:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tivadar.szemethy.netvisor.hu

Dmitry Stadnik wrote:
> If you are that pretty strict about layout constraint maybe it would be
> better to hide it from the properties view? And there is one more way to

That would be a good idea. How should I do that ? I was looking at the
generated code and I'm a little perplexed about where that stuff
(LayoutConstraint, Styles) is coming from.
I'd be good to be able to customize what appears in the properties view
anyway. Thanks for the tip.

T.


> change it - modify xml with notation model externally and reopen the
> diagram )))
>
> Tivadar Szemethy wrote:
>> Randy Hudson wrote:
>>>> (e.g. in GEF, what I did was to create a SetConstraintCommand, and
>>>> check my constraints in canExecute())
>>>
>>> Can't you just do the same thing in GMF? It is based on GEF.
>>>
>> If the user changes the values (e.g. X, Y) in the properties view,
>> does it go through the same command infrastructure ? (i.e. will your
>> solution work in that case ?)
>>
>> T.
>>
Re: constraining node movement/resize [message #56185 is a reply to message #56113] Wed, 27 September 2006 05:49 Go to previous message
Eclipse UserFriend
Originally posted by: 5d5.mail.ru

Tivadar Szemethy wrote:
>
> That would be a good idea. How should I do that ? I was looking at the
> generated code and I'm a little perplexed about where that stuff
> (LayoutConstraint, Styles) is coming from.
> I'd be good to be able to customize what appears in the properties view
> anyway. Thanks for the tip.

http://wiki.eclipse.org/index.php/GMF_GenModel_Hints#Tuning_ property_sheet
Previous Topic:Changing child element attribute on change of Parenet element attribute
Next Topic:How to change the color of a link
Goto Forum:
  


Current Time: Mon Apr 28 23:48:35 EDT 2025

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

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

Back to the top