2150 |
mathias |
1 |
<!--
|
|
|
2 |
This file demonstrates how the dojox.wire code can be used to do declarative
|
|
|
3 |
wiring of events. Specifically, it shows how you can publish and subscribe
|
|
|
4 |
to topics. In this case the setting of a value on one textbox triggers a
|
|
|
5 |
publish of that value to a topic. Another invoke is wired to fire when
|
|
|
6 |
values are published to that topic which is then displayed in another
|
|
|
7 |
textbox.
|
|
|
8 |
-->
|
|
|
9 |
<html>
|
|
|
10 |
<head>
|
|
|
11 |
<title>Sample Topic Wiring</title>
|
|
|
12 |
<style type="text/css">
|
|
|
13 |
|
|
|
14 |
@import "../../../../dijit/themes/tundra/tundra.css";
|
|
|
15 |
@import "../../../../dojo/resources/dojo.css";
|
|
|
16 |
@import "../../../../dijit/tests/css/dijitTests.css";
|
|
|
17 |
@import "../TableContainer.css";
|
|
|
18 |
|
|
|
19 |
.splitView {
|
|
|
20 |
width: 90%;
|
|
|
21 |
height: 90%;
|
|
|
22 |
border: 1px solid #bfbfbf;
|
|
|
23 |
border-collapse: separate;
|
|
|
24 |
}
|
|
|
25 |
</style>
|
|
|
26 |
|
|
|
27 |
<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
|
|
|
28 |
<script type="text/javascript">
|
|
|
29 |
dojo.require("dojo.parser");
|
|
|
30 |
dojo.require("dojox.wire");
|
|
|
31 |
dojo.require("dojox.wire.ml.Invocation");
|
|
|
32 |
dojo.require("dojox.wire.ml.DataStore");
|
|
|
33 |
dojo.require("dojox.wire.ml.Transfer");
|
|
|
34 |
dojo.require("dojox.wire.ml.Data");
|
|
|
35 |
|
|
|
36 |
dojo.require("dijit.form.TextBox");
|
|
|
37 |
</script>
|
|
|
38 |
</head>
|
|
|
39 |
|
|
|
40 |
<body class="tundra">
|
|
|
41 |
|
|
|
42 |
<!-- Layout -->
|
|
|
43 |
<font size="3"><b>Demo of Topic Wiring</b></font><br/><br/>
|
|
|
44 |
This demo shows how you can wire events to publish to a topic as well as recieve topic events
|
|
|
45 |
<br/>
|
|
|
46 |
<br/>
|
|
|
47 |
<table>
|
|
|
48 |
<tr>
|
|
|
49 |
<td>
|
|
|
50 |
<div dojoType="dijit.form.TextBox" jsId="inputField" value="" size="50"></div>
|
|
|
51 |
</td>
|
|
|
52 |
</tr>
|
|
|
53 |
<tr>
|
|
|
54 |
<td>
|
|
|
55 |
<div dojoType="dijit.form.TextBox" jsId="targetField1" value="" disabled="true" size="50"></div>
|
|
|
56 |
</td>
|
|
|
57 |
</tr>
|
|
|
58 |
</table>
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
<!-------------------------------- Using dojox.wire, declaratively wire up the widgets. --------------------------->
|
|
|
62 |
|
|
|
63 |
<!--
|
|
|
64 |
Whenever a key is entered into the textbox, publish the value of it to a topic.
|
|
|
65 |
-->
|
|
|
66 |
<div dojoType="dojox.wire.ml.Action"
|
|
|
67 |
id="action1"
|
|
|
68 |
trigger="inputField"
|
|
|
69 |
triggerEvent="onkeyup">
|
|
|
70 |
<div dojoType="dojox.wire.ml.Invocation" topic="sampleTopic" parameters="inputField.value"></div>
|
|
|
71 |
</div>
|
|
|
72 |
|
|
|
73 |
<!--
|
|
|
74 |
Whenever a value is published to a topic, set it as the value of the textbox by calling the setValue function.
|
|
|
75 |
-->
|
|
|
76 |
<div dojoType="dojox.wire.ml.Invocation" triggerTopic="sampleTopic" object="targetField1" method="setValue" parameters="arguments[0]"></div>
|
|
|
77 |
</body>
|
|
|
78 |
</html>
|