Embedding Applets in the ToolBar

The above monitor application maintains a continuous network connection to a server to listen to a data stream.

This demonstrates the ability to construct World Wide Web documents which contain continuously updating fields. Possible applications are front-ends for monitors for any data that is constant updated, such as for stock market graphs, news wire information, continuouly updating weather map,,,.

How does this work??

Basically, this document has a "tool" type "link" to a script. This causes viola to fetch the script, instantiates the script (objects), and install the object in the tool bar.

So, this is the markup that makes the link.

<LINK REL="tool" HREF="monitorBar.v">

And here's the listing for the "monitorBar.v" applet/object/script file.

\name {monitorBar} \children {monitorBar.socket} \class {field} \script { switch (arg[0]) { case "graph": y = arg[1] / 100.0 * hh; drawLine(1, y, 1, hh); copyArea(0, 0, ww, hh, 1, 0); return; break; case "config": usual(); clearWindow(); ww = get("width"); hh = get("height"); return; break; } usual(); } \gapV {2} \gapH {2} \width {100} \height {50} \BGColor {blue} \FGColor {white} \border {6} \ \name {monitorBar.socket} \parent {monitorBar} \class {socket} \host {pebble.berkeley.ora.com} \port {7777} \script { /* sym share price */ switch (arg[0]) { case "input": data = input(); send(parent(), "graph", int(nthWord(data, 3))); return; break; case "init": usual(); set("outDelimStr", "\r\n"); set("inDelimStr1", '\n'); startClient(); return; break; } usual(); } \