Package com.nomagic.magicdraw.uml
Class ElementIcon
- java.lang.Object
-
- com.nomagic.magicdraw.icons.ElementIconsRegistry
-
- com.nomagic.magicdraw.uml.ElementIcon
-
@OpenApiAll public class ElementIcon extends ElementIconsRegistry
Utility class for providing icons for Elements. Icon can be provided for BaseElement object, class type of Element, diagram type. SeeClassTypes
for useful utility methods to work with class types. UseBaseElement.getClassType()
to retrieve class type of the Element.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ElementIcon.ElementIconCache2
private static class
ElementIcon.ElementIconsCacheImpl
-
Field Summary
Fields Modifier and Type Field Description private static ElementIcon.ElementIconsCacheImpl
elementIconsCacheImpl
static ResizableIcon
SYMBOL_ADORNMENT
private static java.util.WeakHashMap<ResizableIcon,ResizableIcon>
symbolAdornments
-
Fields inherited from class com.nomagic.magicdraw.icons.ElementIconsRegistry
ABSTRACT_CLASS, ACCEPT_TIME_EVENT_ACTION, AGGREGATION, ARTIFACT_DEPLOYMENT_INSTANCE, ARTIFACT_INSTANCE, ASSEMBLY_CONNECTOR, CALL_MESSAGE, CHOICE_PSEUDO_STATE, COMPONENT_INSTANCE, COMPOSITE_STATE, COMPOSITION, CONCURRENT_STATE, CREATE_MESSAGE, DEEP_HISTORY_PSEUDO_STATE, DELEGATION_CONNECTOR, DESTROY_MESSAGE, DEVICE_INSTANCE, DIRECTED_AGGREGATION, DIRECTED_ASSOCIATION, DIRECTED_COMPOSITION, DOCUMENTATION, ENTRY_POINT_PSEUDO_STATE, EXECUTION_ENVIRONMENT_INSTANCE, EXIT_POINT_PSEUDO_STATE, FORK_PSEUDO_STATE, INITIAL_PSEUDO_STATE, JOIN_PSEUDO_STATE, JUNCTION_PSEUDO_STATE, LINK, METACLASS, MODEL_MODEL_LIBRARY, NARY_ASSOCIATION, NODE_INSTANCE, NON_NAVIGABLE_ASSOCIATION, NONE_ICON, PACKAGE_MODEL_LIBRARY, PROFILE_MODEL_LIBRARY, REPLY_MESSAGE, SEND_MESSAGE, SHALLOW_HISTORY_PSEUDO_STATE, SUBMACHINE_STATE, SUBSYSTEM, SUBSYSTEM_INSTANCE, TERMINATE_PSEUDO_STATE, USECASE_INSTANCE
-
-
Constructor Summary
Constructors Constructor Description ElementIcon()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static ResizableIcon
adornSymbol(ResizableIcon icon)
static ResizableIcon
get16x16Icon(ResizableIcon icon)
Return scaled down to 16x16 icon for a given iconstatic ResizableIcon
getIcon(BaseElement element)
Returns icon for a given elementstatic ResizableIcon
getIcon(BaseElement element, boolean hideCustomPathStyle)
Returns icon for a given elementstatic ResizableIcon
getIconByClassType(java.lang.Class classType)
Returns icon by class type of the element.static ResizableIcon
getIconByClassType(java.lang.Class classType, Stereotype stereotype)
Returns icon by class type and stereotype.static ResizableIcon
getIconByClassType(java.lang.Class classType, java.util.Collection<Stereotype> stereotypes)
Returns icon, according class type and stereotypes.static ResizableIcon
getIconByDiagramType(DiagramPresentationElement diagram)
Returns icon by diagram type.static ResizableIcon
getIconByDiagramType(java.lang.String diagramType)
Returns icon by diagram typestatic ResizableIcon
getIconByStereotype(java.util.function.Supplier<ResizableIcon> iconSupplier, Stereotype stereotype)
Returns icon from stereotype or from iconSupplier if stereotype has no iconstatic ResizableIcon
getIconByType(BaseElement element)
Returns image, according element meta type.static ResizableIcon
getSVGIconByDiagramType(java.lang.String diagramType)
Returns SVG icon by diagram typeprivate static ResizableIcon
internalGetIcon(BaseElement element, boolean hideCustomPathStyle)
Returns icon, according the given element type.private static ResizableIcon
internalGetIconForSymbol(PresentationElement presentationElement, boolean hideCustomPathStyle)
private static void
loadIconForElement(java.lang.Class<? extends PresentationElement> elementClass, java.lang.String iconName)
-
Methods inherited from class com.nomagic.magicdraw.icons.ElementIconsRegistry
getIcon, internalGetIconByTypeMap, loadDoubleSizeIcon, putIcon
-
-
-
-
Field Detail
-
symbolAdornments
private static final java.util.WeakHashMap<ResizableIcon,ResizableIcon> symbolAdornments
-
elementIconsCacheImpl
private static final ElementIcon.ElementIconsCacheImpl elementIconsCacheImpl
-
SYMBOL_ADORNMENT
public static final ResizableIcon SYMBOL_ADORNMENT
-
-
Method Detail
-
loadIconForElement
private static void loadIconForElement(java.lang.Class<? extends PresentationElement> elementClass, java.lang.String iconName)
-
get16x16Icon
@CheckForNull public static ResizableIcon get16x16Icon(@CheckForNull ResizableIcon icon)
Return scaled down to 16x16 icon for a given icon- Parameters:
icon
- icon- Returns:
- scaled icon
-
getIcon
@CheckForNull public static ResizableIcon getIcon(@CheckForNull BaseElement element)
Returns icon for a given element- Parameters:
element
- the Element- Returns:
- icon
-
getIcon
@CheckForNull public static ResizableIcon getIcon(@CheckForNull BaseElement element, boolean hideCustomPathStyle)
Returns icon for a given element- Parameters:
element
- the ElementhideCustomPathStyle
- if true custom path style icon is skipped and standard relationship icons is returned- Returns:
- icon
-
internalGetIcon
@CheckForNull private static ResizableIcon internalGetIcon(@CheckForNull BaseElement element, boolean hideCustomPathStyle)
Returns icon, according the given element type. It will return correct icon for all kinds of elements, but symbol (PresentationElement).- Parameters:
element
- the ElementhideCustomPathStyle
- if true custom path style icon is skipped in icon searching process- Returns:
- icon
-
getIconByClassType
@CheckForNull public static ResizableIcon getIconByClassType(java.lang.Class classType, @CheckForNull Stereotype stereotype)
Returns icon by class type and stereotype.- Parameters:
classType
- class typestereotype
- given stereotype- Returns:
- icon
-
getIconByStereotype
@CheckForNull public static ResizableIcon getIconByStereotype(java.util.function.Supplier<ResizableIcon> iconSupplier, @CheckForNull Stereotype stereotype)
Returns icon from stereotype or from iconSupplier if stereotype has no icon- Parameters:
iconSupplier
- icon supplierstereotype
- given stereotype- Returns:
- icon
-
getIconByClassType
@CheckForNull public static ResizableIcon getIconByClassType(java.lang.Class classType, java.util.Collection<Stereotype> stereotypes)
Returns icon, according class type and stereotypes.- Parameters:
classType
- class typestereotypes
- stereotypes- Returns:
- icon
-
getIconByClassType
@CheckForNull public static ResizableIcon getIconByClassType(java.lang.Class classType)
Returns icon by class type of the element.- Parameters:
classType
- class type- Returns:
- icon
-
getIconByType
@CheckForNull public static ResizableIcon getIconByType(@CheckForNull BaseElement element)
Returns image, according element meta type.- Parameters:
element
- element- Returns:
- icon
-
getIconByDiagramType
@CheckForNull public static ResizableIcon getIconByDiagramType(DiagramPresentationElement diagram)
Returns icon by diagram type.- Parameters:
diagram
- the diagram- Returns:
- icon
-
getIconByDiagramType
@CheckForNull public static ResizableIcon getIconByDiagramType(java.lang.String diagramType)
Returns icon by diagram type- Parameters:
diagramType
- the diagram.- Returns:
- icon
-
getSVGIconByDiagramType
@CheckForNull public static ResizableIcon getSVGIconByDiagramType(java.lang.String diagramType)
Returns SVG icon by diagram type- Parameters:
diagramType
- the diagram.- Returns:
- icon
-
internalGetIconForSymbol
@CheckForNull private static ResizableIcon internalGetIconForSymbol(PresentationElement presentationElement, boolean hideCustomPathStyle)
-
adornSymbol
@CheckForNull private static ResizableIcon adornSymbol(@CheckForNull ResizableIcon icon)
-
-