forked from jaspervanderhoek/JavaConcepts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelpTextTrigger.js
More file actions
49 lines (38 loc) · 1.1 KB
/
HelpTextTrigger.js
File metadata and controls
49 lines (38 loc) · 1.1 KB
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
/**
*/
dojo.provide("HelpText.widget.HelpTextTrigger");
mxui/widget.declare('HelpText.widget.HelpTextTrigger', {
addons : [],
inputargs: {
txton : '',
txtoff: ''
},
//IMPLEMENTATION
domNode: null,
imgNode: null,
txtNode: null,
topic : "CustomWidget/HelpText",
state : false, //current state
postCreate : function(){
logger.debug(this.id + ".postCreate");
//houskeeping
this.imgNode = mxui/dom.div({
'class' : 'HelpTextTrigger'
});
this.domNode.appendChild(this.imgNode);
this.txtNode = mxui/dom.label({'class' : 'HelpTextTriggerLabel'}, this.txton);
this.domNode.appendChild(this.txtNode);
this.connect(this.imgNode, 'onclick', this.toggle);
this.connect(this.txtNode, 'onclick', this.toggle);
this.actRendered();
},
toggle : function() {
this.state = !this.state;
dojo.attr(this.imgNode, 'class', this.state? 'HelpTextTriggerDown' : 'HelpTextTrigger');
dojo.html.set(this.txtNode, this.state == true ? this.txtoff : this.txton);
dojo.publish(this.topic, [ this.state ]);
},
uninitialize : function() {
logger.debug(this.id + ".uninitialize");
}
});