posted on Sunday, September 18, 2005 10:03 AM
by
anoras
Resources From My JavaZone Rich Internet Applications Session
On Thursday I talked about Rich Internet Applications on the
JavaZone 2005 conference in Oslo.
The conference had a varied agenda, with many sessions that were interesting
whether you’re a pure Java developer or not. Since I spent lots of time meeting
other industry peers and getting involved in allsorts of technical discussions,
I didn’t catch too many sessions, but the ones I saw where great. Luckily, all
the sessions from the two largest rooms will be made available as DivX recordings
via the BitTorrent network in near future, so I’ll get a chance to catch up on
some of the sessions I should have seen. As soon as it is available, I’ll
provide a link to the .torrent file for my session as soon as it is available.
For those who attended my session, here are the resources
and code snippets from my session:
The
source code for the JavaScript implementation of the java.beans.XMLDecoder
class:
function XmlDecoder(doc)
{
this._doc=XmlDocument.create();
this._doc.async=false;
this._doc.loadXML(doc);
}
XmlDecoder.prototype._doc=null;
XmlDecoder.prototype._pos=0;
XmlDecoder.prototype._objectNodes=null;
XmlDecoder.prototype.readObject=function()
{
if (this._objectNodes==null)
{
this._objectNodes=this._doc.getElementsByTagName("object");
this._pos=0;
}
if (this._pos<this._objectNodes.length)
{
return this._decodeObject(this._objectNodes[this._pos++]);
}
return;
}
XmlDecoder.prototype._decodeObject=function(objectNode)
{
var
obj=Type.createInstance(XmlDecoder._parseClassName(objectNode.getAttribute("class")));
var
props=objectNode.getElementsByTagName("void");
for (var
i=0; i<props.length; i++)
{
var propName=props[i].getAttribute("property");
var
valueElm=props[i].firstChild;
while
(valueElm.nodeType!=1) valueElm=valueElm.nextSibling;
switch
(valueElm.tagName)
{
case "object":
Type.setProperty(obj,this._decodeObject(valueElm));
default:
Type.setProperty(obj,propName,Convert.fromJavaPrimitive(valueElm.firstChild.nodeValue,valueElm.tagName));
}
}
return
obj;
}
XmlDecoder._parseClassName=function(qn)
{
var
qps=qn.split('.');
return
qps[qps.length-1];
}
Finally, I want to thank everyone who attended my session. Hope
you had a good time.