UcompOS Artifacts

In the UcompOS Rich Productivity Framework, there is a model that supports the creation of a type of utility called an Artifact which can be thought of as similar to a desktop widget where the desktop is the main interface of the UcompOS Portal main container.

An Artifact is created in a UcompOS application with the UcompOSArtifactProxy class that is built into the UcompOS SDK.

Artifacts can be flash-based (SWF) or image-based (PNG, GIF, or JPG).

Artifacts can then have functionality or behaviors attached to them.  Also, Flash-based artifacts can be UcompOS sub-applications so they can be Flash content that themselves have the UcompOS SDK implemented and can participate in transactions in the context of the UcompOS Continuum.

I am going to create a video tutorial today that shows how to build a UcompOS Artifact but for now, I’ll highlight in brief terms the code behind creating one.

The first step is creating a new instance of UcompOSArtifactProxy in a UcompOS application or sub application.  This of course occurs after the UcompOS SDK has been instantiated.

In ActionScript:

var artifact:UcompOSArtifactProxy = new UcompOSArtifactProxy();

In JavaScript:

var artifact = new UcompOSArtifactProxy();

Then you call the add(); method of the UcompOSArtifactProxy instance:

Let’s take a look at the signature of the add(); method:

add(label:String = null, imageBytes:ByteArray = null, imageSource:String = null, 
     x:uint = 0, y:uint = 0, draggable:Boolean = false, interactive:Boolean = true, 
    data:Object = null, container:UcompOSArtifactContainerProxy = null, 
    sandbox:Boolean = true):void

I’ll add that in the JavaScript SDK, there is no imageBytes paramater and the imageSource is how you articulate the SWF, JPG, GIF, or PNG content to be used for the artifact via its network URL.

The label property enables you to attach a label to the artifact.  As far as the source of the image that represents the artifact, it can be a ByteArray which at current will automatically be treated as an image-based artifact and the ByteArray would represent the ByteArray of a PNG, GIF, or JPG image.  If you don’t pass a ByteArray, you would pass the network URL of an image or SWF file.  If you pass both a ByteArray and a URL the ByteArray will take precedence.  If you pass neither a ByteArray or a URL, an IllegalOperationError will be thrown by the UcompOS SDK.

x and y let you position the artifact on the UcompOS Portal interface.  draggable indicates whether the user should be able to drag and drop the artifact on the UcompOS Portal interface.  interactive indicates if the artifact should accept mouseover, and click interactivity with the user.  When this property is true, the useHandCursor property on the item is implemented with a true value.

data lets you house a data Object on the artifact for convenience purposes so for instance if you have a double click handler attached to the artifact instance, when the double click event is dispatched, the data Object attached to the artifact is packaged into the event Object.

container is the Artifact Container that the artifact should be placed into.  I’ll be posting another blog this morning talking about UcompOS Artifact Containers and the UcompOSArtifactContainerProxy class.  If this value is null, then the artifact is placed on the UcompOS Portal interface with 0,0 being the upper-left origin points.

Finally, for SWF-based artifacts, sandbox represents whether the SWF content should be allowed to participate in drag and drop operations with other entities in the UcompOS Continuum where a value of false would allow this.

Note that all artifacts regardless of their sandbox property can be configured to accept drag and drop interactions.  But if you had something like a DataGrid in an artifact and you wanted to be able to drag and drop items from other SWF content into that DataGrid, you would need the sandbox property set to false.

UcompOS Artifacts

UcompOS Artifacts

In the example at left here, this represents an example of a number of artifacts that have been organized into an artifact container.

This is an example from my Educator 2 application I am building on top of the UcompOS Rich Productivity Framework.

The first artifact labeled “My Workspace” represents the user’s remote Educator 2 File System (where each user essentially has their own Content Management System interface).  The artifact labeled “Educator 1″ represents the user’s content area if their username also exists in our legacy Educator 1 product.

The remaining artifacts are all created with the aid of a class I’ll be discussing in a future posting called the UcompOSDesktopProxy which is able to talk to the end user’s desktop and each artifact represents a “mount point” on the end user’s computer.

In the case of these artifacts, they all have been implemented to support drag and drop behavior as well as double click behavior and I’ll showcase this functionality in an upcoming video tutorial I’ll create in the near future.

In this case here, when the user double clicks one of the artifacts, it launches a particular UcompOS application loaded into a UcompOS Window that showcases the file contents of each particular resource represented by the artifact.