Package com.nomagic.uml2.ext.jmi.helpers
Class ElementImageHelper
- java.lang.Object
-
- com.nomagic.uml2.ext.jmi.helpers.ElementImageHelper
-
@OpenApiAll public class ElementImageHelper extends java.lang.Object
Utility class to work with 'Image' property, which is contained by all elements.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ElementImageHelper.ImageInformation
Structure, which contains information of image: content, format and location.
-
Constructor Summary
Constructors Constructor Description ElementImageHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ElementImageHelper.ImageInformation
getCustomImageInformation(Element element)
Gets image information by element if image is set.static ElementImageHelper.ImageInformation
getCustomImageInformation(Element element, Stereotype stereotype)
Deprecated.static Element
getElementToSetImage(ModelElementProvider pElement)
Returns element to set image propertystatic ResizableIcon
getIconFromCustomImageProperty(ElementImageHelper.ImageInformation imageInformation)
A helper method to create resizable icon from image information.static ResizableIcon
getIconFromCustomImageProperty(Element element)
Gets 'ResizableIcon', which is created from the image information.static Stereotype
getImageHolderStereotype(Project project)
Return image holder stereotype from a given project.static ElementImageHelper.ImageInformation
getProvidedElementImageInformation(ModelElementProvider pElement)
Returns image information of provided elementstatic void
setCustomImageInformation(Element element, ElementImageHelper.ImageInformation imageInformation)
Set image information to given element: stereotype 'CustomImageHolder' is applied on element and image information are saved to the tags of this stereotype.static void
setCustomImageInformation(Element element, Image image)
Set image information to given element: stereotype 'CustomImageHolder' is applied on element and image information are saved to the tags of this stereotype.
-
-
-
Method Detail
-
getCustomImageInformation
@CheckForNull public static ElementImageHelper.ImageInformation getCustomImageInformation(Element element)
Gets image information by element if image is set.- Parameters:
element
- element, which contains image property.- Returns:
- image information if image to element is set, otherwise null.
-
getCustomImageInformation
@Deprecated @CheckForNull public static ElementImageHelper.ImageInformation getCustomImageInformation(Element element, Stereotype stereotype)
Deprecated.Gets image information by element if image is set.- Parameters:
element
- element, which contains image property.- Returns:
- image information if image to element is set, otherwise null.
-
setCustomImageInformation
public static void setCustomImageInformation(Element element, Image image)
Set image information to given element: stereotype 'CustomImageHolder' is applied on element and image information are saved to the tags of this stereotype.- Parameters:
element
- element, which contains image propertyimage
- information source used to set image
-
setCustomImageInformation
public static void setCustomImageInformation(Element element, @CheckForNull ElementImageHelper.ImageInformation imageInformation)
Set image information to given element: stereotype 'CustomImageHolder' is applied on element and image information are saved to the tags of this stereotype. If image is removed, stereotype is removed too.- Parameters:
element
- element, which contains image propertyimageInformation
- structure, which contains information of image: content, format and location
-
getImageHolderStereotype
public static Stereotype getImageHolderStereotype(Project project)
Return image holder stereotype from a given project.- Parameters:
project
- project- Returns:
- image holder stereotype
-
getIconFromCustomImageProperty
@CheckForNull public static ResizableIcon getIconFromCustomImageProperty(@CheckForNull Element element)
Gets 'ResizableIcon', which is created from the image information.- Parameters:
element
- element, which contains image property- Returns:
- 'ResizableIcon' if image is set to element's 'Image' property, otherwise null
-
getIconFromCustomImageProperty
@CheckForNull public static ResizableIcon getIconFromCustomImageProperty(@CheckForNull ElementImageHelper.ImageInformation imageInformation)
A helper method to create resizable icon from image information.- Parameters:
imageInformation
- image info- Returns:
- icon
-
getElementToSetImage
@CheckForNull public static Element getElementToSetImage(ModelElementProvider pElement)
Returns element to set image property- Parameters:
pElement
- presentation element- Returns:
- element to which image should be set
-
getProvidedElementImageInformation
@CheckForNull public static ElementImageHelper.ImageInformation getProvidedElementImageInformation(ModelElementProvider pElement)
Returns image information of provided element- Parameters:
pElement
- presentation element- Returns:
- element to which image should be set
-
-