Monday, May 17, 2010

Obix Object Browser as a Tree in Adobe Air using Swiz framework

I recently created a tree component in flex for browsing obix sources as a proof of concept and decided to share it so that it might be useful for others. It was a fun experience that enabled me to learn more about the nice swiz framework.

The harder parts had been the implementation of lazy loading and the loading of the icons from remote locations, both of which I got ideas from other people and adapted.

and the icon loading idea is from http://blog.benstucki.net/?p=42

The handling of the obix becomes pretty easy with the e4x in flex. One point worth highlighting is the need for explicitly referring to the obix namespace.

So you need to define the namespace like this

var ns:Namespace = new Namespace("http://obix.org/ns/schema/1.0");


so that you can invoke stuff like

result.child(new QName(ns, "*"));


The swiz framework provides a nice executeServiceCall method in controller classes which facilitates service calls. The source code of the Swiz 1.0.0 Beta framework is not included in view source. You can get it from its source code repository.

The demo here works as a client to the http://obix.tridium.com/obix/

Download, install, run and view source.
And Enjoy or don't! :)


No comments:

Post a Comment