@eclipse-glsp-examples/workflow-glsp 0.9.0-next.d9bed812 → 0.9.0-next.e2f2fd8a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/css/diagram.css +58 -38
- package/lib/di.config.d.ts +4 -19
- package/lib/di.config.d.ts.map +1 -1
- package/lib/di.config.js +20 -25
- package/lib/di.config.js.map +1 -1
- package/lib/direct-task-editing/di.config.d.ts +1 -1
- package/lib/direct-task-editing/di.config.js +4 -4
- package/lib/direct-task-editing/di.config.js.map +1 -1
- package/lib/direct-task-editing/direct-task-editor.d.ts +4 -4
- package/lib/direct-task-editing/direct-task-editor.d.ts.map +1 -1
- package/lib/direct-task-editing/direct-task-editor.js +88 -184
- package/lib/direct-task-editing/direct-task-editor.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/model.d.ts +8 -3
- package/lib/model.d.ts.map +1 -1
- package/lib/model.js +73 -68
- package/lib/model.js.map +1 -1
- package/lib/workflow-views.d.ts +5 -15
- package/lib/workflow-views.d.ts.map +1 -1
- package/lib/workflow-views.js +31 -108
- package/lib/workflow-views.js.map +1 -1
- package/package.json +22 -25
- package/scripts/download.ts +19 -16
- package/src/di.config.ts +29 -78
- package/src/direct-task-editing/di.config.ts +3 -3
- package/src/direct-task-editing/direct-task-editor.ts +28 -22
- package/src/index.ts +5 -6
- package/src/model.ts +46 -10
- package/src/workflow-views.tsx +31 -76
package/lib/workflow-views.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2019-2021 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,22 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { IView, Point,
|
|
17
|
-
import { VNode } from
|
|
18
|
-
import {
|
|
19
|
-
export declare class
|
|
20
|
-
render(node: TaskNode, context: RenderingContext): VNode;
|
|
21
|
-
protected getRoundedCornerRadius(node: SShapeElement): number;
|
|
22
|
-
}
|
|
23
|
-
export declare class ForkOrJoinNodeView extends RectangularNodeView {
|
|
24
|
-
render(node: ActivityNode, context: RenderingContext): VNode;
|
|
25
|
-
}
|
|
26
|
-
export declare class WorkflowEdgeView extends PolylineEdgeView {
|
|
16
|
+
import { IView, Point, PolylineEdgeViewWithGapsOnIntersections, RenderingContext, SEdge } from '@eclipse-glsp/client';
|
|
17
|
+
import { VNode } from 'snabbdom';
|
|
18
|
+
import { Icon } from './model';
|
|
19
|
+
export declare class WorkflowEdgeView extends PolylineEdgeViewWithGapsOnIntersections {
|
|
27
20
|
protected renderAdditionals(edge: SEdge, segments: Point[], context: RenderingContext): VNode[];
|
|
28
21
|
}
|
|
29
|
-
export declare class WeightedEdgeView extends WorkflowEdgeView {
|
|
30
|
-
render(edge: Readonly<WeightedEdge>, context: RenderingContext): VNode;
|
|
31
|
-
}
|
|
32
22
|
export declare class IconView implements IView {
|
|
33
23
|
render(element: Icon, context: RenderingContext): VNode;
|
|
34
24
|
getRadius(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-views.d.ts","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAEH,KAAK,EACL,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"workflow-views.d.ts","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAEH,KAAK,EACL,KAAK,EACL,uCAAuC,EACvC,gBAAgB,EAChB,KAAK,EAER,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAK/B,qBACa,gBAAiB,SAAQ,uCAAuC;IACzE,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,EAAE;CAiBlG;AAED,qBACa,QAAS,YAAW,KAAK;IAClC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK;IAUvD,SAAS,IAAI,MAAM;CAGtB"}
|
package/lib/workflow-views.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
16
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -19,9 +6,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
19
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
20
7
|
};
|
|
21
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.IconView = exports.
|
|
9
|
+
exports.IconView = exports.WorkflowEdgeView = void 0;
|
|
23
10
|
/********************************************************************************
|
|
24
|
-
* Copyright (c) 2019 EclipseSource and others.
|
|
11
|
+
* Copyright (c) 2019-2021 EclipseSource and others.
|
|
25
12
|
*
|
|
26
13
|
* This program and the accompanying materials are made available under the
|
|
27
14
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -35,102 +22,38 @@ exports.IconView = exports.WeightedEdgeView = exports.WorkflowEdgeView = exports
|
|
|
35
22
|
*
|
|
36
23
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
37
24
|
********************************************************************************/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
const client_1 = require("@eclipse-glsp/client");
|
|
26
|
+
const inversify_1 = require("inversify");
|
|
27
|
+
const sprotty_1 = require("sprotty");
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
+
const JSX = { createElement: sprotty_1.svg };
|
|
30
|
+
let WorkflowEdgeView = class WorkflowEdgeView extends client_1.PolylineEdgeViewWithGapsOnIntersections {
|
|
31
|
+
renderAdditionals(edge, segments, context) {
|
|
32
|
+
const additionals = super.renderAdditionals(edge, segments, context);
|
|
33
|
+
const p1 = segments[segments.length - 2];
|
|
34
|
+
const p2 = segments[segments.length - 1];
|
|
35
|
+
const arrow = (JSX.createElement("path", { "class-sprotty-edge": true, "class-arrow": true, d: 'M 1.5,0 L 10,-4 L 10,4 Z', transform: `rotate(${client_1.toDegrees(client_1.angleOfPoint({ x: p1.x - p2.x, y: p1.y - p2.y }))} ${p2.x} ${p2.y}) translate(${p2.x} ${p2.y})` }));
|
|
36
|
+
additionals.push(arrow);
|
|
37
|
+
return additionals;
|
|
46
38
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
context.renderChildren(node));
|
|
52
|
-
return graph;
|
|
53
|
-
};
|
|
54
|
-
TaskNodeView.prototype.getRoundedCornerRadius = function (node) {
|
|
55
|
-
return 5;
|
|
56
|
-
};
|
|
57
|
-
TaskNodeView = __decorate([
|
|
58
|
-
inversify_1.injectable()
|
|
59
|
-
], TaskNodeView);
|
|
60
|
-
return TaskNodeView;
|
|
61
|
-
}(client_1.RectangularNodeView));
|
|
62
|
-
exports.TaskNodeView = TaskNodeView;
|
|
63
|
-
var ForkOrJoinNodeView = /** @class */ (function (_super) {
|
|
64
|
-
__extends(ForkOrJoinNodeView, _super);
|
|
65
|
-
function ForkOrJoinNodeView() {
|
|
66
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
67
|
-
}
|
|
68
|
-
ForkOrJoinNodeView.prototype.render = function (node, context) {
|
|
69
|
-
var graph = JSX.createElement("g", null,
|
|
70
|
-
JSX.createElement("rect", { "class-sprotty-node": true, "class-forkOrJoin": true, "class-mouseover": node.hoverFeedback, "class-selected": node.selected, width: 10, height: Math.max(50, node.bounds.height) }));
|
|
71
|
-
return graph;
|
|
72
|
-
};
|
|
73
|
-
ForkOrJoinNodeView = __decorate([
|
|
74
|
-
inversify_1.injectable()
|
|
75
|
-
], ForkOrJoinNodeView);
|
|
76
|
-
return ForkOrJoinNodeView;
|
|
77
|
-
}(client_1.RectangularNodeView));
|
|
78
|
-
exports.ForkOrJoinNodeView = ForkOrJoinNodeView;
|
|
79
|
-
var WorkflowEdgeView = /** @class */ (function (_super) {
|
|
80
|
-
__extends(WorkflowEdgeView, _super);
|
|
81
|
-
function WorkflowEdgeView() {
|
|
82
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
83
|
-
}
|
|
84
|
-
WorkflowEdgeView.prototype.renderAdditionals = function (edge, segments, context) {
|
|
85
|
-
var p1 = segments[segments.length - 2];
|
|
86
|
-
var p2 = segments[segments.length - 1];
|
|
87
|
-
return [
|
|
88
|
-
JSX.createElement("path", { "class-sprotty-edge": true, "class-arrow": true, d: "M 1.5,0 L 10,-4 L 10,4 Z", transform: "rotate(" + client_1.toDegrees(client_1.angleOfPoint({ x: p1.x - p2.x, y: p1.y - p2.y })) + " " + p2.x + " " + p2.y + ") translate(" + p2.x + " " + p2.y + ")" })
|
|
89
|
-
];
|
|
90
|
-
};
|
|
91
|
-
WorkflowEdgeView = __decorate([
|
|
92
|
-
inversify_1.injectable()
|
|
93
|
-
], WorkflowEdgeView);
|
|
94
|
-
return WorkflowEdgeView;
|
|
95
|
-
}(client_1.PolylineEdgeView));
|
|
39
|
+
};
|
|
40
|
+
WorkflowEdgeView = __decorate([
|
|
41
|
+
inversify_1.injectable()
|
|
42
|
+
], WorkflowEdgeView);
|
|
96
43
|
exports.WorkflowEdgeView = WorkflowEdgeView;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return
|
|
44
|
+
let IconView = class IconView {
|
|
45
|
+
render(element, context) {
|
|
46
|
+
const radius = this.getRadius();
|
|
47
|
+
return (JSX.createElement("g", null,
|
|
48
|
+
JSX.createElement("circle", { "class-sprotty-icon": true, r: radius, cx: radius + 2, cy: radius + 2 }),
|
|
49
|
+
context.renderChildren(element)));
|
|
101
50
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var route = router.route(edge);
|
|
105
|
-
if (route.length === 0)
|
|
106
|
-
return this.renderDanglingEdge("Cannot compute route", edge, context);
|
|
107
|
-
return JSX.createElement("g", { "class-sprotty-edge": true, "class-weighted": true, "class-low": edge.probability === 'low', "class-medium": edge.probability === 'medium', "class-high": edge.probability === 'high', "class-mouseover": edge.hoverFeedback },
|
|
108
|
-
this.renderLine(edge, route, context),
|
|
109
|
-
this.renderAdditionals(edge, route, context),
|
|
110
|
-
context.renderChildren(edge, { route: route }));
|
|
111
|
-
};
|
|
112
|
-
WeightedEdgeView = __decorate([
|
|
113
|
-
inversify_1.injectable()
|
|
114
|
-
], WeightedEdgeView);
|
|
115
|
-
return WeightedEdgeView;
|
|
116
|
-
}(WorkflowEdgeView));
|
|
117
|
-
exports.WeightedEdgeView = WeightedEdgeView;
|
|
118
|
-
var IconView = /** @class */ (function () {
|
|
119
|
-
function IconView() {
|
|
51
|
+
getRadius() {
|
|
52
|
+
return 14;
|
|
120
53
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
context.renderChildren(element));
|
|
126
|
-
};
|
|
127
|
-
IconView.prototype.getRadius = function () {
|
|
128
|
-
return 16;
|
|
129
|
-
};
|
|
130
|
-
IconView = __decorate([
|
|
131
|
-
inversify_1.injectable()
|
|
132
|
-
], IconView);
|
|
133
|
-
return IconView;
|
|
134
|
-
}());
|
|
54
|
+
};
|
|
55
|
+
IconView = __decorate([
|
|
56
|
+
inversify_1.injectable()
|
|
57
|
+
], IconView);
|
|
135
58
|
exports.IconView = IconView;
|
|
136
59
|
//# sourceMappingURL=workflow-views.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-views.js","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-views.js","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAQ8B;AAC9B,yCAAuC;AAEvC,qCAA8B;AAG9B,6DAA6D;AAC7D,MAAM,GAAG,GAAG,EAAE,aAAa,EAAE,aAAG,EAAE,CAAC;AAGnC,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,gDAAuC;IAC/D,iBAAiB,CAAC,IAAW,EAAE,QAAiB,EAAE,OAAyB;QACjF,MAAM,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACrE,MAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACzC,MAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,CACV,kDACwB,IAAI,iBACX,IAAI,EACjB,CAAC,EAAC,0BAA0B,EAC5B,SAAS,EAAE,UAAU,kBAAS,CAAC,qBAAY,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,IAC/G,EAAE,CAAC,CACP,GAAG,GACL,CACL,CAAC;QACF,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ,CAAA;AAlBY,gBAAgB;IAD5B,sBAAU,EAAE;GACA,gBAAgB,CAkB5B;AAlBY,4CAAgB;AAqB7B,IAAa,QAAQ,GAArB,MAAa,QAAQ;IACjB,MAAM,CAAC,OAAa,EAAE,OAAyB;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAChC,OAAO,CACH;YACI,oDAA4B,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAW;YACrF,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAChC,CACP,CAAC;IACN,CAAC;IAED,SAAS;QACL,OAAO,EAAE,CAAC;IACd,CAAC;CACJ,CAAA;AAdY,QAAQ;IADpB,sBAAU,EAAE;GACA,QAAQ,CAcpB;AAdY,4BAAQ"}
|
package/package.json
CHANGED
|
@@ -1,47 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp-examples/workflow-glsp",
|
|
3
|
-
"version": "0.9.0-next.
|
|
3
|
+
"version": "0.9.0-next.e2f2fd8a",
|
|
4
4
|
"description": "GLSP diagrams for the Workflow DSL",
|
|
5
5
|
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
|
|
6
|
-
"author": "Eclipse GLSP",
|
|
7
|
-
"contributors": [
|
|
8
|
-
{
|
|
9
|
-
"name": "Philip Langer",
|
|
10
|
-
"email": "planger@eclipsesource.com",
|
|
11
|
-
"url": "https://www.eclipsesource.com"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"name": "Tobias Ortmayr",
|
|
15
|
-
"email": "tortmayr@eclipsesource.com",
|
|
16
|
-
"url": "https://www.eclipsesource.com"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"name": "Martin Fleck",
|
|
20
|
-
"email": "mfleck@eclipsesource.com",
|
|
21
|
-
"url": "https://www.eclipsesource.com"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
6
|
"keywords": [
|
|
25
|
-
"
|
|
7
|
+
"glsp",
|
|
26
8
|
"workflow",
|
|
27
9
|
"diagram",
|
|
28
10
|
"example"
|
|
29
11
|
],
|
|
12
|
+
"author": {
|
|
13
|
+
"name": "Eclipse GLSP"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://www.eclipse.org/glsp/",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/eclipse-glsp/glsp-client.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
|
|
21
|
+
"contributors": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Eclipse GLSP Project",
|
|
24
|
+
"email": "glsp-dev@eclipse.org",
|
|
25
|
+
"url": "https://projects.eclipse.org/projects/ecd.glsp"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
30
28
|
"dependencies": {
|
|
31
|
-
"@eclipse-glsp/client": "0.9.0-next.
|
|
29
|
+
"@eclipse-glsp/client": "0.9.0-next.e2f2fd8a",
|
|
32
30
|
"balloon-css": "^0.5.0"
|
|
33
31
|
},
|
|
34
32
|
"devDependencies": {
|
|
35
33
|
"mvn-artifact-download": "5.1.0",
|
|
36
34
|
"rimraf": "^2.6.1",
|
|
37
|
-
"tslint": "^5.5.0",
|
|
38
35
|
"typescript": "^3.9.2"
|
|
39
36
|
},
|
|
40
37
|
"scripts": {
|
|
41
|
-
"prepare": "yarn
|
|
38
|
+
"prepare": "yarn clean && yarn build && yarn lint",
|
|
42
39
|
"clean": "rimraf lib",
|
|
43
|
-
"build": "tsc
|
|
44
|
-
"lint": "
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"lint": "eslint -c ./.eslintrc.js --ext .ts,.tsx ./src",
|
|
45
42
|
"watch": "tsc -w"
|
|
46
43
|
},
|
|
47
44
|
"files": [
|
package/scripts/download.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2020-2021 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,20 +13,23 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import download from
|
|
17
|
-
import { join, resolve } from
|
|
16
|
+
import download from 'mvn-artifact-download';
|
|
17
|
+
import { join, resolve } from 'path';
|
|
18
18
|
|
|
19
|
-
const downloadDir = resolve(join(__dirname)) +
|
|
20
|
-
const mavenRepository =
|
|
21
|
-
const groupId =
|
|
22
|
-
const artifactId =
|
|
23
|
-
const version =
|
|
24
|
-
const classifier =
|
|
19
|
+
const downloadDir = resolve(join(__dirname)) + '/../../..';
|
|
20
|
+
const mavenRepository = 'https://oss.sonatype.org/content/repositories/snapshots/';
|
|
21
|
+
const groupId = 'org.eclipse.glsp.example';
|
|
22
|
+
const artifactId = 'org.eclipse.glsp.example.workflow';
|
|
23
|
+
const version = '0.9.0';
|
|
24
|
+
const classifier = 'glsp';
|
|
25
25
|
|
|
26
|
-
console.log(
|
|
27
|
-
download({ groupId, artifactId, version, classifier, isSnapShot: true }, downloadDir, mavenRepository)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
console.log('Downloading latest version of the Workflow Example Java Server from the maven repository...');
|
|
27
|
+
download({ groupId, artifactId, version, classifier, isSnapShot: true }, downloadDir, mavenRepository).then(() =>
|
|
28
|
+
console.log(
|
|
29
|
+
'Download completed. Start the server using this command: \njava -jar org.eclipse.glsp.example.workflow-' +
|
|
30
|
+
version +
|
|
31
|
+
'-SNAPSHOT-glsp.jar org.eclipse.glsp.example.workflow.launch.ExampleServerLauncher --port=8081 --websocket\n\n' +
|
|
32
|
+
'After starting the server, access the following file locally in your browser to see the running example:\n' +
|
|
33
|
+
'./examples/workflow-standalone/app/diagram.html'
|
|
34
|
+
)
|
|
35
|
+
);
|
package/src/di.config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2019-2021 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,118 +13,69 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import "../css/diagram.css";
|
|
17
|
-
import "balloon-css/balloon.min.css";
|
|
18
|
-
import "sprotty/css/edit-label.css";
|
|
19
|
-
|
|
20
16
|
import {
|
|
21
|
-
|
|
22
|
-
buttonModule,
|
|
17
|
+
configureDefaultModelElements,
|
|
23
18
|
configureModelElement,
|
|
24
19
|
ConsoleLogger,
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
createClientContainer,
|
|
21
|
+
DefaultTypes,
|
|
27
22
|
DeleteElementContextMenuItemProvider,
|
|
28
23
|
DiamondNodeView,
|
|
29
|
-
edgeLayoutModule,
|
|
30
24
|
editLabelFeature,
|
|
31
|
-
ExpandButtonView,
|
|
32
|
-
expandModule,
|
|
33
|
-
exportModule,
|
|
34
|
-
fadeModule,
|
|
35
|
-
GLSP_TYPES,
|
|
36
|
-
glspCommandPaletteModule,
|
|
37
|
-
glspContextMenuModule,
|
|
38
|
-
glspDecorationModule,
|
|
39
|
-
glspEditLabelModule,
|
|
40
|
-
GLSPGraph,
|
|
41
|
-
glspHoverModule,
|
|
42
|
-
glspMouseToolModule,
|
|
43
|
-
glspSelectModule,
|
|
44
|
-
glspServerCopyPasteModule,
|
|
45
25
|
GridSnapper,
|
|
46
|
-
HtmlRoot,
|
|
47
|
-
HtmlRootView,
|
|
48
|
-
labelEditUiModule,
|
|
49
|
-
layoutCommandsModule,
|
|
50
26
|
LogLevel,
|
|
51
|
-
markerNavigatorModule,
|
|
52
|
-
modelHintsModule,
|
|
53
|
-
modelSourceModule,
|
|
54
|
-
modelSourceWatcherModule,
|
|
55
|
-
navigationModule,
|
|
56
|
-
NoOverlapMovmentRestrictor,
|
|
57
|
-
openModule,
|
|
58
27
|
overrideViewerOptions,
|
|
59
|
-
|
|
60
|
-
PreRenderedElement,
|
|
61
|
-
PreRenderedView,
|
|
28
|
+
RectangularNodeView,
|
|
62
29
|
RevealNamedElementActionProvider,
|
|
63
|
-
|
|
64
|
-
SButton,
|
|
30
|
+
RoundedCornerNodeView,
|
|
65
31
|
SCompartment,
|
|
66
32
|
SCompartmentView,
|
|
67
33
|
SEdge,
|
|
68
|
-
SGraphView,
|
|
69
34
|
SLabel,
|
|
70
35
|
SLabelView,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} from
|
|
80
|
-
import {
|
|
81
|
-
|
|
82
|
-
import { directTaskEditor } from "./direct-task-editing/di.config";
|
|
83
|
-
import { ActivityNode, Icon, TaskNode, WeightedEdge } from "./model";
|
|
84
|
-
import { ForkOrJoinNodeView, IconView, TaskNodeView, WeightedEdgeView, WorkflowEdgeView } from "./workflow-views";
|
|
36
|
+
StructureCompartmentView,
|
|
37
|
+
TYPES
|
|
38
|
+
} from '@eclipse-glsp/client';
|
|
39
|
+
import 'balloon-css/balloon.min.css';
|
|
40
|
+
import { Container, ContainerModule } from 'inversify';
|
|
41
|
+
import 'sprotty/css/edit-label.css';
|
|
42
|
+
import '../css/diagram.css';
|
|
43
|
+
import { directTaskEditor } from './direct-task-editing/di.config';
|
|
44
|
+
import { ActivityNode, CategoryNode, Icon, TaskNode, WeightedEdge } from './model';
|
|
45
|
+
import { IconView, WorkflowEdgeView } from './workflow-views';
|
|
85
46
|
|
|
86
47
|
const workflowDiagramModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
87
48
|
rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope();
|
|
88
49
|
rebind(TYPES.LogLevel).toConstantValue(LogLevel.warn);
|
|
89
|
-
bind(GLSP_TYPES.IMovementRestrictor).to(NoOverlapMovmentRestrictor).inSingletonScope();
|
|
90
50
|
bind(TYPES.ISnapper).to(GridSnapper);
|
|
91
51
|
bind(TYPES.ICommandPaletteActionProvider).to(RevealNamedElementActionProvider);
|
|
92
52
|
bind(TYPES.IContextMenuItemProvider).to(DeleteElementContextMenuItemProvider);
|
|
93
53
|
const context = { bind, unbind, isBound, rebind };
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
configureModelElement(context, 'task:
|
|
54
|
+
|
|
55
|
+
configureDefaultModelElements(context);
|
|
56
|
+
configureModelElement(context, 'task:automated', TaskNode, RoundedCornerNodeView);
|
|
57
|
+
configureModelElement(context, 'task:manual', TaskNode, RoundedCornerNodeView);
|
|
97
58
|
configureModelElement(context, 'label:heading', SLabel, SLabelView, { enable: [editLabelFeature] });
|
|
98
59
|
configureModelElement(context, 'comp:comp', SCompartment, SCompartmentView);
|
|
99
60
|
configureModelElement(context, 'comp:header', SCompartment, SCompartmentView);
|
|
100
61
|
configureModelElement(context, 'label:icon', SLabel, SLabelView);
|
|
101
|
-
configureModelElement(context,
|
|
102
|
-
configureModelElement(context, '
|
|
103
|
-
configureModelElement(context, 'button:expand', SButton, ExpandButtonView);
|
|
104
|
-
configureModelElement(context, 'routing-point', SRoutingHandle, SRoutingHandleView);
|
|
105
|
-
configureModelElement(context, 'volatile-routing-point', SRoutingHandle, SRoutingHandleView);
|
|
106
|
-
configureModelElement(context, 'edge', SEdge, WorkflowEdgeView);
|
|
107
|
-
configureModelElement(context, 'edge:weighted', WeightedEdge, WeightedEdgeView);
|
|
62
|
+
configureModelElement(context, DefaultTypes.EDGE, SEdge, WorkflowEdgeView);
|
|
63
|
+
configureModelElement(context, 'edge:weighted', WeightedEdge, WorkflowEdgeView);
|
|
108
64
|
configureModelElement(context, 'icon', Icon, IconView);
|
|
109
65
|
configureModelElement(context, 'activityNode:merge', ActivityNode, DiamondNodeView);
|
|
110
66
|
configureModelElement(context, 'activityNode:decision', ActivityNode, DiamondNodeView);
|
|
111
|
-
configureModelElement(context, 'activityNode:fork', ActivityNode,
|
|
112
|
-
configureModelElement(context, 'activityNode:join', ActivityNode,
|
|
67
|
+
configureModelElement(context, 'activityNode:fork', ActivityNode, RectangularNodeView);
|
|
68
|
+
configureModelElement(context, 'activityNode:join', ActivityNode, RectangularNodeView);
|
|
69
|
+
|
|
70
|
+
configureModelElement(context, 'category', CategoryNode, RoundedCornerNodeView);
|
|
71
|
+
configureModelElement(context, 'struct', SCompartment, StructureCompartmentView);
|
|
113
72
|
});
|
|
114
73
|
|
|
115
74
|
export default function createContainer(widgetId: string): Container {
|
|
116
|
-
const container =
|
|
117
|
-
|
|
118
|
-
container.load(validationModule, defaultModule, glspMouseToolModule, defaultGLSPModule, glspSelectModule, boundsModule, glspViewportModule, toolsModule,
|
|
119
|
-
glspHoverModule, fadeModule, exportModule, expandModule, openModule, buttonModule, modelSourceModule, labelEditUiModule, glspEditLabelModule,
|
|
120
|
-
workflowDiagramModule, toolFeedbackModule, modelHintsModule, glspContextMenuModule, glspServerCopyPasteModule, modelSourceWatcherModule,
|
|
121
|
-
glspCommandPaletteModule, paletteModule, routingModule, glspDecorationModule, edgeLayoutModule, zorderModule,
|
|
122
|
-
layoutCommandsModule, directTaskEditor, navigationModule, markerNavigatorModule);
|
|
123
|
-
|
|
75
|
+
const container = createClientContainer(workflowDiagramModule, directTaskEditor);
|
|
124
76
|
overrideViewerOptions(container, {
|
|
125
77
|
baseDiv: widgetId,
|
|
126
|
-
hiddenDiv: widgetId +
|
|
78
|
+
hiddenDiv: widgetId + '_hidden'
|
|
127
79
|
});
|
|
128
|
-
|
|
129
80
|
return container;
|
|
130
81
|
}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { ContainerModule } from
|
|
17
|
-
import { TYPES } from
|
|
16
|
+
import { ContainerModule } from 'inversify';
|
|
17
|
+
import { TYPES } from 'sprotty';
|
|
18
18
|
|
|
19
|
-
import { TaskEditor } from
|
|
19
|
+
import { TaskEditor } from './direct-task-editor';
|
|
20
20
|
|
|
21
21
|
export const directTaskEditor = new ContainerModule((bind, _unbind, isBound) => {
|
|
22
22
|
bind(TaskEditor).toSelf().inSingletonScope();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2020-2021 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -32,22 +32,21 @@ import {
|
|
|
32
32
|
ValidationDecorator,
|
|
33
33
|
ValidationStatus,
|
|
34
34
|
ViewerOptions
|
|
35
|
-
} from
|
|
36
|
-
import { inject, injectable } from
|
|
37
|
-
import { TYPES } from
|
|
38
|
-
import { DOMHelper } from
|
|
35
|
+
} from '@eclipse-glsp/client';
|
|
36
|
+
import { inject, injectable } from 'inversify';
|
|
37
|
+
import { TYPES } from 'sprotty/lib';
|
|
38
|
+
import { DOMHelper } from 'sprotty/lib/base/views/dom-helper';
|
|
39
39
|
|
|
40
|
-
import { isTaskNode, TaskNode } from
|
|
40
|
+
import { isTaskNode, TaskNode } from '../model';
|
|
41
41
|
|
|
42
42
|
export class ApplyTaskEditOperation implements Action {
|
|
43
43
|
static readonly KIND = 'applyTaskEdit';
|
|
44
44
|
readonly kind = ApplyTaskEditOperation.KIND;
|
|
45
|
-
constructor(readonly taskId: string, readonly expression: string) {
|
|
45
|
+
constructor(readonly taskId: string, readonly expression: string) {}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
@injectable()
|
|
49
49
|
export class TaskEditor extends AbstractUIExtension {
|
|
50
|
-
|
|
51
50
|
static readonly ID = 'task-editor';
|
|
52
51
|
readonly autoSuggestionSettings = {
|
|
53
52
|
noSuggestionsMessage: 'No suggestions available',
|
|
@@ -74,37 +73,43 @@ export class TaskEditor extends AbstractUIExtension {
|
|
|
74
73
|
protected task: TaskNode;
|
|
75
74
|
protected autoSuggestion: AutoCompleteWidget;
|
|
76
75
|
|
|
77
|
-
id() {
|
|
78
|
-
|
|
76
|
+
id(): string {
|
|
77
|
+
return TaskEditor.ID;
|
|
78
|
+
}
|
|
79
|
+
containerClass(): string {
|
|
80
|
+
return 'command-palette';
|
|
81
|
+
}
|
|
79
82
|
|
|
80
83
|
protected initializeContents(containerElement: HTMLElement): void {
|
|
81
84
|
this.autoSuggestion = new AutoCompleteWidget(
|
|
82
85
|
this.autoSuggestionSettings,
|
|
83
86
|
{ provideSuggestions: input => this.retrieveSuggestions(input) },
|
|
84
87
|
{ executeFromSuggestion: input => this.executeFromSuggestion(input) },
|
|
85
|
-
() => this.hide(),
|
|
88
|
+
() => this.hide(),
|
|
89
|
+
this.logger
|
|
90
|
+
);
|
|
86
91
|
this.autoSuggestion.configureValidation(
|
|
87
92
|
{ validate: input => this.validateInput(input) },
|
|
88
93
|
new ValidationDecorator(containerElement)
|
|
89
94
|
);
|
|
90
|
-
this.autoSuggestion.configureTextSubmitHandler(
|
|
91
|
-
|
|
92
|
-
);
|
|
95
|
+
this.autoSuggestion.configureTextSubmitHandler({
|
|
96
|
+
executeFromTextOnlyInput: (input: string) => this.executeFromTextOnlyInput(input)
|
|
97
|
+
});
|
|
93
98
|
this.autoSuggestion.initialize(containerElement);
|
|
94
99
|
}
|
|
95
100
|
|
|
96
|
-
show(root: Readonly<SModelRoot>, ...contextElementIds: string[]) {
|
|
101
|
+
show(root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
|
|
97
102
|
super.show(root, ...contextElementIds);
|
|
98
103
|
this.autoSuggestion.open(root);
|
|
99
104
|
}
|
|
100
105
|
|
|
101
|
-
protected onBeforeShow(containerElement: HTMLElement, root: Readonly<SModelRoot>, ...contextElementIds: string[]) {
|
|
106
|
+
protected onBeforeShow(containerElement: HTMLElement, root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
|
|
102
107
|
this.task = getTask(contextElementIds, root)[0];
|
|
103
108
|
this.autoSuggestion.inputField.value = '';
|
|
104
109
|
this.setPosition(containerElement);
|
|
105
110
|
}
|
|
106
111
|
|
|
107
|
-
protected setPosition(containerElement: HTMLElement) {
|
|
112
|
+
protected setPosition(containerElement: HTMLElement): void {
|
|
108
113
|
let x = 0;
|
|
109
114
|
let y = 0;
|
|
110
115
|
|
|
@@ -120,8 +125,9 @@ export class TaskEditor extends AbstractUIExtension {
|
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
protected async retrieveSuggestions(input: string): Promise<LabeledAction[]> {
|
|
123
|
-
const response = await this.actionDispatcher.request(
|
|
124
|
-
this.editorContextService.get({ ['text']: input }))
|
|
128
|
+
const response = await this.actionDispatcher.request(
|
|
129
|
+
new RequestContextActions(TaskEditor.ID, this.editorContextService.get({ ['text']: input }))
|
|
130
|
+
);
|
|
125
131
|
if (isSetContextActionsAction(response)) {
|
|
126
132
|
return response.actions;
|
|
127
133
|
}
|
|
@@ -136,16 +142,16 @@ export class TaskEditor extends AbstractUIExtension {
|
|
|
136
142
|
return Promise.reject();
|
|
137
143
|
}
|
|
138
144
|
|
|
139
|
-
protected executeFromSuggestion(input: LabeledAction | Action[] | Action) {
|
|
145
|
+
protected executeFromSuggestion(input: LabeledAction | Action[] | Action): void {
|
|
140
146
|
this.actionDispatcher.dispatchAll(toActionArray(input));
|
|
141
147
|
}
|
|
142
148
|
|
|
143
|
-
protected executeFromTextOnlyInput(input: string) {
|
|
149
|
+
protected executeFromTextOnlyInput(input: string): void {
|
|
144
150
|
const action = new ApplyTaskEditOperation(this.task.id, input);
|
|
145
151
|
this.actionDispatcher.dispatch(action);
|
|
146
152
|
}
|
|
147
153
|
|
|
148
|
-
hide() {
|
|
154
|
+
hide(): void {
|
|
149
155
|
this.autoSuggestion.dispose();
|
|
150
156
|
super.hide();
|
|
151
157
|
}
|