From a3cb2d540dda9c5738afd3f11e37e5cfcbccca8a Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Wed, 16 Jun 2010 15:33:42 +0200 Subject: [live] new demo application Signed-off-by: Michael Olbrich --- configure.ac | 3 + web-gui/Makefile.am | 3 +- web-gui/live/Makefile.am | 30 +++++ web-gui/live/Manifest.json | 34 ++++++ web-gui/live/config.json.in | 78 +++++++++++++ web-gui/live/generate.py.in | 72 ++++++++++++ web-gui/live/source/class/live/Application.js | 128 +++++++++++++++++++++ web-gui/live/source/class/live/test/DemoTest.js | 55 +++++++++ web-gui/live/source/class/live/theme/Appearance.js | 18 +++ web-gui/live/source/class/live/theme/Color.js | 18 +++ web-gui/live/source/class/live/theme/Decoration.js | 18 +++ web-gui/live/source/class/live/theme/Font.js | 28 +++++ web-gui/live/source/class/live/theme/Theme.js | 21 ++++ web-gui/live/source/index.html | 9 ++ web-gui/live/source/resource/live/back.png | Bin 0 -> 98107 bytes .../live/source/resource/live/network-offline.png | Bin 0 -> 2789 bytes .../live/source/resource/live/network-online.png | Bin 0 -> 2779 bytes web-gui/live/source/translation/readme.txt | 3 + 18 files changed, 517 insertions(+), 1 deletion(-) create mode 100644 web-gui/live/Makefile.am create mode 100644 web-gui/live/Manifest.json create mode 100644 web-gui/live/config.json.in create mode 100755 web-gui/live/generate.py.in create mode 100644 web-gui/live/source/class/live/Application.js create mode 100644 web-gui/live/source/class/live/test/DemoTest.js create mode 100644 web-gui/live/source/class/live/theme/Appearance.js create mode 100644 web-gui/live/source/class/live/theme/Color.js create mode 100644 web-gui/live/source/class/live/theme/Decoration.js create mode 100644 web-gui/live/source/class/live/theme/Font.js create mode 100644 web-gui/live/source/class/live/theme/Theme.js create mode 100644 web-gui/live/source/index.html create mode 100644 web-gui/live/source/resource/live/back.png create mode 100644 web-gui/live/source/resource/live/network-offline.png create mode 100644 web-gui/live/source/resource/live/network-online.png create mode 100644 web-gui/live/source/translation/readme.txt diff --git a/configure.ac b/configure.ac index 8f896aa..46d7c75 100644 --- a/configure.ac +++ b/configure.ac @@ -54,10 +54,13 @@ AC_CONFIG_FILES([ web-gui/hello-world/config.json web-gui/calculator/Makefile web-gui/calculator/config.json + web-gui/live/Makefile + web-gui/live/config.json ]) AC_CONFIG_FILES([run.sh],[chmod +x run.sh]) AC_CONFIG_FILES([web-gui/hello-world/generate.py],[chmod +x web-gui/hello-world/generate.py]) AC_CONFIG_FILES([web-gui/calculator/generate.py],[chmod +x web-gui/calculator/generate.py]) +AC_CONFIG_FILES([web-gui/live/generate.py],[chmod +x web-gui/live/generate.py]) AC_OUTPUT diff --git a/web-gui/Makefile.am b/web-gui/Makefile.am index 5cf8e07..891ba41 100644 --- a/web-gui/Makefile.am +++ b/web-gui/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = \ hello-world \ - calculator + calculator \ + live all: index.html diff --git a/web-gui/live/Makefile.am b/web-gui/live/Makefile.am new file mode 100644 index 0000000..4bc47f1 --- /dev/null +++ b/web-gui/live/Makefile.am @@ -0,0 +1,30 @@ + +QOOXDOO_SOURCE = \ + Manifest.json \ + generate.py \ + source/resource/live/back.png \ + source/resource/live/network-offline.png \ + source/resource/live/network-online.png \ + source/index.html \ + source/translation/readme.txt \ + source/class/live/Application.js \ + source/class/live/test/DemoTest.js \ + source/class/live/theme/Color.js \ + source/class/live/theme/Theme.js \ + source/class/live/theme/Decoration.js \ + source/class/live/theme/Font.js \ + source/class/live/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/live/Manifest.json b/web-gui/live/Manifest.json new file mode 100644 index 0000000..578336a --- /dev/null +++ b/web-gui/live/Manifest.json @@ -0,0 +1,34 @@ +{ + "info" : + { + "name" : "live", + + "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" : "live", + "encoding" : "utf-8", + "class" : "source/class", + "resource" : "source/resource", + "translation" : "source/translation", + "type" : "application" + } +} + diff --git a/web-gui/live/config.json.in b/web-gui/live/config.json.in new file mode 100644 index 0000000..410dd31 --- /dev/null +++ b/web-gui/live/config.json.in @@ -0,0 +1,78 @@ +{ + "name" : "live", + + "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" : "live", + "QOOXDOO_PATH" : "@QOOXDOO_SDK@", + "QXTHEME" : "live.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/live/generate.py.in b/web-gui/live/generate.py.in new file mode 100755 index 0000000..2e1f102 --- /dev/null +++ b/web-gui/live/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/live/source/class/live/Application.js b/web-gui/live/source/class/live/Application.js new file mode 100644 index 0000000..193e506 --- /dev/null +++ b/web-gui/live/source/class/live/Application.js @@ -0,0 +1,128 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +/* ************************************************************************ + +#asset(live/*) + +************************************************************************ */ + +/** + * This is the main application class of your custom application "live" + */ +qx.Class.define("live.Application", +{ +extend : qx.application.Standalone, + +properties: { + online: { + init: false, + apply: "__applyOnline", + check: "Boolean" + } +}, + + +/* +***************************************************************************** + MEMBERS +***************************************************************************** +*/ + +members : +{ + __rpc: null, + __call: null, + __statusImageOn: null, + __statusImageOff: null, + __statusStack: null, + __label: null, + /** + * 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... + ------------------------------------------------------------------------- + */ + + // Document is the application root + var doc = this.getRoot(); + doc.setBackgroundColor("#ffffff"); + + var back = new qx.ui.basic.Image("live/back.png"); + back.setScale(true); + doc.add(back, {left:0, top: 0}); + + this.__label = new qx.ui.basic.Label("The Server is"); + doc.add(this.__label, {left:50, top: 50}); + this.__statusStack = new qx.ui.container.Stack(); + this.__statusStack.setAllowGrowX(false); + this.__statusStack.setAllowGrowY(false); + doc.add(this.__statusStack, {left:100, top: 100}); + this.__statusImageOn = new qx.ui.basic.Image("live/network-online.png"); + this.__statusStack.add(this.__statusImageOn); + this.__statusImageOff = new qx.ui.basic.Image("live/network-offline.png"); + this.__statusStack.add(this.__statusImageOff); + this.__statusStack.setSelection([this.__statusImageOff]); + + this.__rpc = new qx.io.remote.Rpc("http://localhost:8080/rpc", "com.pengutronix.jdb.Hello|/"); + + var timer = new qx.event.Timer(1000); + timer.addListener("interval", this.__tick, this); + timer.start(); + }, + __applyOnline: function(online) { + if (online) { + this.__statusStack.setSelection([this.__statusImageOn]); + this.__label.setValue("The Server is online."); + } + else { + this.__statusStack.setSelection([this.__statusImageOff]); + this.__label.setValue("The Server is offline."); + } + }, + __tick : function() + { + if (this.__call != null) { + this.__rpc.abort(this.__call); + this.setOnline(false); + } + this.__call = this.__rpc.callAsync( + qx.lang.Function.bind(this.__callback, this), + "com.pengutronix.jdb.Hello.HelloWorld"); + }, + __callback: function(ret, err, id) { + this.__call = null; + if (err != null) { + this.setOnline(false); + return; + } + this.setOnline(true); + } +} +}); diff --git a/web-gui/live/source/class/live/test/DemoTest.js b/web-gui/live/source/class/live/test/DemoTest.js new file mode 100644 index 0000000..0846cc7 --- /dev/null +++ b/web-gui/live/source/class/live/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("live.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/live/source/class/live/theme/Appearance.js b/web-gui/live/source/class/live/theme/Appearance.js new file mode 100644 index 0000000..0cd7600 --- /dev/null +++ b/web-gui/live/source/class/live/theme/Appearance.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("live.theme.Appearance", +{ + extend : qx.theme.modern.Appearance, + + appearances : + { + } +}); \ No newline at end of file diff --git a/web-gui/live/source/class/live/theme/Color.js b/web-gui/live/source/class/live/theme/Color.js new file mode 100644 index 0000000..23114cc --- /dev/null +++ b/web-gui/live/source/class/live/theme/Color.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("live.theme.Color", +{ + extend : qx.theme.modern.Color, + + colors : + { + } +}); \ No newline at end of file diff --git a/web-gui/live/source/class/live/theme/Decoration.js b/web-gui/live/source/class/live/theme/Decoration.js new file mode 100644 index 0000000..602f6c9 --- /dev/null +++ b/web-gui/live/source/class/live/theme/Decoration.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("live.theme.Decoration", +{ + extend : qx.theme.modern.Decoration, + + decorations : + { + } +}); \ No newline at end of file diff --git a/web-gui/live/source/class/live/theme/Font.js b/web-gui/live/source/class/live/theme/Font.js new file mode 100644 index 0000000..7abc09e --- /dev/null +++ b/web-gui/live/source/class/live/theme/Font.js @@ -0,0 +1,28 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("live.theme.Font", +{ + extend : qx.theme.modern.Font, + + fonts : + { + "default" : + { + size : (qx.bom.client.System.WINVISTA || qx.bom.client.System.WIN7) ? 25 : 22, + lineHeight : 1.4, + family : qx.bom.client.Platform.MAC ? [ "Lucida Grande" ] : + (qx.bom.client.System.WINVISTA || qx.bom.client.System.WIN7) ? + [ "Segoe UI", "Candara" ] : + [ "Tahoma", "Liberation Sans", "Arial", "sans-serif" ], + bold : true + } + } +}); diff --git a/web-gui/live/source/class/live/theme/Theme.js b/web-gui/live/source/class/live/theme/Theme.js new file mode 100644 index 0000000..438ea30 --- /dev/null +++ b/web-gui/live/source/class/live/theme/Theme.js @@ -0,0 +1,21 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("live.theme.Theme", +{ + meta : + { + color : live.theme.Color, + decoration : live.theme.Decoration, + font : live.theme.Font, + icon : qx.theme.icon.Tango, + appearance : live.theme.Appearance + } +}); \ No newline at end of file diff --git a/web-gui/live/source/index.html b/web-gui/live/source/index.html new file mode 100644 index 0000000..be0060d --- /dev/null +++ b/web-gui/live/source/index.html @@ -0,0 +1,9 @@ + + + + + live + + + + diff --git a/web-gui/live/source/resource/live/back.png b/web-gui/live/source/resource/live/back.png new file mode 100644 index 0000000..fd06541 Binary files /dev/null and b/web-gui/live/source/resource/live/back.png differ diff --git a/web-gui/live/source/resource/live/network-offline.png b/web-gui/live/source/resource/live/network-offline.png new file mode 100644 index 0000000..954c04b Binary files /dev/null and b/web-gui/live/source/resource/live/network-offline.png differ diff --git a/web-gui/live/source/resource/live/network-online.png b/web-gui/live/source/resource/live/network-online.png new file mode 100644 index 0000000..a4995ee Binary files /dev/null and b/web-gui/live/source/resource/live/network-online.png differ diff --git a/web-gui/live/source/translation/readme.txt b/web-gui/live/source/translation/readme.txt new file mode 100644 index 0000000..66975e6 --- /dev/null +++ b/web-gui/live/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