Skip to content

Commit fc748a7

Browse files
committed
Linting.
1 parent ddef796 commit fc748a7

19 files changed

Lines changed: 226 additions & 199 deletions

app/favicon.png

1.67 KB
Loading

app/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>CustomPorts</title>
4+
<title>yFiles Visual Programming</title>
55

66
<link type="text/css" rel="stylesheet" href="dist/lib.css">
7-
7+
<link rel="icon" href="/favicon.png">
88
<style>
99
html, body, #graphComponent {
1010
width: 100%;

app/scripts/app.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Class.ensure(LayoutExecutor);
1616
class App {
1717
surface: ISurface;
1818

19+
constructor() {
20+
this.surface = new Surface();
21+
this.createSampleGraph();
22+
}
23+
1924
createSampleGraph() {
2025

2126
// const r = new RandomFlowNodeController(model, surface);
@@ -41,11 +46,6 @@ class App {
4146
this.surface.layout();
4247
}
4348

44-
constructor() {
45-
this.surface = new Surface();
46-
this.createSampleGraph();
47-
}
48-
4949
}
5050

5151
new App();

app/scripts/core/FlowNodeController.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ import {IFlowNodeViewModel} from './IFlowNodeViewModel';
88
* Base implementation of {@link IFlowNodeController}.
99
*/
1010
export abstract class FlowNodeController implements IFlowNodeController {
11+
12+
public get enabled() {
13+
return this.viewModel.enabled;
14+
}
15+
16+
public set enabled(v) {
17+
this.viewModel.enabled = v;
18+
}
1119
protected model: IFlowModel;
1220
protected surface: ISurface;
1321
protected outputStyle: TemplatePortStyle;
1422
protected inputStyle: TemplatePortStyle;
15-
public ports: { [key: string]: IPort };
1623
protected viewModel: IFlowNodeViewModel;
1724
protected node:INode;
1825
protected constructor( surface: ISurface) {
@@ -32,14 +39,7 @@ export abstract class FlowNodeController implements IFlowNodeController {
3239
normalizedOutline: outlinePath
3340
});
3441
}
35-
36-
public get enabled() {
37-
return this.viewModel.enabled;
38-
}
39-
40-
public set enabled(v) {
41-
this.viewModel.enabled = v;
42-
}
42+
public ports: { [key: string]: IPort };
4343

4444

4545
}

