Setting visibility in an action [message #165176] |
Wed, 12 December 2007 13:24 |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
I try to make a node invisible in an action with:
Node n = (Node) selectedElement.getNotationView();
n.setVisible(false);
This works, but only after a new object is added or deleted from the
diagram. How can I make this happen "inside" the action?
Even better in this case would be to only delete the view of the node
(not the domain element)
I tried:
stack.execute(new ICommandProxy(new DestroyElementCommand(new
DestroyElementRequest(root, true))));
But this destroys both.
Any ideas?
Best Regards,
Tomas Zijdemans
|
|
|
Re: Setting visibility in an action [message #165184 is a reply to message #165176] |
Wed, 12 December 2007 14:09 |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
Solved it with:
selectedElement.getFigure().setVisible(false);
:)
Tomas Zijdemans wrote:
> I try to make a node invisible in an action with:
>
> Node n = (Node) selectedElement.getNotationView();
> n.setVisible(false);
>
> This works, but only after a new object is added or deleted from the
> diagram. How can I make this happen "inside" the action?
>
> Even better in this case would be to only delete the view of the node
> (not the domain element)
>
> I tried:
>
> stack.execute(new ICommandProxy(new DestroyElementCommand(new
> DestroyElementRequest(root, true))));
>
> But this destroys both.
>
> Any ideas?
>
>
> Best Regards,
>
> Tomas Zijdemans
|
|
|
Re: Setting visibility in an action [message #165205 is a reply to message #165184] |
Wed, 12 December 2007 16:27 |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
Ok, new problem!
When I reopen the diagram, nodes that have been set to visible(false) is
visible!
How can I prevent this?
Best Regards,
Tomas Zijdemans
Tomas Zijdemans wrote:
> Solved it with:
>
> selectedElement.getFigure().setVisible(false);
>
> :)
>
>
> Tomas Zijdemans wrote:
>> I try to make a node invisible in an action with:
>>
>> Node n = (Node) selectedElement.getNotationView();
>> n.setVisible(false);
>>
>> This works, but only after a new object is added or deleted from the
>> diagram. How can I make this happen "inside" the action?
>>
>> Even better in this case would be to only delete the view of the node
>> (not the domain element)
>>
>> I tried:
>>
>> stack.execute(new ICommandProxy(new DestroyElementCommand(new
>> DestroyElementRequest(root, true))));
>>
>> But this destroys both.
>>
>> Any ideas?
>>
>>
>> Best Regards,
>>
>> Tomas Zijdemans
|
|
|
|
Re: Setting visibility in an action [message #165227 is a reply to message #165221] |
Wed, 12 December 2007 19:58 |
Eclipse User |
|
|
|
Originally posted by: trommas.yahoo.com
I didn't about those :)
How can I ensure that the editparts stay invisible after the diagram is
reopened?
The absolute best solution for me (what I'm really trying to
accomplish), is to replace an edit part.
I have A super of B, through an action the user should be able to
"convert" between them. Now I create new nodes - in the same location -
and set the old one invisible. This is obviously not a good solution...
Best Regards,
Tomas Zijdemans
Boris Blajer wrote:
> Hi Tomas,
>
> Setting the View#visible to false inside a transactional command should
> make the view disappear. If not, please set a breakpoint on
> GraphicalEditPart#refreshVisibility and/or
> DiagramEventBroker#getInterestedNotificationListeners to see if the
> notification gets dispatched correctly to the edit part (either the one
> you are hiding or its parent).
>
> Deleting the view instead of hiding it will not work correctly on
> synchronized diagrams.
>
> Best regards,
> Boris
>
> Tomas Zijdemans wrote:
>> I try to make a node invisible in an action with:
>>
>> Node n = (Node) selectedElement.getNotationView();
>> n.setVisible(false);
>>
>> This works, but only after a new object is added or deleted from the
>> diagram. How can I make this happen "inside" the action?
>>
>> Even better in this case would be to only delete the view of the node
>> (not the domain element)
>>
>> I tried:
>>
>> stack.execute(new ICommandProxy(new DestroyElementCommand(new
>> DestroyElementRequest(root, true))));
>>
>> But this destroys both.
>>
>> Any ideas?
>>
>>
>> Best Regards,
>>
>> Tomas Zijdemans
|
|
|
Re: Setting visibility in an action [message #165258 is a reply to message #165227] |
Thu, 13 December 2007 11:04 |
Boris Blajer Messages: 217 Registered: July 2009 |
Senior Member |
|
|
Hi Tomas,
In this case, I would recommend to have a property in the model to
control the appearance of the node (and persist it). NodeMapping's for
the possible variants should be associated with constraints. AFAIK GMF
will automatically change the visualID (and thus the visual appearance)
in response to modification of the property. If it does not, executing
refresh on the canonical edit policy of the parent should help.
Best regards,
Boris
Tomas Zijdemans wrote:
> I didn't about those :)
>
> How can I ensure that the editparts stay invisible after the diagram is
> reopened?
>
> The absolute best solution for me (what I'm really trying to
> accomplish), is to replace an edit part.
>
> I have A super of B, through an action the user should be able to
> "convert" between them. Now I create new nodes - in the same location -
> and set the old one invisible. This is obviously not a good solution...
>
>
> Best Regards,
>
> Tomas Zijdemans
>
>
> Boris Blajer wrote:
>> Hi Tomas,
>>
>> Setting the View#visible to false inside a transactional command
>> should make the view disappear. If not, please set a breakpoint on
>> GraphicalEditPart#refreshVisibility and/or
>> DiagramEventBroker#getInterestedNotificationListeners to see if the
>> notification gets dispatched correctly to the edit part (either the
>> one you are hiding or its parent).
>>
>> Deleting the view instead of hiding it will not work correctly on
>> synchronized diagrams.
>>
>> Best regards,
>> Boris
>>
>> Tomas Zijdemans wrote:
>>> I try to make a node invisible in an action with:
>>>
>>> Node n = (Node) selectedElement.getNotationView();
>>> n.setVisible(false);
>>>
>>> This works, but only after a new object is added or deleted from the
>>> diagram. How can I make this happen "inside" the action?
>>>
>>> Even better in this case would be to only delete the view of the node
>>> (not the domain element)
>>>
>>> I tried:
>>>
>>> stack.execute(new ICommandProxy(new DestroyElementCommand(new
>>> DestroyElementRequest(root, true))));
>>>
>>> But this destroys both.
>>>
>>> Any ideas?
>>>
>>>
>>> Best Regards,
>>>
>>> Tomas Zijdemans
|
|
|
Powered by
FUDForum. Page generated in 0.03532 seconds