From 52b669d1c4654a9e2f5a45f62cea5a2fe79ea83a Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Wed, 2 Jun 2010 12:43:21 +0200 Subject: [web-gui] qooxdoo hello world demo Signed-off-by: Michael Olbrich --- web-gui/hello-world/Manifest.json | 34 ++++++++ web-gui/hello-world/config.json | 77 +++++++++++++++++ web-gui/hello-world/generate.py | 72 ++++++++++++++++ web-gui/hello-world/readme.txt | 10 +++ .../source/class/hello_world/Application.js | 96 +++++++++++++++++++++ .../source/class/hello_world/test/DemoTest.js | 55 ++++++++++++ .../source/class/hello_world/theme/Appearance.js | 18 ++++ .../source/class/hello_world/theme/Color.js | 18 ++++ .../source/class/hello_world/theme/Decoration.js | 18 ++++ .../source/class/hello_world/theme/Font.js | 18 ++++ .../source/class/hello_world/theme/Theme.js | 21 +++++ web-gui/hello-world/source/index.html | 9 ++ .../source/resource/hello-world/test.png | Bin 0 -> 2478 bytes web-gui/hello-world/source/script/hello_world.js | 20 +++++ web-gui/hello-world/source/translation/readme.txt | 3 + 15 files changed, 469 insertions(+) create mode 100644 web-gui/hello-world/Manifest.json create mode 100644 web-gui/hello-world/config.json create mode 100755 web-gui/hello-world/generate.py create mode 100644 web-gui/hello-world/readme.txt create mode 100644 web-gui/hello-world/source/class/hello_world/Application.js create mode 100644 web-gui/hello-world/source/class/hello_world/test/DemoTest.js create mode 100644 web-gui/hello-world/source/class/hello_world/theme/Appearance.js create mode 100644 web-gui/hello-world/source/class/hello_world/theme/Color.js create mode 100644 web-gui/hello-world/source/class/hello_world/theme/Decoration.js create mode 100644 web-gui/hello-world/source/class/hello_world/theme/Font.js create mode 100644 web-gui/hello-world/source/class/hello_world/theme/Theme.js create mode 100644 web-gui/hello-world/source/index.html create mode 100644 web-gui/hello-world/source/resource/hello-world/test.png create mode 100644 web-gui/hello-world/source/script/hello_world.js create mode 100644 web-gui/hello-world/source/translation/readme.txt (limited to 'web-gui') diff --git a/web-gui/hello-world/Manifest.json b/web-gui/hello-world/Manifest.json new file mode 100644 index 0000000..48425cb --- /dev/null +++ b/web-gui/hello-world/Manifest.json @@ -0,0 +1,34 @@ +{ + "info" : + { + "name" : "hello_world", + + "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" : "hello_world", + "encoding" : "utf-8", + "class" : "source/class", + //"resource" : "source/resource", + "translation" : "source/translation", + "type" : "application" + } +} + diff --git a/web-gui/hello-world/config.json b/web-gui/hello-world/config.json new file mode 100644 index 0000000..55aa274 --- /dev/null +++ b/web-gui/hello-world/config.json @@ -0,0 +1,77 @@ +{ + "name" : "hello_world", + + "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" : "hello_world", + "QOOXDOO_PATH" : "../../../../src/qooxdoo-1.1-sdk", + "QXTHEME" : "hello_world.theme.Theme", + "API_EXCLUDE" : ["qx.test.*", "${APPLICATION}.theme.*", "${APPLICATION}.test.*"], + "LOCALES" : [ "en" ], + "CACHE" : "${TMPDIR}/cache", + "ROOT" : "." + } + + // 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/hello-world/generate.py b/web-gui/hello-world/generate.py new file mode 100755 index 0000000..2d7794d --- /dev/null +++ b/web-gui/hello-world/generate.py @@ -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 = '../../../../src/qooxdoo-1.1-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/hello-world/readme.txt b/web-gui/hello-world/readme.txt new file mode 100644 index 0000000..a7b3d84 --- /dev/null +++ b/web-gui/hello-world/readme.txt @@ -0,0 +1,10 @@ +GUI Skeleton - A qooxdoo Application Template +============================================= + +This is a qooxdoo application skeleton which is used as a template. The +'create-application.py' script (usually under tool/bin/create-application.py) +will use this and expand it into a self-contained qooxdoo application which +can then be further extended. Please refer to the script and other documentation +for further information. + +short:: is a standard qooxdoo GUI application \ No newline at end of file diff --git a/web-gui/hello-world/source/class/hello_world/Application.js b/web-gui/hello-world/source/class/hello_world/Application.js new file mode 100644 index 0000000..a8369bd --- /dev/null +++ b/web-gui/hello-world/source/class/hello_world/Application.js @@ -0,0 +1,96 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +/* ************************************************************************ + +#asset(hello_world/*) + +************************************************************************ */ + +/** + * This is the main application class of your custom application "hello_world" + */ +qx.Class.define("hello_world.Application", +{ + extend : qx.application.Standalone, + + + + /* + ***************************************************************************** + MEMBERS + ***************************************************************************** + */ + + members : + { + /** + * 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(); + + var helloLabel = new qx.ui.basic.Label(""); + doc.add(helloLabel, {left: 100, top: 50}); + + var echoEdit = new qx.ui.form.TextField(); + doc.add(echoEdit, {left: 100, top: 100, right: 300}); + + var echoButton = new new qx.ui.form.Button("Echo"); + doc.add(echoButton, {left: 320, top: 100}); + + var rpc = new qx.io.remote.Rpc("http://localhost:8080/", "com.pengutronix.jdb.Hello|/"); + + rpc.callAsync(function(result, error) { + if (error == null) { + helloLabel.setText(result); + } + else { + helloLabel.setText("Error: " + error); + } + }, "com.pengutronix.jdb.Hello.HelloWorld"); + + // Add an event listener + echoButton.addListener("execute", function(e) { + rpc.callAsync(function(result, error) { + if (error == null) { + echoLabel.setText(result); + } + else { + echoLabel.setText("Error: " + error); + } + }, "com.pengutronix.jdb.Hello.Echo", echoEdit.getValue()); + }); + } + } +}); diff --git a/web-gui/hello-world/source/class/hello_world/test/DemoTest.js b/web-gui/hello-world/source/class/hello_world/test/DemoTest.js new file mode 100644 index 0000000..2333e41 --- /dev/null +++ b/web-gui/hello-world/source/class/hello_world/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("hello_world.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/hello-world/source/class/hello_world/theme/Appearance.js b/web-gui/hello-world/source/class/hello_world/theme/Appearance.js new file mode 100644 index 0000000..ee5a135 --- /dev/null +++ b/web-gui/hello-world/source/class/hello_world/theme/Appearance.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("hello_world.theme.Appearance", +{ + extend : qx.theme.modern.Appearance, + + appearances : + { + } +}); \ No newline at end of file diff --git a/web-gui/hello-world/source/class/hello_world/theme/Color.js b/web-gui/hello-world/source/class/hello_world/theme/Color.js new file mode 100644 index 0000000..1cd7692 --- /dev/null +++ b/web-gui/hello-world/source/class/hello_world/theme/Color.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("hello_world.theme.Color", +{ + extend : qx.theme.modern.Color, + + colors : + { + } +}); \ No newline at end of file diff --git a/web-gui/hello-world/source/class/hello_world/theme/Decoration.js b/web-gui/hello-world/source/class/hello_world/theme/Decoration.js new file mode 100644 index 0000000..9dc79bc --- /dev/null +++ b/web-gui/hello-world/source/class/hello_world/theme/Decoration.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("hello_world.theme.Decoration", +{ + extend : qx.theme.modern.Decoration, + + decorations : + { + } +}); \ No newline at end of file diff --git a/web-gui/hello-world/source/class/hello_world/theme/Font.js b/web-gui/hello-world/source/class/hello_world/theme/Font.js new file mode 100644 index 0000000..957646d --- /dev/null +++ b/web-gui/hello-world/source/class/hello_world/theme/Font.js @@ -0,0 +1,18 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("hello_world.theme.Font", +{ + extend : qx.theme.modern.Font, + + fonts : + { + } +}); \ No newline at end of file diff --git a/web-gui/hello-world/source/class/hello_world/theme/Theme.js b/web-gui/hello-world/source/class/hello_world/theme/Theme.js new file mode 100644 index 0000000..3c07b4c --- /dev/null +++ b/web-gui/hello-world/source/class/hello_world/theme/Theme.js @@ -0,0 +1,21 @@ +/* ************************************************************************ + + Copyright: + + License: + + Authors: + +************************************************************************ */ + +qx.Theme.define("hello_world.theme.Theme", +{ + meta : + { + color : hello_world.theme.Color, + decoration : hello_world.theme.Decoration, + font : hello_world.theme.Font, + icon : qx.theme.icon.Tango, + appearance : hello_world.theme.Appearance + } +}); \ No newline at end of file diff --git a/web-gui/hello-world/source/index.html b/web-gui/hello-world/source/index.html new file mode 100644 index 0000000..f31da7f --- /dev/null +++ b/web-gui/hello-world/source/index.html @@ -0,0 +1,9 @@ + + + + + hello_world + + + + diff --git a/web-gui/hello-world/source/resource/hello-world/test.png b/web-gui/hello-world/source/resource/hello-world/test.png new file mode 100644 index 0000000..ef360cd Binary files /dev/null and b/web-gui/hello-world/source/resource/hello-world/test.png differ diff --git a/web-gui/hello-world/source/script/hello_world.js b/web-gui/hello-world/source/script/hello_world.js new file mode 100644 index 0000000..999122f --- /dev/null +++ b/web-gui/hello-world/source/script/hello_world.js @@ -0,0 +1,20 @@ +/* + * This is mock content and will be overwritten with the first 'generate.py source'. + */ +function inform(){ + var message = + "
" + + "

Application not yet ready!

" + + "
Please use the generator to build this application, i.e. run 'generate.py source' in an OS shell; then reload this page.
" + + "
"; + + window.setTimeout(function() { + document.body.innerHTML = message; + }, 0); +} + +if (window.attachEvent) { + window.attachEvent("onload", inform); +} else { + window.addEventListener("load", inform, false); +} diff --git a/web-gui/hello-world/source/translation/readme.txt b/web-gui/hello-world/source/translation/readme.txt new file mode 100644 index 0000000..66975e6 --- /dev/null +++ b/web-gui/hello-world/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