Bubbletop Foundry: Bubbletop Developer’s Documentation
Overview
- The Bubbletop Widget Platform offers you the opportunity to build your own widgets to use and share within the Bubbletop service
- Widgets are simple to make – just build your xHTML and then wrap with our simple XML framework (it’s easy, we’ll show you how!)
- Widgets are secure on Bubbletop. We load every widget into a separate IFRAME to ensure any malicious code is unable to steal personal data.
- We are compatible with iGoogle widgets, and soon widgets from other personable homepages too. If you have already built your widget for iGoogle you don’t need to do anything more than just register your widget with us to get it listed on Bubbletop!
Benefit the community by building widgets around your own ideas and innovations. Extend the reach of your existing website or online app by enabling your users to use it from within the Bubbletop environment.
Introduction – what you need
In order to build a widget you will need the following:
- An idea for your widget
- A text editor or development environment to build the xHTML files, along with CSS, javascript and XML. We like PSPad (freeware) for Windows and BBEdit for Mac. For more complex projects we like Eclipse, which is open-source and will run on Windows, Mac and Linux… However you probably have a favorite package already.
- Somewhere to host your final XML file. Bubbletop does not host widget files.
- If your widget uses server scripting (such as PHP, Rails, ASP, Perl, etc) you will also need a place to run these too. Usually you would store your XML file on the same server, but you don’t have to.
Workflow
In order to build a successful widget we suggest the following workflow:
- Design out your widget in a graphics package or even on paper. You only have a small area to play with, so making sure that your widget is clear and easy to use is crucial. Keep things simple and try to build your widget to around width of 300px.
- Work out what you need to build your widget before you start coding – if you’re going to mashup a number of APIs and services make sure you know how each one works. If you don’t know which API to use, Programableweb.com is a great resource for finding them.
- Build your widget in regular HTML page. You might find it useful to build your code within a div set to width:300px, as this is the usual width of a widget:
<div id="widgetWidthConstrainer" style="width:300px">
...
</div> - Once you have your widget successfully working in HTML, it’s time to wrap it into the XML file used by Bubbletop. The specification of the XML is discussed below.
- Upload your XML file to your server so that you have a url for your XML File. Then access the Widget Preview service on the Bubbletop Foundry.
- Point the Widget Preview to your XML file. The Widget Preview will load the XML file into the preview window for you to check that we’re able to successfully process and display your widget. For convenience your source code will also be displayed, allowing you to make and preview last-minute alterations to your code. Don’t forget to save your final XML source back to your XML file on your server!
- Submit the widget to Bubbletop via the form provided on this site (make sure all your contact information is correctly listed in your widget XML!)
- We will review your widget and let you know when we add it to the Bubbletop system. If we are unable to add your widget we’ll let you know why via email – we’ll do our best to try to help you fix any problems. If you’re coming to the Orange C0ding C4mp on August 4th, we’ll give you feedback there and then!
- Once your widget is in Bubbletop you can add it to your tab.
Widget XML file
Here is a sample ‘blank’ XML file:
This node helps us know how to display your widget and how to get in contact with you.
- title* The title of your widget
- description* A short description of your widget
- author* Your name/nickname
- author_email* Your email address
- restricted Whether you would like your widget rendered in a unique sub-domain to prevent cross-widget communication (for increased security)
- height The height your would like your widget to be rendered at (default: standard Bubbletop height)
- scaling To be implemented at a later date
- scrolling Whether you would like scrollbars on your widget, should the widget spans an area greater than the iframe window. (default: auto)
- singleton Whether a user can spawn multiple instances of your widget within their Bubbletop account. You should not set this unless your widget really needs it. (default: no)
- accept_data_type To be used in the future
* denotes mandatory attribute
The

