Class Swimlane
Represents a swimlane in a diagram, which acts as a container for multiple nodes, connectors, and groups.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class Swimlane : Node, IDiagramObject, ICloneable
Remarks
A swimlane is a visual element that clusters multiple nodes, connectors, and groups into a single entity. It provides a logical and visual grouping mechanism within a diagram, allowing for better organization and management of elements. Swimlanes act as containers for their children, which can include nodes, groups, and connectors.
Examples
The following example demonstrates how to use the Swimlane class in the SfDiagramComponent:
<SfDiagramComponent Height="600px" Width="90%" Nodes="@nodes" Swimlanes="@swimlaneCollections">
</SfDiagramComponent>
@code {
DiagramObjectCollection<Swimlane> swimlaneCollections = new DiagramObjectCollection<Swimlane>();
protected override void OnInitialized()
{
Node node1 = new Node()
{
ID = "node1",
Height = 100,
Width = 100,
OffsetX = 100,
OffsetY = 100,
};
Node node2 = new Node()
{
ID = "node2",
Height = 100,
Width = 100,
OffsetX = 300,
OffsetY = 100,
};
swimlaneCollections = new DiagramObjectCollection<Swimlane>()
{
new Swimlane()
{
ID = "swimlane1",
Orientation = Orientation.Horizontal,
Height = 200,
Width = 450,
Header = new SwimlaneHeader ()
{
Annotation = new Annotation()
{
Content = "Header of swimlane"
},
Height = 30
},
Phases = new DiagramObjectCollection<Phase>()
{
new Phase()
{
Header = new SwimlaneHeader ()
{
Annotation = new Annotation()
{
Content = "Header of phase"
}
},
Width = 450
}
},
Lanes = new DiagramObjectCollection<Lane>()
{
new Lane()
{
Header = new SwimlaneHeader ()
{
Annotation = new Annotation()
{
Content = "Header of lane"
}
},
Height = 100,
Children = new DiagramObjectCollection<Node>()
{
node1,
node2
}
}
},
ChildrenSpacing = new DiagramThickness()
{
Bottom = 10,
Left = 10,
Right = 10,
Top = 10
}
}
};
}
}
Constructors
Swimlane()
Creates a new instance of the Swimlane.
Declaration
public Swimlane()
Swimlane(Swimlane)
Creates a new instance of the Swimlane from the given Swimlane.
Declaration
public Swimlane(Swimlane src)
Parameters
Type | Name | Description |
---|---|---|
Swimlane | src | Swimlane |
Properties
ChildrenSpacing
Gets or sets the spacing value between the lane/phase header and its children.
Declaration
public DiagramThickness ChildrenSpacing { get; set; }
Property Value
Type | Description |
---|---|
DiagramThickness | A DiagramThickness object representing the spacing value for the swimlane's children.The default /// value for margin is 20 for all sides. |
Remarks
Use this property to set the spacing between the lane/phase header and its children nodes, connectors, or groups within the swimlane.
Examples
The following example demonstrates how to set the children spacing for a swimlane:
<SfDiagramComponent Height="600px" Width="90%" Swimlanes="@swimlaneCollections">
</SfDiagramComponent>
@code {
DiagramObjectCollection<Swimlane> swimlaneCollections = new DiagramObjectCollection<Swimlane>();
protected override void OnInitialized()
{
Node node1 = new Node()
{
ID = "node1",
Height = 100,
Width = 100,
OffsetX = 100,
OffsetY = 100,
};
Node node2 = new Node()
{
ID = "node2",
Height = 100,
Width = 100,
OffsetX = 300,
OffsetY = 100,
};
swimlaneCollections = new DiagramObjectCollection<Swimlane>()
{
new Swimlane()
{
ID = "swimlane1",
Orientation = Orientation.Horizontal,
Height = 200,
Width = 450,
Header = new SwimlaneHeader ()
{
Annotation = new Annotation()
{
Content = "Header of swimlane"
},
Height = 30
},
Phases = new DiagramObjectCollection<Phase>()
{
new Phase()
{
Header = new SwimlaneHeader ()
{
Annotation = new Annotation()
{
Content = "Header of phase"
}
},
Width = 450
}
},
Lanes = new DiagramObjectCollection<Lane>()
{
new Lane()
{
Header = new SwimlaneHeader ()
{
Annotation = new Annotation()
{
Content = "Header of lane"
}
},
Height = 100,
Children = new DiagramObjectCollection<Node>()
{
node1,
node2
}
}
},
ChildrenSpacing = new DiagramThickness()
{
Bottom = 10,
Left = 10,
Right = 10,
Top = 10
}
}
};
}
}
Header
Gets or sets the header of the swimlane.
Declaration
public SwimlaneHeader Header { get; set; }
Property Value
Type | Description |
---|---|
SwimlaneHeader | The header that defines the title of the swimlane. |
Remarks
Use the header property to set a custom annotation or content for the swimlane header.
Examples
The following example demonstrates how to set the header of a swimlane:
<SfDiagramComponent Height="600px" Width="90%" Swimlanes="@swimlaneCollections">
</SfDiagramComponent>
@code {
DiagramObjectCollection<Swimlane> swimlaneCollections = new DiagramObjectCollection<Swimlane>();
protected override void OnInitialized()
{
swimlaneCollections = new DiagramObjectCollection<Swimlane>()
{
new Swimlane()
{
ID = "swimlane1",
Orientation = Orientation.Horizontal,
Height = 200,
Width = 450,
Header = new SwimlaneHeader ()
{
Annotation = new Annotation()
{
Content = "Header of swimlane"
},
Height = 30
}
}
};
}
}
Lanes
Gets or sets the collection of lanes within the swimlane.
Declaration
public DiagramObjectCollection<Lane> Lanes { get; set; }
Property Value
Type | Description |
---|---|
DiagramObjectCollection<Lane> | A collection of Lane objects representing the lanes within the swimlane. |
Remarks
Use this property to add and manage the lanes within the swimlane. Lanes are functional units or responsible departments of a business process that help to map a process within the functional unit or in between other functional units.
Examples
The following example demonstrates how to add lanes to a swimlane:
<SfDiagramComponent Height="600px" Width="90%" Swimlanes="@swimlaneCollections">
</SfDiagramComponent>
@code {
DiagramObjectCollection<Swimlane> swimlaneCollections = new DiagramObjectCollection<Swimlane>();
protected override void OnInitialized()
{
Node node1 = new Node()
{
ID = "node1",
Height = 100,
Width = 100,
OffsetX = 100,
OffsetY = 100,
};
Node node2 = new Node()
{
ID = "node2",
Height = 100,
Width = 100,
OffsetX = 300,
OffsetY = 100,
};
swimlaneCollections = new DiagramObjectCollection<Swimlane>()
{
new Swimlane()
{
ID = "swimlane1",
Orientation = Orientation.Horizontal,
Height = 200,
Width = 450,
Lanes = new DiagramObjectCollection<Lane>()
{
new Lane()
{
Header = new SwimlaneHeader ()
{
Annotation = new Annotation()
{
Content = "Header of lane"
}
},
Height = 100,
Children = new DiagramObjectCollection<Node>()
{
node1,
node2
}
}
}
}
};
}
}
Orientation
Gets or sets the orientation of the swimlane.
Declaration
public Orientation Orientation { get; set; }
Property Value
Type | Description |
---|---|
Orientation | The orientation of the swimlane, which can be either Horizontal or Vertical. |
Remarks
The default orientation is Horizontal.
Examples
The following example demonstrates how to set the orientation of a swimlane:
<SfDiagramComponent Height="600px" Width="90%" Swimlanes="@swimlaneCollections">
</SfDiagramComponent>
@code {
DiagramObjectCollection<Node> nodes = new DiagramObjectCollection<Node>();
DiagramObjectCollection<Swimlane> swimlaneCollections = new DiagramObjectCollection<Swimlane>();
protected override void OnInitialized()
{
swimlaneCollections = new DiagramObjectCollection<Swimlane>()
{
new Swimlane()
{
ID = "swimlane1",
Orientation = Orientation.Horizontal,
Height = 200,
Width = 450,
}
};
}
}
Phases
Gets or sets the collection of phases within the swimlane.
Declaration
public DiagramObjectCollection<Phase> Phases { get; set; }
Property Value
Type | Description |
---|---|
DiagramObjectCollection<Phase> | A collection of Phase objects representing the phases within the swimlane. |
Remarks
Use this property to add and manage the phases within the swimlane. Phases are subprocesses that split each lane horizontally or vertically based on the swimlane's orientation.
Examples
The following example demonstrates how to add phases to a swimlane:
<SfDiagramComponent Height="600px" Width="90%" Swimlanes="@swimlaneCollections">
</SfDiagramComponent>
@code {
DiagramObjectCollection<Swimlane> swimlaneCollections = new DiagramObjectCollection<Swimlane>();
protected override void OnInitialized()
{
swimlaneCollections = new DiagramObjectCollection<Swimlane>()
{
new Swimlane()
{
ID = "swimlane1",
Orientation = Orientation.Horizontal,
Height = 200,
Width = 450,
Phases = new DiagramObjectCollection<Phase>()
{
new Phase()
{
Header = new SwimlaneHeader ()
{
Annotation = new Annotation()
{
Content = "Header of phase"
}
},
Width = 450
}
}
}
};
}
}
Methods
Clone()
Creates a new instance of the Swimlane class that is a copy of the current instance.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | A new Swimlane object that is a copy of this instance. |