// GET= UmlActivity public ActionResult UmlActivity() { List <DiagramNode> nodes = new List <DiagramNode>(); List <DiagramNodeAnnotation> Node1 = new List <DiagramNodeAnnotation>(); Node1.Add(new DiagramNodeAnnotation() { Content = "Receive Customer Call" }); List <DiagramNodeAnnotation> Node3 = new List <DiagramNodeAnnotation>(); Node3.Add(new DiagramNodeAnnotation() { Content = "Determine Type of Call" }); List <DiagramNodeAnnotation> Node4 = new List <DiagramNodeAnnotation>(); Node4.Add(new DiagramNodeAnnotation() { Content = "Customer Logging a Call" }); List <DiagramNodeAnnotation> Node6 = new List <DiagramNodeAnnotation>(); Node6.Add(new DiagramNodeAnnotation() { Content = "Transfer the Call to Sales" }); List <DiagramNodeAnnotation> Node7 = new List <DiagramNodeAnnotation>(); Node7.Add(new DiagramNodeAnnotation() { Content = "Transfer the Call to Help Desk" }); List <DiagramNodeAnnotation> Node10 = new List <DiagramNodeAnnotation>(); Node10.Add(new DiagramNodeAnnotation() { Content = "Close Call", Margin = new DiagramMargin() { Left = 25, Right = 25 } }); List <DiagramConnectorAnnotation> Connector1 = new List <DiagramConnectorAnnotation>(); Connector1.Add(new DiagramConnectorAnnotation() { Content = "Type=New Customer", Style = new DiagramTextStyle() { Fill = "White" } }); List <DiagramConnectorAnnotation> Connector2 = new List <DiagramConnectorAnnotation>(); Connector2.Add(new DiagramConnectorAnnotation() { Content = "Type=Existing Customer", Style = new DiagramTextStyle() { Fill = "White" } }); nodes.Add(new DiagramNode() { Id = "Start", OffsetX = 288, OffsetY = 25.5, Height = 40, Width = 40, Shape = new { type = "UmlActivity", shape = "InitialNode" } }); nodes.Add(new DiagramNode() { Id = "ReceiveCall", OffsetX = 288, OffsetY = 85.5, Height = 40, Width = 105, Annotations = Node1, Shape = new { type = "UmlActivity", shape = "Action" } }); nodes.Add(new DiagramNode() { Id = "node2", OffsetX = 288, OffsetY = 130.5, Height = 10, Width = 70, Shape = new { type = "UmlActivity", shape = "ForkNode" } }); nodes.Add(new DiagramNode() { Id = "Determine", OffsetX = 168, OffsetY = 210.5, Height = 40, Width = 105, Annotations = Node3, Shape = new { type = "UmlActivity", shape = "Action" } }); nodes.Add(new DiagramNode() { Id = "Log", OffsetX = 408, OffsetY = 210.5, Height = 40, Width = 105, Annotations = Node4, Shape = new { type = "UmlActivity", shape = "Action" } }); nodes.Add(new DiagramNode() { Id = "node5", OffsetX = 168, OffsetY = 290.5, Height = 50, Width = 50, Shape = new { type = "UmlActivity", shape = "Decision" } }); nodes.Add(new DiagramNode() { Id = "transfer_sales", OffsetX = 88, OffsetY = 360.5, Height = 40, Width = 105, Annotations = Node6, Shape = new { type = "UmlActivity", shape = "Action" } }); nodes.Add(new DiagramNode() { Id = "transfer_desk", OffsetX = 263, OffsetY = 360.5, Height = 40, Width = 105, Annotations = Node7, Shape = new { type = "UmlActivity", shape = "Action" } }); nodes.Add(new DiagramNode() { Id = "node8", OffsetX = 168, OffsetY = 430.5, Height = 50, Width = 50, Shape = new { type = "UmlActivity", shape = "MergeNode" } }); nodes.Add(new DiagramNode() { Id = "node9", OffsetX = 288, OffsetY = 500.5, Height = 10, Width = 70, Shape = new { type = "UmlActivity", shape = "JoinNode" } }); nodes.Add(new DiagramNode() { Id = "CloseCall", OffsetX = 288, OffsetY = 550.5, Height = 40, Width = 105, Annotations = Node10, Shape = new { type = "UmlActivity", shape = "Action" } }); nodes.Add(new DiagramNode() { Id = "node11", OffsetX = 288, OffsetY = 615.5, Height = 40, Width = 40, Shape = new { type = "UmlActivity", shape = "FinalNode" } }); List <DiagramSegment> segments = new List <DiagramSegment>(); segments.Add(new DiagramSegment() { Type = "Orthogonal", Length = 213, Direction = "Bottom" }); segments.Add(new DiagramSegment() { Type = "Orthogonal", Length = 50, Direction = "Left" }); List <DiagramConnector> Connectors = new List <DiagramConnector>(); Connectors.Add(new DiagramConnector() { Id = "connector1", SourceID = "Start", TargetID = "ReceiveCall", }); Connectors.Add(new DiagramConnector() { Id = "connector2", SourceID = "ReceiveCall", TargetID = "node2" }); Connectors.Add(new DiagramConnector() { Id = "connector3", SourceID = "node2", TargetID = "Determine", SourcePortID = "port1", TargetPortID = "portTop" }); Connectors.Add(new DiagramConnector() { Id = "connector4", SourceID = "node2", TargetID = "Log", SourcePortID = "port2", TargetPortID = "portTop" }); Connectors.Add(new DiagramConnector() { Id = "connector5", SourceID = "Determine", TargetID = "node5", }); Connectors.Add(new DiagramConnector() { Id = "connector6", SourceID = "node5", TargetID = "transfer_sales", Annotations = Connector1, SourcePortID = "portLeft", TargetPortID = "portTop", }); Connectors.Add(new DiagramConnector() { Id = "connector7", SourceID = "node5", TargetID = "transfer_desk", Annotations = Connector2, SourcePortID = "portRight", TargetPortID = "portTop", }); Connectors.Add(new DiagramConnector() { Id = "connector8", SourceID = "transfer_sales", TargetID = "node8", SourcePortID = "portBottom", TargetPortID = "portLeft" }); Connectors.Add(new DiagramConnector() { Id = "connector9", SourceID = "transfer_desk", TargetID = "node8", SourcePortID = "portBottom", TargetPortID = "portRight" }); Connectors.Add(new DiagramConnector() { Id = "connector10", SourceID = "node8", TargetID = "node9", SourcePortID = "portBottom", TargetPortID = "port3" }); Connectors.Add(new DiagramConnector() { Id = "connector11", SourceID = "Log", TargetID = "node9", SourcePortID = "portBottom", TargetPortID = "port4", Segments = segments }); Connectors.Add(new DiagramConnector() { Id = "connector12", SourceID = "node9", TargetID = "CloseCall", }); Connectors.Add(new DiagramConnector() { Id = "connector13", SourceID = "CloseCall", TargetID = "node11", }); ViewBag.nodes = nodes; ViewBag.connectors = Connectors; List <Syncfusion.EJ2.Diagrams.DiagramNode> umlShapes = new List <Syncfusion.EJ2.Diagrams.DiagramNode>(); umlShapes.Add(new DiagramNode() { Id = "Action", Shape = new { type = "UmlActivity", shape = "Action" } }); umlShapes.Add(new DiagramNode() { Id = "Decision", Shape = new { type = "UmlActivity", shape = "Decision" } }); umlShapes.Add(new DiagramNode() { Id = "MergeNode", Shape = new { type = "UmlActivity", shape = "MergeNode" } }); umlShapes.Add(new DiagramNode() { Id = "InitialNode", Shape = new { type = "UmlActivity", shape = "InitialNode" } }); umlShapes.Add(new DiagramNode() { Id = "FinalNode", Shape = new { type = "UmlActivity", shape = "FinalNode" } }); umlShapes.Add(new DiagramNode() { Id = "ForkNode", Shape = new { type = "UmlActivity", shape = "ForkNode" } }); umlShapes.Add(new DiagramNode() { Id = "JoinNode", Shape = new { type = "UmlActivity", shape = "JoinNode" } }); umlShapes.Add(new DiagramNode() { Id = "TimeEvent", Shape = new { type = "UmlActivity", shape = "TimeEvent" } }); umlShapes.Add(new DiagramNode() { Id = "AcceptingEvent", Shape = new { type = "UmlActivity", shape = "AcceptingEvent" } }); umlShapes.Add(new DiagramNode() { Id = "SendSignal", Shape = new { type = "UmlActivity", shape = "SendSignal" } }); umlShapes.Add(new DiagramNode() { Id = "ReceiveSignal", Shape = new { type = "UmlActivity", shape = "ReceiveSignal" } }); umlShapes.Add(new DiagramNode() { Id = "StructuredNode", Shape = new { type = "UmlActivity", shape = "StructuredNode" } }); umlShapes.Add(new DiagramNode() { Id = "Note", Shape = new { type = "UmlActivity", shape = "Note" } }); DiagramPoint sourcePoint = new DiagramPoint() { X = 0, Y = 0 }; DiagramPoint targetPoint = new DiagramPoint() { X = 40, Y = 40 }; ConnectorTargetDecoratorConnectors targetDecorator = new ConnectorTargetDecoratorConnectors() { Shape = DecoratorShapes.Arrow, Style = new DiagramShapeStyle() { Fill = "#757575", StrokeColor = "#757575" } }; DiagramStrokeStyle style1 = new DiagramStrokeStyle() { StrokeWidth = 2, StrokeColor = "#757575", StrokeDashArray = "4 4" }; DiagramStrokeStyle style2 = new DiagramStrokeStyle() { StrokeWidth = 2, StrokeColor = "#757575" }; List <DiagramConnector> SymbolPaletteConnectors = new List <DiagramConnector>(); SymbolPaletteConnectors.Add(new DiagramConnector() { Id = "Link1", Type = Segments.Orthogonal, SourcePoint = sourcePoint, TargetPoint = targetPoint, TargetDecorator = targetDecorator, Style = style1 }); SymbolPaletteConnectors.Add(new DiagramConnector() { Id = "Link2", Type = Segments.Orthogonal, SourcePoint = sourcePoint, TargetPoint = targetPoint, TargetDecorator = targetDecorator, Style = style2 }); SymbolPaletteConnectors.Add(new DiagramConnector() { Id = "Link3", Type = Segments.Straight, SourcePoint = sourcePoint, TargetPoint = targetPoint, TargetDecorator = targetDecorator, Style = style2 }); List <SymbolPalettePalette> Palette = new List <SymbolPalettePalette>(); Palette.Add(new SymbolPalettePalette() { Id = "UMLActivity", Expanded = true, Symbols = umlShapes, Title = "UML Shapes" }); Palette.Add(new SymbolPalettePalette() { Id = "connectors", Expanded = true, Symbols = SymbolPaletteConnectors, Title = "Connectors" }); ViewBag.Palette = Palette; SymbolPaletteMargin margin = new SymbolPaletteMargin() { Left = 15, Right = 15, Bottom = 15, Top = 15 }; ViewBag.margin = margin; return(View()); }
// GET: Swimlane public ActionResult Swimlane() { List <DiagramNode> Nodes = new List <DiagramNode>(); GenerateDiagramNodes(Nodes); List <DiagramConnector> Connectors = new List <DiagramConnector>(); GenerateDiagramConnectors(Connectors); ViewBag.nodes = Nodes; ViewBag.connectors = Connectors; ViewBag.getNodeDefaults = "getNodeDefaults"; ViewBag.getConnectorDefaults = "getConnectorDefaults"; List <DiagramPort> ports = new List <DiagramPort>(); ports.Add(new DiagramPort() { Id = "Port1", Offset = new DiagramPoint() { X = 0, Y = 0.5 }, Visibility = PortVisibility.Connect | PortVisibility.Hover, Constraints = PortConstraints.Default | PortConstraints.Draw }); ports.Add(new DiagramPort() { Id = "Port2", Offset = new DiagramPoint() { X = 0.5, Y = 0 }, Visibility = PortVisibility.Connect | PortVisibility.Hover, Constraints = PortConstraints.Default | PortConstraints.Draw }); ports.Add(new DiagramPort() { Id = "Port3", Offset = new DiagramPoint() { X = 1, Y = 0.5 }, Visibility = PortVisibility.Connect | PortVisibility.Hover, Constraints = PortConstraints.Default | PortConstraints.Draw }); ports.Add(new DiagramPort() { Id = "Port4", Offset = new DiagramPoint() { X = 0.5, Y = 1 }, Visibility = PortVisibility.Connect | PortVisibility.Hover, Constraints = PortConstraints.Default | PortConstraints.Draw }); List <DiagramNode> SymbolPaletee = new List <DiagramNode>(); Dictionary <string, object> addInfo = new Dictionary <string, object>(); addInfo.Add("tooltip", "Terminator"); SymbolPaletee.Add(new DiagramNode() { Id = "Terminator", AddInfo = addInfo, Ports = ports, Width = 50, Height = 50, Shape = new { type = "Flow", shape = "Terminator" } }); Dictionary <string, object> addInfo1 = new Dictionary <string, object>(); addInfo1.Add("tooltip", "Process"); SymbolPaletee.Add(new DiagramNode() { Id = "Process", AddInfo = addInfo1, Ports = ports, Width = 50, Height = 50, Shape = new { type = "Flow", shape = "Process" } }); Dictionary <string, object> addInfo2 = new Dictionary <string, object>(); addInfo2.Add("tooltip", "Document"); SymbolPaletee.Add(new DiagramNode() { Id = "Document", AddInfo = addInfo2, Ports = ports, Width = 50, Height = 50, Shape = new { type = "Flow", shape = "Document" } }); Dictionary <string, object> addInfo3 = new Dictionary <string, object>(); addInfo3.Add("tooltip", "Predefined process"); SymbolPaletee.Add(new DiagramNode() { Id = "PreDefinedProcess", AddInfo = addInfo3, Ports = ports, Width = 50, Height = 50, Shape = new { type = "Flow", shape = "PreDefinedProcess" } }); Dictionary <string, object> addInfo4 = new Dictionary <string, object>(); addInfo4.Add("tooltip", "Data"); SymbolPaletee.Add(new DiagramNode() { Id = "data", AddInfo = addInfo4, Ports = ports, Width = 50, Height = 50, Shape = new { type = "Flow", shape = "Data" } }); List <Lane> lanes = new List <Lane>(); Lane lane1 = new Lane(); lane1.Id = "lane1"; lane1.Height = 60; lane1.Width = 150; lane1.Header = new Header() { Width = 50, Height = 50, Style = new DiagramTextStyle() { FontSize = 11, StrokeColor = "#757575" } }; lanes.Add(lane1); List <Lane> lanes1 = new List <Lane>(); Lane lane2 = new Lane(); lane2.Id = "lane2"; lane2.Height = 150; lane2.Width = 60; lane2.Header = new Header() { Width = 50, Height = 50, Style = new DiagramTextStyle() { FontSize = 11, StrokeColor = "#757575" } }; lanes1.Add(lane2); List <DiagramNode> swimlanePalette = new List <DiagramNode>(); Dictionary <string, object> addInfo5 = new Dictionary <string, object>(); addInfo5.Add("tooltip", "Horizontal swimlane"); swimlanePalette.Add(new DiagramNode() { Id = "stackCanvas1", Height = 60, Width = 140, AddInfo = addInfo5, Shape = new SwimLaneModel() { Type = "SwimLane", Lanes = lanes, Orientation = "Horizontal", IsLane = true }, OffsetX = 70, OffsetY = 30 }); Dictionary <string, object> addInfo6 = new Dictionary <string, object>(); addInfo6.Add("tooltip", "Vertical swimlane"); swimlanePalette.Add(new DiagramNode() { Id = "stackCanvas2", Height = 140, Width = 60, AddInfo = addInfo6, Shape = new SwimLaneModel() { Type = "SwimLane", Lanes = lanes1, Orientation = "Vertical", IsLane = true }, OffsetX = 70, OffsetY = 30 }); Dictionary <string, object> addInfo7 = new Dictionary <string, object>(); addInfo7.Add("tooltip", "Vertical phase"); swimlanePalette.Add(new DiagramNode() { Id = "verticalPhase", Height = 60, Width = 140, AddInfo = addInfo7, Shape = new SwimLaneModel() { Type = "SwimLane", Orientation = "Horizontal", IsPhase = true } }); Dictionary <string, object> addInfo8 = new Dictionary <string, object>(); addInfo8.Add("tooltip", "Horizontal phase"); swimlanePalette.Add(new DiagramNode() { Id = "horizontalPhase", Height = 60, Width = 140, AddInfo = addInfo8, Shape = new SwimLaneModel() { Type = "SwimLane", Orientation = "Vertical", IsPhase = true } }); List <DiagramConnector> SymbolPaletteConnectors = new List <DiagramConnector>(); SymbolPaletteConnectors.Add(new DiagramConnector() { Id = "Link1", Type = Segments.Orthogonal, SourcePoint = new DiagramPoint() { X = 0, Y = 0 }, TargetPoint = new DiagramPoint() { X = 27, Y = 27 }, TargetDecorator = new ConnectorTargetDecoratorConnectors() { Shape = DecoratorShapes.Arrow, Style = new DiagramShapeStyle() { StrokeColor = "#757575", Fill = "#757575" } }, Style = new DiagramStrokeStyle() { StrokeWidth = 2, StrokeColor = "#757575" } }); SymbolPaletteConnectors.Add(new DiagramConnector() { Id = "Link2", Type = Segments.Orthogonal, SourcePoint = new DiagramPoint() { X = 0, Y = 0 }, TargetPoint = new DiagramPoint() { X = 27, Y = 27 }, TargetDecorator = new ConnectorTargetDecoratorConnectors() { Shape = DecoratorShapes.Arrow, Style = new DiagramShapeStyle() { StrokeColor = "#757575", Fill = "#757575" } }, Style = new DiagramStrokeStyle() { StrokeWidth = 2, StrokeDashArray = "4,4", StrokeColor = "#757575" } }); SymbolPaletteConnectors.Add(new DiagramConnector() { Id = "Link4", Type = Segments.Straight, SourcePoint = new DiagramPoint() { X = 0, Y = 0 }, TargetPoint = new DiagramPoint() { X = 40, Y = 40 }, TargetDecorator = new ConnectorTargetDecoratorConnectors() { Shape = DecoratorShapes.None }, Style = new DiagramStrokeStyle() { StrokeWidth = 2, StrokeColor = "#757575" } }); SymbolPaletteConnectors.Add(new DiagramConnector() { Id = "Link5", Type = Segments.Straight, SourcePoint = new DiagramPoint() { X = 0, Y = 0 }, TargetPoint = new DiagramPoint() { X = 40, Y = 40 }, TargetDecorator = new ConnectorTargetDecoratorConnectors() { Shape = DecoratorShapes.None }, Style = new DiagramStrokeStyle() { StrokeWidth = 2, StrokeDashArray = "4,4", StrokeColor = "#757575" } }); List <SymbolPalettePalette> Palette = new List <SymbolPalettePalette> { new SymbolPalettePalette() { Id = "basic", Expanded = true, Symbols = SymbolPaletee, IconCss = "e-ddb-icons e-flow", Title = "Basic Shapes" }, new SymbolPalettePalette() { Id = "swimlane", Expanded = true, Symbols = swimlanePalette, IconCss = "e-ddb-icons e-basic", Title = "Swimlane" }, new SymbolPalettePalette() { Id = "connectors", Expanded = true, Symbols = SymbolPaletteConnectors, IconCss = "e-ddb-icons e-connector", Title = "Connectors" } }; List <MenuItems> items = new List <MenuItems>(); items.Add(new MenuItems() { Id = "Clone", Text = "Clone", Target = ".e-diagramcontent" }); items.Add(new MenuItems() { Id = "Cut", Text = "Cut", Target = ".e-diagramcontent" }); items.Add(new MenuItems() { Id = "InsertLaneBefore", Text = "InsertLaneBefore", Target = ".e-diagramcontent" }); items.Add(new MenuItems() { Id = "InsertLaneAfter", Text = "InsertLaneAfter", Target = ".e-diagramcontent" }); ViewBag.items = items; SymbolPaletteMargin margin = new SymbolPaletteMargin() { Left = 8, Right = 8, Top = 8, Bottom = 8 }; ViewBag.margin = margin; ViewBag.Palette = Palette; return(View()); }