source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/IHS BMX Framework/IndianHealthService.BMXNet.Doc/Help/Scripts/LanguageFilter.js

Last change on this file was 1146, checked in by Sam Habiel, 13 years ago

Initial Import of BMX4

File size: 2.4 KB
Line 
1/*
2
3function Selector2 (id, tag, attribute) {
4 this.root = document.getElementById(id);
5 this.elements = new Array();
6 this.values = new Array();
7 this.registerChildren(root, attribute);
8
9 this.handlers = new Array();
10}
11
12Selector2.prototype.registerChildren(parent, tag, attribute) {
13 var children = parent.childNodes;
14 for (var i = 0; i<children.length; i++) {
15 var child = children[i];
16 if (child.nodeType == 1) {
17 var value = child.getAttribute(attribute);
18 if (value) {
19 this.elements.add(child);
20 this.values.add(value);
21 }
22 this.registerChildren(child, tag, attribute);
23 }
24 }
25}
26
27Selector2.prototype.registerHandler(handler) {
28 this.handlers.add(handler);
29}
30
31Selector2.prototype.select(value) {
32 for (var i=0; i<handlers.length; i++) {
33 this.handlers[i](this, value);
34 }
35}
36*/
37
38function Selector(id)
39{
40 this.selectorHandlers = new Array();
41 this.curvedTabCollections = new Array();
42 this.tabCollections = new Array();
43 this.blockCollections = new Array();
44 this.id = id;
45}
46
47Selector.prototype.register=function(handler)
48{
49 this.selectorHandlers.push(handler);
50}
51
52Selector.prototype.registerTabbedArea = function(curvedTabCollection, tabCollection, blockCollection)
53{
54 this.curvedTabCollections.push(curvedTabCollection);
55 this.tabCollections.push(tabCollection);
56 this.blockCollections.push(blockCollection);
57}
58
59Selector.prototype.changeLanguage = function(data, name, style)
60{
61
62 var value= name + ' ' + style;
63
64 for(var handler in this.selectorHandlers)
65 {
66 this.selectorHandlers[handler](this.id, data, value, this.curvedTabCollections, this.tabCollections, this.blockCollections);
67 }
68}
69
70Selector.prototype.select = function(data)
71{
72 var value = data.get('lang');
73
74 if (value == null) return;
75 var names = value.split(' ');
76
77 var nodes = getChildNodes(this.id);
78
79 for( var i=0; i<nodes.length; i++)
80 {
81 if(nodes[i].getAttribute('id') == names[0])
82 {
83 styleSheetHandler(this.id, data, value, this.curvedTabCollections, this.tabCollections, this.blockCollections);
84 codeBlockHandler(this.id, data, value, this.curvedTabCollections, this.tabCollections, this.blockCollections);
85 languageHandler(this.id, data, value, this.curvedTabCollections, this.tabCollections, this.blockCollections);
86 }
87 }
88}
89
90
91
Note: See TracBrowser for help on using the repository browser.