Creating EditParts where the user click in the editor [message #200728] |
Wed, 26 October 2005 13:38 |
Eclipse User |
|
|
|
Originally posted by: harsh.ti.com
All,
I want to set the bounds of my figure so the x,y is the location of the
mouse cursor and the height and width are fixed. The problem is, my model
does not handle bounds related data and I would prefer it that way. In
some of the examples I have see, in the XYLayoutPolicy the
getCreateCommand method sets the bounds and sets the initial bounds and
then when the command is executed it it is stored in the model. Then in
the Refresh Visuals, when the edit parts are updated/created the bounds of
the figure are there. I know this is the ideal method but is there
another way so the model is not in play?
Thank you,
Harsh
|
|
|
Re: Creating EditParts where the user click in the editor [message #200755 is a reply to message #200728] |
Wed, 26 October 2005 20:03 |
Eclipse User |
|
|
|
Originally posted by: Lamont_Gilbert.rigidsoftware.com
Harsh Sabikhi wrote:
> All,
>
> I want to set the bounds of my figure so the x,y is the location of the
> mouse cursor and the height and width are fixed. The problem is, my
> model does not handle bounds related data and I would prefer it that
> way. In some of the examples I have see, in the XYLayoutPolicy the
> getCreateCommand method sets the bounds and sets the initial bounds and
> then when the command is executed it it is stored in the model. Then in
> the Refresh Visuals, when the edit parts are updated/created the bounds
> of the figure are there. I know this is the ideal method but is there
> another way so the model is not in play?
>
> Thank you,
> Harsh
>
The size of your edit part will be based on model data only if your edit
part is kind enough to ask the model for size. The edit part can easily
ignore the model and set the size based on a preference somewhere.
CL
|
|
|
|
Re: Creating EditParts where the user click in the editor [message #200867 is a reply to message #200728] |
Thu, 27 October 2005 22:59 |
venkataramana m Messages: 86 Registered: July 2009 |
Member |
|
|
Harsh, I understand your requirement legitimate in a situation like this ..
1. First time visuals are going to be created based on some model objects like some text-elements to be displayed etc.,(not visual model like x,y, w,h etc.,)
2. Once the visuals are rendered, then figure classes should store the x,y, w,h info. i.e, if a user moves a figure, then visual should update/refresh itself without having to get x,y from model, ofcourse model doesn't have it.
But finally when closing the diagram, where do you want to save your layout data ? Some visual model represention right ? Or you dont need to persist user modifications in diagram-layout..I mean user-changes in layout are never persisted..so everytime he is gonna get similar look.
Consider the above and may be rephrase your requirement once more. Then some solutions can be thought of to not make a roundtrip like this ;-)...
Tool -> Editpart -> Editpolicy - Command -> Model -> Editpart -> Figure
Indeed a sequence diagram will have all the messages in the chain above.
Thanks
Venkat
|
|
|
Re: Creating EditParts where the user click in the editor [message #200937 is a reply to message #200779] |
Fri, 28 October 2005 12:24 |
Eclipse User |
|
|
|
Originally posted by: Lamont_Gilbert.rigidsoftware.com
Harsh wrote:
> Thank you for your response.
>
> The question is can safely assume to draw the edit part figure at the
> last mouse location? I can maybe implement my edit parts to handle
> mouse events.
>
> Regards,
> Harsh
>
typically editparts location is managed by its parent so to speak. Take
your debugger and an example of GEF and follow through a CreateRequest.
CL
|
|
|
Re: Creating EditParts where the user click in the editor [message #200991 is a reply to message #200867] |
Fri, 28 October 2005 14:23 |
Eclipse User |
|
|
|
Originally posted by: harsh.ti.com
Venkat,
We are storing our model layout in an xml file and persisting this with an
even greater solution. When the user opens a file recognized by our
editor, we concatenate information from 2 files, namely the model and the
layout file.
I figured out how to do it. Perhaps, there is a better solution but this
will do for now.
Thank you all for your help.
Harsh
|
|
|
Powered by
FUDForum. Page generated in 0.04642 seconds