Skip to content

Commit 10891fc

Browse files
committed
yFiles for HTML 2.4.0.6 demos
1 parent 107323a commit 10891fc

File tree

67 files changed

+18992
-25866
lines changed

Some content is hidden

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

67 files changed

+18992
-25866
lines changed

demos/01-tutorial-getting-started/10-layout/SampleApplication.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ let dateMapper = null
7474
*/
7575
function run(licenseData) {
7676
License.value = licenseData
77+
7778
// Initialize the GraphComponent and place it in the div with CSS selector #graphComponent
7879
graphComponent = new GraphComponent('#graphComponent')
7980

@@ -119,14 +120,15 @@ function run(licenseData) {
119120

120121
// /////////////// New in this Sample /////////////////
121122

122-
// We need to load the 'view-layout-bridge' module explicitly to prevent tree-shaking
123-
// tools it from removing this dependency which is needed for 'morphLayout'.
124-
Class.ensure(LayoutExecutor)
125-
126123
/**
124+
* Applies a hierarchic layout.
127125
* @returns {!Promise}
128126
*/
129127
async function runLayout() {
128+
// We need to load the 'view-layout-bridge' module explicitly to prevent tree-shaking
129+
// tools it from removing this dependency which is needed for 'morphLayout'.
130+
Class.ensure(LayoutExecutor)
131+
130132
const layoutButton = document.getElementById('layout-btn')
131133
layoutButton.disabled = true
132134
// Uses the morphLayout method to perform the layout, animate it, manage undo and adjust the content rectangle in

demos/01-tutorial-getting-started/10-layout/SampleApplication.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ let dateMapper: Mapper<IModelItem, Date> = null
7272

7373
function run(licenseData: object): void {
7474
License.value = licenseData
75+
7576
// Initialize the GraphComponent and place it in the div with CSS selector #graphComponent
7677
graphComponent = new GraphComponent('#graphComponent')
7778

@@ -117,11 +118,14 @@ function run(licenseData: object): void {
117118

118119
// /////////////// New in this Sample /////////////////
119120

120-
// We need to load the 'view-layout-bridge' module explicitly to prevent tree-shaking
121-
// tools it from removing this dependency which is needed for 'morphLayout'.
122-
Class.ensure(LayoutExecutor)
123-
121+
/**
122+
* Applies a hierarchic layout.
123+
*/
124124
async function runLayout(): Promise<void> {
125+
// We need to load the 'view-layout-bridge' module explicitly to prevent tree-shaking
126+
// tools it from removing this dependency which is needed for 'morphLayout'.
127+
Class.ensure(LayoutExecutor)
128+
125129
const layoutButton = document.getElementById('layout-btn') as HTMLButtonElement
126130
layoutButton.disabled = true
127131
// Uses the morphLayout method to perform the layout, animate it, manage undo and adjust the content rectangle in

demos/01-tutorial-getting-started/11-layout-data/SampleApplication.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
**
2828
***************************************************************************/
2929
import {
30+
Class,
3031
DefaultLabelStyle,
3132
EdgePathLabelModel,
3233
EdgeSides,
@@ -45,6 +46,7 @@ import {
4546
Insets,
4647
InteriorStretchLabelModel,
4748
LabelEventArgs,
49+
LayoutExecutor,
4850
License,
4951
MinimumNodeSizeStage,
5052
Point,
@@ -62,8 +64,9 @@ let graphComponent = null
6264

6365
/**
6466
* @param {!object} licenseData
67+
* @returns {!Promise}
6568
*/
66-
function run(licenseData) {
69+
async function run(licenseData) {
6770
License.value = licenseData
6871

6972
// Initialize the GraphComponent and place it in the div with CSS selector #graphComponent
@@ -95,16 +98,24 @@ function run(licenseData) {
9598

9699
// Initialize the demo application's CSS and Javascript for the description
97100
showApp(graphComponent)
101+
102+
await runLayout()
98103
}
99104

100105
/**
101106
* Applies a hierarchic layout and uses the data of the layout from the tags of the nodes.
102107
* @returns {!Promise}
103108
*/
104109
async function runLayout() {
105-
const hierarchicLayout = new HierarchicLayout()
110+
// We need to load the 'view-layout-bridge' module explicitly to prevent tree-shaking
111+
// tools it from removing this dependency which is needed for 'morphLayout'.
112+
Class.ensure(LayoutExecutor)
113+
114+
const layoutButton = document.getElementById('layout-btn')
115+
layoutButton.disabled = true
106116

107117
// /////////////// New in this Sample /////////////////
118+
const hierarchicLayout = new HierarchicLayout()
108119

109120
// Configures the layout data from the data that exits in the tags of the nodes
110121
const hierarchicLayoutData = new HierarchicLayoutData({
@@ -135,6 +146,8 @@ async function runLayout() {
135146
} else {
136147
throw error
137148
}
149+
} finally {
150+
layoutButton.disabled = false
138151
}
139152
}
140153

@@ -179,9 +192,6 @@ function createSampleGraph() {
179192
builder.createEdgesSource(GraphBuilderData.edges, 'source', 'target', 'id')
180193

181194
builder.buildGraph()
182-
183-
// Runs the layout
184-
runLayout()
185195
}
186196

187197
/**

demos/01-tutorial-getting-started/11-layout-data/SampleApplication.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
***************************************************************************/
2929
/* eslint-disable @typescript-eslint/no-explicit-any */
3030
import {
31+
Class,
3132
DefaultLabelStyle,
3233
EdgePathLabelModel,
3334
EdgeSides,
@@ -46,6 +47,7 @@ import {
4647
Insets,
4748
InteriorStretchLabelModel,
4849
LabelEventArgs,
50+
LayoutExecutor,
4951
License,
5052
MinimumNodeSizeStage,
5153
Point,
@@ -61,7 +63,7 @@ import GraphBuilderData from './resources/graph'
6163
// @ts-ignore
6264
let graphComponent: GraphComponent = null
6365

64-
function run(licenseData: object): void {
66+
async function run(licenseData: object): Promise<void> {
6567
License.value = licenseData
6668

6769
// Initialize the GraphComponent and place it in the div with CSS selector #graphComponent
@@ -93,15 +95,23 @@ function run(licenseData: object): void {
9395

9496
// Initialize the demo application's CSS and Javascript for the description
9597
showApp(graphComponent)
98+
99+
await runLayout()
96100
}
97101

98102
/**
99103
* Applies a hierarchic layout and uses the data of the layout from the tags of the nodes.
100104
*/
101105
async function runLayout(): Promise<void> {
102-
const hierarchicLayout = new HierarchicLayout()
106+
// We need to load the 'view-layout-bridge' module explicitly to prevent tree-shaking
107+
// tools it from removing this dependency which is needed for 'morphLayout'.
108+
Class.ensure(LayoutExecutor)
109+
110+
const layoutButton = document.getElementById('layout-btn') as HTMLButtonElement
111+
layoutButton.disabled = true
103112

104113
// /////////////// New in this Sample /////////////////
114+
const hierarchicLayout = new HierarchicLayout()
105115

106116
// Configures the layout data from the data that exits in the tags of the nodes
107117
const hierarchicLayoutData = new HierarchicLayoutData({
@@ -133,6 +143,8 @@ async function runLayout(): Promise<void> {
133143
} else {
134144
throw error
135145
}
146+
} finally {
147+
layoutButton.disabled = false
136148
}
137149
}
138150

@@ -176,9 +188,6 @@ function createSampleGraph(): void {
176188
builder.createEdgesSource(GraphBuilderData.edges, 'source', 'target', 'id')
177189

178190
builder.buildGraph()
179-
180-
// Runs the layout
181-
runLayout()
182191
}
183192

184193
/**

demos/01-tutorial-getting-started/11-layout-data/index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ <h1>Layout Data</h1>
120120
class="demo-icon-yIconUngroup"
121121
></button>
122122
<span class="demo-separator"></span>
123-
<button data-command="Layout" title="Layout" class="demo-icon-yIconLayout labeled">
123+
<button
124+
id="layout-btn"
125+
data-command="Layout"
126+
title="Layout"
127+
class="demo-icon-yIconLayout labeled"
128+
>
124129
Layout
125130
</button>
126131
</div>

demos/README.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ <h2>Your browser does not support modern CSS</h2>
109109
<div class="content-wide">
110110
<div id="general-intro">
111111
<p class="first-paragraph">
112-
The <a href='https://www.yworks.com/products/yfiles-for-html'>yFiles for HTML 2.4.0.5</a> demo applications are available in both JavaScript and
112+
The <a href='https://www.yworks.com/products/yfiles-for-html'>yFiles for HTML 2.4.0.6</a> demo applications are available in both JavaScript and
113113
TypeScript, with only a few exceptions.
114114
</p>
115115
<div class="js-only">

demos/analysis/graphanalysis/resources/substructures.graphml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
//
2929
////////////////////////////////////////////////////////////////////////-->
3030

31-
<!--Created by yFiles for HTML 2.4.0.5-->
31+
<!--Created by yFiles for HTML 2.4.0.6-->
3232
<graphml xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml.html/2.0/ygraphml.xsd " xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:y="http://www.yworks.com/xml/yfiles-common/3.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/3.0" xmlns:yjs="http://www.yworks.com/xml/yfiles-for-html/2.0/xaml" xmlns:x0="http://www.yworks.com/yFilesHTML/demos/FlatDemoStyle/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3333
<yjs:Stroke x:Key="8" fill="{y:GraphMLReference 9}"/>
3434
<graph id="G" edgedefault="directed">

demos/complete/networkmonitoring/Device.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ export /**
3535
*/
3636
const DeviceKind = {
3737
WORKSTATION: 1,
38-
LAPTOP: 1,
39-
SMARTPHONE: 2,
40-
SWITCH: 3,
41-
WLAN: 4,
42-
SERVER: 5,
43-
DATABASE: 6
38+
LAPTOP: 2,
39+
SMARTPHONE: 3,
40+
SWITCH: 4,
41+
WLAN: 5,
42+
SERVER: 6,
43+
DATABASE: 7
4444
}
4545

4646
/**

demos/complete/networkmonitoring/Device.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
*/
3232
export enum DeviceKind {
3333
WORKSTATION = 1,
34-
LAPTOP,
35-
SMARTPHONE,
36-
SWITCH,
37-
WLAN,
38-
SERVER,
39-
DATABASE
34+
LAPTOP = 2,
35+
SMARTPHONE = 3,
36+
SWITCH = 4,
37+
WLAN = 5,
38+
SERVER = 6,
39+
DATABASE = 7
4040
}
4141

4242
/**

demos/complete/networkmonitoring/NetworkMonitoringDemo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import HTMLPopupSupport from './HTMLPopupSupport.js'
6161
import loadJson from '../../resources/load-json.js'
6262
import { passiveSupported } from '../../utils/Workarounds.js'
6363
import Network from './Network.js'
64-
import SampleData from './resources/sample.js'
64+
import { networkData } from './resources/network-sample.js'
6565

6666
// This demo creates a network monitoring tool for dynamic data.
6767
// The mock-up model is created and updated by class Simulator.
@@ -254,7 +254,7 @@ function toggleLabels(event) {
254254
function loadNetwork() {
255255
return new Promise(resolve =>
256256
setTimeout(() => {
257-
loadGraph(SampleData)
257+
loadGraph(networkData)
258258
populateModel(graphComponent.graph)
259259
resolve()
260260
}, 0)

demos/complete/networkmonitoring/NetworkMonitoringDemo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ import HTMLPopupSupport from './HTMLPopupSupport'
6161
import loadJson from '../../resources/load-json'
6262
import { passiveSupported } from '../../utils/Workarounds'
6363
import Network from './Network'
64-
import SampleData from './resources/sample'
65-
import type { NetworkSample } from './resources/sample'
64+
import { networkData } from './resources/network-sample'
65+
import type { NetworkSample } from './resources/network-sample'
6666

6767
// This demo creates a network monitoring tool for dynamic data.
6868
// The mock-up model is created and updated by class Simulator.
@@ -239,7 +239,7 @@ function toggleLabels(event: Event): void {
239239
function loadNetwork(): Promise<void> {
240240
return new Promise<void>(resolve =>
241241
setTimeout(() => {
242-
loadGraph(SampleData)
242+
loadGraph(networkData)
243243
populateModel(graphComponent.graph)
244244
resolve()
245245
}, 0)

demos/complete/networkmonitoring/resources/database.svg

Lines changed: 1 addition & 1 deletion
Loading

demos/complete/networkmonitoring/resources/laptop.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)