summaryrefslogtreecommitdiff
path: root/webapps/swat/source/class/swat/main/Main.js
blob: bf90f3206888ca86ef9f92d51d847f26e4a1dcf1 (plain)
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
/*
 * Copyright:
 *   (C) 2006 by Derrell Lipman
 *       All rights reserved
 *
 * License:
 *   LGPL 2.1: http://creativecommons.org/licenses/LGPL/2.1/
 */

/*
#require(swat.main.Module)
#require(swat.main.AbstractModule)
#require(swat.main.Authenticate);
*/

/**
 * Swat main menu
 */
qx.OO.defineClass("swat.main.Main", qx.component.AbstractApplication,
function()
{
  qx.component.AbstractApplication.call(this);
});

/*
 * Register our supported modules.  The order listed here is the order they
 * will appear in the Modules menu.
 */

//#require(swat.module.statistics.Statistics)
new swat.main.Module("Status and Statistics",
                     swat.module.statistics.Statistics);

//#require(swat.module.ldbbrowse.LdbBrowse)
new swat.main.Module("LDB Browser",
                     swat.module.ldbbrowse.LdbBrowse);

//#require(swat.module.documentation.Documentation)
//#require(apiviewer.Viewer)
new swat.main.Module("API Documentation",
                     swat.module.documentation.Documentation);


/*
---------------------------------------------------------------------------
  METHODS
---------------------------------------------------------------------------
*/

qx.Proto.initialize = function()
{
  // Set the resource URI
  qx.Settings.setCustom("resourceUri", "./resource");

  // Turn on JSON debugging for the time being
  qx.Settings.setCustomOfClass("qx.io.Json", "enableDebug", true);

  // For each module...
  var moduleList = swat.main.Module.getList();
  for (moduleName in moduleList)
  {
    // ... call the module's buildInitialFsm() function
    var module = moduleList[moduleName]["clazz"].getInstance();
    module.buildInitialFsm(moduleList[moduleName]);
  }
};


qx.Proto.main = function()
{
  var moduleList = swat.main.Module.getList();

  // Initialize the gui for the main menu
  swat.main.Gui.buildGui(moduleList);

  // Similarly, now that we have a canvas for each module, ...
  for (moduleName in moduleList)
  {
    // ... call the module's buildInitialGui() function
    var module = moduleList[moduleName]["clazz"].getInstance();
    module.buildInitialGui(moduleList[moduleName]);
  }
};


qx.Proto.finalize = function()
{
  // Call each module's finalization function
  var moduleList = swat.main.Module.getList();
  for (moduleName in moduleList)
  {
    var module = moduleList[moduleName]["clazz"].getInstance();
    module.finalize(moduleList[moduleName]);
  }
};