Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Cannot resize down editparts
Cannot resize down editparts [message #482592] Thu, 27 August 2009 07:51 Go to next message
Maxence VANBÉSIEN is currently offline Maxence VANBÉSIENFriend
Messages: 40
Registered: July 2009
Location: Lille, France
Member
Hello,

I currently face a strange behaviour in GMF diagrams.

In fact, I cannot resize down my Nodes on my Diagrams, even when it is not
set to its minimal size.

A workaround I found while manipulating the diagram is that I have to
enlarge the node, to be able to shrink it just after. I looked in Eclipse
logs, and anything is ever logged (no message nor exceptions)

Have you already heard about such behaviour ?

Thanks in advance,

Best regards,

Maxence
Re: Cannot resize down editparts [message #482820 is a reply to message #482592] Fri, 28 August 2009 08:55 Go to previous messageGo to next message
Maxence VANBÉSIEN is currently offline Maxence VANBÉSIENFriend
Messages: 40
Registered: July 2009
Location: Lille, France
Member
Hello,

Here are some additional information about this issue.

In fact, the issue seems to come from the draw2D Figures management...

In my generated code, I have an EditPart that relies on an EditPartFigure
(which is a Rounded Rectangle extension in fact).

When I change the size of my EditPart, the validate() method of the
DiagramEditPart.BorderItemsAwareFreeFormLayer class is called, which
implies this object and all its children to be validated recursively. Now,
this validation process leads to the resizing of the Figure, only when the
Figure that is being validated is not valid before entering this validate
method.

Moreover, I remarked that my EditPartFigure is set as a child of a
DefaultSizeNodeFigure, and when I try to enlarge the RoundedRectangle,
this DefaultSizeNodeFigure is not valid before being validated. This
causes the Figure.layout() method to be called and my RoundedRectangle to
be resized. Otherwise, when I try to shrink the RoundedRectangle, the
DefalutSizeNodeFigure is said to be already valid before being validated,
and this causes the RoundedRectangle not to be shrunk. (This can also
explain the fact that the Rectangle can be shrunk only when the Rectangle
has been enlarged previously)...

Unfortunately, I don't know why the DefaultSizeNodeFigure is invalidated
when it is asked to be enlarged, and already valid when asked to be
shrunk, but this is the only difference I could report in the two
behaviours.

Now, I don't know how I could investigate more, and how I could set a
workaround for this issue, since the problem seems to come from draw2d,
and since the trouble-maker object it not directly the generated
EditPartFigure.

So, I really look forward to having news and information about this issue,
so I can fix the behaviour of my Diagram.
Of course I can provide more details if needed.

Thanks a lot in advance,

Best regards,

Maxence
Re: Cannot resize down editparts [message #485069 is a reply to message #482820] Thu, 10 September 2009 13:15 Go to previous messageGo to next message
Maxence VANBÉSIEN is currently offline Maxence VANBÉSIENFriend
Messages: 40
Registered: July 2009
Location: Lille, France
Member
Any additional clue about this topic so I can investigate personally on
this issue ?
Re: Cannot resize down editparts [message #485782 is a reply to message #482820] Mon, 14 September 2009 22:27 Go to previous messageGo to next message
Ugo Sangiorgi is currently offline Ugo SangiorgiFriend
Messages: 44
Registered: July 2009
Member
I'm also facing the same problem, and for a long time.
So +1

Thanks

Maxence Vanbesien escreveu:
> Hello,
> Here are some additional information about this issue.
>
> In fact, the issue seems to come from the draw2D Figures management...
>
> In my generated code, I have an EditPart that relies on an
> EditPartFigure (which is a Rounded Rectangle extension in fact).
>
> When I change the size of my EditPart, the validate() method of the
> DiagramEditPart.BorderItemsAwareFreeFormLayer class is called, which
> implies this object and all its children to be validated recursively.
> Now, this validation process leads to the resizing of the Figure, only
> when the Figure that is being validated is not valid before entering
> this validate method.
>
> Moreover, I remarked that my EditPartFigure is set as a child of a
> DefaultSizeNodeFigure, and when I try to enlarge the RoundedRectangle,
> this DefaultSizeNodeFigure is not valid before being validated. This
> causes the Figure.layout() method to be called and my RoundedRectangle
> to be resized. Otherwise, when I try to shrink the RoundedRectangle, the
> DefalutSizeNodeFigure is said to be already valid before being
> validated, and this causes the RoundedRectangle not to be shrunk. (This
> can also explain the fact that the Rectangle can be shrunk only when the
> Rectangle has been enlarged previously)...
>
> Unfortunately, I don't know why the DefaultSizeNodeFigure is invalidated
> when it is asked to be enlarged, and already valid when asked to be
> shrunk, but this is the only difference I could report in the two
> behaviours.
>
> Now, I don't know how I could investigate more, and how I could set a
> workaround for this issue, since the problem seems to come from draw2d,
> and since the trouble-maker object it not directly the generated
> EditPartFigure.
>
> So, I really look forward to having news and information about this
> issue, so I can fix the behaviour of my Diagram.
> Of course I can provide more details if needed.
>
> Thanks a lot in advance,
> Best regards,
> Maxence
>
Re: Cannot resize down editparts [message #495049 is a reply to message #482592] Tue, 03 November 2009 16:28 Go to previous messageGo to next message
Maxence Vanbesien is currently offline Maxence VanbesienFriend
Messages: 10
Registered: October 2009
Junior Member
Hello All,

Any additional information about this issue ? I'm still stuck on that since the issue seems to come from draw2d...

Is this possible that I did something wrong ? because a very few people seem to have already faced the same issue... Sad

Thanks in advance for any possible clue...

[Updated on: Tue, 03 November 2009 16:29]

Report message to a moderator

Re: Cannot resize down editparts [message #501951 is a reply to message #495049] Fri, 04 December 2009 15:04 Go to previous messageGo to next message
Ugo Sangiorgi is currently offline Ugo SangiorgiFriend
Messages: 44
Registered: July 2009
Member
I'm also stuck with this problem,
anybody knows how is it possile NOT to restraint EditParts from being
resized DOWN?
I can always resize the parts to be bigger, not smaller. =/


Maxence Vanbesien escreveu:
> Hello All,
> Any additional information about this issue ? I'm still stuck on that
> since the issue seems to come from draw2d...
>
> Is this possible that I did something wrong ? because nobody seems to
> have already faced the same issue... :(
>
> Thanks in advance for any possible clue...
Re: Cannot resize down editparts [message #502913 is a reply to message #501951] Thu, 10 December 2009 10:08 Go to previous messageGo to next message
Romain Bioteau is currently offline Romain BioteauFriend
Messages: 65
Registered: August 2009
Location: Grenoble
Member
Hi,
I faced the same problem and there is a workaround.
You could try to override the refreshBound() method of your editpart like this :

/**
	 * refresh the bounds 
	 */
	protected void refreshBounds() {
		int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
		int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
		Dimension size = new Dimension(width, height);

                getFigure().setMinimumSize(size) ; //This is a workaround for the resize limitation if the figure has a child (such as a label) 

		int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
		int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
		Point loc = new Point(x, y);
		((GraphicalEditPart) getParent()).setLayoutConstraint(
			this,
			getFigure(),
			new Rectangle(loc, size));
	}


However the feedback figure is not correctly refreshed.

I Hope it will help


R&D Engineer at BonitaSoft
Re: Cannot resize down editparts [message #510952 is a reply to message #502913] Fri, 29 January 2010 09:52 Go to previous message
Maxence Vanbesien is currently offline Maxence VanbesienFriend
Messages: 10
Registered: October 2009
Junior Member
Hello Romain,

Sorry for the late answer, but I had lots of things under the hood to manage before having time to spend effort on that subject...

I overrid the refreshBounds() method in all the impacted EditParts, and now the behaviour I have is exactly the one you describe.

Even if this is a workaround, and we still have a refreshment problem in the feedback figure, I find the result more than satisfying ! Smile

Thus, Thanks a lot !!! Very Happy

Best regards,

[Updated on: Fri, 29 January 2010 09:53]

Report message to a moderator

Previous Topic:GMF Compartments
Next Topic: AbstractTransactionalCommand: Undo/Redo does not work
Goto Forum:
  


Current Time: Mon Apr 12 16:52:10 GMT 2021

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

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

Back to the top