Class UmlTypedElement
Represents a base abstraction for UML elements that have a name, type, and visual style.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.Diagram.dll
Syntax
public class UmlTypedElement : NodeBase, IDiagramObject, ICloneable
Remarks
This class is commonly used for attributes, method parameters, and other typed UML elements.
Examples
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
nodes.Add(new Node()
{
ID = "methodNode",
OffsetX = 250,
OffsetY = 200,
Width = 200,
Height = 200,
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
ClassShape = new UmlClass()
{
Name = "Calculator",
Methods = new DiagramObjectCollection<UmlClassMethod>()
{
new UmlClassMethod()
{
Name = "Add",
Type = "int",
Parameters = new DiagramObjectCollection<UmlTypedElement>()
{
new UmlTypedElement() { Name = "x", Type = "int" },
new UmlTypedElement() { Name = "y", Type = "int" }
}
}
}
}
}
});
Constructors
UmlTypedElement()
Creates a new instance of the UmlClass.
Declaration
public UmlTypedElement()
UmlTypedElement(UmlTypedElement)
Initializes a new instance of the UmlTypedElement class by copying an existing instance.
Declaration
public UmlTypedElement(UmlTypedElement src)
Parameters
| Type | Name | Description |
|---|---|---|
| UmlTypedElement | src | The source UmlTypedElement to copy. |
Properties
Name
Gets or sets the name of the element.
Declaration
[JsonPropertyName("name")]
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the element name. |
Examples
This example demonstrates defining a parameter name:
nodes.Add(new Node()
{
Style = new ShapeStyle() { Fill = "lightyellow" },
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
ClassShape = new UmlClass()
{
Name = "Calculator",
Methods = new DiagramObjectCollection<UmlClassMethod>()
{
new UmlClassMethod()
{
Name = "Add",
Type = "int",
Scope = UmlScope.Public,
Parameters = new DiagramObjectCollection<UmlTypedElement>()
{
new UmlTypedElement() { Name = "x", Type = "int" },
new UmlTypedElement() { Name = "y", Type = "int" }
}
}
}
}
}
});
Style
Gets or sets the text style applied when rendering the element.
Declaration
[JsonPropertyName("style")]
public TextStyle Style { get; set; }
Property Value
| Type | Description |
|---|---|
| TextStyle | A TextStyle defining the visual appearance. |
Remarks
Controls rendering such as text color and background fill.
Examples
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
ClassShape = new UmlClass()
{
Name = "Sensor",
Methods = new DiagramObjectCollection<UmlClassMethod>()
{
new UmlClassMethod()
{
Name = "Read",
Parameters = new DiagramObjectCollection<UmlTypedElement>()
{
new UmlTypedElement()
{
Name = "temperature",
Type = "double",
Style = new TextStyle()
{
Fill = "lightblue",
Color = "black"
}
}
}
}
}
}
}
});
Type
Gets or sets the type of the element(e.g., "int", "string", "double").
Declaration
[JsonPropertyName("type")]
public string Type { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the type. |
Remarks
Defines the data type (e.g., int, string, double).
Examples
nodes.Add(new Node()
{
Shape = new UmlClassifierShape()
{
Classifier = ClassifierShape.Class,
ClassShape = new UmlClass()
{
Name = "Math",
Methods = new DiagramObjectCollection<UmlClassMethod>()
{
new UmlClassMethod()
{
Name = "Square",
Parameters = new DiagramObjectCollection<UmlTypedElement>()
{
new UmlTypedElement() { Name = "value", Type = "int" }
}
}
}
}
}
});
Methods
Clone()
Creates a new object that is a copy of the current UmlTypedElement.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| object | A new UmlTypedElement instance that is a deep copy of the current object. |
Overrides
Remarks
This method performs a deep copy, creating an independent instance with identical parameter name, type, and style.