app/scripts/core/FlowNodeModel.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@ import {StreamEvent} from './StreamEvent';
99
* The model of a flow node.
1010
*/
1111
export class FlowNodeModel implements IFlowNodeModel {
12-
private _id: string;
13-
14-
15-
private _model: FlowModel;
16-
private values: { [key: string]: string };
17-
/**
18-
* Occurs whenever something happens on the in/out.
19-
*/
20-
public onChange: Stream<any, never>;
21-
// @ts-ignore
22-
private onChangeEmitter: Emitter;
2312

2413

2514
public get model() {
@@ -36,6 +25,17 @@ export class FlowNodeModel implements IFlowNodeModel {
3625
public set id(v) {
3726
this._id = v;
3827
}
28+
private _id: string;
29+
30+
31+
private readonly _model: FlowModel;
32+
private readonly values: { [key: string]: string };
33+
// @ts-ignore
34+
private onChangeEmitter: Emitter;
35+
/**
36+
* Occurs whenever something happens on the in/out.
37+
*/
38+
public onChange: Stream<any, never>;
3939

4040
/**
4141
*

app/scripts/core/FlowNodeViewModel.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,37 @@ export class FlowNodeViewModel extends BaseClass<IPropertyObservable>(IPropertyO
2020
this.firePropertyChanged('enabled');
2121
}
2222

23-
private _propertyChanged: any;
24-
2523

2624
get id(): string {
2725
return this._id;
2826
}
2927

28+
public get title(): string {
29+
return this._title;
30+
}
31+
32+
get model(): IFlowModel {
33+
return this._model;
34+
}
35+
36+
private _propertyChanged: any;
37+
3038
private readonly _title: string;
3139
private readonly _id: string;
3240
private readonly _model: IFlowModel;
3341

3442
protected _enabled: boolean;
3543

44+
/**
45+
* Firest the PropertyChanged event.
46+
* @param propertyName The name of the property that has changed
47+
*/
48+
protected firePropertyChanged(propertyName) {
49+
if (this._propertyChanged !== null) {
50+
this._propertyChanged(this, new PropertyChangedEventArgs(propertyName))
51+
}
52+
}
53+
3654
public portViewModels: { [key: string]: IFlowPortViewModel };
3755

3856
constructor(title, model) {
@@ -45,14 +63,6 @@ export class FlowNodeViewModel extends BaseClass<IPropertyObservable>(IPropertyO
4563
this.portViewModels = {};
4664
}
4765

48-
public get title(): string {
49-
return this._title;
50-
}
51-
52-
get model(): IFlowModel {
53-
return this._model;
54-
}
55-
5666
/**
5767
* Adds a listener to the PropertyChanged event.
5868
* @param {function(*,PropertyChangedEventArgs):void} listener - The listener to add.
@@ -69,16 +79,6 @@ export class FlowNodeViewModel extends BaseClass<IPropertyObservable>(IPropertyO
6979
this._propertyChanged = delegate.remove(this._propertyChanged, listener)
7080
}
7181

72-
/**
73-
* Firest the PropertyChanged event.
74-
* @param propertyName The name of the property that has changed
75-
*/
76-
protected firePropertyChanged(propertyName) {
77-
if (this._propertyChanged !== null) {
78-
this._propertyChanged(this, new PropertyChangedEventArgs(propertyName))
79-
}
80-
}
81-
8282
setPropertyValue(name, value) {
8383
this.model.nodes[this.id].setPropertyValue(name, value);
8484
}

app/scripts/core/FlowPortViewModel.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {IFlowNodeModel} from './IFlowNodeModel';
88
* View-model attached to a port.
99
*/
1010
export class FlowPortViewModel implements IFlowPortViewModel {
11-
port:IPort;
1211
get position(): Point {
1312
return this._position;
1413
}
@@ -17,15 +16,6 @@ export class FlowPortViewModel implements IFlowPortViewModel {
1716
this._position = value;
1817
}
1918

20-
21-
constructor(name, portType, viewModel, position) {
22-
this._name = name;
23-
this._portType = portType;
24-
this._viewModel = viewModel;
25-
this._position = position;
26-
27-
}
28-
2919
get viewModel(): IFlowNodeViewModel {
3020
return this._viewModel;
3121
}
@@ -54,6 +44,16 @@ export class FlowPortViewModel implements IFlowPortViewModel {
5444
private _portType: PortType;
5545
private _viewModel: IFlowNodeViewModel;
5646
private _position: Point;
47+
port:IPort;
48+
49+
50+
constructor(name, portType, viewModel, position) {
51+
this._name = name;
52+
this._portType = portType;
53+
this._viewModel = viewModel;
54+
this._position = position;
55+
56+
}
5757

5858
addPropertyChangedListener(listener: (sender: any, args: PropertyChangedEventArgs) => void): void {
5959
}

app/scripts/core/IFlowNodeViewModel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ export interface IFlowNodeViewModel extends IPropertyObservable {
1010
model: IFlowModel;
1111
title: String;
1212

13-
setPropertyValue(name, value);
14-
1513
/**
1614
* Gets or sets whether the element is enabled
1715
* and propagates data across the flow.
@@ -22,4 +20,6 @@ export interface IFlowNodeViewModel extends IPropertyObservable {
2220
* Gets or sets the view-models assigned to the ports.
2321
*/
2422
portViewModels: { [key: string]: IFlowPortViewModel };
23+
24+
setPropertyValue(name, value);
2525
}

app/scripts/core/IFlowPortViewModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export interface IFlowPortViewModel extends IPropertyObservable {
2121
viewModel: IFlowNodeViewModel;
2222

2323
position: Point;
24+
port:IPort;
2425

2526
getNodeModel(): IFlowNodeModel
2627
setProperty(name, value);
27-
port:IPort;
2828
}

app/scripts/core/Surface.ts

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -16,70 +16,6 @@ import * as _ from 'lodash';
1616
* High-level API managing the flow.
1717
*/
1818
export class Surface implements ISurface {
19-
graph: IGraph;
20-
model: IFlowModel;
21-
graphComponent: GraphComponent;
22-
23-
constructor() {
24-
this.model = new FlowModel();
25-
this.init();
26-
}
27-
28-
init() {
29-
this.setLicense();
30-
this.createComponent();
31-
this.setStyle();
32-
this.defineBridges();
33-
this.createInteractions();
34-
}
35-
36-
setLicense() {
37-
38-
License.value = {
39-
'company': 'The Orbifold b.v.b.a.',
40-
'date': '10/22/2019',
41-
'distribution': true,
42-
'domains': [
43-
'*'
44-
],
45-
'fileSystemAllowed': true,
46-
'licensefileversion': '1.1',
47-
'localhost': true,
48-
'oobAllowed': true,
49-
'package': 'complete',
50-
'product': 'yFiles for HTML',
51-
'projectname': 'yWorks Consulting',
52-
'subscription': '12/31/2020',
53-
'type': 'project',
54-
'version': '2.2',
55-
'key': 'd9568c2bdf4ebd16cf3d80a0edc8fe155ca5a38c'
56-
};
57-
}
58-
59-
createComponent() {
60-
this.graphComponent = new GraphComponent('#graphComponent');
61-
this.graph = this.graphComponent.graph;
62-
63-
}
64-
65-
layout() {
66-
const executor = new LayoutExecutor({
67-
graphComponent: this.graphComponent,
68-
layout: new HierarchicLayout({
69-
layoutOrientation: 'left-to-right',
70-
gridSpacing: 0
71-
}),
72-
animateViewport: true,
73-
easedAnimation: true,
74-
duration: '0.5s',
75-
fixPorts: true,
76-
});
77-
78-
executor.start().then( () => {
79-
this.graphComponent.fitContent();
80-
this.graphComponent.zoom = 3;
81-
});
82-
}
8319

8420
private createInteractions() {
8521
const mode = new GraphEditorInputMode();
@@ -211,6 +147,70 @@ export class Surface implements ISurface {
211147
}
212148
}
213149
}
150+
graph: IGraph;
151+
model: IFlowModel;
152+
graphComponent: GraphComponent;
153+
154+
constructor() {
155+
this.model = new FlowModel();
156+
this.init();
157+
}
158+
159+
init() {
160+
this.setLicense();
161+
this.createComponent();
162+
this.setStyle();
163+
this.defineBridges();
164+
this.createInteractions();
165+
}
166+
167+
setLicense() {
168+
169+
License.value = {
170+
'company': 'The Orbifold b.v.b.a.',
171+
'date': '10/22/2019',
172+
'distribution': true,
173+
'domains': [
174+
'*'
175+
],
176+
'fileSystemAllowed': true,
177+
'licensefileversion': '1.1',
178+
'localhost': true,
179+
'oobAllowed': true,
180+
'package': 'complete',
181+
'product': 'yFiles for HTML',
182+
'projectname': 'yWorks Consulting',
183+
'subscription': '12/31/2020',
184+
'type': 'project',
185+
'version': '2.2',
186+
'key': 'd9568c2bdf4ebd16cf3d80a0edc8fe155ca5a38c'
187+
};
188+
}
189+
190+
createComponent() {
191+
this.graphComponent = new GraphComponent('#graphComponent');
192+
this.graph = this.graphComponent.graph;
193+
194+
}
195+
196+
layout() {
197+
const executor = new LayoutExecutor({
198+
graphComponent: this.graphComponent,
199+
layout: new HierarchicLayout({
200+
layoutOrientation: 'left-to-right',
201+
gridSpacing: 0
202+
}),
203+
animateViewport: true,
204+
easedAnimation: true,
205+
duration: '0.5s',
206+
fixPorts: true,
207+
});
208+
209+
executor.start().then( () => {
210+
this.graphComponent.fitContent();
211+
this.graphComponent.zoom = 3;
212+
});
213+
}
214214

215215
connect(source: IPort, target: IPort): IEdge {
216216
// note that the `graph.addEdgeCreatedListener` takes are of the rest

0 commit comments

Comments
 (0)