Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Splitting Editor Panel in Areas
Splitting Editor Panel in Areas [message #226181] Wed, 15 April 2009 12:12 Go to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Hello,
i'm just working on a EMF/GMF based editor.
I already got it working, but now I have to add a special feature:

The editor panel should be splitted in 2 or more areas, and in each area
there should only be allowed defined tools from the palette.

I have done a little screenshot for better understanding:
http://s5b.directupload.net/images/090415/tbmaidjo.jpg

First you see the current editor, then I modified it how it should look
like.

In the left area it only should be possibble to add Inputs/Outputs and in
the right area only Firmware.

Its possible to get it working like that and at wich points I have to
modify the editor ?

I would be very pleased about some hints,

Kind regards
Patrick
Re: Splitting Editor Panel in Areas [message #226202 is a reply to message #226181] Wed, 15 April 2009 12:39 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Patrick,

Is it possible to introduce two more elements - "left container" and "right
container" into this model? It can be easy to handle this situation if you
have separate diagram elements for "left" and "right" editor areas and all
other elements (Inputs/Outputs/Firmware) will be created in left/right container
in accordance.

If you can not introduce extra containers into this model then you have to
start with modifying an EditPart generated for diagram root element. I suppose
you have to modify diagram figure to draw a separator between left/right
part of the diagram and some of the existing edit policies to disable element
creation in an incorrect diagram area.

-----------------
Alex Shatalin
Re: Splitting Editor Panel in Areas [message #226220 is a reply to message #226202] Wed, 15 April 2009 14:04 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,

> Is it possible to introduce two more elements - "left container" and "right
> container" into this model? It can be easy to handle this situation if you
> have separate diagram elements for "left" and "right" editor areas and all
> other elements (Inputs/Outputs/Firmware) will be created in left/right
container
> in accordance.

Yes could be possible, what kind of elements should these containers be,
and its possible that they automatically fill the editor panel completely
?


> If you can not introduce extra containers into this model then you have to
> start with modifying an EditPart generated for diagram root element. I
suppose
> you have to modify diagram figure to draw a separator between left/right
> part of the diagram and some of the existing edit policies to disable
element
> creation in an incorrect diagram area.

Thats the way i thought... will have to find the right classes and just
modify it.


> -----------------
> Alex Shatalin
Re: Splitting Editor Panel in Areas [message #226236 is a reply to message #226220] Wed, 15 April 2009 15:07 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Patrick,

> Yes could be possible, what kind of elements should these containers
> be, and its possible that they automatically fill the editor panel
> completely ?
Then i think it's better for you to wollow this direction. From the very
beggining these two classes will not fill whole editor area, but I suppose
it's much more easy to modify editor and layout these elements appropriately
then to deal with custom editpolicies/requests/figures while implementing
second solution.

I'm suggesting you first generate diagram code and then modify refreshBounds()
method of two top-level EditParts to not load/set bounds from notation model,
but rather calculate it based on a diagram size..
Here is a code from ShapeEditPart responsible for loading coordinates from
notation model:

int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_ Width())).intValue();
int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_ Height())).intValue();
Dimension size = new Dimension(width, height);
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocat ion_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocat ion_Y())).intValue();
Point loc = new Point(x, y);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(),
new Rectangle(loc, size));

-----------------
Alex Shatalin
Re: Splitting Editor Panel in Areas [message #226279 is a reply to message #226236] Thu, 16 April 2009 07:22 Go to previous messageGo to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Good Morning Alex,
so let me summarize:
Adding two or more classes as top nodes of the diagramm. Then make them
fill the complete panel and just allow subclasses get added in the right
compartment of each top class ?

Regards,
Patrick
Re: Splitting Editor Panel in Areas [message #226351 is a reply to message #226279] Thu, 16 April 2009 10:50 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Patrick,

exactly

-----------------
Alex Shatalin
Re: Splitting Editor Panel in Areas [message #228324 is a reply to message #226351] Wed, 29 April 2009 13:10 Go to previous messageGo to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Hello again,
i just implemented a containment class and implemented its refreshBound()
method.
All is working good, only one little problem left:

For setting its size automatically i need the editor panel size, any hint
how to get that?


Sincerly
Patrick
Re: Splitting Editor Panel in Areas [message #228342 is a reply to message #228324] Wed, 29 April 2009 13:22 Go to previous message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Got it:

Dimension xx = ((GraphicalEditPart) getParent()).getFigure().getSize();
Previous Topic:synchronization between views and editors
Next Topic:Method layout(View, String) in LayoutService might fail
Goto Forum:
  


Current Time: Wed Apr 24 23:54:16 GMT 2024

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

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

Back to the top