Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Access EditPart's model within a LayoutManager
Access EditPart's model within a LayoutManager [message #144783] Mon, 30 July 2007 15:22 Go to next message
Eclipse UserFriend
Originally posted by: juergen.sterr.brain-child.de

Hi,

we are building an editor which should provide the definition of a text
based screen output. The user can define text elements on the screen. Such
an element has a fixed position on the screen. The screen can display up
to 34 characters per line and has 10 lines at all. Text elements can only
be placed at a single line. Thus each text element has a x-y-coordinate
pair and a text as its base data model.

The text elements should be laied out on the diagram according to their
x-y-coordinates. The only way we have discovered to do that is to
implement a custom LayoutManager. This LayoutManager must map an text
elements virtual x-y-coordinates to real screen coordinates. The problem
with this approach is, within the LayoutManager we don't have access to
the EditPart's data model in order to get the coordinates.

Now my questions are, is our approach the right one to solve the layout
problem? How can I access the data model of a text element within the
LayoutManager, which is maintained by the appropriate EditPart.

Thanks

Jürgen
Re: Access EditPart's model within a LayoutManager [message #144812 is a reply to message #144783] Mon, 30 July 2007 17:18 Go to previous message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Jürgen,

LayoutManagers usually have a constraint for each figure it is managing.
The constraint can be set by the editpart. See the method:
GraphicalEditPart.setLayoutConstraint(EditPart child, IFigure figure,
Object constraint)
For an example of how this works in GMF, see the
ShapeEditPart.refreshBounds() method.

Sounds like your constraint would be the virtual x,y coordinates.

Regards,
Cherie

Jürgen Sterr wrote:
> Hi,
>
> we are building an editor which should provide the definition of a text
> based screen output. The user can define text elements on the screen.
> Such an element has a fixed position on the screen. The screen can
> display up to 34 characters per line and has 10 lines at all. Text
> elements can only be placed at a single line. Thus each text element has
> a x-y-coordinate pair and a text as its base data model.
>
> The text elements should be laied out on the diagram according to their
> x-y-coordinates. The only way we have discovered to do that is to
> implement a custom LayoutManager. This LayoutManager must map an text
> elements virtual x-y-coordinates to real screen coordinates. The problem
> with this approach is, within the LayoutManager we don't have access to
> the EditPart's data model in order to get the coordinates.
>
> Now my questions are, is our approach the right one to solve the layout
> problem? How can I access the data model of a text element within the
> LayoutManager, which is maintained by the appropriate EditPart.
>
> Thanks
>
> Jürgen
>
Previous Topic:Drag from a view, drop onto the diagram, and create a node
Next Topic:Problems with generating diagram code with GMF 2.0
Goto Forum:
  


Current Time: Sat Nov 02 18:40:48 GMT 2024

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

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

Back to the top