Skip to content

Commit ac93ad6

Browse files
committed
Rename internal model classes with 'Impl' suffix
1 parent 3a46aa0 commit ac93ad6

File tree

118 files changed

+1047
-975
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1047
-975
lines changed

examples/circlegraph/src/di.config.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (c) 2017-2018 TypeFox and others.
2+
* Copyright (c) 2017-2023 TypeFox and others.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
@@ -14,19 +14,20 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
1616

17-
import { Container, ContainerModule, injectable, inject } from "inversify";
17+
import { Container, ContainerModule, injectable, inject } from 'inversify';
1818
import {
1919
TYPES, configureViewerOptions, SGraphView, ConsoleLogger, LogLevel, loadDefaultModules,
20-
LocalModelSource, CircularNode, configureModelElement, SGraph, SEdge, selectFeature, PolylineEdgeView, MouseListener, SModelElement
20+
LocalModelSource, CircularNode, configureModelElement, SGraphImpl, SEdgeImpl, selectFeature,
21+
PolylineEdgeView, MouseListener, SModelElementImpl
2122
} from 'sprotty';
22-
import { Action, Point } from "sprotty-protocol";
23-
import { CircleNodeView } from "./views";
23+
import { Action, Point } from 'sprotty-protocol';
24+
import { CircleNodeView } from './views';
2425

2526
const NodeCreator = Symbol('NodeCreator');
2627

