Revize 552a1fea
Přidáno uživatelem Pavel Fidranský před asi 6 roky(ů)
sources/src/main/webapp/js/components/attribute.js | ||
---|---|---|
15 | 15 |
var rootElement; |
16 | 16 |
|
17 | 17 |
this.render = function() { |
18 |
rootElement = app.utils.createHtmlElement('li', {});
|
|
18 |
rootElement = DOM.createHtmlElement('li');
|
|
19 | 19 |
|
20 |
rootElement.appendChild(app.dom.createTextElement(this.name + ': '));
|
|
20 |
rootElement.appendChild(DOM.createTextElement(this.name + ': '));
|
|
21 | 21 |
rootElement.appendChild(renderValue.call(this)); |
22 | 22 |
|
23 | 23 |
return rootElement; |
... | ... | |
26 | 26 |
function renderValue() { |
27 | 27 |
switch (this.name) { |
28 | 28 |
case 'URL': |
29 |
return app.dom.htmlStringToElement(`<a href="${this.value}" target="_blank">${this.value}</a>`);
|
|
29 |
return DOM.htmlStringToElement(`<a href="${this.value}" target="_blank">${this.value}</a>`);
|
|
30 | 30 |
case 'Size': |
31 |
return app.dom.createTextElement(formatValue.call(this) + ' B');
|
|
31 |
return DOM.createTextElement(formatValue.call(this) + ' B');
|
|
32 | 32 |
case 'Estimate': |
33 | 33 |
case 'Spent': |
34 |
return app.dom.createTextElement(formatValue.call(this) + ' h');
|
|
34 |
return DOM.createTextElement(formatValue.call(this) + ' h');
|
|
35 | 35 |
case 'Progress': |
36 |
return app.dom.createTextElement(formatValue.call(this) + '%');
|
|
36 |
return DOM.createTextElement(formatValue.call(this) + '%');
|
|
37 | 37 |
default: |
38 |
return app.dom.createTextElement(formatValue.call(this));
|
|
38 |
return DOM.createTextElement(formatValue.call(this));
|
|
39 | 39 |
} |
40 | 40 |
} |
41 | 41 |
|
sources/src/main/webapp/js/components/edge.js | ||
---|---|---|
191 | 191 |
* @returns {Element} SVG DOM element. |
192 | 192 |
*/ |
193 | 193 |
this.render = function() { |
194 |
rootElement = app.utils.createSvgElement('g', {
|
|
194 |
rootElement = DOM.createSvgElement('g', {
|
|
195 | 195 |
'class': 'edge', |
196 | 196 |
'data-id': props.id, |
197 | 197 |
'data-from': props.from, |
198 | 198 |
'data-to': props.to, |
199 | 199 |
}); |
200 | 200 |
|
201 |
rootElement.appendChild(app.utils.createSvgElement('line', {
|
|
201 |
rootElement.appendChild(DOM.createSvgElement('line', {
|
|
202 | 202 |
'class': 'line', |
203 | 203 |
'x1': start.x, |
204 | 204 |
'y1': start.y, |
... | ... | |
208 | 208 |
'stroke-width': 5, |
209 | 209 |
})); |
210 | 210 |
|
211 |
rootElement.appendChild(app.utils.createSvgElement('line', {
|
|
211 |
rootElement.appendChild(DOM.createSvgElement('line', {
|
|
212 | 212 |
'class': 'line', |
213 | 213 |
'x1': start.x, |
214 | 214 |
'y1': start.y, |
... | ... | |
221 | 221 |
var rotation = getArrowRotation.call(this); |
222 | 222 |
|
223 | 223 |
// arrow |
224 |
var arrow = app.utils.createSvgElement('g', {
|
|
224 |
var arrow = DOM.createSvgElement('g', {
|
|
225 | 225 |
'class': 'arrow', |
226 | 226 |
'data-edgeId': this.id, |
227 | 227 |
'transform': `rotate(${rotation}, ${position.x},${position.y}) translate(${position.x},${position.y})`, |
228 | 228 |
}); |
229 |
arrow.appendChild(app.utils.createSvgElement('polygon', {
|
|
229 |
arrow.appendChild(DOM.createSvgElement('polygon', {
|
|
230 | 230 |
'points': '0,-10 30,0 0,10', |
231 | 231 |
|
232 | 232 |
})); |
sources/src/main/webapp/js/components/edgePopover.js | ||
---|---|---|
17 | 17 |
subedgeInfoList.filter(function(subedgeInfo) { |
18 | 18 |
return subedgeInfo.attributes.length > 0; |
19 | 19 |
}).forEach(function(subedgeInfo) { |
20 |
var listItem = app.dom.createHtmlElement('li', {});
|
|
21 |
listItem.appendChild(app.dom.createTextElement(app.archetype.edge[subedgeInfo.archetype].name));
|
|
20 |
var listItem = DOM.createHtmlElement('li');
|
|
21 |
listItem.appendChild(DOM.createTextElement(app.archetype.edge[subedgeInfo.archetype].name));
|
|
22 | 22 |
|
23 |
var sublist = app.dom.createHtmlElement('ul', {});
|
|
23 |
var sublist = DOM.createHtmlElement('ul');
|
|
24 | 24 |
listItem.appendChild(sublist); |
25 | 25 |
|
26 | 26 |
detailsListElement.appendChild(listItem); |
... | ... | |
61 | 61 |
* @returns {Element} HTML DOM element. |
62 | 62 |
*/ |
63 | 63 |
this.render = function() { |
64 |
rootElement = app.utils.createHtmlElement('div', {
|
|
64 |
rootElement = DOM.createHtmlElement('div', {
|
|
65 | 65 |
'class': 'popover edge-popover hidden', |
66 | 66 |
}); |
67 |
rootElement.addEventListener('wheel', app.utils.stopPropagation);
|
|
68 |
rootElement.addEventListener('mousedown', app.utils.stopPropagation);
|
|
67 |
rootElement.addEventListener('wheel', Utils.stopPropagation);
|
|
68 |
rootElement.addEventListener('mousedown', Utils.stopPropagation);
|
|
69 | 69 |
rootElement.addEventListener('mouseleave', this.close.bind(this)); |
70 | 70 |
|
71 |
var popoverTitle = app.utils.createHtmlElement('span', {
|
|
71 |
var popoverTitle = DOM.createHtmlElement('span', {
|
|
72 | 72 |
'class': 'popover-title', |
73 | 73 |
}); |
74 | 74 |
popoverTitle.appendChild(document.createTextNode('Edge details')); |
75 | 75 |
rootElement.appendChild(popoverTitle); |
76 | 76 |
|
77 |
var popoverContent = app.utils.createHtmlElement('div', {
|
|
77 |
var popoverContent = DOM.createHtmlElement('div', {
|
|
78 | 78 |
'class': 'popover-content', |
79 | 79 |
}); |
80 | 80 |
rootElement.appendChild(popoverContent); |
81 | 81 |
|
82 |
detailsListElement = app.utils.createHtmlElement('ul', {});
|
|
82 |
detailsListElement = DOM.createHtmlElement('ul');
|
|
83 | 83 |
popoverContent.appendChild(detailsListElement); |
84 | 84 |
|
85 | 85 |
return rootElement; |
sources/src/main/webapp/js/components/group.js | ||
---|---|---|
437 | 437 |
/** |
438 | 438 |
* Hook function used to remove the group from the sidebar list it is located in before it is moved to the viewport. |
439 | 439 |
*/ |
440 |
this.removeFromSidebarList = app.utils.noop;
|
|
440 |
this.removeFromSidebarList = Utils.noop;
|
|
441 | 441 |
|
442 | 442 |
/** |
443 | 443 |
* Creates a new DOM element representing the group in memory. The element being created depends on whether the group |
... | ... | |
499 | 499 |
* @returns {Element} SVG DOM element. |
500 | 500 |
*/ |
501 | 501 |
function renderIncluded() { |
502 |
rootElement = app.utils.createSvgElement('svg', {
|
|
502 |
rootElement = DOM.createSvgElement('svg', {
|
|
503 | 503 |
'class': 'node group', |
504 | 504 |
'x': position.x, |
505 | 505 |
'y': position.y, |
... | ... | |
508 | 508 |
rootElement.addEventListener('click', click.bind(this)); |
509 | 509 |
rootElement.addEventListener('mousedown', mouseDown.bind(this)); |
510 | 510 |
|
511 |
rootElement.appendChild(app.utils.createSvgElement('rect', {
|
|
511 |
rootElement.appendChild(DOM.createSvgElement('rect', {
|
|
512 | 512 |
'width': size.width, |
513 | 513 |
'height': size.height, |
514 | 514 |
'x': 1, |
... | ... | |
519 | 519 |
})); |
520 | 520 |
|
521 | 521 |
// name |
522 |
var nameTextInner = app.dom.createHtmlElement('span', {
|
|
522 |
var nameTextInner = DOM.createHtmlElement('span', {
|
|
523 | 523 |
'class': 'group-name', |
524 | 524 |
}); |
525 |
nameTextInner.appendChild(app.dom.createTextElement(this.name));
|
|
525 |
nameTextInner.appendChild(DOM.createTextElement(this.name));
|
|
526 | 526 |
|
527 |
var nameText = app.utils.createSvgElement('foreignObject', {
|
|
527 |
var nameText = DOM.createSvgElement('foreignObject', {
|
|
528 | 528 |
'x': 4, |
529 | 529 |
'y': 4, |
530 | 530 |
'width': 46, |
... | ... | |
535 | 535 |
rootElement.appendChild(nameText); |
536 | 536 |
|
537 | 537 |
// symbol |
538 |
var symbolText = app.utils.createSvgElement('text', {
|
|
538 |
var symbolText = DOM.createSvgElement('text', {
|
|
539 | 539 |
'class': 'group-symbol', |
540 | 540 |
'x': 10, |
541 | 541 |
'y': 60, |
... | ... | |
544 | 544 |
rootElement.appendChild(symbolText); |
545 | 545 |
|
546 | 546 |
// dissolve button |
547 |
var dissolveButton = app.utils.createSvgElement('g', {
|
|
547 |
var dissolveButton = DOM.createSvgElement('g', {
|
|
548 | 548 |
'class': 'button dissolve-button', |
549 | 549 |
}); |
550 |
dissolveButton.appendChild(app.utils.createSvgElement('rect', {
|
|
550 |
dissolveButton.appendChild(DOM.createSvgElement('rect', {
|
|
551 | 551 |
'rx': 4, |
552 | 552 |
'ry': 4, |
553 | 553 |
'x': 54, |
... | ... | |
555 | 555 |
'height': 14, |
556 | 556 |
'width': 14, |
557 | 557 |
})); |
558 |
dissolveButton.appendChild(app.utils.createSvgElement('line', {
|
|
558 |
dissolveButton.appendChild(DOM.createSvgElement('line', {
|
|
559 | 559 |
'x1': 57, |
560 | 560 |
'y1': 7, |
561 | 561 |
'x2': 65, |
562 | 562 |
'y2': 15, |
563 | 563 |
})); |
564 |
dissolveButton.appendChild(app.utils.createSvgElement('line', {
|
|
564 |
dissolveButton.appendChild(DOM.createSvgElement('line', {
|
|
565 | 565 |
'x1': 65, |
566 | 566 |
'y1': 7, |
567 | 567 |
'x2': 57, |
... | ... | |
577 | 577 |
* @returns {Element} HTML DOM element. |
578 | 578 |
*/ |
579 | 579 |
function renderExcluded() { |
580 |
rootElement = app.utils.createHtmlElement('li', {
|
|
580 |
rootElement = DOM.createHtmlElement('li', {
|
|
581 | 581 |
'class': 'node group', |
582 | 582 |
'data-id': this.id, |
583 | 583 |
}); |
584 | 584 |
|
585 |
var svg = app.utils.createSvgElement('svg', {
|
|
585 |
var svg = DOM.createSvgElement('svg', {
|
|
586 | 586 |
'xmlns': 'http://www.w3.org/2000/svg', |
587 | 587 |
'height': 60, |
588 | 588 |
'width': 46, |
... | ... | |
590 | 590 |
rootElement.appendChild(svg); |
591 | 591 |
|
592 | 592 |
// related archetypes |
593 |
var relatedArchetypesGroup = app.dom.createSvgElement('g', {
|
|
593 |
var relatedArchetypesGroup = DOM.createSvgElement('g', {
|
|
594 | 594 |
'transform': 'translate(10, 15)', |
595 | 595 |
}); |
596 | 596 |
svg.appendChild(relatedArchetypesGroup); |
597 | 597 |
|
598 | 598 |
var archetypeIconOrder = 0; |
599 | 599 |
for (var archetypeIndex in relatedArchetypeMap) { |
600 |
var relatedArchetype = app.dom.createSvgElement('g', {
|
|
600 |
var relatedArchetype = DOM.createSvgElement('g', {
|
|
601 | 601 |
'class': 'related-archetype', |
602 | 602 |
'transform': `translate(0, ${archetypeIconOrder * 20})`, |
603 | 603 |
}); |
604 | 604 |
relatedArchetypesGroup.appendChild(relatedArchetype); |
605 | 605 |
|
606 | 606 |
// counter |
607 |
var relatedArchetypeCounter = app.dom.createSvgElement('text', {});
|
|
608 |
relatedArchetypeCounter.appendChild(app.dom.createTextElement(relatedArchetypeMap[archetypeIndex]));
|
|
607 |
var relatedArchetypeCounter = DOM.createSvgElement('text');
|
|
608 |
relatedArchetypeCounter.appendChild(DOM.createTextElement(relatedArchetypeMap[archetypeIndex]));
|
|
609 | 609 |
relatedArchetype.appendChild(relatedArchetypeCounter); |
610 | 610 |
|
611 | 611 |
// icon |
612 |
var relatedArchetypeIcon = app.dom.createSvgElement('use', {
|
|
612 |
var relatedArchetypeIcon = DOM.createSvgElement('use', {
|
|
613 | 613 |
'href': '#vertexArchetypeIcon-' + app.archetype.vertex[archetypeIndex].name, |
614 | 614 |
'class': 'archetype-icon', |
615 | 615 |
'transform': `translate(15, -10)`, |
... | ... | |
618 | 618 |
relatedArchetype.appendChild(relatedArchetypeIcon); |
619 | 619 |
|
620 | 620 |
// line |
621 |
relatedArchetype.appendChild(app.dom.createSvgElement('line', {
|
|
621 |
relatedArchetype.appendChild(DOM.createSvgElement('line', {
|
|
622 | 622 |
'x1': 30, |
623 | 623 |
'y1': -5, |
624 | 624 |
'x2': 36, |
... | ... | |
629 | 629 |
} |
630 | 630 |
|
631 | 631 |
// symbol |
632 |
var symbolText = app.utils.createHtmlElement('span', {
|
|
632 |
var symbolText = DOM.createHtmlElement('span', {
|
|
633 | 633 |
'class': 'group-symbol', |
634 | 634 |
'style': 'background-color: ' + this.symbol[1] + ';', |
635 | 635 |
'x': 10, |
... | ... | |
640 | 640 |
rootElement.appendChild(symbolText); |
641 | 641 |
|
642 | 642 |
// name |
643 |
var nameText = app.utils.createHtmlElement('span', {
|
|
643 |
var nameText = DOM.createHtmlElement('span', {
|
|
644 | 644 |
'class': 'group-name', |
645 | 645 |
}); |
646 | 646 |
nameText.appendChild(document.createTextNode(this.name)); |
... | ... | |
656 | 656 |
}, this); |
657 | 657 |
|
658 | 658 |
// buttons |
659 |
var buttonGroup = app.utils.createHtmlElement('div', {
|
|
659 |
var buttonGroup = DOM.createHtmlElement('div', {
|
|
660 | 660 |
'class': 'button-group', |
661 | 661 |
}); |
662 | 662 |
rootElement.appendChild(buttonGroup); |
663 | 663 |
|
664 | 664 |
// show symbol button |
665 |
var showSymbolButton = app.utils.createHtmlElement('button', {
|
|
665 |
var showSymbolButton = DOM.createHtmlElement('button', {
|
|
666 | 666 |
'class': 'show-symbol-button button', |
667 | 667 |
'style': 'background-color: ' + this.symbol[1] + ';', |
668 | 668 |
'title': 'Show symbol next to all neighbouring components', |
... | ... | |
672 | 672 |
buttonGroup.appendChild(showSymbolButton); |
673 | 673 |
|
674 | 674 |
// include button |
675 |
var includeButton = app.utils.createHtmlElement('button', {
|
|
675 |
var includeButton = DOM.createHtmlElement('button', {
|
|
676 | 676 |
'class': 'include-button button', |
677 | 677 |
'title': 'Display group in viewport', |
678 | 678 |
}); |
679 |
includeButton.appendChild(app.utils.createHtmlElement('img', {
|
|
679 |
includeButton.appendChild(DOM.createHtmlElement('img', {
|
|
680 | 680 |
'src': 'images/button_cancel.png', |
681 | 681 |
'alt': 'Icon of "display group in viewport" action', |
682 | 682 |
})); |
sources/src/main/webapp/js/components/groupVertexList.js | ||
---|---|---|
17 | 17 |
this.appendChild = function(vertex) { |
18 | 18 |
var listItemElement; |
19 | 19 |
if (parentalGroup.isExcluded()) { |
20 |
listItemElement = app.utils.createHtmlElement('li', {});
|
|
20 |
listItemElement = DOM.createHtmlElement('li');
|
|
21 | 21 |
} else { |
22 |
listItemElement = app.utils.createSvgElement('text', {
|
|
22 |
listItemElement = DOM.createSvgElement('text', {
|
|
23 | 23 |
'y': listItemCounter * lineHeight, |
24 | 24 |
}); |
25 | 25 |
} |
... | ... | |
49 | 49 |
*/ |
50 | 50 |
this.render = function() { |
51 | 51 |
if (parentalGroup.isExcluded()) { |
52 |
rootElement = app.utils.createHtmlElement('ul', {});
|
|
52 |
rootElement = DOM.createHtmlElement('ul');
|
|
53 | 53 |
} else { |
54 |
rootElement = app.utils.createSvgElement('g', {
|
|
54 |
rootElement = DOM.createSvgElement('g', {
|
|
55 | 55 |
'transform': 'translate(70, 30)', |
56 | 56 |
}); |
57 | 57 |
} |
sources/src/main/webapp/js/components/minimap.js | ||
---|---|---|
44 | 44 |
* @returns {Element} HTML DOM element. |
45 | 45 |
*/ |
46 | 46 |
this.render = function() { |
47 |
rootElement = app.utils.createSvgElement('svg', {
|
|
47 |
rootElement = DOM.createSvgElement('svg', {
|
|
48 | 48 |
'class': 'minimap', |
49 | 49 |
'id': 'minimapComponent', |
50 | 50 |
'viewBox': `-100 -50 ${width} ${height}`, |
51 | 51 |
}); |
52 | 52 |
rootElement.addEventListener('mousedown', onRootMouseDown.bind(this)); |
53 | 53 |
|
54 |
var graphElement = app.dom.createSvgElement('use', {
|
|
54 |
var graphElement = DOM.createSvgElement('use', {
|
|
55 | 55 |
'transform': `scale(${scale})`, |
56 | 56 |
}); |
57 | 57 |
graphElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', useElement); |
58 | 58 |
rootElement.appendChild(graphElement); |
59 | 59 |
|
60 |
viewportElement = app.dom.createSvgElement('rect', {
|
|
60 |
viewportElement = DOM.createSvgElement('rect', {
|
|
61 | 61 |
'class': 'minimap-viewport', |
62 | 62 |
}); |
63 | 63 |
viewportElement.addEventListener('mousedown', onViewportMouseDown.bind(this)); |
sources/src/main/webapp/js/components/modalWindow.js | ||
---|---|---|
12 | 12 |
this.open = function() { |
13 | 13 |
rootElement.classList.remove('hidden'); |
14 | 14 |
|
15 |
diagramForm.appendChild(app.dom.createHtmlElement('div', { class: 'err_msg' }));
|
|
16 |
diagramForm.appendChild(app.dom.htmlStringToElement(`<table><tbody><tr><td><label for="diagramName">Diagram name:</label></td><td><input type="text" name="diagramName" value="${app.diagram !== null ? app.diagram.name : ''}" id="diagramName" required></td></tr><tr><td><label for="diagramPublic">Is public:</label></td><td><input type="checkbox" name="diagramPublic" value="1" id="diagramPublic" ${app.diagram !== null && app.diagram.public ? 'checked' : ''}></td></tr><tr><td></td><td><button type="submit" class="button">Save</button></td></tr></tbody></table>`));
|
|
15 |
diagramForm.appendChild(DOM.createHtmlElement('div', { class: 'err_msg' }));
|
|
16 |
diagramForm.appendChild(DOM.htmlStringToElement(`<table><tbody><tr><td><label for="diagramName">Diagram name:</label></td><td><input type="text" name="diagramName" value="${app.diagram !== null ? app.diagram.name : ''}" id="diagramName" required></td></tr><tr><td><label for="diagramPublic">Is public:</label></td><td><input type="checkbox" name="diagramPublic" value="1" id="diagramPublic" ${app.diagram !== null && app.diagram.public ? 'checked' : ''}></td></tr><tr><td></td><td><button type="submit" class="button">Save</button></td></tr></tbody></table>`));
|
|
17 | 17 |
|
18 | 18 |
diagramForm.diagramName.focus(); |
19 | 19 |
}; |
... | ... | |
32 | 32 |
* @returns {Element} HTML DOM element. |
33 | 33 |
*/ |
34 | 34 |
this.render = function() { |
35 |
rootElement = app.utils.createHtmlElement('div', {
|
|
35 |
rootElement = DOM.createHtmlElement('div', {
|
|
36 | 36 |
'class': 'modal hidden', |
37 | 37 |
}); |
38 | 38 |
rootElement.addEventListener('click', this.close); |
39 | 39 |
|
40 |
var modalContent = app.utils.createHtmlElement('div', {
|
|
40 |
var modalContent = DOM.createHtmlElement('div', {
|
|
41 | 41 |
'class': 'modal-content', |
42 | 42 |
}); |
43 |
modalContent.addEventListener('click', app.utils.stopPropagation);
|
|
43 |
modalContent.addEventListener('click', Utils.stopPropagation);
|
|
44 | 44 |
rootElement.appendChild(modalContent); |
45 | 45 |
|
46 |
var closeButton = app.utils.createHtmlElement('button', {
|
|
46 |
var closeButton = DOM.createHtmlElement('button', {
|
|
47 | 47 |
'class': 'close-button button', |
48 | 48 |
}); |
49 |
closeButton.appendChild(app.utils.createTextElement('×'));
|
|
49 |
closeButton.appendChild(DOM.createTextElement('×'));
|
|
50 | 50 |
closeButton.addEventListener('click', closeButtonClick.bind(this)); |
51 | 51 |
modalContent.appendChild(closeButton); |
52 | 52 |
|
53 |
diagramForm = app.dom.createHtmlElement('form', {});
|
|
53 |
diagramForm = DOM.createHtmlElement('form');
|
|
54 | 54 |
diagramForm.addEventListener('submit', saveDiagram.bind(this)); |
55 | 55 |
modalContent.appendChild(diagramForm); |
56 | 56 |
|
sources/src/main/webapp/js/components/sidebar.js | ||
---|---|---|
35 | 35 |
}; |
36 | 36 |
|
37 | 37 |
this.render = function() { |
38 |
rootElement = app.utils.createHtmlElement('div', {
|
|
38 |
rootElement = DOM.createHtmlElement('div', {
|
|
39 | 39 |
'class': 'sidebar', |
40 | 40 |
'id': 'sidebar', |
41 | 41 |
}); |
42 | 42 |
|
43 |
var sidebarNav = app.utils.createHtmlElement('nav', {
|
|
43 |
var sidebarNav = DOM.createHtmlElement('nav', {
|
|
44 | 44 |
'class': 'sidebar-navbar', |
45 | 45 |
'id': 'uploadMenu', |
46 | 46 |
}); |
47 | 47 |
rootElement.appendChild(sidebarNav); |
48 | 48 |
|
49 | 49 |
// unconnected |
50 |
var unconnectedButton = app.utils.createHtmlElement('button', {
|
|
50 |
var unconnectedButton = DOM.createHtmlElement('button', {
|
|
51 | 51 |
'class': 'button', |
52 | 52 |
'id': 'unconnectedButton', |
53 | 53 |
'title': 'Unconnected vertices', |
54 | 54 |
}); |
55 |
unconnectedButton.appendChild(app.dom.createHtmlElement('img', {
|
|
55 |
unconnectedButton.appendChild(DOM.createHtmlElement('img', {
|
|
56 | 56 |
'src': 'images/tochange/unconnected.gif', |
57 | 57 |
'alt': 'Icon of "toggle unconnected vertices list" action', |
58 | 58 |
})); |
59 |
unconnectedButton.appendChild(app.dom.createTextElement('Unconnected vertices'));
|
|
59 |
unconnectedButton.appendChild(DOM.createTextElement('Unconnected vertices'));
|
|
60 | 60 |
unconnectedButton.addEventListener('click', function() { |
61 | 61 |
document.getElementById('unconnectedNodeListComponent').classList.toggle('hidden'); |
62 | 62 |
app.redrawEdges(); |
... | ... | |
64 | 64 |
sidebarNav.appendChild(unconnectedButton); |
65 | 65 |
|
66 | 66 |
|
67 |
var sidebarContainer = app.utils.createHtmlElement('div', {
|
|
67 |
var sidebarContainer = DOM.createHtmlElement('div', {
|
|
68 | 68 |
'class': 'sidebar-container', |
69 | 69 |
}); |
70 | 70 |
rootElement.appendChild(sidebarContainer); |
... | ... | |
83 | 83 |
rootElement.appendChild(this.excludedNodeListComponent.render()); |
84 | 84 |
|
85 | 85 |
|
86 |
var sidebarBottom = app.utils.createHtmlElement('div', {
|
|
86 |
var sidebarBottom = DOM.createHtmlElement('div', {
|
|
87 | 87 |
'class': 'sidebar-bottom', |
88 | 88 |
}); |
89 | 89 |
rootElement.appendChild(sidebarBottom); |
sources/src/main/webapp/js/components/sidebarExcludedNodeList.js | ||
---|---|---|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
// unset remove hook |
42 |
node.removeFromSidebarList = app.utils.noop;
|
|
42 |
node.removeFromSidebarList = Utils.noop;
|
|
43 | 43 |
|
44 | 44 |
nodeList.splice(nodeList.indexOf(node), 1); |
45 | 45 |
node.remove(false); |
... | ... | |
50 | 50 |
}; |
51 | 51 |
|
52 | 52 |
this.render = function() { |
53 |
rootElement = app.utils.createHtmlElement('div', {
|
|
53 |
rootElement = DOM.createHtmlElement('div', {
|
|
54 | 54 |
'id': props.id, |
55 | 55 |
'class': 'node-container excluded-nodes ' + (props.class ? props.class : ''), |
56 | 56 |
}); |
... | ... | |
59 | 59 |
}); |
60 | 60 |
|
61 | 61 |
// title |
62 |
rootElement.appendChild(app.dom.htmlStringToElement('<h2 class="node-container-title">Excluded components</h2>'));
|
|
62 |
rootElement.appendChild(DOM.htmlStringToElement('<h2 class="node-container-title">Excluded components</h2>'));
|
|
63 | 63 |
|
64 | 64 |
// buttons |
65 |
buttonGroup = app.utils.createHtmlElement('div', {
|
|
65 |
buttonGroup = DOM.createHtmlElement('div', {
|
|
66 | 66 |
'class': 'button-group hidden', |
67 | 67 |
}); |
68 | 68 |
rootElement.appendChild(buttonGroup); |
69 | 69 |
|
70 | 70 |
// include all button |
71 |
var includeAllButton = app.utils.createHtmlElement('button', {
|
|
71 |
var includeAllButton = DOM.createHtmlElement('button', {
|
|
72 | 72 |
'class': 'include-all-button button', |
73 | 73 |
'title': 'Display all excluded nodes in viewport', |
74 | 74 |
}); |
75 |
includeAllButton.appendChild(app.utils.createHtmlElement('img', {
|
|
75 |
includeAllButton.appendChild(DOM.createHtmlElement('img', {
|
|
76 | 76 |
'src': 'images/button_cancel.png', |
77 | 77 |
'alt': 'Icon of "display all excluded nodes in viewport" action', |
78 | 78 |
})); |
... | ... | |
80 | 80 |
buttonGroup.appendChild(includeAllButton); |
81 | 81 |
|
82 | 82 |
// sorting options |
83 |
sortListElement = app.utils.createHtmlElement('ul', {
|
|
83 |
sortListElement = DOM.createHtmlElement('ul', {
|
|
84 | 84 |
'class': 'sort-list hidden', |
85 | 85 |
}); |
86 | 86 |
rootElement.appendChild(sortListElement); |
87 | 87 |
|
88 |
var sortByNameAscListItem = app.utils.createHtmlElement('li', {
|
|
88 |
var sortByNameAscListItem = DOM.createHtmlElement('li', {
|
|
89 | 89 |
'class': 'sort-asc', |
90 | 90 |
}); |
91 |
sortByNameAscListItem.appendChild(app.utils.createTextElement('name'));
|
|
91 |
sortByNameAscListItem.appendChild(DOM.createTextElement('name'));
|
|
92 | 92 |
sortByNameAscListItem.addEventListener('click', sortByName.bind(this, 1)); |
93 | 93 |
sortListElement.appendChild(sortByNameAscListItem); |
94 | 94 |
|
95 |
var sortByNameDescListItem = app.utils.createHtmlElement('li', {
|
|
95 |
var sortByNameDescListItem = DOM.createHtmlElement('li', {
|
|
96 | 96 |
'class': 'sort-desc', |
97 | 97 |
}); |
98 |
sortByNameDescListItem.appendChild(app.utils.createTextElement('name'));
|
|
98 |
sortByNameDescListItem.appendChild(DOM.createTextElement('name'));
|
|
99 | 99 |
sortByNameDescListItem.addEventListener('click', sortByName.bind(this, -1)); |
100 | 100 |
sortListElement.appendChild(sortByNameDescListItem); |
101 | 101 |
|
102 |
var sortByCountAscListItem = app.utils.createHtmlElement('li', {
|
|
102 |
var sortByCountAscListItem = DOM.createHtmlElement('li', {
|
|
103 | 103 |
'class': 'sort-asc', |
104 | 104 |
}); |
105 |
sortByCountAscListItem.appendChild(app.utils.createTextElement('#components'));
|
|
105 |
sortByCountAscListItem.appendChild(DOM.createTextElement('#components'));
|
|
106 | 106 |
sortByCountAscListItem.addEventListener('click', sortByCount.bind(this, 1)); |
107 | 107 |
sortListElement.appendChild(sortByCountAscListItem); |
108 | 108 |
|
109 |
var sortByCountDescListItem = app.utils.createHtmlElement('li', {
|
|
109 |
var sortByCountDescListItem = DOM.createHtmlElement('li', {
|
|
110 | 110 |
'class': 'sort-desc', |
111 | 111 |
}); |
112 |
sortByCountDescListItem.appendChild(app.utils.createTextElement('#components'));
|
|
112 |
sortByCountDescListItem.appendChild(DOM.createTextElement('#components'));
|
|
113 | 113 |
sortByCountDescListItem.addEventListener('click', sortByCount.bind(this, -1)); |
114 | 114 |
sortListElement.appendChild(sortByCountDescListItem); |
115 | 115 |
|
116 | 116 |
// list |
117 |
nodeListElement = app.utils.createHtmlElement('ul', {
|
|
117 |
nodeListElement = DOM.createHtmlElement('ul', {
|
|
118 | 118 |
'class': 'node-list', |
119 | 119 |
}); |
120 | 120 |
rootElement.appendChild(nodeListElement); |
sources/src/main/webapp/js/components/sidebarUnconnectedNodeList.js | ||
---|---|---|
36 | 36 |
} |
37 | 37 |
|
38 | 38 |
// unset remove hook |
39 |
node.removeFromSidebarList = app.utils.noop;
|
|
39 |
node.removeFromSidebarList = Utils.noop;
|
|
40 | 40 |
|
41 | 41 |
nodeList.splice(nodeList.indexOf(node), 1); |
42 | 42 |
|
... | ... | |
46 | 46 |
}; |
47 | 47 |
|
48 | 48 |
this.render = function() { |
49 |
rootElement = app.utils.createHtmlElement('div', {
|
|
49 |
rootElement = DOM.createHtmlElement('div', {
|
|
50 | 50 |
'id': props.id, |
51 | 51 |
'class': 'node-container unconnected-nodes ' + (props.class ? props.class : ''), |
52 | 52 |
}); |
... | ... | |
55 | 55 |
}); |
56 | 56 |
|
57 | 57 |
// title |
58 |
rootElement.appendChild(app.dom.htmlStringToElement('<h2 class="node-container-title">Unconnected vertices</h2>'));
|
|
58 |
rootElement.appendChild(DOM.htmlStringToElement('<h2 class="node-container-title">Unconnected vertices</h2>'));
|
|
59 | 59 |
|
60 | 60 |
// buttons |
61 |
buttonGroup = app.utils.createHtmlElement('div', {
|
|
61 |
buttonGroup = DOM.createHtmlElement('div', {
|
|
62 | 62 |
'class': 'button-group', |
63 | 63 |
}); |
64 | 64 |
rootElement.appendChild(buttonGroup); |
65 | 65 |
|
66 | 66 |
// include all button |
67 |
var includeAllButton = app.utils.createHtmlElement('button', {
|
|
67 |
var includeAllButton = DOM.createHtmlElement('button', {
|
|
68 | 68 |
'class': 'include-all-button button', |
69 | 69 |
'title': 'Display all unconnected nodes in viewport', |
70 | 70 |
}); |
71 |
includeAllButton.appendChild(app.utils.createHtmlElement('img', {
|
|
71 |
includeAllButton.appendChild(DOM.createHtmlElement('img', {
|
|
72 | 72 |
'src': 'images/unconnected/uncon_left.png', |
73 | 73 |
'alt': 'Icon of "display all unconnected nodes in viewport" action', |
74 | 74 |
})); |
... | ... | |
76 | 76 |
buttonGroup.appendChild(includeAllButton); |
77 | 77 |
|
78 | 78 |
// exclude all button |
79 |
var excludeAllButton = app.utils.createHtmlElement('button', {
|
|
79 |
var excludeAllButton = DOM.createHtmlElement('button', {
|
|
80 | 80 |
'class': 'exclude-all-button button', |
81 | 81 |
'title': 'Display all unconnected nodes in sidebar', |
82 | 82 |
}); |
83 |
excludeAllButton.appendChild(app.utils.createHtmlElement('img', {
|
|
83 |
excludeAllButton.appendChild(DOM.createHtmlElement('img', {
|
|
84 | 84 |
'src': 'images/unconnected/uncon_right.png', |
85 | 85 |
'alt': 'Icon of "display all unconnected nodes in sidebar" action', |
86 | 86 |
})); |
... | ... | |
88 | 88 |
buttonGroup.appendChild(excludeAllButton); |
89 | 89 |
|
90 | 90 |
// list |
91 |
nodeListElement = app.utils.createHtmlElement('ul', {
|
|
91 |
nodeListElement = DOM.createHtmlElement('ul', {
|
|
92 | 92 |
'class': 'node-list', |
93 | 93 |
}); |
94 | 94 |
rootElement.appendChild(nodeListElement); |
sources/src/main/webapp/js/components/statusBar.js | ||
---|---|---|
12 | 12 |
*/ |
13 | 13 |
this.setComponentCount = function(componentCount) { |
14 | 14 |
componentCounterElement.innerHTML = ''; |
15 |
componentCounterElement.appendChild(app.utils.createTextElement('loaded components: ' + componentCount));
|
|
15 |
componentCounterElement.appendChild(DOM.createTextElement('loaded components: ' + componentCount));
|
|
16 | 16 |
}; |
17 | 17 |
|
18 | 18 |
/** |
... | ... | |
20 | 20 |
* @returns {Element} HTML DOM element. |
21 | 21 |
*/ |
22 | 22 |
this.render = function() { |
23 |
rootElement = app.utils.createHtmlElement('nav', {
|
|
23 |
rootElement = DOM.createHtmlElement('nav', {
|
|
24 | 24 |
'class': 'status-bar', |
25 | 25 |
}); |
26 | 26 |
|
27 |
componentCounterElement = app.utils.createHtmlElement('span', {
|
|
27 |
componentCounterElement = DOM.createHtmlElement('span', {
|
|
28 | 28 |
'class': 'component-counter', |
29 | 29 |
}); |
30 | 30 |
rootElement.appendChild(componentCounterElement); |
31 | 31 |
|
32 |
minimapToggleElement = app.dom.createHtmlElement('span', {
|
|
32 |
minimapToggleElement = DOM.createHtmlElement('span', {
|
|
33 | 33 |
'class': 'link', |
34 | 34 |
}); |
35 |
minimapToggleElement.appendChild(app.dom.createTextElement('toggle minimap'));
|
|
35 |
minimapToggleElement.appendChild(DOM.createTextElement('toggle minimap'));
|
|
36 | 36 |
minimapToggleElement.addEventListener('click', toggleMinimap.bind(this)); |
37 | 37 |
rootElement.appendChild(minimapToggleElement); |
38 | 38 |
|
sources/src/main/webapp/js/components/vertex.js | ||
---|---|---|
438 | 438 |
/** |
439 | 439 |
* Hook function used to remove the vertex from the sidebar list it is located in before it is moved to the viewport. |
440 | 440 |
*/ |
441 |
this.removeFromSidebarList = app.utils.noop;
|
|
441 |
this.removeFromSidebarList = Utils.noop;
|
|
442 | 442 |
|
443 | 443 |
/** |
444 | 444 |
* @returns {boolean} True if the vertex is not connected to any other nodes. |
... | ... | |
501 | 501 |
* @returns {Element} SVG DOM element. |
502 | 502 |
*/ |
503 | 503 |
function renderIncluded() { |
504 |
rootElement = app.utils.createSvgElement('svg', {
|
|
504 |
rootElement = DOM.createSvgElement('svg', {
|
|
505 | 505 |
'class': 'node vertex', |
506 | 506 |
'x': position.x, |
507 | 507 |
'y': position.y, |
... | ... | |
509 | 509 |
'data-name': this.name, |
510 | 510 |
}); |
511 | 511 |
rootElement.addEventListener('click', click.bind(this)); |
512 |
rootElement.addEventListener('dblclick', app.utils.stopPropagation);
|
|
512 |
rootElement.addEventListener('dblclick', Utils.stopPropagation);
|
|
513 | 513 |
rootElement.addEventListener('contextmenu', contextMenu.bind(this)); |
514 | 514 |
rootElement.addEventListener('mousedown', mouseDown.bind(this)); |
515 | 515 |
|
516 |
rootElement.appendChild(app.utils.createSvgElement('rect', {
|
|
516 |
rootElement.appendChild(DOM.createSvgElement('rect', {
|
|
517 | 517 |
'height': size.height, |
518 | 518 |
'width': size.width + this.countRelatedArchetypes() * relatedArchetypeIconWidth, |
519 | 519 |
'x': 1, |
... | ... | |
521 | 521 |
})); |
522 | 522 |
|
523 | 523 |
// archetype icon |
524 |
var archetypeIcon = app.dom.createSvgElement('use', {
|
|
524 |
var archetypeIcon = DOM.createSvgElement('use', {
|
|
525 | 525 |
'href': '#vertexArchetypeIcon-' + app.archetype.vertex[this.archetype].name, |
526 | 526 |
'class': 'archetype-icon', |
527 | 527 |
'transform': 'translate(8, 8)', |
... | ... | |
531 | 531 |
rootElement.appendChild(archetypeIcon); |
532 | 532 |
|
533 | 533 |
// name |
534 |
var nameText = app.utils.createSvgElement('text', {
|
|
534 |
var nameText = DOM.createSvgElement('text', {
|
|
535 | 535 |
'fill': 'black', |
536 | 536 |
'x': 25, |
537 | 537 |
'y': 20, |
... | ... | |
540 | 540 |
rootElement.appendChild(nameText); |
541 | 541 |
|
542 | 542 |
// related archetype icons |
543 |
var relatedArchetypeListContainer = app.dom.createSvgElement('g', {
|
|
543 |
var relatedArchetypeListContainer = DOM.createSvgElement('g', {
|
|
544 | 544 |
'transform': `translate(${size.width}, 0)`, |
545 | 545 |
}); |
546 | 546 |
rootElement.appendChild(relatedArchetypeListContainer); |
547 | 547 |
|
548 | 548 |
var archetypeIconOrder = 0; |
549 | 549 |
for (var archetypeIndex in relatedArchetypeMap) { |
550 |
var relatedArchetypeIcon = app.utils.createSvgElement('use', {
|
|
550 |
var relatedArchetypeIcon = DOM.createSvgElement('use', {
|
|
551 | 551 |
'href': '#vertexArchetypeIcon-' + app.archetype.vertex[archetypeIndex].name, |
552 | 552 |
'class': 'archetype-icon', |
553 | 553 |
'transform': `translate(${archetypeIconOrder * relatedArchetypeIconWidth}, 8)`, |
... | ... | |
574 | 574 |
* @returns {Element} HTML DOM element. |
575 | 575 |
*/ |
576 | 576 |
function renderExcluded() { |
577 |
rootElement = app.dom.createHtmlElement('li', {
|
|
577 |
rootElement = DOM.createHtmlElement('li', {
|
|
578 | 578 |
'class': 'node vertex', |
579 | 579 |
'data-id': this.id, |
580 | 580 |
}); |
581 | 581 |
|
582 |
var svg = app.dom.createSvgElement('svg', {
|
|
582 |
var svg = DOM.createSvgElement('svg', {
|
|
583 | 583 |
'xmlns': 'http://www.w3.org/2000/svg', |
584 | 584 |
'height': 60, |
585 | 585 |
'width': 46, |
... | ... | |
587 | 587 |
rootElement.appendChild(svg); |
588 | 588 |
|
589 | 589 |
// related archetypes |
590 |
var relatedArchetypesGroup = app.dom.createSvgElement('g', {
|
|
590 |
var relatedArchetypesGroup = DOM.createSvgElement('g', {
|
|
591 | 591 |
'transform': 'translate(10, 15)', |
592 | 592 |
}); |
593 | 593 |
svg.appendChild(relatedArchetypesGroup); |
594 | 594 |
|
595 | 595 |
var archetypeIconOrder = 0; |
596 | 596 |
for (var archetypeIndex in relatedArchetypeMap) { |
597 |
var relatedArchetype = app.dom.createSvgElement('g', {
|
|
597 |
var relatedArchetype = DOM.createSvgElement('g', {
|
|
598 | 598 |
'class': 'related-archetype', |
599 | 599 |
'transform': `translate(0, ${archetypeIconOrder * 20})`, |
600 | 600 |
}); |
601 | 601 |
relatedArchetypesGroup.appendChild(relatedArchetype); |
602 | 602 |
|
603 | 603 |
// counter |
604 |
var relatedArchetypeCounter = app.dom.createSvgElement('text', {});
|
|
605 |
relatedArchetypeCounter.appendChild(app.dom.createTextElement(relatedArchetypeMap[archetypeIndex]));
|
|
604 |
var relatedArchetypeCounter = DOM.createSvgElement('text');
|
|
605 |
relatedArchetypeCounter.appendChild(DOM.createTextElement(relatedArchetypeMap[archetypeIndex]));
|
|
606 | 606 |
relatedArchetype.appendChild(relatedArchetypeCounter); |
607 | 607 |
|
608 | 608 |
// icon |
609 |
var relatedArchetypeIcon = app.dom.createSvgElement('use', {
|
|
609 |
var relatedArchetypeIcon = DOM.createSvgElement('use', {
|
|
610 | 610 |
'href': '#vertexArchetypeIcon-' + app.archetype.vertex[archetypeIndex].name, |
611 | 611 |
'class': 'archetype-icon', |
612 | 612 |
'transform': `translate(15, -10)`, |
... | ... | |
615 | 615 |
relatedArchetype.appendChild(relatedArchetypeIcon); |
616 | 616 |
|
617 | 617 |
// line |
618 |
relatedArchetype.appendChild(app.dom.createSvgElement('line', {
|
|
618 |
relatedArchetype.appendChild(DOM.createSvgElement('line', {
|
|
619 | 619 |
'x1': 30, |
620 | 620 |
'y1': -5, |
621 | 621 |
'x2': 36, |
... | ... | |
626 | 626 |
} |
627 | 627 |
|
628 | 628 |
// name |
629 |
var nameText = app.utils.createHtmlElement('div', {
|
|
629 |
var nameText = DOM.createHtmlElement('div', {
|
|
630 | 630 |
'class': 'vertex-name', |
631 | 631 |
'title': this.name, |
632 | 632 |
}); |
... | ... | |
635 | 635 |
rootElement.appendChild(nameText); |
636 | 636 |
|
637 | 637 |
// buttons |
638 |
var buttonGroup = app.utils.createHtmlElement('div', {
|
|
638 |
var buttonGroup = DOM.createHtmlElement('div', {
|
|
639 | 639 |
'class': 'button-group', |
640 | 640 |
}); |
641 | 641 |
rootElement.appendChild(buttonGroup); |
642 | 642 |
|
643 | 643 |
// show symbol button |
644 |
var showSymbolButton = app.utils.createHtmlElement('button', {
|
|
644 |
var showSymbolButton = DOM.createHtmlElement('button', {
|
|
645 | 645 |
'class': 'show-symbol-button button', |
646 | 646 |
'style': 'background-color: ' + this.symbol[1] + ';', |
647 | 647 |
'title': 'Show symbol next to all neighbouring components', |
... | ... | |
651 | 651 |
buttonGroup.appendChild(showSymbolButton); |
652 | 652 |
|
653 | 653 |
// include button |
654 |
var includeButton = app.utils.createHtmlElement('button', {
|
|
654 |
var includeButton = DOM.createHtmlElement('button', {
|
|
655 | 655 |
'class': 'include-button button', |
656 | 656 |
'title': 'Display node in viewport', |
657 | 657 |
}); |
658 |
includeButton.appendChild(app.utils.createHtmlElement('img', {
|
|
658 |
includeButton.appendChild(DOM.createHtmlElement('img', {
|
|
659 | 659 |
'src': 'images/button_cancel.png', |
660 | 660 |
'alt': 'Icon of "Icon of "display node in viewport" action" action', |
661 | 661 |
})); |
sources/src/main/webapp/js/components/vertexContextMenuList.js | ||
---|---|---|
36 | 36 |
throw new Error('Vertex is already a member of some group.'); |
37 | 37 |
} |
38 | 38 |
|
39 |
var nodeListItemElement = app.utils.createHtmlElement('li', {
|
|
39 |
var nodeListItemElement = DOM.createHtmlElement('li', {
|
|
40 | 40 |
'title': node.name, |
41 | 41 |
}); |
42 | 42 |
nodeListItemElement.addEventListener('click', nodeListItemClick.bind(node)); |
43 | 43 |
listElement.appendChild(nodeListItemElement); |
44 | 44 |
|
45 |
var nodeSymbolText = app.utils.createHtmlElement('span', {
|
|
45 |
var nodeSymbolText = DOM.createHtmlElement('span', {
|
|
46 | 46 |
'class': 'group-symbol', |
47 | 47 |
'style': 'background-color: ' + node.symbol[1] + ';', |
48 | 48 |
}); |
49 | 49 |
nodeSymbolText.appendChild(document.createTextNode(node.symbol[0])); |
50 | 50 |
nodeListItemElement.appendChild(nodeSymbolText); |
51 | 51 |
|
52 |
var nodeNameText = app.utils.createHtmlElement('span', {
|
|
52 |
var nodeNameText = DOM.createHtmlElement('span', {
|
|
53 | 53 |
'class': 'group-name', |
54 | 54 |
}); |
55 | 55 |
nodeNameText.appendChild(document.createTextNode(node.name)); |
... | ... | |
77 | 77 |
* @returns {Element} HTML DOM element. |
78 | 78 |
*/ |
79 | 79 |
this.render = function() { |
80 |
rootElement = app.utils.createHtmlElement('div', {
|
|
80 |
rootElement = DOM.createHtmlElement('div', {
|
|
81 | 81 |
'class': 'context-menu hidden', |
82 | 82 |
}); |
83 |
rootElement.addEventListener('mousedown', app.utils.stopPropagation);
|
|
83 |
rootElement.addEventListener('mousedown', Utils.stopPropagation);
|
|
84 | 84 |
|
85 |
listElement = app.utils.createHtmlElement('ul', {});
|
|
85 |
listElement = DOM.createHtmlElement('ul');
|
|
86 | 86 |
rootElement.appendChild(listElement); |
87 | 87 |
|
88 | 88 |
return rootElement; |
sources/src/main/webapp/js/components/vertexPopover.js | ||
---|---|---|
53 | 53 |
* @returns {Element} HTML DOM element. |
54 | 54 |
*/ |
55 | 55 |
this.render = function() { |
56 |
rootElement = app.utils.createHtmlElement('div', {
|
|
56 |
rootElement = DOM.createHtmlElement('div', {
|
|
57 | 57 |
'class': 'popover vertex-popover hidden', |
58 | 58 |
}); |
59 |
rootElement.addEventListener('wheel', app.utils.stopPropagation);
|
|
60 |
rootElement.addEventListener('mousedown', app.utils.stopPropagation);
|
|
59 |
rootElement.addEventListener('wheel', Utils.stopPropagation);
|
|
60 |
rootElement.addEventListener('mousedown', Utils.stopPropagation);
|
|
61 | 61 |
rootElement.addEventListener('mouseleave', this.close.bind(this)); |
62 | 62 |
|
63 |
popoverTitle = app.utils.createHtmlElement('span', {
|
|
63 |
popoverTitle = DOM.createHtmlElement('span', {
|
|
64 | 64 |
'class': 'popover-title', |
65 | 65 |
}); |
66 | 66 |
rootElement.appendChild(popoverTitle); |
67 | 67 |
|
68 |
var popoverContent = app.utils.createHtmlElement('div', {
|
|
68 |
var popoverContent = DOM.createHtmlElement('div', {
|
|
69 | 69 |
'class': 'popover-content', |
70 | 70 |
}); |
71 | 71 |
rootElement.appendChild(popoverContent); |
72 | 72 |
|
73 |
detailsListElement = app.utils.createHtmlElement('ul', {});
|
|
73 |
detailsListElement = DOM.createHtmlElement('ul');
|
|
74 | 74 |
popoverContent.appendChild(detailsListElement); |
75 | 75 |
|
76 | 76 |
return rootElement; |
sources/src/main/webapp/js/components/vertexSymbolList.js | ||
---|---|---|
13 | 13 |
* @param {array} symbol Symbol to be added to the list. |
14 | 14 |
*/ |
15 | 15 |
this.appendChild = function(symbol) { |
16 |
var symbolGroup = app.utils.createSvgElement('g', {
|
|
16 |
var symbolGroup = DOM.createSvgElement('g', {
|
|
17 | 17 |
'class': `neighbour-node-symbol symbol-${symbol[0]}`, |
18 | 18 |
}); |
19 | 19 |
rootElement.appendChild(symbolGroup); |
20 | 20 |
|
21 |
symbolGroup.appendChild(app.utils.createSvgElement('rect', {
|
|
21 |
symbolGroup.appendChild(DOM.createSvgElement('rect', {
|
|
22 | 22 |
'x': 0, |
23 | 23 |
'y': 0, |
24 | 24 |
'width': width, |
... | ... | |
26 | 26 |
'fill': symbol[1], |
27 | 27 |
})); |
28 | 28 |
|
29 |
var symbolText = app.utils.createSvgElement('text', {
|
|
29 |
var symbolText = DOM.createSvgElement('text', {
|
|
30 | 30 |
'x': 6, |
31 | 31 |
'y': 15, |
32 | 32 |
}); |
... | ... | |
53 | 53 |
* @param {Element} symbol SVG DOM element. |
54 | 54 |
*/ |
55 | 55 |
this.render = function(symbol) { |
56 |
rootElement = app.utils.createSvgElement('g', {
|
|
56 |
rootElement = DOM.createSvgElement('g', {
|
|
57 | 57 |
'transform': 'translate(0, 30)', |
58 | 58 |
}); |
59 | 59 |
|
sources/src/main/webapp/js/components/viewport.js | ||
---|---|---|
96 | 96 |
}; |
97 | 97 |
|
98 | 98 |
this.addSvgDefinition = function(id, svgString) { |
99 |
var g = app.dom.createSvgElement('g', {
|
|
99 |
var g = DOM.createSvgElement('g', {
|
|
100 | 100 |
'id': id, |
101 | 101 |
}); |
102 | 102 |
g.innerHTML = svgString; |
... | ... | |
143 | 143 |
}; |
144 | 144 |
|
145 | 145 |
this.render = function() { |
146 |
rootElement = app.utils.createHtmlElement('div', {
|
|
146 |
rootElement = DOM.createHtmlElement('div', {
|
|
147 | 147 |
'class': 'viewport', |
148 | 148 |
'id': 'viewport', |
149 | 149 |
}); |
... | ... | |
151 | 151 |
rootElement.addEventListener('mousedown', onMouseDown.bind(this)); |
152 | 152 |
rootElement.addEventListener('dblclick', onDoubleClick.bind(this)); |
153 | 153 |
|
154 |
var mainSvg = app.utils.createSvgElement('svg', {
|
|
154 |
var mainSvg = DOM.createSvgElement('svg', {
|
|
155 | 155 |
'xmlns': 'http://www.w3.org/2000/svg', |
156 | 156 |
'width': '100%', |
157 | 157 |
'height': '100%', |
... | ... | |
182 | 182 |
groupsContainer.setAttribute('data-id', 'groups'); |
183 | 183 |
graph.appendChild(groupsContainer); |
184 | 184 |
|
185 |
definitions = app.utils.createSvgElement('defs', {});
|
|
185 |
definitions = DOM.createSvgElement('defs');
|
|
186 | 186 |
mainSvg.appendChild(definitions); |
187 | 187 |
|
188 |
var linearGradient = app.utils.createSvgElement('linearGradient', {
|
|
188 |
var linearGradient = DOM.createSvgElement('linearGradient', {
|
|
189 | 189 |
'id': 'node--highlighted-required-provided', |
190 | 190 |
}); |
191 |
linearGradient.appendChild(app.utils.createSvgElement('stop', {
|
|
191 |
linearGradient.appendChild(DOM.createSvgElement('stop', {
|
|
192 | 192 |
'offset': '0%', |
193 | 193 |
'stop-color': 'red', |
194 | 194 |
})); |
195 |
linearGradient.appendChild(app.utils.createSvgElement('stop', {
|
|
195 |
linearGradient.appendChild(DOM.createSvgElement('stop', {
|
|
196 | 196 |
'offset': '100%', |
197 | 197 |
'stop-color': '#5896ff', |
198 | 198 |
})); |
sources/src/main/webapp/js/forceDirected.js | ||
---|---|---|
28 | 28 |
j = 0; |
29 | 29 |
|
30 | 30 |
for (i = 0; i < visibleNodes.length; i++) { |
31 |
forceField[app.utils.getUniqueId(visibleNodes[i])] = [0, 0];
|
|
31 |
forceField[Utils.getUniqueId(visibleNodes[i])] = [0, 0];
|
|
32 | 32 |
} |
33 | 33 |
|
34 | 34 |
// calculate repulsive force |
... | ... | |
56 | 56 |
var distance = Math.sqrt(sum); |
57 | 57 |
|
58 | 58 |
if (distance !== 0) { |
59 |
forceField[app.utils.getUniqueId(currNode)][0] += Math.floor(x * (repulsiveStrength / distance));
|
|
60 |
forceField[app.utils.getUniqueId(currNode)][1] += Math.floor(y * (repulsiveStrength / distance));
|
|
59 |
forceField[Utils.getUniqueId(currNode)][0] += Math.floor(x * (repulsiveStrength / distance));
|
|
60 |
forceField[Utils.getUniqueId(currNode)][1] += Math.floor(y * (repulsiveStrength / distance));
|
|
61 | 61 |
} |
62 | 62 |
} |
63 | 63 |
} |
... | ... | |
79 | 79 |
var sum = Math.pow(x, 2) + Math.pow(y, 2); |
80 | 80 |
var distance = Math.sqrt(sum); |
81 | 81 |
|
82 |
forceField[app.utils.getUniqueId(currNode)][0] += Math.round(-1 * x * (distance / attractiveStrength));
|
|
83 |
forceField[app.utils.getUniqueId(currNode)][1] += Math.round(-1 * y * (distance / attractiveStrength));
|
|
82 |
forceField[Utils.getUniqueId(currNode)][0] += Math.round(-1 * x * (distance / attractiveStrength));
|
|
83 |
forceField[Utils.getUniqueId(currNode)][1] += Math.round(-1 * y * (distance / attractiveStrength));
|
|
84 | 84 |
} |
85 | 85 |
|
86 | 86 |
for (j = 0; j < currNode.getOutEdgeList().length; j++) { |
... | ... | |
96 | 96 |
var sum = Math.pow(x, 2) + Math.pow(y, 2); |
97 | 97 |
var distance = Math.sqrt(sum); |
98 | 98 |
|
99 |
forceField[app.utils.getUniqueId(currNode)][0] += Math.round(-1 * x * (distance / attractiveStrength));
|
|
100 |
forceField[app.utils.getUniqueId(currNode)][1] += Math.round(-1 * y * (distance / attractiveStrength));
|
|
99 |
forceField[Utils.getUniqueId(currNode)][0] += Math.round(-1 * x * (distance / attractiveStrength));
|
|
100 |
forceField[Utils.getUniqueId(currNode)][1] += Math.round(-1 * y * (distance / attractiveStrength));
|
|
101 | 101 |
} |
102 | 102 |
} |
103 | 103 |
|
... | ... | |
139 | 139 |
} |
140 | 140 |
|
141 | 141 |
// force dampening |
142 |
var forceX = Math.floor(forceField[app.utils.getUniqueId(currNode)][0] / dampeningEffect),
|
|
143 |
forceY = Math.floor(forceField[app.utils.getUniqueId(currNode)][1] / dampeningEffect);
|
|
142 |
var forceX = Math.floor(forceField[Utils.getUniqueId(currNode)][0] / dampeningEffect),
|
|
143 |
forceY = Math.floor(forceField[Utils.getUniqueId(currNode)][1] / dampeningEffect);
|
|
144 | 144 |
|
145 | 145 |
// adding a random effect |
146 | 146 |
/* |
sources/src/main/webapp/js/graphExporter.js | ||
---|---|---|
26 | 26 |
var excludedNodeList = app.sidebarComponent.excludedNodeListComponent.getNodeList(); |
27 | 27 |
var sideBar = excludedNodeList.map(function(node) { |
28 | 28 |
return { |
29 |
id: app.utils.getUniqueId(node),
|
|
29 |
id: Utils.getUniqueId(node),
|
|
30 | 30 |
isIconsDisplayed: node.isIconsDisplayed(), |
31 | 31 |
}; |
32 | 32 |
}); |
... | ... | |
36 | 36 |
}); |
37 | 37 |
|
38 | 38 |
// when edge is highlighted another vertex can not be highlighted |
39 |
if (app.utils.isUndefined(highlightedEdge)) {
|
|
39 |
if (Utils.isUndefined(highlightedEdge)) {
|
|
40 | 40 |
var highlightedVertex = app.nodeList.find(function (vertex) { |
41 | 41 |
return vertex.isHighlighted() |
42 | 42 |
}); |
... | ... | |
51 | 51 |
possibleEnumValues: app.possibleEnumValues, |
52 | 52 |
groups: groups, |
53 | 53 |
sideBar: sideBar, |
54 |
highlightedVertex: app.utils.getUniqueId(highlightedVertex),
|
|
55 |
highlightedEdge: app.utils.isUndefined(highlightedEdge) ? '' : highlightedEdge.id,
|
|
54 |
highlightedVertex: Utils.getUniqueId(highlightedVertex),
|
|
55 |
highlightedEdge: Utils.isUndefined(highlightedEdge) ? '' : highlightedEdge.id,
|
|
56 | 56 |
}; |
57 | 57 |
} |
58 | 58 |
|
sources/src/main/webapp/js/graphLoader.js | ||
---|---|---|
9 | 9 |
* @throws {InvalidArgumentError} Thrown when either graph data are incomplete. |
10 | 10 |
*/ |
11 | 11 |
this.run = function(data) { |
12 |
if (app.utils.isUndefined(data.vertices) || app.utils.isUndefined(data.edges)) {
|
|
12 |
if (Utils.isUndefined(data.vertices) || Utils.isUndefined(data.edges)) {
|
|
13 | 13 |
throw new InvalidArgumentError('Invalid data.'); |
14 | 14 |
} |
15 | 15 |
|
... | ... | |
23 | 23 |
app.possibleEnumValues = data.possibleEnumValues; |
24 | 24 |
|
25 | 25 |
app.archetype.vertex.filter(function(vertexArchetype) { |
26 |
return app.utils.isDefined(vertexArchetype.icon);
|
|
26 |
return Utils.isDefined(vertexArchetype.icon);
|
|
27 | 27 |
}).forEach(function(vertexArchetype) { |
28 | 28 |
app.viewportComponent.addSvgDefinition('vertexArchetypeIcon-' + vertexArchetype.name, vertexArchetype.icon); |
29 | 29 |
}); |
30 | 30 |
|
31 | 31 |
var highlightedNodeId; |
32 | 32 |
var highlightedNodeType; |
33 |
if (app.utils.isDefined(data.highlightedVertex) && data.highlightedVertex.length > 0) {
|
|
33 |
if (Utils.isDefined(data.highlightedVertex) && data.highlightedVertex.length > 0) {
|
|
34 | 34 |
var highlightedNodeAttr = data.highlightedVertex.split("-"); |
35 | 35 |
if (highlightedNodeAttr.length === 2) { |
36 | 36 |
highlightedNodeType = highlightedNodeAttr[0]; |
37 | 37 |
highlightedNodeId = parseInt(highlightedNodeAttr[1], 10); |
38 | 38 |
} |
39 | 39 |
} |
40 |
if (app.utils.isDefined(data.highlightedEdge) && data.highlightedEdge.length > 0) {
|
|
40 |
if (Utils.isDefined(data.highlightedEdge) && data.highlightedEdge.length > 0) {
|
|
41 | 41 |
var highlightedEdgeId = parseInt(data.highlightedEdge, 10); |
42 | 42 |
} |
43 | 43 |
|
... | ... | |
55 | 55 |
|
56 | 56 |
var position = component.position; |
57 | 57 |
|
58 |
if (position === null || app.utils.isUndefined(position)) {
|
|
58 |
if (position === null || Utils.isUndefined(position)) {
|
|
59 | 59 |
// set random |
60 | 60 |
vertex.setPosition(new Coordinates( |
61 | 61 |
Math.floor(Math.random() * canvasSize), |
... | ... | |
127 | 127 |
|
128 | 128 |
// position |
129 | 129 |
var position = component.position; |
130 |
if (position === null || app.utils.isUndefined(position)) {
|
|
130 |
if (position === null || Utils.isUndefined(position)) {
|
|
131 | 131 |
// set random |
132 | 132 |
group.setPosition(new Coordinates( |
133 | 133 |
Math.floor(Math.random() * canvasSize), |
... | ... | |
172 | 172 |
return idArr[0] === prefix && node.id === idArr[1]; |
173 | 173 |
}); |
174 | 174 |
|
175 |
if (app.utils.isDefined(node)) {
|
|
175 |
if (Utils.isDefined(node)) {
|
|
176 | 176 |
node.exclude(excludedNode.isIconsDisplayed); |
177 | 177 |
|
178 | 178 |
app.sidebarComponent.excludedNodeListComponent.add(node); |
... | ... | |
185 | 185 |
// update status bar |
186 | 186 |
app.sidebarComponent.statusBarComponent.setComponentCount(data.vertices.length); |
187 | 187 |
|
188 |
if (app.utils.isDefined(highlightedEdge)) {
|
|
188 |
if (Utils.isDefined(highlightedEdge)) {
|
|
189 | 189 |
highlightedEdge.setHighlighted(true); |
190 | 190 |
highlightedEdge.getFrom().setHighlighted(true); |
191 | 191 |
highlightedEdge.getTo().setHighlighted(true); |
192 | 192 |
} |
193 |
if (app.utils.isDefined(highlightedNode)) highlightedNode.setHighlightedWithNeighbours(true);
|
|
193 |
if (Utils.isDefined(highlightedNode)) highlightedNode.setHighlightedWithNeighbours(true);
|
|
194 | 194 |
}; |
195 | 195 |
|
196 | 196 |
} |
Také k dispozici: Unified diff
static util methods are used everywhere