summaryrefslogtreecommitdiffstats
path: root/web-gui
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2010-06-02 18:20:03 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2010-06-02 18:25:04 +0200
commitc60d54e06ed08498e9a50ea2aaff68a0646544bc (patch)
tree753ab506c9d4f5c08d3c7a5cf20787369f23ee21 /web-gui
parentb1c4d9c1d461e1f14498b81fd4c69a45dbddf8da (diff)
downloadjson-dbus-bridge-examples-c60d54e06ed08498e9a50ea2aaff68a0646544bc.tar.gz
json-dbus-bridge-examples-c60d54e06ed08498e9a50ea2aaff68a0646544bc.tar.xz
[web-gui] add calculator example
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'web-gui')
-rw-r--r--web-gui/Makefile.am3
-rw-r--r--web-gui/calculator/Makefile.am10
-rw-r--r--web-gui/calculator/Manifest.json34
-rw-r--r--web-gui/calculator/config.json.in77
-rwxr-xr-xweb-gui/calculator/generate.py72
-rw-r--r--web-gui/calculator/readme.txt10
-rw-r--r--web-gui/calculator/source/class/calculator/Application.js75
-rw-r--r--web-gui/calculator/source/class/calculator/test/DemoTest.js55
-rw-r--r--web-gui/calculator/source/class/calculator/theme/Appearance.js18
-rw-r--r--web-gui/calculator/source/class/calculator/theme/Color.js18
-rw-r--r--web-gui/calculator/source/class/calculator/theme/Decoration.js18
-rw-r--r--web-gui/calculator/source/class/calculator/theme/Font.js18
-rw-r--r--web-gui/calculator/source/class/calculator/theme/Theme.js21
-rw-r--r--web-gui/calculator/source/index.html9
-rw-r--r--web-gui/calculator/source/resource/calculator/test.pngbin0 -> 2478 bytes
-rw-r--r--web-gui/calculator/source/script/calculator.js20
-rw-r--r--web-gui/calculator/source/translation/readme.txt3
17 files changed, 460 insertions, 1 deletions
diff --git a/web-gui/Makefile.am b/web-gui/Makefile.am
index c10e6fb..4ca8f21 100644
--- a/web-gui/Makefile.am
+++ b/web-gui/Makefile.am
@@ -1,6 +1,7 @@
SUBDIRS = \
- hello-world
+ hello-world \
+ calculator
MAINTAINERCLEANFILES = \
Makefile.in
diff --git a/web-gui/calculator/Makefile.am b/web-gui/calculator/Makefile.am
new file mode 100644
index 0000000..af29dd7
--- /dev/null
+++ b/web-gui/calculator/Makefile.am
@@ -0,0 +1,10 @@
+
+all:
+ if [ "@srcdir@" != "@builddir@" ]; then \
+ cp -a "@srcdir@/"{source,generate.py,Manifest.json} "@builddir@/"; \
+ fi
+ ./generate.py build
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
+
diff --git a/web-gui/calculator/Manifest.json b/web-gui/calculator/Manifest.json
new file mode 100644
index 0000000..13bb655
--- /dev/null
+++ b/web-gui/calculator/Manifest.json
@@ -0,0 +1,34 @@
+{
+ "info" :
+ {
+ "name" : "calculator",
+
+ "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" : "calculator",
+ "encoding" : "utf-8",
+ "class" : "source/class",
+ "resource" : "source/resource",
+ "translation" : "source/translation",
+ "type" : "application"
+ }
+}
+
diff --git a/web-gui/calculator/config.json.in b/web-gui/calculator/config.json.in
new file mode 100644
index 0000000..73bc087
--- /dev/null
+++ b/web-gui/calculator/config.json.in
@@ -0,0 +1,77 @@
+{
+ "name" : "calculator",
+
+ "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" : "calculator",
+ "QOOXDOO_PATH" : "@QOOXDOO_SDK@",
+ "QXTHEME" : "calculator.theme.Theme",
+ "API_EXCLUDE" : ["qx.test.*", "${APPLICATION}.theme.*", "${APPLICATION}.test.*"],
+ "LOCALES" : [ "en" ],
+ "CACHE" : "@abs_builddir@/../qooxdoo-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/calculator/generate.py b/web-gui/calculator/generate.py
new file mode 100755
index 0000000..2d7794d
--- /dev/null
+++ b/web-gui/calculator/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/calculator/readme.txt b/web-gui/calculator/readme.txt
new file mode 100644
index 0000000..a7b3d84
--- /dev/null
+++ b/web-gui/calculator/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/calculator/source/class/calculator/Application.js b/web-gui/calculator/source/class/calculator/Application.js
new file mode 100644
index 0000000..b0dfb02
--- /dev/null
+++ b/web-gui/calculator/source/class/calculator/Application.js
@@ -0,0 +1,75 @@
+/* ************************************************************************
+
+ Copyright:
+
+ License:
+
+ Authors:
+
+************************************************************************ */
+
+/* ************************************************************************
+
+#asset(calculator/*)
+
+************************************************************************ */
+
+/**
+ * This is the main application class of your custom application "calculator"
+ */
+qx.Class.define("calculator.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...
+ -------------------------------------------------------------------------
+ */
+
+ // Create a button
+ var button1 = new qx.ui.form.Button("First Button", "calculator/test.png");
+
+ // Document is the application root
+ var doc = this.getRoot();
+
+ // Add button to document at fixed coordinates
+ doc.add(button1, {left: 100, top: 50});
+
+ // Add an event listener
+ button1.addListener("execute", function(e) {
+ alert("Hello World!");
+ });
+ }
+ }
+});
diff --git a/web-gui/calculator/source/class/calculator/test/DemoTest.js b/web-gui/calculator/source/class/calculator/test/DemoTest.js
new file mode 100644
index 0000000..ac0b7c4
--- /dev/null
+++ b/web-gui/calculator/source/class/calculator/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("calculator.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/calculator/source/class/calculator/theme/Appearance.js b/web-gui/calculator/source/class/calculator/theme/Appearance.js
new file mode 100644
index 0000000..5f56b24
--- /dev/null
+++ b/web-gui/calculator/source/class/calculator/theme/Appearance.js
@@ -0,0 +1,18 @@
+/* ************************************************************************
+
+ Copyright:
+
+ License:
+
+ Authors:
+
+************************************************************************ */
+
+qx.Theme.define("calculator.theme.Appearance",
+{
+ extend : qx.theme.modern.Appearance,
+
+ appearances :
+ {
+ }
+}); \ No newline at end of file
diff --git a/web-gui/calculator/source/class/calculator/theme/Color.js b/web-gui/calculator/source/class/calculator/theme/Color.js
new file mode 100644
index 0000000..8636762
--- /dev/null
+++ b/web-gui/calculator/source/class/calculator/theme/Color.js
@@ -0,0 +1,18 @@
+/* ************************************************************************
+
+ Copyright:
+
+ License:
+
+ Authors:
+
+************************************************************************ */
+
+qx.Theme.define("calculator.theme.Color",
+{
+ extend : qx.theme.modern.Color,
+
+ colors :
+ {
+ }
+}); \ No newline at end of file
diff --git a/web-gui/calculator/source/class/calculator/theme/Decoration.js b/web-gui/calculator/source/class/calculator/theme/Decoration.js
new file mode 100644
index 0000000..cfa2c0f
--- /dev/null
+++ b/web-gui/calculator/source/class/calculator/theme/Decoration.js
@@ -0,0 +1,18 @@
+/* ************************************************************************
+
+ Copyright:
+
+ License:
+
+ Authors:
+
+************************************************************************ */
+
+qx.Theme.define("calculator.theme.Decoration",
+{
+ extend : qx.theme.modern.Decoration,
+
+ decorations :
+ {
+ }
+}); \ No newline at end of file
diff --git a/web-gui/calculator/source/class/calculator/theme/Font.js b/web-gui/calculator/source/class/calculator/theme/Font.js
new file mode 100644
index 0000000..24356ca
--- /dev/null
+++ b/web-gui/calculator/source/class/calculator/theme/Font.js
@@ -0,0 +1,18 @@
+/* ************************************************************************
+
+ Copyright:
+
+ License:
+
+ Authors:
+
+************************************************************************ */
+
+qx.Theme.define("calculator.theme.Font",
+{
+ extend : qx.theme.modern.Font,
+
+ fonts :
+ {
+ }
+}); \ No newline at end of file
diff --git a/web-gui/calculator/source/class/calculator/theme/Theme.js b/web-gui/calculator/source/class/calculator/theme/Theme.js
new file mode 100644
index 0000000..aa59d7d
--- /dev/null
+++ b/web-gui/calculator/source/class/calculator/theme/Theme.js
@@ -0,0 +1,21 @@
+/* ************************************************************************
+
+ Copyright:
+
+ License:
+
+ Authors:
+
+************************************************************************ */
+
+qx.Theme.define("calculator.theme.Theme",
+{
+ meta :
+ {
+ color : calculator.theme.Color,
+ decoration : calculator.theme.Decoration,
+ font : calculator.theme.Font,
+ icon : qx.theme.icon.Tango,
+ appearance : calculator.theme.Appearance
+ }
+}); \ No newline at end of file
diff --git a/web-gui/calculator/source/index.html b/web-gui/calculator/source/index.html
new file mode 100644
index 0000000..71568a9
--- /dev/null
+++ b/web-gui/calculator/source/index.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>calculator</title>
+ <script type="text/javascript" src="script/calculator.js"></script>
+</head>
+<body></body>
+</html>
diff --git a/web-gui/calculator/source/resource/calculator/test.png b/web-gui/calculator/source/resource/calculator/test.png
new file mode 100644
index 0000000..ef360cd
--- /dev/null
+++ b/web-gui/calculator/source/resource/calculator/test.png
Binary files differ
diff --git a/web-gui/calculator/source/script/calculator.js b/web-gui/calculator/source/script/calculator.js
new file mode 100644
index 0000000..999122f
--- /dev/null
+++ b/web-gui/calculator/source/script/calculator.js
@@ -0,0 +1,20 @@
+/*
+ * This is mock content and will be overwritten with the first 'generate.py source'.
+ */
+function inform(){
+ var message =
+ "<div style='font-family: Verdana'>" +
+ "<h2>Application not yet ready!</h2>" +
+ "<div>Please use the generator to build this application, i.e. run <i>'generate.py source'</i> in an OS shell; then reload this page.</div>" +
+ "</div>";
+
+ 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/calculator/source/translation/readme.txt b/web-gui/calculator/source/translation/readme.txt
new file mode 100644
index 0000000..66975e6
--- /dev/null
+++ b/web-gui/calculator/source/translation/readme.txt
@@ -0,0 +1,3 @@
+This directory will contain translation (.po) files once you run the
+'translation' job in your project.
+