2728
export default (nodeCreator: (point?: Point)=>void) => {
28-
require("sprotty/css/sprotty.css");
29-
require("../css/diagram.css");
29+
require('sprotty/css/sprotty.css');
30+
require('../css/diagram.css');
3031

3132
const circlegraphModule = new ContainerModule((bind, unbind, isBound, rebind) => {
3233
bind(TYPES.ModelSource).to(LocalModelSource).inSingletonScope();
@@ -36,11 +37,13 @@ export default (nodeCreator: (point?: Point)=>void) => {
3637
bind(DroppableMouseListener).toSelf().inSingletonScope();
3738
bind(TYPES.MouseListener).toService(DroppableMouseListener);
3839
const context = { bind, unbind, isBound, rebind };
39-
configureModelElement(context, 'graph', SGraph, SGraphView);
40+
41+
configureModelElement(context, 'graph', SGraphImpl, SGraphView);
4042
configureModelElement(context, 'node:circle', CircularNode, CircleNodeView);
41-
configureModelElement(context, 'edge:straight', SEdge, PolylineEdgeView, {
43+
configureModelElement(context, 'edge:straight', SEdgeImpl, PolylineEdgeView, {
4244
disable: [selectFeature]
4345
});
46+
4447
configureViewerOptions(context, {
4548
needsClientLayout: false
4649
});
@@ -57,12 +60,12 @@ class DroppableMouseListener extends MouseListener {
5760

5861
@inject(NodeCreator) nodeCreator: (point?: Point)=>void;
5962

60-
override dragOver(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
63+
override dragOver(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[] {
6164
event.preventDefault();
6265
return [];
6366
}
6467

65-
override drop(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
68+
override drop(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[] {
6669
this.nodeCreator({ x: event.offsetX, y:event.offsetY })
6770
return [];
6871
}

examples/circlegraph/src/standalone.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (c) 2017-2018 TypeFox and others.
2+
* Copyright (c) 2017-2023 TypeFox and others.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
@@ -15,10 +15,10 @@
1515
********************************************************************************/
1616

1717
import {
18-
TYPES, IActionDispatcher, ElementMove, MoveAction, LocalModelSource, getBasicType
18+
TYPES, IActionDispatcher, ElementMove, MoveAction, LocalModelSource
1919
} from 'sprotty';
20-
import { Bounds, Point, SEdge, SelectAction, SGraph, SNode } from 'sprotty-protocol';
21-
import createContainer from "./di.config";
20+
import { Bounds, Point, SEdge, SelectAction, SGraph, SNode, getBasicType } from 'sprotty-protocol';
21+
import createContainer from './di.config';
2222

2323
const NODE_SIZE = 60;
2424

examples/circlegraph/src/views.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (c) 2017-2018 TypeFox and others.
2+
* Copyright (c) 2017-2023 TypeFox and others.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
@@ -17,15 +17,15 @@
1717
/** @jsx svg */
1818
import { svg } from 'sprotty/lib/lib/jsx';
1919
import { injectable } from 'inversify';
20-
import { VNode } from "snabbdom";
21-
import { RenderingContext, SNode, ShapeView } from 'sprotty';
20+
import { VNode } from 'snabbdom';
21+
import { RenderingContext, SNodeImpl, ShapeView } from 'sprotty';
2222

2323
/**
2424
* A very simple example node consisting of a plain circle.
2525
*/
2626
@injectable()
2727
export class CircleNodeView extends ShapeView {
28-
render(node: SNode, context: RenderingContext): VNode | undefined {
28+
render(node: SNodeImpl, context: RenderingContext): VNode | undefined {
2929
if (!this.isVisible(node, context)) {
3030
return undefined;
3131
}
@@ -40,7 +40,7 @@ export class CircleNodeView extends ShapeView {
4040
</g>;
4141
}
4242

43-
protected getRadius(node: SNode): number {
43+
protected getRadius(node: SNodeImpl): number {
4444
const d = Math.min(node.size.width, node.size.height);
4545
return d > 0 ? d / 2 : 0;
4646
}

examples/classdiagram/src/di.config.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (c) 2017-2018 TypeFox and others.
2+
* Copyright (c) 2017-2023 TypeFox and others.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
@@ -14,29 +14,29 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
1616
import '@vscode/codicons/dist/codicon.css';
17-
import { Container, ContainerModule } from "inversify";
17+
import { Container, ContainerModule } from 'inversify';
1818
import {
1919
TYPES, configureViewerOptions, SGraphView, SLabelView, SCompartmentView, JumpingPolylineEdgeView,
2020
ConsoleLogger, LogLevel, loadDefaultModules, HtmlRootView, PreRenderedView, ExpandButtonView,
21-
SRoutingHandleView, PreRenderedElement, HtmlRoot, SGraph, configureModelElement, SLabel,
22-
SCompartment, SEdge, SButton, SRoutingHandle, RevealNamedElementActionProvider,
21+
SRoutingHandleView, PreRenderedElementImpl, HtmlRootImpl, SGraphImpl, configureModelElement, SLabelImpl,
22+
SCompartmentImpl, SEdgeImpl, SButtonImpl, SRoutingHandleImpl, RevealNamedElementActionProvider,
2323
CenterGridSnapper, expandFeature, nameFeature, withEditLabelFeature, editLabelFeature,
2424
RectangularNode, BezierCurveEdgeView, SBezierCreateHandleView, SBezierControlHandleView
2525
} from 'sprotty';
26-
import edgeIntersectionModule from "sprotty/lib/features/edge-intersection/di.config";
26+
import edgeIntersectionModule from 'sprotty/lib/features/edge-intersection/di.config';
2727
import { BezierMouseListener } from 'sprotty/lib/features/routing/bezier-edge-router';
2828
import { ClassDiagramLabelValidationDecorator, ClassDiagramLabelValidator } from './label-validation';
2929
import { ClassContextMenuItemProvider, ClassContextMenuService } from './menu';
30-
import { ClassLabel, ClassNode, Icon, PropertyLabel } from "./model";
30+
import { ClassLabel, ClassNode, Icon, PropertyLabel } from './model';
3131
import { ClassDiagramModelSource } from './model-source';
32-
import { PopupModelProvider } from "./popup";
33-
import { IconView, NodeView } from "./views";
32+
import { PopupModelProvider } from './popup';
33+
import { IconView, NodeView } from './views';
3434

3535
export default (containerId: string) => {
36-
require("sprotty/css/sprotty.css");
37-
require("sprotty/css/command-palette.css");
38-
require("sprotty/css/edit-label.css");
39-
require("../css/diagram.css");
36+
require('sprotty/css/sprotty.css');
37+
require('sprotty/css/command-palette.css');
38+
require('sprotty/css/edit-label.css');
39+
require('../css/diagram.css');
4040

4141
const classDiagramModule = new ContainerModule((bind, unbind, isBound, rebind) => {
4242
bind(TYPES.ModelSource).to(ClassDiagramModelSource).inSingletonScope();
@@ -54,7 +54,7 @@ export default (containerId: string) => {
5454
bind(TYPES.IContextMenuItemProvider).to(ClassContextMenuItemProvider);
5555

5656
const context = { bind, unbind, isBound, rebind };
57-
configureModelElement(context, 'graph', SGraph, SGraphView);
57+
configureModelElement(context, 'graph', SGraphImpl, SGraphView);
5858
configureModelElement(context, 'node:package', RectangularNode, NodeView);
5959
configureModelElement(context, 'node:class', ClassNode, NodeView, {
6060
enable: [expandFeature, nameFeature, withEditLabelFeature]
@@ -65,21 +65,21 @@ export default (containerId: string) => {
6565
configureModelElement(context, 'label:text', PropertyLabel, SLabelView, {
6666
enable: [editLabelFeature]
6767
});
68-
configureModelElement(context, 'comp:comp', SCompartment, SCompartmentView);
69-
configureModelElement(context, 'comp:header', SCompartment, SCompartmentView);
70-
configureModelElement(context, 'comp:pkgcontent', SCompartment, SCompartmentView);
68+
configureModelElement(context, 'comp:comp', SCompartmentImpl, SCompartmentView);
69+
configureModelElement(context, 'comp:header', SCompartmentImpl, SCompartmentView);
70+
configureModelElement(context, 'comp:pkgcontent', SCompartmentImpl, SCompartmentView);
7171
configureModelElement(context, 'icon', Icon, IconView);
72-
configureModelElement(context, 'label:icon', SLabel, SLabelView);
73-
configureModelElement(context, 'edge:straight', SEdge, JumpingPolylineEdgeView);
74-
configureModelElement(context, 'edge:bezier', SEdge, BezierCurveEdgeView);
75-
configureModelElement(context, 'html', HtmlRoot, HtmlRootView);
76-
configureModelElement(context, 'pre-rendered', PreRenderedElement, PreRenderedView);
77-
configureModelElement(context, 'button:expand', SButton, ExpandButtonView);
78-
configureModelElement(context, 'routing-point', SRoutingHandle, SRoutingHandleView);
79-
configureModelElement(context, 'volatile-routing-point', SRoutingHandle, SRoutingHandleView);
80-
configureModelElement(context, 'bezier-create-routing-point', SRoutingHandle, SBezierCreateHandleView);
81-
configureModelElement(context, 'bezier-remove-routing-point', SRoutingHandle, SBezierCreateHandleView);
82-
configureModelElement(context, 'bezier-routing-point', SRoutingHandle, SBezierControlHandleView);
72+
configureModelElement(context, 'label:icon', SLabelImpl, SLabelView);
73+
configureModelElement(context, 'edge:straight', SEdgeImpl, JumpingPolylineEdgeView);
74+
configureModelElement(context, 'edge:bezier', SEdgeImpl, BezierCurveEdgeView);
75+
configureModelElement(context, 'html', HtmlRootImpl, HtmlRootView);
76+
configureModelElement(context, 'pre-rendered', PreRenderedElementImpl, PreRenderedView);
77+
configureModelElement(context, 'button:expand', SButtonImpl, ExpandButtonView);
78+
configureModelElement(context, 'routing-point', SRoutingHandleImpl, SRoutingHandleView);
79+
configureModelElement(context, 'volatile-routing-point', SRoutingHandleImpl, SRoutingHandleView);
80+
configureModelElement(context, 'bezier-create-routing-point', SRoutingHandleImpl, SBezierCreateHandleView);
81+
configureModelElement(context, 'bezier-remove-routing-point', SRoutingHandleImpl, SBezierCreateHandleView);
82+
configureModelElement(context, 'bezier-routing-point', SRoutingHandleImpl, SBezierControlHandleView);
8383

8484

8585
configureViewerOptions(context, {

examples/classdiagram/src/label-validation.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
*
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
16+
17+
import { injectable } from 'inversify';
1618
import {
17-
IEditLabelValidator, EditableLabel, SModelElement, EditLabelValidationResult, Severity, IEditLabelValidationDecorator
19+
IEditLabelValidator, EditableLabel, SModelElementImpl, EditLabelValidationResult, Severity, IEditLabelValidationDecorator
1820
} from 'sprotty';
19-
import { injectable } from "inversify";
2021

2122
@injectable()
2223
export class ClassDiagramLabelValidator implements IEditLabelValidator {
23-
async validate(value: string, label: EditableLabel & SModelElement): Promise<EditLabelValidationResult> {
24+
async validate(value: string, label: EditableLabel & SModelElementImpl): Promise<EditLabelValidationResult> {
2425
if (value.length < 1) {
2526
return {
2627
severity: <Severity>'error',
@@ -67,4 +68,4 @@ export class ClassDiagramLabelValidationDecorator implements IEditLabelValidatio
6768
containerElement.classList.remove('validation-ok', 'validation-warning', 'validation-error');
6869
}
6970
}
70-
}
71+
}

examples/classdiagram/src/menu.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
1616

17-
import { inject, injectable } from "inversify";
18-
import { Anchor, DeleteElementAction, EMPTY_ROOT, GetSelectionAction, IActionDispatcher, IContextMenuItemProvider, IContextMenuService, LabeledAction, MenuItem, RequestExportSvgAction, SelectionResult, SModelRoot, TYPES, ViewerOptions } from "sprotty";
19-
import { CenterAction, FitToScreenAction, Point, SetPopupModelAction } from "sprotty-protocol";
17+
import { inject, injectable } from 'inversify';
18+
import {
19+
Anchor, DeleteElementAction, EMPTY_ROOT, GetSelectionAction, IActionDispatcher,
20+
IContextMenuItemProvider, IContextMenuService, LabeledAction, MenuItem,
21+
RequestExportSvgAction, SelectionResult, SModelRootImpl, TYPES, ViewerOptions
22+
} from 'sprotty';
23+
import { CenterAction, FitToScreenAction, Point, SetPopupModelAction } from 'sprotty-protocol';
2024

2125
@injectable()
2226
export class ClassContextMenuService implements IContextMenuService {
@@ -72,7 +76,7 @@ export class ClassContextMenuItemProvider implements IContextMenuItemProvider {
7276

7377
@inject(TYPES.IActionDispatcher) readonly actionDispatcher: IActionDispatcher;
7478

75-
async getItems(root: Readonly<SModelRoot>, lastMousePosition?: Point | undefined): Promise<LabeledAction[]> {
79+
async getItems(root: Readonly<SModelRootImpl>, lastMousePosition?: Point | undefined): Promise<LabeledAction[]> {
7680
const selectionResult = await this.actionDispatcher.request<SelectionResult>(GetSelectionAction.create())
7781
return [
7882
new LabeledAction('Fit Diagram to Screen', [FitToScreenAction.create(root.children.map(child => child.id))]),

examples/classdiagram/src/model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (c) 2017-2018 TypeFox and others.
2+
* Copyright (c) 2017-2023 TypeFox and others.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
@@ -15,7 +15,7 @@
1515
********************************************************************************/
1616

1717
import {
18-
SShapeElement, Expandable, RectangularNode, Nameable, SLabel, WithEditableLabel, isEditableLabel,
18+
SShapeElementImpl, Expandable, RectangularNode, Nameable, SLabelImpl, WithEditableLabel, isEditableLabel,
1919
boundsFeature, layoutContainerFeature, layoutableChildFeature, fadeFeature
2020
} from 'sprotty';
2121

@@ -41,10 +41,10 @@ export class ClassNode extends RectangularNode implements Expandable, Nameable,
4141
}
4242
}
4343

44-
export class ClassLabel extends SLabel { }
45-
export class PropertyLabel extends SLabel { }
44+
export class ClassLabel extends SLabelImpl { }
45+
export class PropertyLabel extends SLabelImpl { }
4646

47-
export class Icon extends SShapeElement {
47+
export class Icon extends SShapeElementImpl {
4848
static readonly DEFAULT_FEATURES = [boundsFeature, layoutContainerFeature, layoutableChildFeature, fadeFeature];
4949

5050
override size = {

examples/classdiagram/src/popup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
1616

17-
import { injectable, inject } from "inversify";
17+
import { injectable, inject } from 'inversify';
1818
import {
1919
TYPES, IModelFactory, IPopupModelProvider
2020
} from 'sprotty';
21-
import { PreRenderedElement, RequestPopupModelAction, SModelElement, SModelRoot } from "sprotty-protocol";
22-
import { ClassNode } from "./model";
21+
import { PreRenderedElement, RequestPopupModelAction, SModelElement, SModelRoot } from 'sprotty-protocol';
22+
import { ClassNode } from './model';
2323

2424
@injectable()
2525
export class PopupModelProvider implements IPopupModelProvider {

examples/classdiagram/src/standalone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
1616

17-
import createContainer from "./di.config";
17+
import createContainer from './di.config';
1818
import { TYPES, LocalModelSource } from 'sprotty';
1919

2020
export default function runClassDiagram() {

examples/classdiagram/src/views.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (c) 2017-2018 TypeFox and others.
2+
* Copyright (c) 2017-2023 TypeFox and others.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
@@ -17,14 +17,14 @@
1717
/** @jsx svg */
1818
import { svg } from 'sprotty/lib/lib/jsx';
1919

20-
import { RenderingContext, IView, RectangularNodeView, SNode, IViewArgs } from 'sprotty';
21-
import { VNode } from "snabbdom";
20+
import { RenderingContext, IView, RectangularNodeView, SNodeImpl, IViewArgs } from 'sprotty';
21+
import { VNode } from 'snabbdom';
2222
import { Icon } from './model';
2323
import { injectable } from 'inversify';
2424

2525
@injectable()
2626
export class NodeView extends RectangularNodeView {
27-
override render(node: Readonly<SNode>, context: RenderingContext, args?: IViewArgs): VNode | undefined {
27+
override render(node: Readonly<SNodeImpl>, context: RenderingContext, args?: IViewArgs): VNode | undefined {
2828
if (!this.isVisible(node, context)) {
2929
return undefined;
3030
}
@@ -33,7 +33,7 @@ export class NodeView extends RectangularNodeView {
3333
class-node-package={node.type === 'node:package'}
3434
class-node-class={node.type === 'node:class'}
3535
class-mouseover={node.hoverFeedback} class-selected={node.selected}
36-
x="0" y="0" width={Math.max(node.size.width, 0)} height={Math.max(node.size.height, 0)}></rect>
36+
x='0' y='0' width={Math.max(node.size.width, 0)} height={Math.max(node.size.height, 0)}></rect>
3737
{context.renderChildren(node)}
3838
</g>;
3939
}

0 commit comments

Comments
 (0)