Class CompartmentManager

java.lang.Object
com.nomagic.magicdraw.uml.symbols.CompartmentManager

@OpenApiAll public class CompartmentManager extends Object

Contains utility methods for dealing with compartment and its elements.

Example 1: Display a property in a compartment

 Property property = ...; // Property model element.
 ClassView classView = ...; // Class symbol.

 SessionManager manager = SessionManager.getInstance();
 manager.createSession("Show Property.");

 CompartmentManager.showCompartmentElement(classView, CompartmentID.ATTRIBUTES, property);

 manager.closeSession();
 

Example 2: Hide a slot on a class shape

 Slot slot = ...; // Slot model element.
 ClassView classView = ...; // Class symbol.

 SessionManager manager = SessionManager.getInstance();
 manager.createSession("Hide slot.");

 CompartmentManager.hideCompartmentElement(classView, CompartmentID.TAGGED_VALUES_ON_SHAPE, slot);

 manager.closeSession();
 
See Also:
  • Constructor Details

    • CompartmentManager

      public CompartmentManager()
  • Method Details

    • hideCompartmentElement

      public static void hideCompartmentElement(PresentationElement view, String compartmentID, Element element)
      Hides an element in a compartment.
      Parameters:
      view - symbol which contains the compartment.
      compartmentID - id of the compartment.
      element - element to hide.
    • hideCompartmentElements

      public static void hideCompartmentElements(PresentationElement view, String compartmentID, List<Element> elements)
      Hides elements in a compartment.
      Parameters:
      view - symbol which contains the compartment.
      compartmentID - id of the compartment.
      elements - elements to hide.
    • showCompartmentElement

      public static void showCompartmentElement(PresentationElement view, String compartmentID, Element element)
      Shows element in a compartment.
      Parameters:
      view - symbol which contains the compartment.
      compartmentID - id of the compartment.
      element - element to show.
    • showCompartmentElements

      public static void showCompartmentElements(PresentationElement view, String compartmentID, List<Element> elements)
      Shows elements in a compartment.
      Parameters:
      view - symbol which contains the compartment.
      compartmentID - id of the compartment.
      elements - elements to show.