Class UmlSequenceFragment
Represents a fragment in a UML sequence diagram that defines interaction blocks such as loops, conditionals, alternatives, and other control flow structures that group and control the execution of messages.
Inheritance
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class UmlSequenceFragment : Object
Remarks
Fragments are rectangular regions that enclose a set of messages and define how they should be executed. Common fragment types include:
- alt - Alternative execution paths (if-else logic)
- opt - Optional execution (if logic)
- loop - Repeated execution (while/for logic)
Each fragment has a guard condition that determines when the enclosed interactions should execute.
Examples
<SfDiagramComponent Height="600px" Model="@umlModel">
</SfDiagramComponent>
@code
{
UmlSequenceDiagramModel umlModel;
protected override void OnInitialized()
{
umlModel = new UmlSequenceDiagramModel()
{
Participants = new List<UmlSequenceParticipant>()
{
new UmlSequenceParticipant()
{
ID = "User",
Content= "User",
ShowDestructionMarker= true,
IsActor= true,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act1", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
},
new UmlSequenceParticipant()
{
ID = "Server",
Content= "Server",
ShowDestructionMarker= true,
IsActor= false,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act2", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
}
},
Messages = new List<UmlSequenceMessage>()
{
new UmlSequenceMessage()
{
ID = "MSG1",
Content = "User sends request",
FromParticipantID = "User",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG2",
Content = "Processing",
FromParticipantID = "Server",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG3",
Content = "Server sends response",
FromParticipantID = "Server",
ToParticipantID = "User"
}
},
Fragments = new List<UmlSequenceFragment>()
{
new UmlSequenceFragment()
{
ID = "frag1",
FragmentType = UmlSequenceFragmentType.Optional,
Conditions = new List<UmlSequenceFragmentCondition>()
{
new UmlSequenceFragmentCondition()
{
Content = "Interactions",
MessageIds = new List<string>(){"MSG1", "MSG2", "MSG3"}
}
}
}
}
};
}
}
Constructors
UmlSequenceFragment()
Initializes a new instance of the UmlSequenceFragment class.
Declaration
public UmlSequenceFragment()
Properties
Conditions
Gets or sets the list of conditions associated with the fragment. Conditions define specific scenarios or checks that govern the fragment's behavior.
Declaration
public List<UmlSequenceFragmentCondition> Conditions { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<UmlSequenceFragmentCondition> | A System.Collections.Generic.List<> of UmlSequenceFragmentCondition objects that represent the conditions associated with the fragment. Each condition includes descriptive content and a set of message identifiers that define its scope. The list cannot be set to null, but can be empty. |
Remarks
Conditions are essential for controlling fragment execution:
- Loop fragments - Condition specifies when to continue looping
- Optional fragments - Condition determines if messages should execute
- Alternative fragments - Multiple conditions provide different execution paths
Each condition's MessageIds property specifies which messages are affected by that particular condition.
Examples
<SfDiagramComponent Height="600px" Model="@umlModel">
</SfDiagramComponent>
@code
{
UmlSequenceDiagramModel umlModel;
protected override void OnInitialized()
{
umlModel = new UmlSequenceDiagramModel()
{
Participants = new List<UmlSequenceParticipant>()
{
new UmlSequenceParticipant()
{
ID = "User",
Content= "User",
ShowDestructionMarker= true,
IsActor= true,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act1", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
},
new UmlSequenceParticipant()
{
ID = "Server",
Content= "Server",
ShowDestructionMarker= true,
IsActor= false,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act2", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
}
},
Messages = new List<UmlSequenceMessage>()
{
new UmlSequenceMessage()
{
ID = "MSG1",
Content = "User sends request",
FromParticipantID = "User",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG2",
Content = "Processing",
FromParticipantID = "Server",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG3",
Content = "Server sends response",
FromParticipantID = "Server",
ToParticipantID = "User"
}
},
Fragments = new List<UmlSequenceFragment>()
{
new UmlSequenceFragment()
{
ID = "frag1",
FragmentType = UmlSequenceFragmentType.Optional,
Conditions = new List<UmlSequenceFragmentCondition>()
{
new UmlSequenceFragmentCondition()
{
Content = "Interactions",
MessageIds = new List<string>(){"MSG1", "MSG2", "MSG3"}
}
}
}
}
};
}
}
FragmentType
Gets or sets the type of the fragment, indicating the kind of interaction construct such as Loop, Optional, or Alternative.
Declaration
public UmlSequenceFragmentType FragmentType { get; set; }
Property Value
Type | Description |
---|---|
UmlSequenceFragmentType | A UmlSequenceFragmentType enumeration value that determines the behavior and visual representation of the fragment. Common values include Loop, Optional, and Alternative. |
Remarks
The fragment type controls how the enclosed messages are executed and displayed:
- Loop - Messages execute repeatedly based on a guard condition
- Optional - Messages execute only if the guard condition is true
- Alternative - Provides multiple execution paths (if-else logic)
Examples
<SfDiagramComponent Height="600px" Model="@umlModel">
</SfDiagramComponent>
@code
{
UmlSequenceDiagramModel umlModel;
protected override void OnInitialized()
{
umlModel = new UmlSequenceDiagramModel()
{
Participants = new List<UmlSequenceParticipant>()
{
new UmlSequenceParticipant()
{
ID = "User",
Content= "User",
ShowDestructionMarker= true,
IsActor= true,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act1", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
},
new UmlSequenceParticipant()
{
ID = "Server",
Content= "Server",
ShowDestructionMarker= true,
IsActor= false,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act2", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
}
},
Messages = new List<UmlSequenceMessage>()
{
new UmlSequenceMessage()
{
ID = "MSG1",
Content = "User sends request",
FromParticipantID = "User",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG2",
Content = "Processing",
FromParticipantID = "Server",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG3",
Content = "Server sends response",
FromParticipantID = "Server",
ToParticipantID = "User"
}
},
Fragments = new List<UmlSequenceFragment>()
{
new UmlSequenceFragment()
{
ID = "frag1",
FragmentType = UmlSequenceFragmentType.Optional,
Conditions = new List<UmlSequenceFragmentCondition>()
{
new UmlSequenceFragmentCondition()
{
Content = "Interactions",
MessageIds = new List<string>(){"MSG1", "MSG2", "MSG3"}
}
}
}
}
};
}
}
ID
Gets or sets the unique identifier for the fragment.
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String that uniquely identifies the UML sequence fragment within the diagram. This identifier must be unique across all fragments in the sequence diagram and is used for referencing and managing the fragment programmatically. The default value is an empty string. |
Remarks
The ID serves as a key for identifying this specific fragment when working with collections of fragments, applying styling, or performing operations on the fragment. It should follow standard naming conventions and be descriptive of the fragment's purpose when possible.
Examples
<SfDiagramComponent Height="600px" Model="@umlModel">
</SfDiagramComponent>
@code
{
UmlSequenceDiagramModel umlModel;
protected override void OnInitialized()
{
umlModel = new UmlSequenceDiagramModel()
{
Participants = new List<UmlSequenceParticipant>()
{
new UmlSequenceParticipant()
{
ID = "User",
Content= "User",
ShowDestructionMarker= true,
IsActor= true,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act1", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
},
new UmlSequenceParticipant()
{
ID = "Server",
Content= "Server",
ShowDestructionMarker= true,
IsActor= false,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act2", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
}
},
Messages = new List<UmlSequenceMessage>()
{
new UmlSequenceMessage()
{
ID = "MSG1",
Content = "User sends request",
FromParticipantID = "User",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG2",
Content = "Processing",
FromParticipantID = "Server",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG3",
Content = "Server sends response",
FromParticipantID = "Server",
ToParticipantID = "User"
}
},
Fragments = new List<UmlSequenceFragment>()
{
new UmlSequenceFragment()
{
ID = "frag1",
FragmentType = UmlSequenceFragmentType.Optional,
Conditions = new List<UmlSequenceFragmentCondition>()
{
new UmlSequenceFragmentCondition()
{
Content = "Interactions",
MessageIds = new List<string>(){"MSG1", "MSG2", "MSG3"}
}
}
}
}
};
}
}