1
|
/**
|
2
|
* Class representing the sidebar status bar. It displays number of components loaded in the diagram and the current graph version.
|
3
|
* @constructor
|
4
|
*/
|
5
|
function StatusBar() {
|
6
|
var rootElement;
|
7
|
var componentCounterElement;
|
8
|
var graphVersionElement;
|
9
|
|
10
|
/**
|
11
|
* Sets a new count of components loaded in the diagram.
|
12
|
* @param {integer} componentCount New count of components.
|
13
|
*/
|
14
|
this.setComponentCount = function(componentCount) {
|
15
|
componentCounterElement.innerHTML = '';
|
16
|
componentCounterElement.appendChild(app.utils.createTextElement('loaded components: ' + componentCount));
|
17
|
};
|
18
|
|
19
|
/**
|
20
|
* Sets a new graph version.
|
21
|
* @param {string|integer} graphVersion New graph version.
|
22
|
*/
|
23
|
this.setGraphVersion = function(graphVersion) {
|
24
|
graphVersionElement.innerHTML = '';
|
25
|
graphVersionElement.appendChild(app.utils.createTextElement('graph version: ' + graphVersion));
|
26
|
};
|
27
|
|
28
|
/**
|
29
|
* Creates a new DOM element representing the status bar in memory.
|
30
|
* @returns {Element} HTML DOM element.
|
31
|
*/
|
32
|
this.render = function() {
|
33
|
rootElement = app.utils.createHtmlElement('nav', {
|
34
|
'class': 'status-bar',
|
35
|
});
|
36
|
|
37
|
componentCounterElement = app.utils.createHtmlElement('span', {
|
38
|
'class': 'component-counter',
|
39
|
});
|
40
|
rootElement.appendChild(componentCounterElement);
|
41
|
|
42
|
graphVersionElement = app.utils.createHtmlElement('span', {
|
43
|
'class': 'graph-version',
|
44
|
});
|
45
|
rootElement.appendChild(graphVersionElement);
|
46
|
|
47
|
return rootElement;
|
48
|
};
|
49
|
|
50
|
/**
|
51
|
* Resets the information displayed in the status bar.
|
52
|
*/
|
53
|
this.reset = function() {
|
54
|
componentCounterElement.innerHTML = '';
|
55
|
graphVersionElement.innerHTML = '';
|
56
|
};
|
57
|
}
|