Topic
  • 10 replies
  • Latest Post - ‏2017-05-10T14:21:53Z by MerlinUK
swethamouni
swethamouni
1 Post

Pinned topic How to hide all ports in class diagram through API methods

‏2013-05-20T08:12:52Z | api rhapsody

I want to hide  ports that are displayed in the class Diagram. There is an menu option to hide all ports in class diagram manually. I want hide these ports while creating class diagrams using API. Kindly help me which Interface/method to use , since there is no such option with IRPGraphNode/IRPGraphElement.

Please see the attached Snapshot for more details

Attachments

  • oskarsaiz
    oskarsaiz
    1 Post

    Re: How to hide all ports in class diagram through API methods

    ‏2013-10-21T08:54:28Z  

    Hello.

    You can use the API call 'setGraphicalProperty' to set the graphical property 'isVisible' to 'FALSE' in order to hide (remove from view) Port(s).

     

    Below is a sample code for your reference:

    Iterator myIter = RhapsodyAppServer.getActiveRhapsodyApplication().getSelectedGraphElements().toList().iterator();
    while(myIter.hasNext()) {

     IRPGraphElement myGrEle = (IRPGraphElement) myIter.next();
     if(myGrEle.getModelObject().getMetaClass().equals("Port"))
      myGrEle.setGraphicalProperty("isVisible", "FALSE"); }

     

    Hope this helps

    Oskar

  • hdul
    hdul
    5 Posts

    Re: How to hide all ports in class diagram through API methods

    ‏2017-04-21T15:15:04Z  
    • oskarsaiz
    • ‏2013-10-21T08:54:28Z

    Hello.

    You can use the API call 'setGraphicalProperty' to set the graphical property 'isVisible' to 'FALSE' in order to hide (remove from view) Port(s).

     

    Below is a sample code for your reference:

    Iterator myIter = RhapsodyAppServer.getActiveRhapsodyApplication().getSelectedGraphElements().toList().iterator();
    while(myIter.hasNext()) {

     IRPGraphElement myGrEle = (IRPGraphElement) myIter.next();
     if(myGrEle.getModelObject().getMetaClass().equals("Port"))
      myGrEle.setGraphicalProperty("isVisible", "FALSE"); }

     

    Hope this helps

    Oskar

    Hi,

    I am using Rhapsody 8.1.5 (in SysML) and tyring to hide (graphically) some pins. The pins are of type : ActionPin (not Port).

    Question: does the code:

    xxxxx.setGraphicalProperty("isVisible", "FALSE");

    still working in that case and with Rhapsody 8.1.5 ?

    Thank you.

  • hdul
    hdul
    5 Posts

    Re: How to hide all ports in class diagram through API methods

    ‏2017-05-09T12:40:11Z  

    Hi,

    is there somebody in IBM to answer  to my last question with 8.1.5 ? please

  • MerlinUK
    MerlinUK
    146 Posts

    Re: How to hide all ports in class diagram through API methods

    ‏2017-05-10T07:53:17Z  
    • hdul
    • ‏2017-05-09T12:40:11Z

    Hi,

    is there somebody in IBM to answer  to my last question with 8.1.5 ? please

    Pins work differently than Ports (and your original question was on Ports)

    Ports appear on structural diagrams like IBDs and are owned by the classifier (Block/Class) - and as such they could be shown on many different structural diagrams. For that reason pressing delete will simply remove (hide) them from the diagram - as will the menu you've shown in your screenshot

    Pins appear on Activity Diagrams - they are only ever visible on the action to which they are attached - neither that action nor the pin can be placed onto any other diagram. For that reason pressing delete will actually delete the pin from the model. Which is also the reason there is no menu to 'hide' a pin.

    So - to 'hide' a Pin - delete it - either manually or using the API

    Hope that helps !

     

     

  • hdul
    hdul
    5 Posts

    Re: How to hide all ports in class diagram through API methods

    ‏2017-05-10T08:05:36Z  
    • MerlinUK
    • ‏2017-05-10T07:53:17Z

    Pins work differently than Ports (and your original question was on Ports)

    Ports appear on structural diagrams like IBDs and are owned by the classifier (Block/Class) - and as such they could be shown on many different structural diagrams. For that reason pressing delete will simply remove (hide) them from the diagram - as will the menu you've shown in your screenshot

    Pins appear on Activity Diagrams - they are only ever visible on the action to which they are attached - neither that action nor the pin can be placed onto any other diagram. For that reason pressing delete will actually delete the pin from the model. Which is also the reason there is no menu to 'hide' a pin.

    So - to 'hide' a Pin - delete it - either manually or using the API

    Hope that helps !

     

     

    Hi Merlin,

    thanks. I understand why there is no menu to "hide" a pin.

    But I just want to graphically put some particular pins (identified xxxx_constant) not visible without deleting them in my model. Just a question of graphical appearance.

    Tell me how I can delete a pin with the API please ?

    Best regards

  • MerlinUK
    MerlinUK
    146 Posts

    Re: How to hide all ports in class diagram through API methods

    ‏2017-05-10T08:31:00Z  
    • hdul
    • ‏2017-05-10T08:05:36Z

    Hi Merlin,

    thanks. I understand why there is no menu to "hide" a pin.

    But I just want to graphically put some particular pins (identified xxxx_constant) not visible without deleting them in my model. Just a question of graphical appearance.

    Tell me how I can delete a pin with the API please ?

    Best regards

    Hi Herve

    There is a  .deleteFromProject() function that is available on all model elements

    FYI in 8121 there may be another option for you - the ability to define custom views on diagrams - you could define a query that shows all elements except pins - and then use that as a custom view on your diagram(s)

    I tried it and it works great :)

    You can download the 8121 beta here:

    https://www-01.ibm.com/marketing/iwm/iwm/web/reg/download.do?source=swerpratl-rcamrob-3&S_PKG=code&S_TACT=109HG80W&lang=en_US&cp=UTF-8

    From the What's New:

    Here's an example:

     

     

     

  • hdul
    hdul
    5 Posts

    Re: How to hide all ports in class diagram through API methods

    ‏2017-05-10T09:05:20Z  
    • MerlinUK
    • ‏2017-05-10T08:31:00Z

    Hi Herve

    There is a  .deleteFromProject() function that is available on all model elements

    FYI in 8121 there may be another option for you - the ability to define custom views on diagrams - you could define a query that shows all elements except pins - and then use that as a custom view on your diagram(s)

    I tried it and it works great :)

    You can download the 8121 beta here:

    https://www-01.ibm.com/marketing/iwm/iwm/web/reg/download.do?source=swerpratl-rcamrob-3&S_PKG=code&S_TACT=109HG80W&lang=en_US&cp=UTF-8

    From the What's New:

    Here's an example:

     

     

     

    thank you. I will see.

  • hdul
    hdul
    5 Posts

    Re: How to hide all ports in class diagram through API methods

    ‏2017-05-10T12:35:11Z  
    • hdul
    • ‏2017-05-10T09:05:20Z

    thank you. I will see.

    Merlin,

    if you could send me by email how to create the query that shows all elements except pins which name terminates by "_cst", it will help me.

    Thanks

  • MerlinUK
    MerlinUK
    146 Posts

    Re: How to hide all ports in class diagram through API methods

    ‏2017-05-10T14:18:20Z  
    • hdul
    • ‏2017-05-10T12:35:11Z

    Merlin,

    if you could send me by email how to create the query that shows all elements except pins which name terminates by "_cst", it will help me.

    Thanks

    Sure - but I dont see your email ?

  • MerlinUK
    MerlinUK
    146 Posts

    Re: How to hide all ports in class diagram through API methods

    ‏2017-05-10T14:21:53Z  
    • hdul
    • ‏2017-05-10T12:35:11Z

    Merlin,

    if you could send me by email how to create the query that shows all elements except pins which name terminates by "_cst", it will help me.

    Thanks

    I've uploaded a sample model to the Rhapsody Community: Sample Model