From 161a7ba4a460f06ee15969eaf9352f25e9aa5663 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Wed, 16 Jun 2010 16:20:54 +0200 Subject: [logging] add new demo Signed-off-by: Michael Olbrich --- web-gui/Makefile.am | 3 +- web-gui/logging/Makefile.am | 30 +++++++ web-gui/logging/Manifest.json | 34 +++++++ web-gui/logging/config.json.in | 78 ++++++++++++++++ web-gui/logging/generate.py.in | 72 +++++++++++++++ .../logging/source/class/logging/Application.js | 100 +++++++++++++++++++++ web-gui/logging/source/class/logging/list/Line.js | 55 ++++++++++++ web-gui/logging/source/class/logging/list/List.js | 65 ++++++++++++++ .../logging/source/class/logging/test/DemoTest.js | 55 ++++++++++++ .../source/class/logging/theme/Appearance.js | 18 ++++ .../logging/source/class/logging/theme/Color.js | 18 ++++ .../source/class/logging/theme/Decoration.js | 18 ++++ web-gui/logging/source/class/logging/theme/Font.js | 18 ++++ .../logging/source/class/logging/theme/Theme.js | 21 +++++ web-gui/logging/source/index.html | 9 ++ web-gui/logging/source/resource/logging/back.png | Bin 0 -> 98107 bytes web-gui/logging/source/resource/logging/test.png | Bin 0 -> 2478 bytes web-gui/logging/source/translation/readme.txt | 3 + 18 files changed, 596 insertions(+), 1 deletion(-) create mode 100644 web-gui/logging/Makefile.am create mode 100644 web-gui/logging/Manifest.json create mode 100644 web-gui/logging/config.json.in create mode 100755 web-gui/logging/generate.py.in create mode 100644 web-gui/logging/source/class/logging/Application.js create mode 100644 web-gui/logging/source/class/logging/list/Line.js create mode 100644 web-gui/logging/source/class/logging/list/List.js create mode 100644 web-gui/logging/source/class/logging/test/DemoTest.js create mode 100644 web-gui/logging/source/class/logging/theme/Appearance.js create mode 100644 web-gui/logging/source/class/logging/theme/Color.js create mode 100644 web-gui/logging/source/class/logging/theme/Decoration.js create mode 100644 web-gui/logging/source/class/logging/theme/Font.js create mode 100644 web-gui/logging/source/class/logging/theme/Theme.js create mode 100644 web-gui/logging/source/index.html create mode 100644 web-gui/logging/source/resource/logging/back.png create mode 100644 web-gui/logging/source/resource/logging/test.png create mode 100644 web-gui/logging/source/translation/readme.txt (limited to 'web-gui') diff --git a/web-gui/Makefile.am b/web-gui/Makefile.am index 891ba41..6a38f4b 100644 --- a/web-gui/Makefile.am +++ b/web-gui/Makefile.am @@ -2,7 +2,8 @@ SUBDIRS = \ hello-world \ calculator \ - live + live \ + logging all: index.html diff --git a/web-gui/logging/Makefile.am b/web-gui/logging/Makefile.am new file mode 100644 index 0000000..c0553fc --- /dev/null +++ b/web-gui/logging/Makefile.am @@ -0,0 +1,30 @@ + +QOOXDOO_SOURCE = \ + Manifest.json \ + generate.py \ + source/resource/logging/back.png \ + source/index.html \ + source/translation/readme.txt \ + source/class/logging/Application.js \ + source/class/logging/list/Line.js \ + source/class/logging/list/List.js \ + source/class/logging/test/DemoTest.js \ + source/class/logging/theme/Color.js \ + source/class/logging/theme/Theme.js \ + source/class/logging/theme/Decoration.js \ + source/class/logging/theme/Font.js \ + source/class/logging/theme/Appearance.js + +all: + ./generate.py build + +clean-local: + rm -rf build + +EXTRA_DIST = \ + config.json.in \ + $(QOOXDOO_SOURCE) + +MAINTAINERCLEANFILES = \ + Makefile.in + diff --git a/web-gui/logging/Manifest.json b/web-gui/logging/Manifest.json new file mode 100644 index 0000000..8a7c86d --- /dev/null +++ b/web-gui/logging/Manifest.json @@ -0,0 +1,34 @@ +{ + "info" : + { + "name" : "logging", + + "summary" : "Custom Application", + "description" : "This is a skeleton for a custom application with qooxdoo.", + + "homepage" : "http://some.homepage.url/", + + "license" : "SomeLicense", + "authors" : + [ + { + "name" : "First Author (uid)", + "email" : "first.author@some.domain" + } + ], + + "version" : "trunk", + "qooxdoo-versions": ["1.1"] + }, + + "provides" : + { + "namespace" : "logging", + "encoding" : "utf-8", + "class" : "source/class", + "resource" : "source/resource", + "translation" : "source/translation", + "type" : "application" + } +} + diff --git a/web-gui/logging/config.json.in b/web-gui/logging/config.json.in new file mode 100644 index 0000000..ae5685d --- /dev/null +++ b/web-gui/logging/config.json.in @@ -0,0 +1,78 @@ +{ + "name" : "logging", + + "include" : + [ + { + "path" : "${QOOXDOO_PATH}/tool/data/config/application.json" + } + ], + + "export" : + [ + "api", + "build", + "clean", + "distclean", + "fix", + "info", + "inspector", + "lint", + "migration", + "pretty", + "profiling", + "source", + "source-all", + "test", + "test-source", + "translation" + ], + + "let" : + { + "APPLICATION" : "logging", + "QOOXDOO_PATH" : "@QOOXDOO_SDK@", + "QXTHEME" : "logging.theme.Theme", + "API_EXCLUDE" : ["qx.test.*", "${APPLICATION}.theme.*", "${APPLICATION}.test.*"], + "LOCALES" : [ "en" ], + "CACHE" : "@abs_builddir@/../qooxdoo-cache", + "BUILD_PATH" : "@abs_builddir@/build", + "ROOT" : "@abs_srcdir@" + } + + // You only need to edit the remainder of this file, if you want to customize + // specific jobs, or add own job definitions. + + /* + "jobs" : + { + // Uncomment the following entry to add a contrib or library to your + // project; make sure to adapt the path to the Manifest.json; if you are + // using a contrib: library, it will be downloaded into the path specified + // by the 'cache/downloads' config key + "libraries" : + { + "library" : + [ + { + "manifest" : "contrib://SkeletonApplication/trunk/Manifest.json" + } + ] + }, + + // If you want to tweak a job setting, see the following sample where + // the "format" feature of the "build-script" job is overridden. + // To see a list of available jobs, invoke 'generate.py x'. + "build-script" : + { + "compile-options" : + { + "code" : + { + "format" : false + } + } + } + } + */ +} diff --git a/web-gui/logging/generate.py.in b/web-gui/logging/generate.py.in new file mode 100755 index 0000000..2e1f102 --- /dev/null +++ b/web-gui/logging/generate.py.in @@ -0,0 +1,72 @@ +#!/usr/bin/env python +################################################################################ +# +# qooxdoo - the new era of web development +# +# http://qooxdoo.org +# +# Copyright: +# 2008 - 2009 1&1 Internet AG, Germany, http://www.1und1.de +# +# License: +# LGPL: http://www.gnu.org/licenses/lgpl.html +# EPL: http://www.eclipse.org/org/documents/epl-v10.php +# See the LICENSE file in the project's top-level directory for details. +# +# Authors: +# * Thomas Herchenroeder (thron7) +# +################################################################################ + +## +# This is a stub proxy for the real generator.py +## + +import sys, os, re, subprocess + +CMD_PYTHON = 'python' +QOOXDOO_PATH = '@QOOXDOO_SDK@' + +def getQxPath(): + path = QOOXDOO_PATH + # try updating from config file + if os.path.exists('config.json'): + # "using QOOXDOO_PATH from config.json" + qpathr=re.compile(r'"QOOXDOO_PATH"\s*:\s*"([^"]*)"\s*,?') + conffile = open('config.json') + aconffile = conffile.readlines() + for line in aconffile: + mo = qpathr.search(line) + if mo: + path = mo.group(1) + break # assume first occurrence is ok + path = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), path)) + + return path + +os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # switch to skeleton dir +qxpath = getQxPath() +REAL_GENERATOR = os.path.join(qxpath, 'tool', 'bin', 'generator.py') + +if not os.path.exists(REAL_GENERATOR): + print "Cannot find real generator script under: \"%s\"; aborting" % REAL_GENERATOR + sys.exit(1) + +argList = [] +argList.append(CMD_PYTHON) +argList.append(REAL_GENERATOR) +argList.extend(sys.argv[1:]) +if sys.platform == "win32": + argList1=[] + for arg in argList: + if arg.find(' ')>-1: + argList1.append('"%s"' % arg) + else: + argList1.append(arg) + argList = argList1 +else: + argList = ['"%s"' % x for x in argList] # quote argv elements + +cmd = " ".join(argList) +retval = subprocess.call(cmd, shell=True) +sys.exit(retval) 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 generate.py test to generate a testrunner application + * and open it from test/index.html + * + * The methods that contain the tests are instance methods with a + * test 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 + * test 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 diff --git a/web-gui/logging/source/index.html b/web-gui/logging/source/index.html new file mode 100644 index 0000000..2e0d609 --- /dev/null +++ b/web-gui/logging/source/index.html @@ -0,0 +1,9 @@ + + + + + logging + + + + diff --git a/web-gui/logging/source/resource/logging/back.png b/web-gui/logging/source/resource/logging/back.png new file mode 100644 index 0000000..fd06541 Binary files /dev/null and b/web-gui/logging/source/resource/logging/back.png differ diff --git a/web-gui/logging/source/resource/logging/test.png b/web-gui/logging/source/resource/logging/test.png new file mode 100644 index 0000000..ef360cd Binary files /dev/null and b/web-gui/logging/source/resource/logging/test.png differ diff --git a/web-gui/logging/source/translation/readme.txt b/web-gui/logging/source/translation/readme.txt new file mode 100644 index 0000000..66975e6 --- /dev/null +++ b/web-gui/logging/source/translation/readme.txt @@ -0,0 +1,3 @@ +This directory will contain translation (.po) files once you run the +'translation' job in your project. + -- cgit v1.2.3