Access EditPart's model within a LayoutManager [message #144783] |
Mon, 30 July 2007 15:22 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 Go to previous message](theme/Solstice/images/up.png) |
Cherie Revells![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=crevells%40ca.ibm.com) 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
>
|
|
|
Powered by
FUDForum. Page generated in 0.03883 seconds