diff options
Diffstat (limited to 'web-gui/logging/source/class/logging/Application.js')
-rw-r--r-- | web-gui/logging/source/class/logging/Application.js | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/web-gui/logging/source/class/logging/Application.js b/web-gui/logging/source/class/logging/Application.js new file mode 100644 index 0000000..c715d5e --- /dev/null +++ b/web-gui/logging/source/class/logging/Application.js @@ -0,0 +1,100 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +/* ************************************************************************ + +#asset(logging/*) + +************************************************************************ */ + +/** + * This is the main application class of your custom application "logging" + */ +qx.Class.define("logging.Application", +{ +extend : qx.application.Standalone, + + + +/* +***************************************************************************** + MEMBERS +***************************************************************************** +*/ + +members : +{ + __list: null, + __rpc: null, + __call: null, + __last: 0, + + /** + * This method contains the initial application code and gets called + * during startup of the application + * + * @lint ignoreDeprecated(alert) + */ + main : function() + { + // Call super class + this.base(arguments); + + // Enable logging in debug variant + if (qx.core.Variant.isSet("qx.debug", "on")) + { + // support native logging capabilities, e.g. Firebug for Firefox + qx.log.appender.Native; + // support additional cross-browser console. Press F7 to toggle visibility + qx.log.appender.Console; + } + + /* + ------------------------------------------------------------------------- + Below is your actual application code... + ------------------------------------------------------------------------- + */ + + var doc = this.getRoot(); + doc.setBackgroundColor("#ffffff"); + + var back = new qx.ui.basic.Image("logging/back.png"); + back.setScale(true); + doc.add(back, {left:0, top: 0}); + + this.__list = new logging.list.List(); + doc.add(this.__list, {left:"15%", top: "10%", width: "70%", height: "80%"}); + + this.__rpc = new qx.io.remote.Rpc("http://localhost:8080/rpc", "com.pengutronix.jdb.systeminfo|/"); + + var timer = new qx.event.Timer(2000); + timer.addListener("interval", this.__tick, this); + timer.start(); + }, + __tick: function() { + if (this.__call != null) { + this.__rpc.abort(this.__call); + } + this.__call = this.__rpc.callAsync( + qx.lang.Function.bind(this.__callback, this), + "com.pengutronix.jdb.SystemInfo.Syslog", "i", this.__last); + }, + __callback: function(ret, err, id) { + this.__call = null; + if (err != null) { + return; + } + this.__last = ret.last; + for (var i = 0; i < ret.data.length; ++i) { + this.__list.addLine(ret.data[i]); + } + } +} +}); |