Skip to content

Commit 790b3b6

Browse files
committed
yFiles for HTML 2.4.0.3 demos
1 parent eadc789 commit 790b3b6

File tree

85 files changed

+963
-863
lines changed

Some content is hidden

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

85 files changed

+963
-863
lines changed

demos/README.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ <h2>Your browser does not support modern CSS</h2>
9797
<div class="content-wide">
9898
<div id="general-intro">
9999
<p class="first-paragraph">
100-
All <a href="https://www.yworks.com/products/yfiles-for-html">yFiles for HTML 2.4.0.2</a> demo applications are available in JavaScript, and demos
100+
All <a href="https://www.yworks.com/products/yfiles-for-html">yFiles for HTML 2.4.0.3</a> demo applications are available in JavaScript, and demos
101101
that are additionally available in TypeScript are labeled with <span class="ts-badge">TS</span>.
102102
</p>
103103
<div class="js-only">

demos/analysis/clustering/ClusteringDemo.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ import {
4949
IEnumerable,
5050
IGraph,
5151
INode,
52-
IRectangle,
5352
Insets,
53+
IRectangle,
54+
IVisualCreator,
5455
KMeansClustering,
5556
KMeansClusteringResult,
5657
LabelPropagationClustering,
@@ -63,8 +64,7 @@ import {
6364
Point,
6465
PolylineEdgeStyle,
6566
Rect,
66-
ShapeNodeStyle,
67-
IVisualCreator
67+
ShapeNodeStyle
6868
} from 'yfiles'
6969

7070
import * as ClusteringData from './resources/ClusteringData.js'
@@ -572,8 +572,7 @@ function onAlgorithmChanged() {
572572
selectedAlgorithm = algorithmsComboBox.selectedIndex
573573

574574
// determine the file name that will be used for loading the graph
575-
const key = algorithmsComboBox[selectedAlgorithm].value
576-
const fileName = key.replace(' ', '').replace('-', '')
575+
const fileName = algorithmsComboBox.value
577576

578577
// Adjusts the window appearance. This method is needed since when the selected clustering algorithm is
579578
// HIERARCHICAL, the window has to be split to visualize the dendrogram.

demos/analysis/clustering/ClusteringDemo.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ import {
4949
IEnumerable,
5050
IGraph,
5151
INode,
52-
IRectangle,
5352
Insets,
53+
IRectangle,
54+
IVisualCreator,
5455
KMeansClustering,
5556
KMeansClusteringResult,
5657
LabelPropagationClustering,
@@ -63,8 +64,7 @@ import {
6364
Point,
6465
PolylineEdgeStyle,
6566
Rect,
66-
ShapeNodeStyle,
67-
IVisualCreator
67+
ShapeNodeStyle
6868
} from 'yfiles'
6969

7070
import * as ClusteringData from './resources/ClusteringData'
@@ -563,8 +563,7 @@ function onAlgorithmChanged() {
563563
selectedAlgorithm = algorithmsComboBox.selectedIndex
564564

565565
// determine the file name that will be used for loading the graph
566-
const key = (algorithmsComboBox[selectedAlgorithm] as HTMLOptionElement).value
567-
const fileName = key.replace(' ', '').replace('-', '')
566+
const fileName = algorithmsComboBox.value
568567

569568
// Adjusts the window appearance. This method is needed since when the selected clustering algorithm is
570569
// HIERARCHICAL, the window has to be split to visualize the dendrogram.

demos/analysis/clustering/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ <h3>Things to Try</h3>
135135
class="demo-icon-yIconPrevious" disabled></button>
136136
<select data-command="AlgorithmSelectionChanged"
137137
title="Select a clustering algorithm graph" id="algorithmsComboBox">
138-
<option>Edge Betweenness</option>
139-
<option>k-Means</option>
140-
<option>Hierarchical</option>
141-
<option>Biconnected Components</option>
142-
<option>Louvain Modularity</option>
143-
<option>Label Propagation</option>
138+
<option value="EdgeBetweenness">Edge Betweenness</option>
139+
<option value="kMeans">k-Means</option>
140+
<option value="Hierarchical">Hierarchical</option>
141+
<option value="BiconnectedComponents">Biconnected Components</option>
142+
<option value="LouvainModularity">Louvain Modularity</option>
143+
<option value="LabelPropagation">Label Propagation</option>
144144
</select>
145145

146146
<button data-command="NextFile" title="Open next graph" id="nextButton"

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.2-->
31+
<!--Created by yFiles for HTML 2.4.0.3-->
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/1.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/bpmn/BpmnEditorDemo.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ import loadJson from '../../resources/load-json.js'
125125
import { BpmnDiParser } from './bpmn-di.js'
126126
import { pointerEventsSupported } from '../../utils/Workarounds.js'
127127

128-
const numberOfDiSamples = 1
129-
130128
/** @type {GraphComponent} */
131129
let graphComponent
132130

@@ -438,9 +436,10 @@ async function onGraphChooserBoxSelectionChanged() {
438436
setUIDisabled(true)
439437

440438
// now derive the file name
441-
const selectedItem = graphChooserBox.options[graphChooserBox.selectedIndex].value
442-
const graphName = selectedItem.toLowerCase().replace(/ /g, '_')
443-
if (graphChooserBox.selectedIndex >= graphChooserBox.options.length - numberOfDiSamples) {
439+
const selectedItem = graphChooserBox.options[graphChooserBox.selectedIndex]
440+
const graphName = selectedItem.value
441+
const isBpmnDi = selectedItem.getAttribute('data-type') === 'bpmn-di'
442+
if (isBpmnDi) {
444443
const content = await loadBpmnDiSample(graphName)
445444
if (content !== null) {
446445
const bpmnDiParser = new BpmnDiParser()

demos/complete/bpmn/BpmnEditorDemo.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ import loadJson from '../../resources/load-json'
125125
import { BpmnDiParser } from './bpmn-di'
126126
import { pointerEventsSupported } from '../../utils/Workarounds'
127127

128-
const numberOfDiSamples = 1
129-
130128
let graphComponent: GraphComponent
131129

132130
/**
@@ -430,9 +428,10 @@ async function onGraphChooserBoxSelectionChanged(): Promise<void> {
430428
setUIDisabled(true)
431429

432430
// now derive the file name
433-
const selectedItem = graphChooserBox.options[graphChooserBox.selectedIndex].value
434-
const graphName = selectedItem.toLowerCase().replace(/ /g, '_')
435-
if (graphChooserBox.selectedIndex >= graphChooserBox.options.length - numberOfDiSamples) {
431+
const selectedItem = graphChooserBox.options[graphChooserBox.selectedIndex]
432+
const graphName = selectedItem.value
433+
const isBpmnDi = selectedItem.getAttribute('data-type') === 'bpmn-di'
434+
if (isBpmnDi) {
436435
const content = await loadBpmnDiSample(graphName)
437436
if (content !== null) {
438437
const bpmnDiParser = new BpmnDiParser()

demos/complete/bpmn/BpmnPopupSupport.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import {
4848
INodeStyle,
4949
IPort,
5050
IPortStyle,
51-
List,
5251
NinePositionsEdgeLabelModel,
5352
Point,
5453
Rect,
@@ -840,26 +839,24 @@ export default class BpmnPopupSupport {
840839
* @param {!Class} enumType
841840
*/
842841
function populateComboBox(comboBox, enumType) {
843-
getEnumNames(enumType).forEach(name => {
842+
Enum.getValueNames(enumType).forEach(name => {
844843
const option = document.createElement('option')
845-
option.innerHTML = name
844+
option.innerText = getFriendlyName(name)
845+
option.value = name
846846
comboBox.options.add(option)
847847
})
848848
}
849849

850850
/**
851-
* Returns a list containing all values of the given enum type.
852-
* @param {!Class} enumType
853-
* @returns {!IEnumerable.<string>}
851+
* Returns a readable name for all-caps enum constants.
852+
* @param {!string} name
854853
*/
855-
function getEnumNames(enumType) {
856-
// get all numeric values of the enum type...
857-
const values = Enum.getValues(enumType)
858-
const nameList = new List()
859-
for (let i = 0; i < values.length; i++) {
860-
const value = values[i]
861-
// ... convert the numeric value in the enum value name and add it to the list of enum value names
862-
nameList.insert(0, Enum.getName(enumType, value))
863-
}
864-
return nameList
854+
function getFriendlyName(name) {
855+
// First character in uppercase
856+
let result = name.substring(0, 1) + name.substring(1).toLowerCase()
857+
// Dashes where necessary
858+
result = result.replace(/(sub|non)_/g, '$1-')
859+
// Replace underscores with spaces
860+
result = result.replace(/_/g, ' ')
861+
return result
865862
}

demos/complete/bpmn/BpmnPopupSupport.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import {
4848
INodeStyle,
4949
IPort,
5050
IPortStyle,
51-
List,
5251
NinePositionsEdgeLabelModel,
5352
Point,
5453
Rect,
@@ -832,25 +831,21 @@ export default class BpmnPopupSupport {
832831
* Adds options to the given combo box for the content of the enum type.
833832
*/
834833
function populateComboBox(comboBox: HTMLSelectElement, enumType: Class): void {
835-
getEnumNames(enumType).forEach(name => {
834+
Enum.getValueNames(enumType).forEach(name => {
836835
const option = document.createElement('option')
837-
option.innerHTML = name
836+
option.innerText = getFriendlyName(name)
837+
option.value = name
838838
comboBox.options.add(option)
839839
})
840840
}
841841

842-
/**
843-
* Returns a list containing all values of the given enum type.
844-
*/
845-
function getEnumNames(enumType: Class): IEnumerable<string> {
846-
// get all numeric values of the enum type...
847-
const values = Enum.getValues(enumType)
848-
const nameList = new List<string>()
849-
for (let i = 0; i < values.length; i++) {
850-
const value = values[i]
851-
// ... convert the numeric value in the enum value name and add it to the list of enum value names
852-
// @ts-ignore
853-
nameList.insert(0, Enum.getName(enumType, value))
854-
}
855-
return nameList
842+
/** Returns a readable name for all-caps enum constants. */
843+
function getFriendlyName(name: string) {
844+
// First character in uppercase
845+
let result = name.substring(0, 1) + name.substring(1).toLowerCase()
846+
// Dashes where necessary
847+
result = result.replace(/(sub|non)_/g, '$1-')
848+
// Replace underscores with spaces
849+
result = result.replace(/_/g, ' ')
850+
return result
856851
}

demos/complete/bpmn/index.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,18 @@ <h2>Things to Try</h2>
199199
<button data-command="PreviousSample" title="Open previous sample" id="previousButton"
200200
class="demo-icon-yIconPrevious" disabled></button>
201201
<select data-command="SampleSelectionChanged" title="Select a sample graph" id="SampleComboBox">
202-
<option>Business</option>
203-
<option>Collaboration</option>
204-
<option>Different Exception Flows</option>
205-
<option>Expanded Subprocess</option>
206-
<option>Lanes Segment</option>
207-
<option>Lanes With Information Systems</option>
208-
<option>Matrix Lanes</option>
209-
<option>Process Normal Flow</option>
210-
<option>Project Application</option>
211-
<option>Simple BPMN Model</option>
212-
<option>Vertical Swimlanes</option>
213-
<option>BPMN DI Sample</option>
202+
<option value="business">Business</option>
203+
<option value="collaboration">Collaboration</option>
204+
<option value="different_exception_flows">Different Exception Flows</option>
205+
<option value="expanded_subprocess">Expanded Subprocess</option>
206+
<option value="lanes_segment">Lanes Segment</option>
207+
<option value="lanes_with_information_systems">Lanes With Information Systems</option>
208+
<option value="matrix_lanes">Matrix Lanes</option>
209+
<option value="process_normal_flow">Process Normal Flow</option>
210+
<option value="project_application">Project Application</option>
211+
<option value="simple_bpmn_model">Simple BPMN Model</option>
212+
<option value="vertical_swimlanes">Vertical Swimlanes</option>
213+
<option value="bpmn_di_sample" data-type="bpmn-di">BPMN DI Sample</option>
214214
</select>
215215
<button data-command="NextSample" title="Open next sample" id="nextButton"
216216
class="demo-icon-yIconNext"></button>

demos/complete/collapse/CollapseDemo.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,16 @@ function newHierarchicLayout() {
232232
function newLayoutAlgorithm(algorithmName) {
233233
let algorithm
234234
switch (algorithmName) {
235-
case 'Tree':
235+
case 'tree':
236236
algorithm = newTreeLayout()
237237
break
238-
case 'Balloon':
238+
case 'balloon':
239239
algorithm = newBalloonLayout()
240240
break
241-
case 'Organic':
241+
case 'organic':
242242
algorithm = newOrganicLayout()
243243
break
244-
case 'Hierarchic':
244+
case 'hierarchic':
245245
algorithm = newHierarchicLayout()
246246
break
247247
default:

demos/complete/collapse/CollapseDemo.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,16 @@ function newHierarchicLayout(): HierarchicLayout {
223223
function newLayoutAlgorithm(algorithmName: string): ILayoutAlgorithm {
224224
let algorithm: MultiStageLayout
225225
switch (algorithmName) {
226-
case 'Tree':
226+
case 'tree':
227227
algorithm = newTreeLayout()
228228
break
229-
case 'Balloon':
229+
case 'balloon':
230230
algorithm = newBalloonLayout()
231231
break
232-
case 'Organic':
232+
case 'organic':
233233
algorithm = newOrganicLayout()
234234
break
235-
case 'Hierarchic':
235+
case 'hierarchic':
236236
algorithm = newHierarchicLayout()
237237
break
238238
default:

demos/complete/collapse/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ <h2>Things to Try</h2>
133133
<span class="demo-separator"></span>
134134

135135
<select data-command="SelectLayout" title="Choose a Layout" id="layoutComboBox">
136-
<option>Tree</option>
137-
<option>Balloon</option>
138-
<option>Organic</option>
139-
<option>Hierarchic</option>
136+
<option value="tree">Tree</option>
137+
<option value="balloon">Balloon</option>
138+
<option value="organic">Organic</option>
139+
<option value="hierarchic">Hierarchic</option>
140140
</select>
141141

142142
</div>

demos/complete/flowchart/FlowchartDemo.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,7 @@ function initializeGraphDefaults() {
279279
* @returns {!Promise}
280280
*/
281281
async function loadGraph(sampleName) {
282-
const sample =
283-
FlowchartData[sampleName.replace('Sample: ', '').replace(' ', '')] ||
284-
FlowchartData.ProblemSolving
282+
const sample = FlowchartData[sampleName] || FlowchartData.ProblemSolving
285283

286284
// clear the graph
287285
graphComponent.graph.clear()
@@ -375,33 +373,33 @@ async function updateGraph() {
375373
switch (select.selectedIndex) {
376374
default:
377375
case 0:
378-
setComboboxValue('select-positive-branch-direction', 'Undefined')
379-
setComboboxValue('select-negative-branch-direction', 'Undefined')
380-
setComboboxValue('select-in-edge-grouping', 'Optimized')
376+
setComboboxValue('select-positive-branch-direction', 'undefined')
377+
setComboboxValue('select-negative-branch-direction', 'undefined')
378+
setComboboxValue('select-in-edge-grouping', 'optimized')
381379
allowFlatwiseEdges.checked = true
382380
break
383381
case 1:
384-
setComboboxValue('select-positive-branch-direction', 'Same As Flow')
385-
setComboboxValue('select-negative-branch-direction', 'Left In Flow')
386-
setComboboxValue('select-in-edge-grouping', 'Optimized')
382+
setComboboxValue('select-positive-branch-direction', 'same-as-flow')
383+
setComboboxValue('select-negative-branch-direction', 'left-in-flow')
384+
setComboboxValue('select-in-edge-grouping', 'optimized')
387385
allowFlatwiseEdges.checked = true
388386
break
389387
case 2:
390-
setComboboxValue('select-positive-branch-direction', 'Same As Flow')
391-
setComboboxValue('select-negative-branch-direction', 'Flatwise')
392-
setComboboxValue('select-in-edge-grouping', 'Optimized')
388+
setComboboxValue('select-positive-branch-direction', 'same-as-flow')
389+
setComboboxValue('select-negative-branch-direction', 'flatwise')
390+
setComboboxValue('select-in-edge-grouping', 'optimized')
393391
allowFlatwiseEdges.checked = true
394392
break
395393
case 3:
396-
setComboboxValue('select-positive-branch-direction', 'Same As Flow')
397-
setComboboxValue('select-negative-branch-direction', 'Flatwise')
398-
setComboboxValue('select-in-edge-grouping', 'Optimized')
394+
setComboboxValue('select-positive-branch-direction', 'same-as-flow')
395+
setComboboxValue('select-negative-branch-direction', 'flatwise')
396+
setComboboxValue('select-in-edge-grouping', 'optimized')
399397
allowFlatwiseEdges.checked = true
400398
break
401399
case 4:
402-
setComboboxValue('select-positive-branch-direction', 'Flatwise')
403-
setComboboxValue('select-negative-branch-direction', 'Flatwise')
404-
setComboboxValue('select-in-edge-grouping', 'None')
400+
setComboboxValue('select-positive-branch-direction', 'flatwise')
401+
setComboboxValue('select-negative-branch-direction', 'flatwise')
402+
setComboboxValue('select-in-edge-grouping', 'none')
405403
allowFlatwiseEdges.checked = false
406404
break
407405
}

0 commit comments

Comments
 (0)