summaryrefslogtreecommitdiffstats
path: root/web-gui/logging/source/class/logging/list/List.js
blob: 34560a9cdf426925607b5d1377c5dd8c78ed7797 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* ************************************************************************

	Copyright:

	License:

	Authors:

************************************************************************ */

/**
 * This is the main application class of your custom application "logging"
 */
qx.Class.define("logging.list.List",
{
extend : qx.ui.container.Scroll,

/*
*****************************************************************************
	PROPERTIES
*****************************************************************************
*/
properties: {
	appearance: {
		refine: true,
		init: "list"
	},
	maxSize: {
		init: 200,
		check: "Integer",
		apply: "__applyMaxSize"
	}
},

construct: function() {
	this.__list = new qx.ui.container.Composite(new qx.ui.layout.VBox());
	this.base(arguments, this.__list);
},
destruct: function() {
	this._disposeObjects("__list");
},

/*
*****************************************************************************
	MEMBERS
*****************************************************************************
*/
members :
{
	__list: null,
	__last: false,

	addLine: function(text) {
		this.__last = !this.__last;
		var l = new logging.list.Line(text, this.__last);
		this.__list.add(l);
		this.__applyMaxSize(this.getMaxSize());
	},
	__applyMaxSize: function(val) {
			while (this.__list.getChildren().length > val)
			this.__list.removeAt(0);
	}
}
});