We also provide easy to use convenience javascript methods to set and get user properties within your widget.
As an example, here are the set of
<user-pref name="days" display-name="days" default-value="5"/>
<user-pref name="location" display-name="location" default-value="USCA0987"/>
<user-pref name="address" display-name="address" default-value="San Francisco,CA"/>
<user-pref name="icon" datatype="hidden"/>
<user-pref name="unit" datatype="enum" default-value="F" display-name="unit">
<enum-value value="F" display-value="F"/>
<enum-value value="C" display-value="C"/>
</user-pref>
When processed, these tags are parsed into the following HTML:
<span class="editBlockLabel">days: </span><select name="days"><option value="1">1</option>
<option value="2">2</option>
<option value="3" selected="selected">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select><br><input name="location" value="USCA0987" type="hidden"><span class="editBlockLabel">address: </span><input name="address" value="San Francisco,CA" type="text"><br><input name="oldaddress" value="San Francisco,CA" type="hidden"><input name="icon" value="" type="hidden"><span class="editBlockLabel">unit: </span><select name="unit"><option value="F" selected="selected">F</option>
<option value="C">C</option>
</select>
As you can see each
- name* The name of the property you wish to set
- datatype The type of input, see below (default: string)
- display_name The label you wish to see accompany your input
- display-value The default value you want to appear
* denotes mandatory attribute
Each
- string Produces a textbox into which the user may enter alphanumeric characters
- bool Produces a radio button the user may tick/untick
- hidden Produces are hidden field not displayed to the user
- enum Used to produce a drop-down list, see below
Enum’s (short for enumerator’s) will iterate over child
See the above code example to see an enum datatype and its child
Event handling is not implemented for V1.0. However very soon we intend to allow you to ‘bind’ your own custom javascript functions to Bubbletop events that occur around your widget - such as OnLoad and OnDragEnd (i.e. when the user finishes moving your widget around their personalized page.
We would very much welcome the community’s thoughts and feedback about this – foundry@bubbletop.com
The HTML contents of your widget should be placed within the
<content type="html">
<![CDATA[
<style type="text/css">
</style>
<script type="text/javascript">
</script>
<!-- html here -->
]]>
</content>
As you can see, we include a type attribute within the
Another way to wrap your service into a widget is to use url type content.
There is no need to include outer tags as the type is already defined in the parent tag. Further more
and tags are unnecessary too.Javascript API
dimsuPref.getProperty(propertyname)
Returns the value assigned the key ‘propertyname’ for that user - either through the edit panel or through the setProperty() method.
dimsuPref.setProperty(propertyname,value,ifSave)
Saves a variable as a key/value pair. Setting ifSave=TRUE stores the key/value back on the server for future retrievale for that user, otherwise the variable is stored for this session only
dimsuPref.savepreference()
Saves all current set preferences for this session to the server
dimsuLib.FetchXMLContent(url,callbackfn)
Passes function ‘callbackfn’ a DOM object of the xml document located at the url specified
dimsuLib.FetchJsonContent(url,callbackfn)
Passes function ‘callbackfn’ a javascript object of the JSON payload located at the url specified
dimsuLib.FetchContent(url,callbackfn)
Passes function ‘callbackfn’ a javascript object of the plain text payload located at the url specified
dimsuLib.FetchContentByPost(url,cmd,myCallbackFunction,myErrorCallbackfunction,myAttachedJSObject)
Makes POST call to a url and send response text to the callback function. Note that you can also register a function to handle errors and even a Javascript object to attach some value to the request object and will be send back to the call back function.
dimsuSys.setWidgetTitle(title)
Sets the title of the Bubblet dynamically. Supercedes the title defined in the widget spec file - can be used for dynamic title changes
dimsuSys.setWidgetIcon(url)
Sets the icon for the Bubblet to be the image at the url given. Image should be 16px x 16px, can be a favicon.
dimsuSys.getLocale()
Returns the current locale as described at http://java.sun.com/j2se/1.4.2/docs/api/java/util/Locale.html, for example en_US, fr_FR.
Example 1 – Hello World
Here is an example of a ‘hello world’ widget:


