forked from Shikaga/DamJS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
DamJSPlugin.js
57 lines (47 loc) · 1.46 KB
/
DamJSPlugin.js
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
function DamJSPlugin(ko) {
this.ko = ko;
this.name = this.ko.observable('UNNAMED');
this.subject = null;
this.data = {};
this.forwardingHandler = null
this.contribHandler = null
this.controls = this.ko.observableArray();
this.damJS = null;
this.enabled = this.ko.observable(false);
}
DamJSPlugin.prototype.addControl = function(control) {
this.controls.push(control);
}
DamJSPlugin.prototype.inFiltered = function(subject) {
return (this.subject === subject) &&
this.enabled() &&
this.forwardingHandler !== null;
}
DamJSPlugin.prototype.contribFiltered = function(subject) {
return (this.subject === subject) &&
this.enabled() &&
this.contribHandler !== null;
}
DamJSPlugin.prototype.setForwardingHandler = function(forwardingHandler) {
this.forwardingHandler = forwardingHandler;
}
DamJSPlugin.prototype.setContribHandler = function(contribHandler) {
this.contribHandler = contribHandler;
}
DamJSPlugin.prototype.onData = function(joinPoint) {
this.forwardingHandler(joinPoint);
}
DamJSPlugin.prototype.onContrib = function(joinPoint) {
this.contribHandler(joinPoint);
}
function DamJSPluginController(ko) {
this.dropdowns = ko.observableArray();
this.value = null;
}
DamJSPluginController.prototype.addDropDown = function(dropdown) {
this.dropdowns.push(dropdown);
}
function DamJSPluginDropDown(options) {
this.options = options;
this.value = ko.observable(options[0]);
}