Hi,

I want to announce a new wave-related open source project: "Wala", a
programming language for writing web-based wave frontends.
You can find the sources at:

http://code.google.com/p/wala-compile<http://code.google.com/p/wala-compiler/admin>
r

It is already partially working, but keep in mind that it is still closer to
a research project than a productive system. The aim is of course to get it
polished and stable in the months ahead.

In the past I got many requests of how to reuse the QWaveClient code to
build custom wave applications. This includes applications that use a
different schema, i.e. neither blips nor threads. My own experiments have
shown that the code re-use was quite limited, because only the raw data
model, OT and network protocols could be re-used.

However, there is a lot of code that deals with question such as: How to
detect when a blip is inserted or removed and how to update the UI? How to
detect that a thread has been created and where to display it? What to do if
all blips of a thread have been deleted? Efficiently displaying digest
changes, and so on ... When using a new data schema all these questions turn
up again. The more complicated the schema, the more difficult it becomes to
ensure that all possibilities have been taken care of.

I failed to abstract these things away in an easy to use framework. So my
idea was to create a language that makes it easy to describe such
applications. Wala is therefore a combination of a client-side template
engine and functional programming. Basically, a wala program specifies how
to map a wave to the UI. Currently I support HTML as a UI, because the
entire Wala stuff is web-based.

The trick is that the wala compiler figures out how to update the UI when
the wave changes! This was exactly the complicated part that I could not
encapsulate in an OO framework. Now instead, the compiler does the nasty
job. Below I attached a sample Wala program that yields a web-based wave
client. It shows a digest, clicking on a wave in the digest shows the
wavelet. It supports blips and threads. The UI updates the digest and blips
as users are typing. Even more, it features a web-based rich text editor
that allows for concurrent wave editing and last not least it supports a
login screen.

A core concept of Wala are XPath-alike live queries such as:

$wave/doc("conversation")/conversation/blip

$wave is some variable and the query searches for all root blips in the
conversation document. As the document mutates, the query updates itself. As
a result all templates that depend on this query are updated as well. Et
voila, the UI automatically adapts if new blips arrive, change or are
removed.

Some more explanations can be found at the Wala website
http://code.google.com/p/wala-compile<http://code.google.com/p/wala-compiler/admin>r
. It is still very rough on the edges. But since I got a wave web client up
and running with it last night, I thought it might be appropriate to show
it. Needless to say that I welcome any participation in the project.

PS: What does this mean for QWaveClient? I am still using and maintaining
it. However, for me wave as a platform is much much more interesting than
the current Google Wave frontend with its blips and threads. I still like
it, but I think the wave platform is extremely powerful. I hope that Wala
makes it much easier to write cool apps for this platform.

Greetings
Torben

====================================================================

var $status = "anonymous";
var $wave = false;

template digest()
{
  @foreach( $d in wave("!indexwave",
"wave1.vs.uni-due.de")/wavelets()/doc("digest")
)
  {
<p class="digest" onclick={{ openWave($d) }} >Wave: {{ text($d) }}</p>
  }
}

template thread($t)
{
  <div class="thread">Thread {{ $t.id }}:
  @foreach( $b in $t/blip )
  {
 @blip($b)
  }
  </div>
}

template blip($b)
{
  <div class="blip">Blip {{$b.id}}:
  @component(editor $e element={{ $wave/doc($b.id)/body }} )
  @foreach( $t in $b/thread )
  {
@thread($t)
  }
  </div>
}

template main()
{
    @if ( $status == "anonymous" )
    {
  <h1>Please log in</h1>
  <input type="text" id="username" />\[email protected]
  <input type="button" value="Log in" onclick="login();" />
    }
    @else
    {
  @digest()
  @foreach( $b in $wave/doc("conversation")/conversation/blip )
  {
@blip( $b )
  }
    }
}

function login()
{
  var username = document.getElementById("username").value;
  JSOT.Rpc.login( username + "@wave1.vs.uni-due.de", onLogin );
}

function onLogin()
{
  JSOT.Path.LocalState.setValue( '$status', "loggedin" );
}

function openWave($d)
{
  var w = JSOT.Rpc.openWavelet( "wave://" + $d.wavelet.domain + "/" + $
d.wavelet.id + "/conv+root" );
  JSOT.Path.LocalState.setValue( '$wave', w );
}

-- 
You received this message because you are subscribed to the Google Groups "Wave 
Protocol" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/wave-protocol?hl=en.

Reply via email to