Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Auto Size of nodes
Auto Size of nodes [message #229565] Tue, 12 May 2009 12:40 Go to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Hello again,
I override refreshBounds() method for auto size a node when adding it to
the diagramm.

Then I used this tutorial
wiki.eclipse.org/GMF_Newsgroup_Q_and_A#How_to_create_require d_elements_on_diagram_when_created.3F
to automatically add the nodes in a new diagramm.

The problem is that refreshBounds() didnt get called, so the auto size
doesnt work when adding the nodes automatically.

I didnt find a working way yet, maybe u can help me.

Any hint how to force that refreshBounds() get called ?

Greets
Patrick
Re: Auto Size of nodes [message #229678 is a reply to message #229565] Tue, 12 May 2009 14:54 Go to previous messageGo to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Problem is not that refreshBounds() didnt get called, problem is that
Dimension of the editor is 0 when I use following code:

// size of editor
Dimension editorDimension =
((GraphicalEditPart)getParent()).getFigure().getSize();
Re: Auto Size of nodes [message #229730 is a reply to message #229565] Tue, 12 May 2009 15:29 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Patrick,

> I override refreshBounds() method for auto size a node when adding it
> to the diagramm.
Why do you need it - node will be created with preferred size by default
so you can "autosize" it by specifying proper preferred sizes for all the
child elements.

-----------------
Alex Shatalin
Re: Auto Size of nodes [message #229745 is a reply to message #229730] Tue, 12 May 2009 15:33 Go to previous messageGo to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Alex Shatalin wrote:

> Hello Patrick,

>> I override refreshBounds() method for auto size a node when adding it
>> to the diagramm.
> Why do you need it - node will be created with preferred size by default
> so you can "autosize" it by specifying proper preferred sizes for all the
> child elements.


I need it because I want that those 2 node fill the complete editor area.


> -----------------
> Alex Shatalin
Re: Auto Size of nodes [message #229790 is a reply to message #229745] Tue, 12 May 2009 15:55 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Patrick,

Ok. Then try calling <diagramFigure>.getClientArea() to diagram size.

-----------------
Alex Shatalin
Re: Auto Size of nodes [message #230076 is a reply to message #229790] Wed, 13 May 2009 12:54 Go to previous messageGo to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
I tried many methods to get the size of the panel, but looks like when I
add nodes with <Model>DiagramEditorUtil#createInitialModel() and
refreshBounds() is calling because of that all size parameters of various
parents are 0.

Maybe I can add the nodes later in the code after the editor is fully
initialized ?


Alex Shatalin wrote:

> Hello Patrick,

> Ok. Then try calling <diagramFigure>.getClientArea() to diagram size.

> -----------------
> Alex Shatalin
Re: Auto Size of nodes [message #230093 is a reply to message #230076] Wed, 13 May 2009 13:47 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Patrick,

> Maybe I can add the nodes later in the code after the editor is fully
> initialized ?
At least you can resize nodes later.
I think you can try listening for corresponding notifications and update
node size in accordance.
Another option which came to mi mind is to completelly override diagram figure
and make it fized in size..

-----------------
Alex Shatalin
Re: Auto Size of nodes [message #230101 is a reply to message #230093] Wed, 13 May 2009 13:52 Go to previous messageGo to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Alex Shatalin wrote:

> Hello Patrick,

>> Maybe I can add the nodes later in the code after the editor is fully
>> initialized ?
> At least you can resize nodes later.
> I think you can try listening for corresponding notifications and update
> node size in accordance.

Yes i could need a event to resize them, also when the editor panel size
is changing. I just searching in the code to get a point for hooking me
into

> Another option which came to mi mind is to completelly override diagram
figure
> and make it fized in size..

> -----------------
> Alex Shatalin
Re: Auto Size of nodes [message #231571 is a reply to message #230101] Wed, 27 May 2009 12:51 Go to previous messageGo to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Alex,
i still didnt find a right notification to add and maximize a node when
creating a new diagramm. Maybe u can give me some hint where i to have to
look.
I only know it from the Microsoft world, there are events like "Shown",
they get called after a element is fully visible.
Do u have any idea where i could get this ?
Kind Regards
Patrick



Patrick Schmitt wrote:

> Alex Shatalin wrote:

>> Hello Patrick,

>>> Maybe I can add the nodes later in the code after the editor is fully
>>> initialized ?
>> At least you can resize nodes later.
>> I think you can try listening for corresponding notifications and update
>> node size in accordance.

> Yes i could need a event to resize them, also when the editor panel size
> is changing. I just searching in the code to get a point for hooking me
> into

>> Another option which came to mi mind is to completelly override diagram
> figure
>> and make it fized in size..

>> -----------------
>> Alex Shatalin
Re: Auto Size of nodes [message #232104 is a reply to message #231571] Wed, 03 June 2009 09:02 Go to previous message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
I found a good solution.

I added an resize listener for the parent node. then i call my custom
refresh bounds method of the children in the resize handler.
Previous Topic:Grouping nodes visually
Next Topic:Create connection: automatically create the source element
Goto Forum:
  


Current Time: Thu Apr 25 04:26:28 GMT 2024

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

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

Back to the top