Package com.nomagic.uml2.ext.jmi.helpers
Class ElementImageHelper
java.lang.Object
com.nomagic.uml2.ext.jmi.helpers.ElementImageHelper
Utility class to work with 'Image' property, which is contained by all elements.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Structure, which contains information of image: content, format and location. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetCustomImageInformation
(Element element) Gets image information by element if image is set.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.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.
-
Constructor Details
-
ElementImageHelper
public ElementImageHelper()
-
-
Method Details
-
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
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
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
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
-
getCustomImageInformation(Element)