@OpenApiAll
public class Annotation
extends java.lang.Object
AnnotationSeverityComparator
for details.
Annotations provide ready to use action which user can make eg. in order to fix some
problem in the model.
Annotation are identified by kind, target, severity and actions - see equals() method for details.Modifier and Type | Class and Description |
---|---|
static class |
Annotation.SCOPE
Scope is context in which annotation can be used.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEBUG |
static java.lang.String |
ERROR |
static java.lang.String |
FATAL |
static java.lang.String |
INFO |
static java.lang.String |
WARNING |
Constructor and Description |
---|
Annotation(BaseElement target,
Constraint constraint)
Creates and initializes a new
Annotation object from specified parameters. |
Annotation(BaseElement target,
Constraint constraint,
java.util.List<? extends NMAction> actions)
Creates and initializes a new
Annotation object from specified parameters. |
Annotation(BaseElement target,
Constraint constraint,
java.lang.String text,
java.util.List<? extends NMAction> actions)
Creates and initializes a new
Annotation object from specified parameters. |
Annotation(Constraint constraint)
Creates and initializes a new
Annotation object from specified parameters. |
Annotation(Constraint constraint,
java.util.List<? extends NMAction> actions)
Creates and initializes a new
Annotation object from specified parameters. |
Annotation(EnumerationLiteral severity,
java.lang.String kind,
java.lang.String text,
BaseElement target)
Creates annotation object without actions.
|
Annotation(EnumerationLiteral severity,
java.lang.String kind,
java.lang.String text,
BaseElement target,
java.util.List<? extends NMAction> actions)
Creates annotation object with actions.
|
Annotation(EnumerationLiteral severity,
java.lang.String kind,
java.lang.String text,
java.lang.Object target)
Creates annotation object without actions.
|
Annotation(EnumerationLiteral severity,
java.lang.String kind,
java.lang.String text,
java.lang.Object target,
java.util.List<? extends NMAction> actions)
Creates annotation object with actions.
|
Annotation(java.lang.Object target,
Constraint constraint)
Creates and initializes a new
Annotation object from specified parameters. |
Annotation(java.lang.Object target,
Constraint constraint,
java.util.List<? extends NMAction> actions)
Creates and initializes a new
Annotation object from specified parameters. |
Annotation(java.lang.Object target,
Constraint constraint,
java.lang.String text,
java.util.List<? extends NMAction> actions)
Creates and initializes a new
Annotation object from specified parameters. |
Modifier and Type | Method and Description |
---|---|
void |
addPainter(AnnotationPainter painter)
Add painter
|
void |
dispose() |
boolean |
equals(java.lang.Object obj) |
java.util.List<? extends NMAction> |
getActions()
Returns annotation actions.
|
static java.util.EnumSet<Annotation.SCOPE> |
getAllPossibleScopes()
Gets all possible annotations scopes which can be used in annotations.
|
Constraint |
getConstraint()
Returns constraint that represents validation rule.
|
static javax.swing.Icon |
getIcon(Annotation annotation)
Returns icon of this annotation
|
java.lang.String |
getKind()
Returns annotation kind (short annotation name)
|
java.util.Collection<AnnotationPainter> |
getPainters() |
java.lang.Object |
getParentObject()
Returns parent object.
|
Project |
getProject()
Gets project that annotation belongs to.
|
java.util.EnumSet<Annotation.SCOPE> |
getScopes()
Gets annotation scopes.
|
EnumerationLiteral |
getSeverity()
Returns annotation severity level - one of the SeverityKind enumeration.
|
java.awt.Color |
getSeverityColor()
Calculates severity level color.
|
Image |
getSeverityImageIcon()
Annotation icon by severity.
|
static EnumerationLiteral |
getSeverityLevel(Project project,
java.lang.String name)
Searches for a severity level with a given name in a project.
|
static java.util.List<EnumerationLiteral> |
getSeverityLevels(Project project)
An utility method for accessing available in the project severity levels (they are mapped to Enumeration Literals).
|
BaseElement |
getTarget()
Returns annotation target - the project entity to which the annotation is bound to.
|
java.lang.Object |
getTargetObject()
Returns an object to which the annotation is bound.
|
java.lang.String |
getText()
Returns annotation message.
|
java.lang.String |
getToolTipText()
Returns annotation tool tip text.
|
int |
hashCode() |
void |
removePainter(AnnotationPainter painter)
Remove painter
|
void |
setParentObject(java.lang.Object parentObject)
Sets parent object.
|
void |
setSeverityColor(java.awt.Color severityColor)
Set severity color, The color may be used to draw decorations around the shape.
|
void |
setSeverityIcon(Image severityIcon)
Set annotation icon by severity
|
void |
setText(java.lang.String text)
Sets annotation text.
|
void |
setToolTipText(java.lang.String toolTipText)
Sets annotation tool tip text.
|
public static final java.lang.String ERROR
public static final java.lang.String INFO
public static final java.lang.String WARNING
public static final java.lang.String FATAL
public static final java.lang.String DEBUG
public Annotation(@CheckForNull BaseElement target, Constraint constraint)
Annotation
object from specified parameters.
Actions list will be empty.target
- model element or presentation element that annotation is assigned to.constraint
- constraint that is violated.public Annotation(@CheckForNull BaseElement target, Constraint constraint, java.util.List<? extends NMAction> actions)
Annotation
object from specified parameters.target
- model element or presentation element that annotation is assigned to.constraint
- constraint that is violated.actions
- annotation actions, can be an empty list.public Annotation(@CheckForNull BaseElement target, Constraint constraint, java.lang.String text, java.util.List<? extends NMAction> actions)
Annotation
object from specified parameters.target
- model element or presentation element that annotation is assigned to.constraint
- constraint that is violated.text
- annotation textactions
- annotation actions, can be an empty list.public Annotation(EnumerationLiteral severity, java.lang.String kind, java.lang.String text, @CheckForNull BaseElement target)
severity
- - defines how important the annotation is, eg. it may influence the
display order of annotation if there are many for the same elementkind
- short unique nametext
- message, detailed description of the problem. It may be displayed in
tooltips, tables etc..target
- model element or presentation element that annotation is assigned to.getSeverityLevels(com.nomagic.magicdraw.core.Project)
public Annotation(EnumerationLiteral severity, java.lang.String kind, java.lang.String text, @CheckForNull BaseElement target, java.util.List<? extends NMAction> actions)
severity
- - defines how important the annotation is, eg. it may influence the
display order of annotation if there are many for the same elementkind
- short unique nametext
- message, detailed description of the problem. It may be displayed in
tooltips, tables etc..target
- model element or presentation element that annotation is assigned to.actions
- annotation actions, can be an empty list.getSeverityLevels(com.nomagic.magicdraw.core.Project)
public Annotation(@CheckForNull java.lang.Object target, Constraint constraint)
Annotation
object from specified parameters.
Actions list will be empty.target
- model element or presentation element that annotation is assigned to.constraint
- constraint that is violated.public Annotation(Constraint constraint)
Annotation
object from specified parameters.
Target is unspecified (null).constraint
- constraint that is violated.public Annotation(Constraint constraint, java.util.List<? extends NMAction> actions)
Annotation
object from specified parameters.
Target is unspecified (null).constraint
- constraint that is violated.actions
- annotation actions, can be an empty list.public Annotation(@CheckForNull java.lang.Object target, Constraint constraint, java.util.List<? extends NMAction> actions)
Annotation
object from specified parameters.target
- model object that annotation is assigned to.constraint
- constraint that is violated.actions
- annotation actions, can be an empty list.public Annotation(@CheckForNull java.lang.Object target, Constraint constraint, java.lang.String text, java.util.List<? extends NMAction> actions)
Annotation
object from specified parameters.target
- object that annotation is assigned to.constraint
- constraint that is violated.text
- annotation textactions
- annotation actions, can be an empty list.public Annotation(EnumerationLiteral severity, java.lang.String kind, java.lang.String text, java.lang.Object target)
severity
- - defines how important the annotation is, eg. it may influence the
display order of annotation if there are many for the same elementkind
- short unique nametext
- message, detailed description of the problem. It may be displayed in
tooltips, tables etc..target
- object that annotation is assigned to.getSeverityLevels(com.nomagic.magicdraw.core.Project)
public Annotation(EnumerationLiteral severity, java.lang.String kind, java.lang.String text, java.lang.Object target, java.util.List<? extends NMAction> actions)
severity
- - defines how important the annotation is, eg. it may influence the
display order of annotation if there are many for the same elementkind
- short unique nametext
- message, detailed description of the problem. It may be displayed in
tooltips, tables etc..target
- object that annotation is assigned to.actions
- annotation actions, can be an empty list.getSeverityLevels(com.nomagic.magicdraw.core.Project)
public void dispose()
public java.util.EnumSet<Annotation.SCOPE> getScopes()
public static java.util.EnumSet<Annotation.SCOPE> getAllPossibleScopes()
public void setText(java.lang.String text)
text
- text to set.public java.lang.String getKind()
@CheckForNull public BaseElement getTarget()
@CheckForNull public java.lang.Object getTargetObject()
@CheckForNull public Project getProject()
public java.lang.String getText()
public java.lang.String getToolTipText()
public void setToolTipText(java.lang.String toolTipText)
toolTipText
- text to set.public java.util.List<? extends NMAction> getActions()
public EnumerationLiteral getSeverity()
getSeverityLevels(com.nomagic.magicdraw.core.Project)
public java.awt.Color getSeverityColor()
public void setSeverityColor(java.awt.Color severityColor)
severityColor
- colorpublic Image getSeverityImageIcon()
@CheckForNull public Constraint getConstraint()
public void setSeverityIcon(Image severityIcon)
severityIcon
- iconpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
@CheckForNull public java.lang.Object getParentObject()
public void setParentObject(@CheckForNull java.lang.Object parentObject)
parentObject
- new parent object.public static javax.swing.Icon getIcon(Annotation annotation)
annotation
- annotationpublic static java.util.List<EnumerationLiteral> getSeverityLevels(Project project)
project
- an owner of Enumerationpublic static EnumerationLiteral getSeverityLevel(Project project, java.lang.String name)
public java.util.Collection<AnnotationPainter> getPainters()
public void addPainter(AnnotationPainter painter)
painter
- painterpublic void removePainter(AnnotationPainter painter)
painter
- painter