IBM Support

Using the Rhapsody API to swap the order of TableLayout columns

Product Documentation


Abstract

The user interface can be used to swap the order of the table columns, but it is possible to use the API to swap the order of columns in Tables in IBM Rhapsody.

Content

The Model

  1. The example model has a number of packages, each with many classes:

    image

     
  2. A table layout/view is used to list the contents in tabular form

    image

     
  3. Context patterns are used to determine what types of information should be displayed in the table.See "Using context patterns in tables" in the Rhapsody docs.

    image

    The Code
     
  4. In this case we use a custom class, TempColumn, to store the name and context values

    image

     
  5. We can use the following API methods: IRPTableLayout.getColumnName and IRPTableLayout.getColumnContext to retrieve data from a table layout.

    image

     
  6. If all the columns of the table layout are placed in a list, this order can be swapped with a call to Collections.swap()
     image
     
  7. The list can then be iteratively copied back into the table layout using IRPTableLayout.setColumnName and IRPTableLayout.setColumnContext
     

image

 

 

 

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Component":"","Platform":[{"code":"PF033","label":"Windows"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

ibm10730739