Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Setting visibility in an action
Setting visibility in an action [message #165176] Wed, 12 December 2007 13:24 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #165221 is a reply to message #165176] Wed, 12 December 2007 16:53 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
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 #165227 is a reply to message #165221] Wed, 12 December 2007 19:58 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Boris Blajer is currently offline Boris BlajerFriend
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
Previous Topic:WrapLabels
Next Topic:Is is possible to extend XXCreateCommands to a custom plug-in ?
Goto Forum:
  


Current Time: Fri Apr 26 06:55:11 GMT 2024

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

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

Back to the top