Image services

Modelio v3

Modelio image services provide a programmatic get the image of a model element, a stereotyped element and a metaclass as it appears in the browser.
You do not have to (and should not) dispose the returned images.

Image of a model element

Use the getUmlImage(Element, boolean) service to get the standard image of the model object ignoring the stereotypes owned by the object. The returned image can be decorated with CMS state image depending on the useCmsDecoration parameter.

The example below gets the UML image of an element with CMS management marks.

1  IIMageService service = Modelio.getInstance().getImageService();
2
3  Element el = ...
4
5  Image image = service.getUmlImage(el, true);

Stereotyped image of an element

Use the getStereotypedImage(Element, IPeerModule, boolean) service to get the stereotyped image of the model object as it appears in the browser. A filter can be specified to display only a stereotype of the given module.

The example below gets the stereotyped image of an element without filter and with CMS management marks.

1  IIMageService service = Modelio.getInstance().getImageService();
2
3  Element el = ...
4
5  Image image = service.getStereotypedImage(el, null, true);

Image of a metaclass

Use the getMetaclassImage(Class<? extends MObject>) service to get the image of a metaclass java class.

The example below gets the image of the “Package” metaclass.

1  IIMageService service = Modelio.getInstance().getImageService();
2
3  Element el = ...
4
5  Image image = service.getMetaclassImage(Package.class);