4 <META http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <TITLE>Samba Admin Console</TITLE>
7 <LINK type="text/css" rel="stylesheet" href="../../resource/css/layout-samba.css"/>
10 type="text/css" rel="stylesheet" href="../../resource/css/layout-samba.css"/>
12 <SCRIPT type="text/javascript" src="../../script/qx.js"></SCRIPT>
14 <!--> Include plug-in applications <!-->
15 <SCRIPT type="text/javascript" src="../../plug-ins/echo.js"></SCRIPT>
16 <SCRIPT type="text/javascript" src="../../plug-ins/nbt_stats.js"></SCRIPT>
20 <SCRIPT type="text/javascript" src="../../script/layout-samba.js"></SCRIPT>
21 <DIV style="position: absolute; background-color: transparent; right:0; top:0; z-index: 1000000001;">
22 <IMG src="../../../images/logo.png">
26 Samba Administrative Console
28 <SCRIPT type="text/javascript">
30 // All global variables will be members of this object.
31 globals = new Object();
33 //paneWidget is the split-pane.
34 globals.paneWidget = qx.ui.splitpane.SplitPane;
36 //appTree is paneWidget's left pane.
37 globals.appTree = new Object();
39 //appInstance is paneWidget's right pane.
40 globals.appInstance = new qx.ui.layout.CanvasLayout();
42 function createApplicationTree() {
43 var app_treeRowStructure =
44 qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard(
46 "icon/16/desktop.png",
47 "icon/16/dictionary.png");
49 qx.ui.treefullcontrol.Tree(app_treeRowStructure);
52 setBackgroundColor(255);
53 setBorder(qx.renderer.border.BorderPresets.getInstance().inset);
54 setOverflow("scrollY");
59 app_tree.getManager().addEventListener("changeSelection", function(e) {
61 sel = app_tree.getSelectedElement();
62 var appName = sel.getUserData("PlugIn Name");
63 this.debug("changeSelection: " + appName);
64 var obj = sel.getUserData("PlugIn Object");
66 obj.display(globals.appInstance);
73 function addButtonClickHandler(addMenu, el, e) {
74 if (addMenu.isSeeable()) {
77 addMenu.setLeft(qx.dom.DomLocation.getPageBoxLeft(el));
78 addMenu.setTop(qx.dom.DomLocation.getPageBoxBottom(el));
83 function removeButtonExecuteHandler() {
84 // Get list of installed plug-in applications.
85 // Display list as a menu
88 function aboutButtonExecuteHandler(aboutWindow) {
92 function addMenuButtonExecuteHandler(plugInName, plugIn) {
94 qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard(plugInName);
96 new qx.ui.treefullcontrol.TreeFolder(treeRowStructure);
98 treeElement.setUserData("PlugIn Name", plugInName);
99 treeElement.setUserData("PlugIn Object", plugIn);
101 globals.appTree.add(treeElement);
103 // Select the most recently added plugin in the tree-menu.
104 globals.appTree.setSelectedElement(globals.appTree.getLastTreeChild());
106 plugIn.display(globals.appInstance);
109 function createConsoleButtons(mainWindow) {
110 // Get list of available plug-in applications.
111 // Display list of applications as a menu.
112 var addMenu = new qx.ui.menu.Menu();
113 var descriptionMenuButton =
114 new qx.ui.menu.MenuButton("Select a plug-in.");
115 var menuSeparator = new qx.ui.menu.MenuSeparator();
116 var echoMenuButton = new qx.ui.menu.MenuButton("Echo");
118 with (echoMenuButton) {
119 addEventListener("execute", function(e) {
120 this.debug("executed: " + this.getLabel());
121 var plugIn = new EchoPlugIn();
122 addMenuButtonExecuteHandler("Echo Test", plugIn);
126 var NBTStatsMenuButton =
127 new qx.ui.menu.MenuButton("NBT Packet Statistics");
129 with (NBTStatsMenuButton) {
130 addEventListener("execute", function(e) {
131 this.debug("executed: " + this.getLabel());
132 var plugIn = new NBTStatsPlugIn();
133 addMenuButtonExecuteHandler("NBT Packet Statistics", plugIn);
137 addMenu.add(descriptionMenuButton);
138 addMenu.add(menuSeparator);
139 addMenu.add(echoMenuButton);
140 addMenu.add(NBTStatsMenuButton);
142 mainWindow.add(addMenu);
144 var addButton = new qx.ui.form.Button("Add Plug-in");
150 addEventListener("click", function(e) {
151 this.debug("clicked: " + this.getLabel());
152 var el = this.getElement();
153 addButtonClickHandler(addMenu, el);
154 e.setPropagationStopped(true);
157 addEventListener("mousedown", function(e) {
158 this.debug("mousedown: " + this.getLabel());
159 e.setPropagationStopped(true);
165 var removeButton = new qx.ui.form.Button("Remove Plug-in");
166 with (removeButton) {
170 addEventListener("execute", function(e) {
171 this.debug("Executed: " + this.getLabel());
172 removeButtonExecuteHandler();
178 var aboutWindow = new qx.ui.window.Window("About");
179 aboutWindow.setSpace(100, "auto", 100, "auto");
180 aboutWindow.setModal(false);
181 aboutWindow.setShowMinimize(false);
182 aboutWindow.setShowMaximize(false);
184 var aboutText = new qx.ui.basic.Label("Blah.");
185 aboutWindow.add(aboutText);
187 mainWindow.add(aboutWindow);
189 var aboutButton = new qx.ui.form.Button("About");
194 addEventListener("execute", function(e) {
195 this.debug("Executed: " + this.getLabel());
196 aboutButtonExecuteHandler(aboutWindow);
201 mainWindow.add(addButton);
202 mainWindow.add(removeButton);
203 mainWindow.add(aboutButton);
206 qx.core.Init.getInstance().defineMain(
208 // Enable JSON-RPC debugging.
209 qx.Settings.setCustomOfClass("qx.io.Json", "enableDebug", true);
211 var consoleFrame = new qx.ui.layout.CanvasLayout;
212 consoleFrame.setLocation(0,60);
213 consoleFrame.setBottom(120);
214 consoleFrame.setRight(280);
215 consoleFrame.setPadding(20);
217 consoleFrame.addToDocument();
219 var mainWindow = new qx.ui.window.Window("Console");
220 mainWindow.setSpace(0, 700, 0, 400);
221 mainWindow.allowMinimize = false;
222 mainWindow.showMinimize = false;
224 // The default window move method is slow.
225 mainWindow.setMoveMethod("frame");
227 consoleFrame.add(mainWindow);
229 // We need buttons to add and remove plug-ins.
230 createConsoleButtons(mainWindow);
233 globals.paneWidget = new qx.ui.splitpane.HorizontalSplitPane("1*","2*");
234 globals.paneWidget.setEdge(28,0);
235 globals.paneWidget.setLiveResize(true);
237 mainWindow.add(globals.paneWidget);
239 // plug-in application tree is on the left.
240 globals.appTree = createApplicationTree();
242 globals.paneWidget.addLeft(globals.appTree);
244 // What is drawn in the right pane is up to the plug-in.
245 // It is a blank canvas for now.
246 globals.appInstance.setTop(0);
247 globals.appInstance.setLeft(0);
248 globals.appInstance.setBottom(50);
249 globals.appInstance.setRight(20);
251 globals.paneWidget.addRight(globals.appInstance);