Skip to content

Commit

Permalink
Comments by spoenemann
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Fontorbe <[email protected]>
  • Loading branch information
gfontorbe committed Feb 21, 2024
1 parent a025a75 commit b91587f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 59 deletions.
38 changes: 17 additions & 21 deletions examples/flowchart/src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import {
Decision,
Process,
Terminal
} from "sprotty-library";
import { Flowchart } from "sprotty-library";
import { SEdge, SGraph, SLabel, SModelRoot, SNode } from "sprotty-protocol";

export function initializeModel(): SModelRoot {
const nodes: SNode[] = [];
const edges: SEdge[] = [];

const node0: Terminal = {
const node0: Flowchart.Terminal = {
id: '0',
type: 'node:terminal',
position: { x: 150, y: 10 },
Expand All @@ -47,7 +43,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node0);

const node1: Process = {
const node1: Flowchart.Process = {
id: '1',
type: 'node:process',
position: { x: 109.15, y: 153.9 },
Expand All @@ -68,7 +64,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node1);

const node2: Decision = {
const node2: Flowchart.Decision = {
id: '2',
type: 'node:decision',
position: { x: 71.4, y: 297.8 },
Expand All @@ -91,7 +87,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node2);

const node3: Process = {
const node3: Flowchart.Process = {
id: '3',
type: 'node:process',
position: { x: 102.35, y: 517.8 },
Expand All @@ -112,7 +108,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node3);

const node4: Decision = {
const node4: Flowchart.Decision = {
id: '4',
type: 'node:decision',
position: { x: 411.1, y: 297.8 },
Expand All @@ -135,7 +131,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node4);

const node5: Process = {
const node5: Flowchart.Process = {
id: '5',
type: 'node:process',
position: { x: 395.7, y: 517.8 },
Expand All @@ -157,7 +153,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node5);

const node6: Process = {
const node6: Flowchart.Process = {
id: '6',
type: 'node:process',
position: { x: 722.3, y: 335.85 },
Expand All @@ -179,7 +175,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node6);

const node7: Decision = {
const node7: Flowchart.Decision = {
id: '7',
type: 'node:decision',
position: { x: 736, y: 479.75 },
Expand All @@ -202,7 +198,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node7);

const node8: Process = {
const node8: Flowchart.Process = {
id: '8',
type: 'node:process',
position: { x: 720.5, y: 699.75 },
Expand All @@ -224,7 +220,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node8);

const node9: Process = {
const node9: Flowchart.Process = {
id: '9',
type: 'node:process',
position: { x: 1055.7, y: 517.8 },
Expand All @@ -246,7 +242,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node9);

const node10: Decision = {
const node10: Flowchart.Decision = {
id: '10',
type: 'node:decision',
position: { x: 1074.9, y: 661.7 },
Expand All @@ -269,7 +265,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node10);

const node11: Decision = {
const node11: Flowchart.Decision = {
id: '11',
type: 'node:decision',
position: { x: 1065.75, y: 881.7 },
Expand All @@ -292,7 +288,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node11);

const node12: Process = {
const node12: Flowchart.Process = {
id: '12',
type: 'node:process',
position: { x: 1099.7, y: 1101.7 },
Expand All @@ -314,7 +310,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node12);

const node13: Terminal = {
const node13: Flowchart.Terminal = {
id: '13',
type: 'node:terminal',
position: { x: 1143.25, y: 1245.6 },
Expand All @@ -336,7 +332,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node13);

const node14: Process = {
const node14: Flowchart.Process = {
id: '14',
type: 'node:process',
position: { x: 1385.4, y: 699.75 },
Expand All @@ -358,7 +354,7 @@ export function initializeModel(): SModelRoot {
};
nodes.push(node14);

const node15: Process = {
const node15: Flowchart.Process = {
id: '15',
type: 'node:process',
position: { x: 1386.1, y: 919.75 },
Expand Down
8 changes: 4 additions & 4 deletions examples/flowchart/src/di.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
import { Container, ContainerModule } from "inversify";
import {
ConsoleLogger,
LocalModelSource,
LogLevel,
TYPES,
configureViewerOptions,
loadDefaultModules
} from "sprotty";
import { flowchartModule } from 'sprotty-library';
import { FlowchartModelSource } from "./model-source";
import { Flowchart } from 'sprotty-library';

export default (containerId: string) => {
require('../css/diagram.css');

const module = new ContainerModule((bind, unbind, isBound, rebind) => {
bind(TYPES.ModelSource).to(FlowchartModelSource).inSingletonScope();
bind(TYPES.ModelSource).to(LocalModelSource).inSingletonScope();
rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope();
rebind(TYPES.LogLevel).toConstantValue(LogLevel.log);

Expand All @@ -42,7 +42,7 @@ export default (containerId: string) => {

const container = new Container();
loadDefaultModules(container);
container.load(flowchartModule);
container.load(Flowchart.flowchartModule);
container.load(module);
return container;
};
27 changes: 0 additions & 27 deletions examples/flowchart/src/model-source.ts

This file was deleted.

3 changes: 2 additions & 1 deletion examples/flowchart/src/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
import { LocalModelSource, TYPES } from 'sprotty';
import { BringToFrontAction, FitToScreenAction } from 'sprotty-protocol';
import createContainer from './di.config';
import { initializeModel } from './data';

export default async function runFlowchart() {
const container = createContainer('sprotty');
const modelSource = container.get<LocalModelSource>(TYPES.ModelSource);
await modelSource.updateModel();
await modelSource.updateModel(initializeModel());

const bringToFrontAction: BringToFrontAction = {
kind: 'bringToFront',
Expand Down
6 changes: 1 addition & 5 deletions packages/sprotty-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
"author": {
"name": "Eclipse Sprotty"
},
"peerDependencies": {
"inversify": "~6.0.2"
},
"dependencies": {
"sprotty": "^1.1.0",
"sprotty-protocol": "^1.1.0"
"sprotty": "^1.1.0"
},
"devDependencies": {},
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion packages/sprotty-library/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import * as Flowchart from './flowchart';

export * from './flowchart';
export { Flowchart };

0 comments on commit b91587f

Please sign in to comment.