Package com.nomagic.magicdraw.uml
Class ElementIcon
- java.lang.Object
-
- com.nomagic.magicdraw.uml.ElementIcon
-
@OpenApiAll public class ElementIcon extends java.lang.Object
Utility class for providing icons for Elements. Icon can be provided for Element 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.ElementIconCache
Cache that caches designated icon for an element, but not the icon itself.private static class
ElementIcon.ElementIconCacheKey
Element icon cache key
-
Field Summary
-
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.static java.util.Map<java.lang.Class,ResizableIcon>
internalGetIconByTypeMap()
private static ResizableIcon
internalGetIconForSymbol(PresentationElement presentationElement, boolean hideCustomPathStyle)
Gets symbol icon.private static ResizableIcon
loadDoubleSizeIcon(java.lang.String name)
private static void
loadIconForElement(java.lang.Class<? extends BaseElement> elementClass, java.lang.String iconName)
-
-
-
Field Detail
-
mSymbolAdornments
private static final java.util.WeakHashMap<ResizableIcon,ResizableIcon> mSymbolAdornments
-
mIconsByType
private static final java.util.Map<java.lang.Class,ResizableIcon> mIconsByType
-
NONE_ICON
public static final ResizableIcon NONE_ICON
-
SYMBOL_ADORNMENT
public static final ResizableIcon SYMBOL_ADORNMENT
-
ABSTRACT_CLASS
public static final ResizableIcon ABSTRACT_CLASS
-
METACLASS
public static final ResizableIcon METACLASS
-
LINK
public static final ResizableIcon LINK
-
USECASE_INSTANCE
public static final ResizableIcon USECASE_INSTANCE
-
SUBSYSTEM_INSTANCE
public static final ResizableIcon SUBSYSTEM_INSTANCE
-
COMPONENT_INSTANCE
public static final ResizableIcon COMPONENT_INSTANCE
-
NODE_INSTANCE
public static final ResizableIcon NODE_INSTANCE
-
ARTIFACT_INSTANCE
public static final ResizableIcon ARTIFACT_INSTANCE
-
DEVICE_INSTANCE
public static final ResizableIcon DEVICE_INSTANCE
-
EXECUTION_ENVIRONMENT_INSTANCE
public static final ResizableIcon EXECUTION_ENVIRONMENT_INSTANCE
-
ARTIFACT_DEPLOYMENT_INSTANCE
public static final ResizableIcon ARTIFACT_DEPLOYMENT_INSTANCE
-
CALL_MESSAGE
public static final ResizableIcon CALL_MESSAGE
-
CREATE_MESSAGE
public static final ResizableIcon CREATE_MESSAGE
-
DESTROY_MESSAGE
public static final ResizableIcon DESTROY_MESSAGE
-
SEND_MESSAGE
public static final ResizableIcon SEND_MESSAGE
-
REPLY_MESSAGE
public static final ResizableIcon REPLY_MESSAGE
-
ASSEMBLY_CONNECTOR
public static final ResizableIcon ASSEMBLY_CONNECTOR
-
DELEGATION_CONNECTOR
public static final ResizableIcon DELEGATION_CONNECTOR
-
PROFILE_MODEL_LIBRARY
public static final ResizableIcon PROFILE_MODEL_LIBRARY
-
MODEL_MODEL_LIBRARY
public static final ResizableIcon MODEL_MODEL_LIBRARY
-
PACKAGE_MODEL_LIBRARY
public static final ResizableIcon PACKAGE_MODEL_LIBRARY
-
DIRECTED_ASSOCIATION
public static final ResizableIcon DIRECTED_ASSOCIATION
-
DIRECTED_AGGREGATION
public static final ResizableIcon DIRECTED_AGGREGATION
-
AGGREGATION
public static final ResizableIcon AGGREGATION
-
COMPOSITION
public static final ResizableIcon COMPOSITION
-
DIRECTED_COMPOSITION
public static final ResizableIcon DIRECTED_COMPOSITION
-
NON_NAVIGABLE_ASSOCIATION
public static final ResizableIcon NON_NAVIGABLE_ASSOCIATION
-
ACCEPT_TIME_EVENT_ACTION
public static final ResizableIcon ACCEPT_TIME_EVENT_ACTION
-
SUBSYSTEM
public static final ResizableIcon SUBSYSTEM
-
COMPOSITE_STATE
public static final ResizableIcon COMPOSITE_STATE
-
SUBMACHINE_STATE
public static final ResizableIcon SUBMACHINE_STATE
-
CONCURRENT_STATE
public static final ResizableIcon CONCURRENT_STATE
-
INITIAL_PSEUDO_STATE
public static final ResizableIcon INITIAL_PSEUDO_STATE
-
DEEP_HISTORY_PSEUDO_STATE
public static final ResizableIcon DEEP_HISTORY_PSEUDO_STATE
-
SHALLOW_HISTORY_PSEUDO_STATE
public static final ResizableIcon SHALLOW_HISTORY_PSEUDO_STATE
-
JOIN_PSEUDO_STATE
public static final ResizableIcon JOIN_PSEUDO_STATE
-
FORK_PSEUDO_STATE
public static final ResizableIcon FORK_PSEUDO_STATE
-
JUNCTION_PSEUDO_STATE
public static final ResizableIcon JUNCTION_PSEUDO_STATE
-
CHOICE_PSEUDO_STATE
public static final ResizableIcon CHOICE_PSEUDO_STATE
-
ENTRY_POINT_PSEUDO_STATE
public static final ResizableIcon ENTRY_POINT_PSEUDO_STATE
-
EXIT_POINT_PSEUDO_STATE
public static final ResizableIcon EXIT_POINT_PSEUDO_STATE
-
TERMINATE_PSEUDO_STATE
public static final ResizableIcon TERMINATE_PSEUDO_STATE
-
DOCUMENTATION
public static final ResizableIcon DOCUMENTATION
-
mSmallIconsByDiagramType
private static final java.util.Map<java.lang.String,ResizableIcon> mSmallIconsByDiagramType
-
mSVGIconsByDiagramType
private static final java.util.Map<java.lang.String,ResizableIcon> mSVGIconsByDiagramType
-
-
Method Detail
-
internalGetIconByTypeMap
public static java.util.Map<java.lang.Class,ResizableIcon> internalGetIconByTypeMap()
-
loadDoubleSizeIcon
private static ResizableIcon loadDoubleSizeIcon(java.lang.String name)
-
loadIconForElement
private static void loadIconForElement(java.lang.Class<? extends BaseElement> 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). UseinternalGetIconForSymbol(com.nomagic.magicdraw.uml.symbols.PresentationElement, boolean)
to get adorned symbol icons.- Parameters:
element
- the Element.hideCustomPathStyle
- if true custom path style icon is skipped in icon searching process- Returns:
- icon
-
internalGetIconForSymbol
@CheckForNull private static ResizableIcon internalGetIconForSymbol(PresentationElement presentationElement, boolean hideCustomPathStyle)
Gets symbol icon. It is usually an element icon adorned with the symbol "icon"- Parameters:
presentationElement
- symbolhideCustomPathStyle
- hide custom path icon if specified- 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
- given 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
-
adornSymbol
@CheckForNull private static ResizableIcon adornSymbol(@CheckForNull ResizableIcon icon)
-
getSVGIconByDiagramType
@CheckForNull public static ResizableIcon getSVGIconByDiagramType(java.lang.String diagramType)
Returns SVG icon by diagram type- Parameters:
diagramType
- the diagram.- Returns:
- icon
-
-