Image icons disappeared when i tried to add BPMN context menu event

Image icons disappeared when i tried to add BPMN context menu event.

image


image

                GO(go.Node, "Spot",
                    {
                        locationObjectName: "SHAPE",
                        locationSpot: go.Spot.Center,
                        resizable: true,
                        resizeObjectName: "PANEL",
                        toolTip: tooltiptemplate,
                        contextMenu: activityNodeMenu,
                        itemTemplate: boundaryEventItemTemplate,
                        selectionAdorned: false
                    },
                    new go.Binding("itemArray", "boundaryEventArray"),
                    new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
                    new go.Binding("layerName", "isSelected", function (s) { return s ? "Foreground" : ""; }).ofObject(),
                    GO(go.Panel, "Auto",
                        {
                            name: "PANEL",
                            minSize: new go.Size(ActivityNodeWidth, ActivityNodeHeight),
                            desiredSize: new go.Size(ActivityNodeWidth, ActivityNodeHeight)
                        },
                        new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify),
                        GO(go.Panel, "Spot",
                            GO(go.Shape, "RoundedRectangle",
                                {
                                    name: "SHAPE",
                                    fill: ActivityNodeFill, stroke: ActivityNodeStroke,
                                    parameter1: 10,
                                    portId: "", fromLinkable: true, toLinkable: true, cursor: "pointer",
                                    fromSpot: go.Spot.RightSide, toSpot: go.Spot.LeftSide,
                                },
                                new go.Binding("stroke", "isSelected", function (sel) {
                                    if (sel) return "dodgerblue"; else return "black";
                                }).ofObject(""),
                                new go.Binding("fill", "isSelected", function (sel) {
                                    if (sel) return "#f0f8ff"; else return "white";
                                }).ofObject(""),
                                new go.Binding("fill", "color"),
                                new go.Binding("strokeWidth", "isCall",
                                    function (s) { return s ? ActivityNodeStrokeWidthIsCall : ActivityNodeStrokeWidth; })
                            ),
                            GO(go.Shape, "Circle", {
                                alignment: new go.Spot(0, 0, 4.5, 4.5),
                                alignmentFocus: go.Spot.TopLeft,
                                fill: null,
                                strokeWidth: 1,
                                width: 25,
                                height: 25,
                                visible: false
                            },
                                new go.Binding("visible", "eventDimension", function (val) {
                                    return val ? true : false;
                                })
                            ),
                            GO(go.Shape, "BpmnTaskScript",
                                {
                                    alignment: new go.Spot(0, 0, 5, 5), alignmentFocus: go.Spot.TopLeft,
                                    width: 22, height: 22
                                },
                                new go.Binding("fill", "taskType", nodeActivityTaskTypeColorConverter),
                                new go.Binding("figure", "taskType", nodeActivityTaskTypeConverter),
                                new go.Binding("alignment", "eventDimension", function (val) {
                                    return val ? new go.Spot(0, 0, 8, 8) : new go.Spot(0, 0, 5, 5);
                                }),
                                new go.Binding("width", "eventDimension", function (val) {
                                    return val ? 18 : 22;
                                }),
                                new go.Binding("height", "eventDimension", function (val) {
                                    return val ? 18 : 22;
                                })
                            ),
                            makeMarkerPanel(false, 1)
                        ),
                        GO(go.TextBlock,
                            {
                                alignment: go.Spot.Center, textAlign: "center", margin: 12,
                                editable: false, overflow: go.TextBlock.OverflowEllipsis
                            },
                            new go.Binding("text", "", function (val, node) {
                                var name = "";
                                if (val && val.externalData && val.externalData.Name !== undefined && val.externalData.Name !== null) {
                                    name = val.externalData.Name;
                                }
                                return name == "" ? val.text : name;
                            }).makeTwoWay()
                        ),
                        GO(go.Panel, "Auto", { alignment: go.Spot.Center, margin: new go.Margin(40, 12, 12, 12) },
                            GO(go.Shape, "Rectangle", {
                                fill: "#fe9635",
                                stroke: null
                            }),
                            GO(go.TextBlock, { text: "(instantiated)", editable: false, visible: false },
                                new go.Binding("visible", "eventDimension", function (val) {
                                    return val ? true : false;
                                })
                            )
                        ),
                        {
                            mouseEnter: function (e, node) { internalHelper.showSmallPorts(node, true); },
                            mouseLeave: function (e, node) { internalHelper.showSmallPorts(node, false); }
                        },
                        GO(go.Shape, {
                            name: "SHAPE",
                            width: 100, height: 65,
                            fill: "transparent",
                            cursor: "all-scroll",
                            strokeWidth: 0
                        })
                    ),
                    {
                        doubleClick: function (e, node) {
                            var part = node.part;
                            internalHelper._openProcessStepModel({
                                parameters: args.parameters,
                                processData: args.processData,
                                toolboxItems: args.toolboxItems,
                                readOnly: args.readOnly,
                                part: part
                            });
                        }
                    },
                    new go.Binding("movable", "locked", function (val) {
                        return val ? false : true;
                    }),
                    new go.Binding("deletable", "locked", function (val) {
                        return val ? false : true;
                    }),
                    new go.Binding("resizable", "locked", function (val) {
                        return val ? false : true;
                    }),
                    getInfoShapes()
                );
				
				
				
				
				
				function getInfoShapes() {
					GO(go.Picture,
						{
							name: name,
							source: imageSource,
							desiredSize: new go.Size(16, 16),
							alignment: spot,
							visible: false,
							alignmentFocus: alignmentFocus,
							mouseLeave: internalHelper.removeBoxHolder
						}
					);
				}

What are the values of all those variables in getInfoShapes when adding an event from the context menu? It looks like it is invisible by default. When does it normally become visible?

Normally the values ​​are like this

              GO(go.Picture,
						{
							name: "exclamation",
							source: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ij48Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNCIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNkODYzNDQiLz48cGF0aCBkPSJNMTQuMTI0IDE4TDEzLjM5IDZoNS4yNDhsLS43MzQgMTJoLTMuNzh6TTE1Ljk4NiAyNmMtMS42OTMgMC0yLjg3OC0xLjI0Mi0yLjg3OC0yLjkwNiAwLTEuNzQ5IDEuMTg1LTIuOTM0IDIuODc4LTIuOTM0IDEuNzIxIDAgMi44NzggMS4xODUgMi45MDYgMi45MzQgMCAxLjY2NS0xLjE1NyAyLjkwNi0yLjg3OCAyLjkwNmgtLjAyOHoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",
							desiredSize: new go.Size(16, 16),
							visible: true
						}
					);

We’re looking into this.

1 Like

The primary problem here is that you have a Spot panel that adds GraphObjects two ways:

  1. With an itemArray (boundaryEventItemTemplate, boundaryEventArray)
  2. With additional items added normally (the getInfoShapes())

But you cannot do both of these. An item array will replace all GraphObjects in the Spot Panel other than the main element, so you will never see the getInfoShapes() picture.

You may need to use additional panels to get exactly the template you want. Or you may need to modify your itemTemplate and its data bindings until you can add both of the icons that you want to have.

So can you exemplify this? Can you show it in the code I shared?

Did you want information about that “info shape” to be in the model?

If so, it would be most general if you added it to the data.boundaryEventArray Array. I would add such an object with a new category and then I would add an item template with that category name to the Panel.itemTemplateMap. So you would need to replace the setting of Panel.itemTemplate with a setting of Panel.itemTemplateMap to a Map holding both the current boundaryEventItemTemplate and your new template meant to show that information.

1 Like