this.diagram.nodeTemplate = this.Go(MapperTreeNode, {
movable: false,
copyable: false,
deletable: false,
textEditable: false
}, // user cannot move an individual node
// no Adornment: instead change panel background color by binding to
// Node.isSelected
{
contextMenu: // define a context menu for each node
this.Go("ContextMenu", // that has one button
this.Go("ContextMenuButton",
this.Go(go.TextBlock, "Load Parent", { margin: new go.Margin(10, 20, 10, 20) }),
{
click: (e, obj) => this.checkbeforexpandParent(e, obj)
},
new go.Binding("visible", "loadParent", (h) => { return h })
),
this.Go("ContextMenuButton",
this.Go(go.TextBlock, "Load Sibling", { margin: new go.Margin(10, 20, 10, 20) }),
{
click: (e, obj) => this.checkbeforexpandSibling(e, obj)
}, new go.Binding("visible", "loadSibling", (h) => { return h })),
// more ContextMenuButtons would go here
) // end Adornment
},
{
selectionAdorned: false
},
// whether the user can start drawing a link from or to this node
// depends on which group it's in
new go.Binding("fromLinkable", "group", function (k) {
// return k === -1;
return false;
}), new go.Binding("toLinkable", "group", function (k) {
// return k === -2;
return false;
}),
this.Go(go.Panel, "Horizontal", {},
this.Go(go.Shape, "Rectangle", {
name: "SHAPE",
fill: '#009CCC', strokeWidth: 0, stroke: '#009CCC',
width: 3, stretch: go.GraphObject.Vertical, alignment: go.Spot.Left,
}),
this.Go(go.Panel, "Auto", { stretch: go.GraphObject.Horizontal },
this.Go(go.Shape, "Rectangle", {
name: "mainSHAPE",
fill: "#ffffff", stroke: '#CCCCCC', strokeWidth: 0,
fromSpot: go.Spot.RightSide,
toSpot: go.Spot.LeftSide,
}),
this.Go(go.Panel, "Table",
{ stretch: go.GraphObject.Horizontal, minSize: new go.Size(150, 20) },
this.Go(go.TextBlock,
{
column: 0,
name: "GROUPTEXT",
margin: new go.Margin(8, 0, 8, 4), font: Constants.attributefont, editable: true,
maxLines: 1, isMultiline: false,
stroke: "#686868",
alignment: go.Spot.LeftCenter
},
new go.Binding("text", "text").makeTwoWay()),
this.Go(go.Picture,
"assets/treeImages/downbebebe.png", {
column: 1,
name: "Expand",
alignment: go.Spot.Right, angle: 180,
click: (e: any, obj: any) => this.expandTree(e, obj),
//transition image
// mouseEnter: (e, obj, prev) => {
// var shape = obj.part.findObject("Edit");
// if (shape instanceof go.Picture) {
// shape.source = "assets/treeImages/edit.png";
// }
// },
// mouseLeave: (e, obj, next) => {
// var shape = obj.part.findObject("Edit");
// if (shape instanceof go.Picture) {
// shape.source = "assets/treeImages/edit.png";
// }
// },
background: "transparent",
margin: new go.Margin(0, 8, 0, 20),
desiredSize: new go.Size(12, 8)
}),
)
),
), // end Horizontal
// Panel
); // end Node