EditPolicies [message #500958] |
Mon, 30 November 2009 13:23 |
Alexander Mack Messages: 100 Registered: July 2009 |
Senior Member |
|
|
Hello,
I am working on n graphical editor with gef.
At the top of the Editor I have a simple DiagramElemen and its DiagramEditPart which only creates a white figure.
At runtime the user can add new Figures. Figure 1 can only be added at the DiagramEditPart, figure 2 only at figure 1.
So far everything is working fine.
Now I want the figures 1 and 2 to be movable and resizeable.
The problem is that I do not really understand how the edit policies are working together.
The following structure works fine:
DigramEditPart -> XYLayoutPolicy (subclassed)
FigureOneEditPart -> LayoutEditPolicy (subclassed)
FigureTwoEditPart -> ResizableEditPolicy (subclassed)
But I think the structure is not well-chosen. (BTW: I do not really know why the user can move and resize figure 1 because there is no EditPart for that??!)
FigureOne is movable and resizeable although uit has no ResizableEditPolicy.
So I tried to create a second EditPolicy fo FigureOne:
DigramEditPart -> XYLayoutPolicy (subclassed)
FigureOneEditPart -> LayoutEditPolicy (subclassed) + ResizableEditPolicy(subclassed)
FigureTwoEditPart -> ResizableEditPolicy (subclassed)
But now, if I am moving figure1, no shadow is visible?!
I would appreciate any help!
Best regards.
Alex
[Updated on: Mon, 30 November 2009 13:24] Report message to a moderator
|
|
|
|
Re: EditPolicies [message #502509 is a reply to message #500958] |
Tue, 08 December 2009 15:33 |
Alexander Mack Messages: 100 Registered: July 2009 |
Senior Member |
|
|
First of all: Thanks for your answer thomas.
I read many tutorials about GEF and the EditPolicies.
I was wondering because according to the following link you need 2 EditPolicies to Move-Resize-Reparent your EditParts:
http://dev.eclipse.org/viewcvs/index.cgi/www/gef/reference/i nteractions.html?root=Eclipse_Website&view=co
At the moment my EditParts only use an LayoutPolicy and an ResizeableEditPolicy.
But there are still problems left:
1. Creating a DiagramElement: There is no Rectangle-shadow shown if I create an element by dragging it to the size I want.
2. My RootRootEditPart is a FreeformLayer which is able to expand in all directions. Now the problem is that the x and y coordinates are not relative to the absolute zero-point but to the upper left corner of the editor. Is it possible to get the "scroll-distance" in x and y direction of the Freeform Layer.
I would really appreciate any help
Thanks a lot
Best regards
Alex
[Updated on: Wed, 09 December 2009 06:50] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02950 seconds