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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
define.class(function(require, $ui$, foldcontainer, view, label, scrollbar, textbox, $widgets$, propeditor){
this.attributes = {
target:Config({type:Object, value:""}),
showunknown:Config({type:boolean, value:false}),
callback:Config({type:Function})
};
this.borderwidth = 0;
this.flexdirection= "column";
this.margin = 0;
this.clearcolor = "#4e4e4e";
this.padding = 0;
this.bgcolor = NaN;
this.uppercaseFirst = function (inp) {
if (!inp || inp.length == 0) return inp;
return inp.charAt(0).toUpperCase() + inp.slice(1);
};
this.render = function(){
var c = this.target;
if (typeof(this.target) === 'string') {
c = this.find(this.target);
}
if (!c) return [];
var res = [];
var keysgroups = {};
for (var key in c._attributes) {
var attr = c._attributes[key];
var typename = "NONE";
var meta = attr.meta;
if (attr.type) {
typename = attr.type.name;
if (attr.type.meta) {
meta = attr.type.meta;
}
}
if (key == "layout") {
meta = "hidden";
}
if (typename != "NONE" && typename != "Event" && meta != "hidden") {
if (!keysgroups[attr.group]) keysgroups[attr.group] = [];
keysgroups[attr.group].push(key);
}
}
for(var group in keysgroups){
var groupcontent = [];
keys = keysgroups[group];
keys.sort();
for(var i = 0 ;i<keys.length;i++){
var key = keys[i];
var thevalue = c["_"+key];
var attr = c._attributes[key];
var props = {
target:this.target,
value:thevalue,
property:attr,
propertyname: key,
fontsize:this.fontsize,
showunknown:this.showunknown
};
if (this.callback) {
props.callback = this.callback;
}
groupcontent.push(propeditor(props))
}
res.push(
foldcontainer({
collapsed: true,
basecolor:this.clearcolor,
autogradient: false,
icon:undefined,
title: this.uppercaseFirst(group),
bordercolor:"#565656",
fontsize:this.fontsize
},
view({
flexdirection:"column",
flex:1,
margin:0,
padding:0,
bgcolor:NaN
},
groupcontent
)
)
);
res[res.length-1].collapsed = function(){
window.mydbg = 1
}
}
return res;
};
var propviewer = this.constructor;
this.constructor.examples = {
Usage: function () {
return [
label({height:30, width:300,
name:"inspectable",
text:"Inspect me below!",
fgcolor:'red',
bordercolor:'pink',
borderwidth:3}),
propviewer({y:40, width:300, height:700, target:"inspectable", overflow:"scroll"})
]
}
}
});
|