Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Fixed a size of an Ellipse
Fixed a size of an Ellipse [message #813077] Sun, 04 March 2012 20:21 Go to next message
Lamia Mati is currently offline Lamia MatiFriend
Messages: 8
Registered: February 2012
Junior Member
Hello everyone;
please how i can fix a size of a figure (i want create a constant size of a figure elipse for example ).
I tried with maximun size and minimum size but the size of the figure is not fixed
Re: Fixed a size of an Ellipse [message #813434 is a reply to message #813077] Mon, 05 March 2012 09:03 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Hello,

I am not sure you need ALL of the list above, but it will not hurt and it is proven to work. So,
- set the min-, max-, and preferred- size to required dimension for Figure
- set Node's resize constraint to Direction.NONE
- create the DefaultSize facet with the desired size inside the corresponding Node

Regards,
Michael "Borlander" Golubev
at Montages Think Tank, Prague, Czech Republic
Re: Fixed a size of an Ellipse [message #813440 is a reply to message #813077] Mon, 05 March 2012 09:09 Go to previous messageGo to next message
Andreas Muelder is currently offline Andreas MuelderFriend
Messages: 73
Registered: July 2011
Member
Hi Lamia,

what do you mean with fix size? Do you want to disable resizing of a figure?

This can be done by installing a NonResizableEditPolicy to your figures edit part.

Unfortunatelly, this does not prevent the user to set a custom size during creation of the element. To disable this you can override the getCreateElementAndViewCommand method in the parents CreationEditPolicy like this:

@Override
protected Command getCreateElementAndViewCommand(
	CreateViewAndElementRequest request) {
String semanticHint = request.getViewAndElementDescriptor().getSemanticHint();
if (semanticHint == MyFigure)){
   request.setSize(new Dimension(-1, -1));
}
return super.getCreateElementAndViewCommand(request);
}


Maybe there is a better way to prevent resizing on creation?

Regards,
Andreas

Re: Fixed a size of an Ellipse [message #814431 is a reply to message #813440] Tue, 06 March 2012 12:52 Go to previous message
Lamia Mati is currently offline Lamia MatiFriend
Messages: 8
Registered: February 2012
Junior Member
Hi Michael & Andreas;
thnks alot for the help.
yes Andreas i want to disable resizing a figure.
I tried with the method of Michael and I managed.
Previous Topic:images and gmf
Next Topic:failed to create a view
Goto Forum:
  


Current Time: Fri Apr 26 08:36:07 GMT 2024

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

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

Back to the top