source: tmcsimulator/branches/EInotebook/scripts/Incidents.js @ 350

Revision 350, 1.6 KB checked in by jdalbey, 7 years ago (diff)

Add a branch EInotebook for Electronic Instructor Notebook prototype

  • Property svn:executable set to *
Line 
1/**
2 * Stores each Incident. You must set Incident.doc to the document that incidents will be
3 * displayed on before using this class.
4 */
5var incidents = new Array();
6
7//========== public members ==========/
8incidents.doc = null;
9
10//========== public methods ==========//
11incidents.get = incidents_get;
12incidents.collapseAll = incidents_collapseAll;
13incidents.expandAll = incidents_expandAll;
14incidents.add = incidents_add;
15
16//=========== method definitions ==========//
17/**
18 * Searches through each Incident to find an Incident with the given number.
19 * @param number {Integer} The number of an incident.
20 * @return The Incident with the given number.
21 */
22function incidents_get(number)
23{
24        var incident;
25       
26        // FOR each incident
27        for (var i = 0; i < this.length; i++)
28        {
29                // IF the incident's number matches
30                if (this[i].number == number)
31                {
32                        // remember the incident
33                        incident = this[i];
34                }
35        }
36        return incident;
37}
38
39/**
40 * Collapses each Incident.
41 */
42function incidents_collapseAll()
43{
44        // FOR each incident
45        for (var i = 0; i < this.length; i++)
46        {
47                // IF the incident is expanded THEN
48                if (this[i].expanded)
49                {
50                        // collapse incident
51                        this[i].expandAction();
52                }
53        }
54}
55
56/**
57 * Expands each incident.
58 */
59function incidents_expandAll()
60{
61        // FOR each incident
62        for (var i = 0; i < this.length; i++)
63        {
64                // IF incident is collapsed THEN
65                if (!this[i].expanded)
66                {
67                        // expand incident
68                        this[i].expandAction();
69                }
70        }
71}
72
73/**
74 * Adds an Incident.
75 * @param incident {Incident} The Incident to be added.
76 */
77function incidents_add(incident)
78{
79        incidents.push(incident);
80}
Note: See TracBrowser for help on using the repository browser.