summaryrefslogtreecommitdiffstats
path: root/web-gui
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2010-06-02 18:10:07 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2010-06-02 18:25:04 +0200
commitb1c4d9c1d461e1f14498b81fd4c69a45dbddf8da (patch)
tree002e5dcdf1c314edff8fbf6e11f1a15fff7f0086 /web-gui
parentd1823d84bca8e295b19069eda613c2ce61f7bc9e (diff)
downloadjson-dbus-bridge-examples-b1c4d9c1d461e1f14498b81fd4c69a45dbddf8da.tar.gz
[web-gui] update hello-world
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'web-gui')
-rw-r--r--web-gui/hello-world/source/class/hello_world/Application.js40
1 files changed, 25 insertions, 15 deletions
diff --git a/web-gui/hello-world/source/class/hello_world/Application.js b/web-gui/hello-world/source/class/hello_world/Application.js
index 0834bce..1a7e450 100644
--- a/web-gui/hello-world/source/class/hello_world/Application.js
+++ b/web-gui/hello-world/source/class/hello_world/Application.js
@@ -60,44 +60,54 @@ qx.Class.define("hello_world.Application",
// Document is the application root
var doc = this.getRoot();
+ var core = new qx.ui.container.Composite(new qx.ui.layout.Grid());
+ doc.add(core, {left: 50, top: 50});
+ core.getLayout().setSpacing(10);
+ core.getLayout().setColumnAlign(0, "left", "middle");
+
+ core.add( new qx.ui.basic.Label("RPC Hello World:"), {row: 0, column: 0});
var helloLabel = new qx.ui.basic.Label("<waiting for hello>");
- doc.add(helloLabel, {left: 100, top: 50});
+ core.add(helloLabel, {row: 0, column: 1});
+ core.add( new qx.ui.basic.Label("Send Text:"), {row: 1, column: 0});
var echoEdit = new qx.ui.form.TextField();
- doc.add(echoEdit, {left: 100, top: 100});
echoEdit.setWidth(200);
+ core.add(echoEdit, {row: 1, column: 1});
var echoButton = new qx.ui.form.Button("Echo");
- doc.add(echoButton, {left: 320, top: 100});
+ core.add(echoButton, {row: 1, column: 2});
+ core.add( new qx.ui.basic.Label("RPC Echo Receive:"), {row: 2, column: 0});
var echoLabel = new qx.ui.basic.Label("<waiting for echo>");
- doc.add(echoLabel, {left: 500, top: 100});
+ core.add(echoLabel, {row: 2, column: 1});
var rpc = new qx.io.remote.Rpc("http://localhost:8080/rpc", "com.pengutronix.jdb.Hello|/");
- rpc.callAsync(function(result, error) {
- if (error == null) {
- helloLabel.setValue(result);
- }
- else {
- helloLabel.setValue("Error: " + error);
- }
- }, "com.pengutronix.jdb.Hello.HelloWorld");
+ // synchronous RPC call. callSync() throws an exception on error
+ try {
+ var val = rpc.callSync("com.pengutronix.jdb.Hello.HelloWorld");
+ helloLabel.setValue(val);
+ }
+ catch (error) {
+ helloLabel.setValue("Error: " + error);
+ }
// Add an event listener
echoButton.addListener("execute", function(e) {
var text = echoEdit.getValue();
if (text == null)
text = "";
- rpc.callAsync(function(result, error) {
+ var handler = function(result, error) {
if (error == null) {
echoLabel.setValue(result);
}
else {
echoLabel.setValue("Error: " + error);
}
- }, "com.pengutronix.jdb.Hello.Echo", "s", text);
- });
+ }
+ // asynchronous RPC call. The handler will be called with result or error == null
+ rpc.callAsync(handler, "com.pengutronix.jdb.Hello.Echo", "s", text);
+ });
}
}
});