java.lang.Object
com.dassault_systemes.modeler.sysml.model.Images

@OpenApiAll public class Images extends Object
Utility class to work with Image elements
  • Field Details

  • Constructor Details

    • Images

      public Images()
  • Method Details

    • createImage

      public static AttributeDefinition createImage(ModelElementProject project, String type, String encoding, String content)
      Creates a new image attribute definition under the given project and initializes its metadata fields.
      Parameters:
      project - the project in which the image is created
      type - MIME type of the image
      encoding - encoding of the image content (base64 or identity)
      content - encoded image content
      Returns:
      the created image attribute definition
    • setImageAttributes

      public static void setImageAttributes(Type image, String type, String encoding, String content)
      Sets the metadata attributes (type, encoding, content) on the given image element.
      Parameters:
      image - the image element
      type - MIME type
      encoding - encoding format
      content - encoded content
    • isImage

      public static boolean isImage(Element element)
      Checks whether the given element represents an image using the default image metadata library.
      Parameters:
      element - the element to check
      Returns:
      true if the element is an image
    • getIcon

      @CheckForNull public static ResizableIcon getIcon(Type element)
      Returns a Swing icon for the given image element, if possible.
      Parameters:
      element - the image element
      Returns:
      a resizable icon, or null if the image cannot be decoded
    • createIcon

      @CheckForNull public static ResizableIcon createIcon(@CheckForNull String encoding, @CheckForNull String content, @CheckForNull String type, @CheckForNull String location)
      Creates a Swing icon from the given encoded image data.
      Parameters:
      encoding - encoding format (base64 or identity)
      content - encoded content
      type - MIME type
      location - optional location hint
      Returns:
      a resizable icon, or null if decoding fails
    • getContentAsBase64

      public static String getContentAsBase64(byte[] content)
      Encodes raw bytes into a Base64 string.
      Parameters:
      content - raw bytes
      Returns:
      Base64-encoded string