Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Drawning Figures in 2 places
Drawning Figures in 2 places [message #214581] Tue, 18 April 2006 23:36 Go to next message
Eclipse UserFriend
Originally posted by: vinicius.ferraz.gmail.com

Hi, I'm a new GEF user and have 1 doubt. I'm trying to put some elements
inside others, like an AND door in a circuit. However i don't know how
(and where) i can remove the children´s reference inside the parent.

The Problem In other words: when I put the element inside the other. The
elements is drawing in 2 places.

Where do i remove the reference? in a command? how can i do that?
Re: Drawning Figures in 2 places [message #214720 is a reply to message #214581] Thu, 20 April 2006 20:35 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
If you're moving an element from one container into another first you need
to consider the model changes that persist the container changes.

If we consider moving a LED from the diagram to a Circuit:
First to remove it from the owned container using the OrphanChildCommand in
Logic designer which will remove it from the first container.
@see LogicContainerEditPolicy#getOrphanChildrenCommand

Then it is added to the target container using an AddCommand
@see LogicXYLayoutEditPolicy#getAddCommand

These instrument the model changes. Then the EditParts will listen to the
model changes accordingly. Both the DiagramEditPart and CircuitEditPart are
LogicContainerEditPart which override the method getModelChildren.
Subsequent calls to refreshChildren will synchronize the EditPart children
with the model children. Alternatively, for performance they can listen to
the model changes specifically which will invoke addChild or removeChild
based on the corresponding event.
@see LogicEditPart@propertyChange

Regards,

Steve.

"Vinicius Ferraz Campos" <vinicius.ferraz@gmail.com> wrote in message
news:e23t6d$bi0$1@utils.eclipse.org...
> Hi, I'm a new GEF user and have 1 doubt. I'm trying to put some elements
> inside others, like an AND door in a circuit. However i don't know how
> (and where) i can remove the children
Re: Drawning Figures in 2 places [message #214745 is a reply to message #214720] Fri, 21 April 2006 12:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vinicius.ferraz.gmail.com

Steven Shaw wrote:
> If you're moving an element from one container into another first you need
> to consider the model changes that persist the container changes.
>
> If we consider moving a LED from the diagram to a Circuit:
> First to remove it from the owned container using the OrphanChildCommand in
> Logic designer which will remove it from the first container.
> @see LogicContainerEditPolicy#getOrphanChildrenCommand
>
> Then it is added to the target container using an AddCommand
> @see LogicXYLayoutEditPolicy#getAddCommand
>
> These instrument the model changes. Then the EditParts will listen to the
> model changes accordingly. Both the DiagramEditPart and CircuitEditPart are
> LogicContainerEditPart which override the method getModelChildren.
> Subsequent calls to refreshChildren will synchronize the EditPart children
> with the model children. Alternatively, for performance they can listen to
> the model changes specifically which will invoke addChild or removeChild
> based on the corresponding event.
> @see LogicEditPart@propertyChange
>
> Regards,
>
> Steve.
>
> "Vinicius Ferraz Campos" <vinicius.ferraz@gmail.com> wrote in message
> news:e23t6d$bi0$1@utils.eclipse.org...
>> Hi, I'm a new GEF user and have 1 doubt. I'm trying to put some elements
>> inside others, like an AND door in a circuit. However i don't know how
>> (and where) i can remove the children´s reference inside the parent.
>>
>> The Problem In other words: when I put the element inside the other. The
>> elements is drawing in 2 places.
>>
>> Where do i remove the reference? in a command? how can i do that?
>
>

I will try to do this next monday, but first of all I have other doubts:

1- Are only that things to do ( implements OrphanChildCommand and after
getAddCommand) ?
I'm asking for that cause I thought implements chain command in
getAddCommand like: ChangeGuideCommand and DeleteCommand. I'm failed.
(Know i don't know accurately the ChangeGuideComand function)

2- Is it necessary override refreshChildren? And if I have to call
this method, where I do that?

Thanks for all.
Re: Drawning Figures in 2 places [message #214758 is a reply to message #214745] Fri, 21 April 2006 20:30 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
1.) I just captured the essence of the model operation. Yes, some other
commands are chained to those for managing grid operations.

2.) No you shouldn't need to override refreshChildren, only
getModelChildren. You can optionally call refreshChildren to synchronize
the EditParts with the model, but it can be expensive as opposed to adding,
removing the children explicitly as the logic example demonstrates.

-Steve

"Vinicius Ferraz Campos" <vinicius.ferraz@gmail.com> wrote in message
news:e2aich$qb0$1@utils.eclipse.org...
> Steven Shaw wrote:
> > If you're moving an element from one container into another first you
need
> > to consider the model changes that persist the container changes.
> >
> > If we consider moving a LED from the diagram to a Circuit:
> > First to remove it from the owned container using the OrphanChildCommand
in
> > Logic designer which will remove it from the first container.
> > @see LogicContainerEditPolicy#getOrphanChildrenCommand
> >
> > Then it is added to the target container using an AddCommand
> > @see LogicXYLayoutEditPolicy#getAddCommand
> >
> > These instrument the model changes. Then the EditParts will listen to
the
> > model changes accordingly. Both the DiagramEditPart and CircuitEditPart
are
> > LogicContainerEditPart which override the method getModelChildren.
> > Subsequent calls to refreshChildren will synchronize the EditPart
children
> > with the model children. Alternatively, for performance they can listen
to
> > the model changes specifically which will invoke addChild or removeChild
> > based on the corresponding event.
> > @see LogicEditPart@propertyChange
> >
> > Regards,
> >
> > Steve.
> >
> > "Vinicius Ferraz Campos" <vinicius.ferraz@gmail.com> wrote in message
> > news:e23t6d$bi0$1@utils.eclipse.org...
> >> Hi, I'm a new GEF user and have 1 doubt. I'm trying to put some
elements
> >> inside others, like an AND door in a circuit. However i don't know how
> >> (and where) i can remove the children
Re: Drawning Figures in 2 places [message #214834 is a reply to message #214758] Mon, 24 April 2006 14:19 Go to previous message
Eclipse UserFriend
Originally posted by: vinicius.ferraz.gmail.com

Steven Shaw wrote:
> 1.) I just captured the essence of the model operation. Yes, some other
> commands are chained to those for managing grid operations.
>
> 2.) No you shouldn't need to override refreshChildren, only
> getModelChildren. You can optionally call refreshChildren to synchronize
> the EditParts with the model, but it can be expensive as opposed to adding,
> removing the children explicitly as the logic example demonstrates.
>
> -Steve
>
> "Vinicius Ferraz Campos" <vinicius.ferraz@gmail.com> wrote in message
> news:e2aich$qb0$1@utils.eclipse.org...
>> Steven Shaw wrote:
>>> If you're moving an element from one container into another first you
> need
>>> to consider the model changes that persist the container changes.
>>>
>>> If we consider moving a LED from the diagram to a Circuit:
>>> First to remove it from the owned container using the OrphanChildCommand
> in
>>> Logic designer which will remove it from the first container.
>>> @see LogicContainerEditPolicy#getOrphanChildrenCommand
>>>
>>> Then it is added to the target container using an AddCommand
>>> @see LogicXYLayoutEditPolicy#getAddCommand
>>>
>>> These instrument the model changes. Then the EditParts will listen to
> the
>>> model changes accordingly. Both the DiagramEditPart and CircuitEditPart
> are
>>> LogicContainerEditPart which override the method getModelChildren.
>>> Subsequent calls to refreshChildren will synchronize the EditPart
> children
>>> with the model children. Alternatively, for performance they can listen
> to
>>> the model changes specifically which will invoke addChild or removeChild
>>> based on the corresponding event.
>>> @see LogicEditPart@propertyChange
>>>
>>> Regards,
>>>
>>> Steve.
>>>
>>> "Vinicius Ferraz Campos" <vinicius.ferraz@gmail.com> wrote in message
>>> news:e23t6d$bi0$1@utils.eclipse.org...
>>>> Hi, I'm a new GEF user and have 1 doubt. I'm trying to put some
> elements
>>>> inside others, like an AND door in a circuit. However i don't know how
>>>> (and where) i can remove the children´s reference inside the parent.
>>>>
>>>> The Problem In other words: when I put the element inside the other.
> The
>>>> elements is drawing in 2 places.
>>>>
>>>> Where do i remove the reference? in a command? how can i do that?
>>>
>> I will try to do this next monday, but first of all I have other doubts:
>>
>> 1- Are only that things to do ( implements OrphanChildCommand and after
>> getAddCommand) ?
>> I'm asking for that cause I thought implements chain command in
>> getAddCommand like: ChangeGuideCommand and DeleteCommand. I'm failed.
>> (Know i don't know accurately the ChangeGuideComand function)
>>
>> 2- Is it necessary override refreshChildren? And if I have to call
>> this method, where I do that?
>>
>> Thanks for all.
>
>
Steven, i did what u say. But nothing happened. That command wasn't invoked.

When I click on the figure and put it in other container the command
called is getAddCommand in the New container. This command is the
LAYOUT_ROLE. If u look LogicXYLayoutEditPolicy@getAddCommand it do a
chain of commands: addcomand + setConstraint + 2 other commands (1
chainGuideAttachmentCommand and other chainGuideDetachmentCommand). I
dont know how do I implement the chainGuide command.

Thanks again...
Previous Topic:GTK+ Performance
Next Topic:XML Tree with GEF
Goto Forum:
  


Current Time: Fri Apr 26 12:41:26 GMT 2024

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

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

Back to the top