diff options
Diffstat (limited to 'web-gui/logging/source/class/logging')
-rw-r--r-- | web-gui/logging/source/class/logging/Application.js | 100 | ||||
-rw-r--r-- | web-gui/logging/source/class/logging/list/Line.js | 55 | ||||
-rw-r--r-- | web-gui/logging/source/class/logging/list/List.js | 65 | ||||
-rw-r--r-- | web-gui/logging/source/class/logging/test/DemoTest.js | 55 | ||||
-rw-r--r-- | web-gui/logging/source/class/logging/theme/Appearance.js | 18 | ||||
-rw-r--r-- | web-gui/logging/source/class/logging/theme/Color.js | 18 | ||||
-rw-r--r-- | web-gui/logging/source/class/logging/theme/Decoration.js | 18 | ||||
-rw-r--r-- | web-gui/logging/source/class/logging/theme/Font.js | 18 | ||||
-rw-r--r-- | web-gui/logging/source/class/logging/theme/Theme.js | 21 |
9 files changed, 368 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]); + } + } +} +}); diff --git a/web-gui/logging/source/class/logging/list/Line.js b/web-gui/logging/source/class/logging/list/Line.js new file mode 100644 index 0000000..1da9818 --- /dev/null +++ b/web-gui/logging/source/class/logging/list/Line.js @@ -0,0 +1,55 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +/** + * This is the main application class of your custom application "logging" + */ +qx.Class.define("logging.list.Line", +{ +extend : qx.ui.basic.Label, + +/* +***************************************************************************** + PROPERTIES +***************************************************************************** +*/ +properties: { + appearance: { + refine: true, + init: "list-line" + }, + even: { + init: false, + apply: "__applyEven", + check: "Boolean" + } +}, + +construct: function(text, even) { + this.base(arguments, text); + this.setEven(even); + this.setAllowGrowX(true); + this.setAllowShrinkX(false); + this.setRich(true); +}, + +/* +***************************************************************************** + MEMBERS +***************************************************************************** +*/ +members : +{ + __applyEven: function(val) { + this.replaceState(val ? "odd" : "even", val ? "even" : "odd"); + } +} +}); + diff --git a/web-gui/logging/source/class/logging/list/List.js b/web-gui/logging/source/class/logging/list/List.js new file mode 100644 index 0000000..34560a9 --- /dev/null +++ b/web-gui/logging/source/class/logging/list/List.js @@ -0,0 +1,65 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +/** + * This is the main application class of your custom application "logging" + */ +qx.Class.define("logging.list.List", +{ +extend : qx.ui.container.Scroll, + +/* +***************************************************************************** + PROPERTIES +***************************************************************************** +*/ +properties: { + appearance: { + refine: true, + init: "list" + }, + maxSize: { + init: 200, + check: "Integer", + apply: "__applyMaxSize" + } +}, + +construct: function() { + this.__list = new qx.ui.container.Composite(new qx.ui.layout.VBox()); + this.base(arguments, this.__list); +}, +destruct: function() { + this._disposeObjects("__list"); +}, + +/* +***************************************************************************** + MEMBERS +***************************************************************************** +*/ +members : +{ + __list: null, + __last: false, + + addLine: function(text) { + this.__last = !this.__last; + var l = new logging.list.Line(text, this.__last); + this.__list.add(l); + this.__applyMaxSize(this.getMaxSize()); + }, + __applyMaxSize: function(val) { + while (this.__list.getChildren().length > val) + this.__list.removeAt(0); + } +} +}); + diff --git a/web-gui/logging/source/class/logging/test/DemoTest.js b/web-gui/logging/source/class/logging/test/DemoTest.js new file mode 100644 index 0000000..0bfab5a --- /dev/null +++ b/web-gui/logging/source/class/logging/test/DemoTest.js @@ -0,0 +1,55 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +/** + * This class demonstrates how to define unit tests for your application. + * + * Execute <code>generate.py test</code> to generate a testrunner application + * and open it from <tt>test/index.html</tt> + * + * The methods that contain the tests are instance methods with a + * <code>test</code> prefix. You can create an arbitrary number of test + * classes like this one. They can be organized in a regular class hierarchy, + * i.e. using deeper namespaces and a corresponding file structure within the + * <tt>test</tt> folder. + */ +qx.Class.define("logging.test.DemoTest", +{ + extend : qx.dev.unit.TestCase, + + members : + { + /* + --------------------------------------------------------------------------- + TESTS + --------------------------------------------------------------------------- + */ + + /** + * Here are some simple tests + */ + testSimple : function() + { + this.assertEquals(4, 3+1, "This should never fail!"); + this.assertFalse(false, "Can false be true?!"); + }, + + /** + * Here are some more advanced tests + */ + testAdvanced: function () + { + var a = 3; + var b = a; + this.assertIdentical(a, b, "A rose by any other name is still a rose"); + this.assertInRange(3, 1, 10, "You must be kidding, 3 can never be outside [1,10]!"); + } + } +}); diff --git a/web-gui/logging/source/class/logging/theme/Appearance.js b/web-gui/logging/source/class/logging/theme/Appearance.js new file mode 100644 index 0000000..1b0ba64 --- /dev/null +++ b/web-gui/logging/source/class/logging/theme/Appearance.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("logging.theme.Appearance", +{ + extend : qx.theme.modern.Appearance, + + appearances : + { + } +});
\ No newline at end of file diff --git a/web-gui/logging/source/class/logging/theme/Color.js b/web-gui/logging/source/class/logging/theme/Color.js new file mode 100644 index 0000000..fb7ac5e --- /dev/null +++ b/web-gui/logging/source/class/logging/theme/Color.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("logging.theme.Color", +{ + extend : qx.theme.modern.Color, + + colors : + { + } +});
\ No newline at end of file diff --git a/web-gui/logging/source/class/logging/theme/Decoration.js b/web-gui/logging/source/class/logging/theme/Decoration.js new file mode 100644 index 0000000..4601f7f --- /dev/null +++ b/web-gui/logging/source/class/logging/theme/Decoration.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("logging.theme.Decoration", +{ + extend : qx.theme.modern.Decoration, + + decorations : + { + } +});
\ No newline at end of file diff --git a/web-gui/logging/source/class/logging/theme/Font.js b/web-gui/logging/source/class/logging/theme/Font.js new file mode 100644 index 0000000..0875c53 --- /dev/null +++ b/web-gui/logging/source/class/logging/theme/Font.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("logging.theme.Font", +{ + extend : qx.theme.modern.Font, + + fonts : + { + } +});
\ No newline at end of file diff --git a/web-gui/logging/source/class/logging/theme/Theme.js b/web-gui/logging/source/class/logging/theme/Theme.js new file mode 100644 index 0000000..87d14f7 --- /dev/null +++ b/web-gui/logging/source/class/logging/theme/Theme.js @@ -0,0 +1,21 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("logging.theme.Theme", +{ + meta : + { + color : logging.theme.Color, + decoration : logging.theme.Decoration, + font : logging.theme.Font, + icon : qx.theme.icon.Tango, + appearance : logging.theme.Appearance + } +});
\ No newline at end of file |