Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Two tools bring Ajax to Eclipse's Ajax Toolkit Framework

Dojo and Zimbra

Tim McIntire (tim949@gmail.com), Software Engineer and HPC Cluster Architect, Consultant
Tim McIntire works as a consultant in a variety of computer science disciplines. His research has been published in Concurrency and Computation and IEEE Transactions on Geoscience and Remote Sensing. He is also the co-founder of Cluster Corp., a market leader in Rocks cluster integration and HPC consulting. Previously, he led the computer science effort at Scripps Institution of Oceanography's Digital Image Analysis Lab, and his work on the NASA-sponsored Parallel Image Processing Environment (PIPE) was featured in an article on Rocks cluster software in the computational science magazine EnVision.

Summary:  IBM's contribution to the launch of the new Open Ajax Initiative aims to increase accessibility to the powerful Web programming technique through the Eclipse Foundation. To help prepare developers for the new tool set, this article introduces two existing runtime tools -- Dojo and Zimbra -- which will be supported in Eclipse's Ajax Toolkit Framework (ATF).

Date:  09 May 2006
Level:  Intermediate
Also available in:   Korean  Russian  Japanese

Activity:  23655 views
Comments:  

The partners behind the Open Asynchronous JavaScript and XML (Ajax) Initiative are strengthening the community by building an open platform in which developers can collaborate. The founding members of the initiative -- including BEA Systems, Borland Software, the Dojo Foundation, the Eclipse Foundation, Google, IBM, Laszlo Systems, Mozilla, Novell, Openwave Systems, Oracle, Red Hat, Yahoo!, Zend Technologies, and Zimbra -- realize the tremendous importance of introducing new tools to a growing community of Ajax developers. The initiative puts a wide range of tools into the hands of the people who are building responsive user interfaces (UIs) into new and existing environments. The unified interface and advanced debugging capabilities in Eclipse bring an enterprise-class coding environment to the community. Eclipse's ATF will offer easy access to toolkits from Dojo and Zimbra.

Initiative members believe that major backing of Open Ajax may be the tipping point it takes to drive the message that the Web still has life in it. The Open Ajax Initiative is working to do something positive for the health of the Web in general.

Note: See Resources for a press release explaining the Open Ajax Initiative.

The Eclipse ATF

The Eclipse Foundation has been a beacon for open source development and powerful application frameworks. Eclipse is a Java™-based open source development platform that is fully extensible and can be deployed on every major platform. A wide variety of plug-ins and tools are available.

As part of the Open Ajax Initiative, the Eclipse Foundation is building the ATF, which will provide an extensible framework for runtime environments, such as Dojo and Zimbra. The ATF acts a central component unifying tools that are part of the Open Ajax Initiative. An early version of the ATF is available from IBM alphaWorks (see Resources).

Based on the Eclipse Web Tools Project, the ATF provides tools for building independent development environments (IDEs), includes features such as runtime syntax checking, and embeds a JavaScript debugger, Document Object Model (DOM) browser, and a Mozilla Web browser. The ATF is what gives traditionally sparsely featured open source development tools the full enterprise-style development environment that many developers are comfortable working in. This tutorial focuses on Dojo and Zimbra, as they are two of the most capable and mature Ajax tools available. Figure 1 shows the components of the initiative and how the ATF fits in.


Figure 1. Open Ajax Initiative components
Open Ajax Initiative components

Dojo

In anticipation of the adoption of tools used in the Open Ajax Initiative, you should familiarize yourself with the tool kits the ATF will support, such as Dojo and Zimbra.

Dojo is a community project designed to unify the efforts of the JavaScript and Dynamic Hypertext Markup Language (DHTML) communities in a single direction by building a standard JavaScript library. The community realized it wouldn't get far without people working together, so three separate predecessor tool kits were unified to form the Dojo Foundation, which owns and maintains the code. Dojo has several optional packages, including an Ajax edition; an I/O edition; and a "Kitchen Sink" edition, which includes the entire tool set.

Getting started with Dojo is as simple as downloading one of five editions:

  • Ajax -- Use the Ajax edition to create applications with asynchronous I/O (XmlHttp), integrate complex visual effects, and use an aspect-oriented event system.
  • I/O (XmlHttp) -- The I/O edition is built with dojo.io.bind, so you can use an XmlHttp layer for asynchronous I/O.
  • Event + I/O -- This edition includes Dojo's aspect-oriented event system and the XmlHttp layer.
  • Widgets -- This includes HTML and Cascading Style Sheet (CSS) template capabilities with loose coupling to the widget implementation, providing distinct separation of style, content, and logic.
  • The "Kitchen Sink" -- This build includes all the Dojo libraries.

Install Dojo

Choose the appropriate Dojo edition, download it, and extract the package. Move the following files into your root Web directory (you'll add a helloworld.html file for example purposes):

  • dojo.js
  • iframe_history.html
  • src (directory)
  • helloworld.html

Add a single line to .html files with the path to your Dojo files:

<script type="text/javascript" src="path/to/dojo/dojo.js"></script>

You're now free to load Dojo libraries and widgets within your JavaScript. (see Resources for detailed instructions).

A simple Dojo example

Now let's try a simple example that prints "Hello World!" through a debug process each time you press a button. We will edit helloworld.html in this example. The initial bit of code shown in Listing 1 sets the path for dojo.js and turns debug mode on so you can test your output.


Listing 1. A simple example that prints "Hello World!"

<html>
  <head>
    <script type="text/javascript">
      djConfig = { isDebug: true };
    <script>

    <script type="text/javascript" src="./dojo.js"></script>

Use the Button2 widget with "events" to call out your helloPressed function:


Listing 2. Use Button2 widget with "events" to call out helloPressed function

<!-- DOJO EXECUTION -->
<script type="text/javascript">
  dojo.require("dojo.widget.Button2");
  dojo.require("dojo.event.*");

The helloPressed function simply makes a call to dojo.debug to print out the "Hello World!" message:

function helloPressed()
{
  dojo.debug('Hello World!');
}

Here you have an init function, which associates the helloButton with a Dojo widget. The second line indicates that the helloPressed function should be called when you click Press Me.

function init()
{
  var helloButton = dojo.widget.byId('helloButton');
  dojo.event.connect(helloButton, 'onClick', 'helloPressed');
}

The following line runs the init function on the initial page load:

dojo.addOnLoad(init);

Finally, the body of the HTML contains the actual button, which is given a type and an Id to associate it with the JavaScript above.


Listing 3. Associate ID with above JavaScript

    </script>
  </head>

  <body>
    <button dojoType="Button2" widgetId="helloButton">Press Me</button>
  </body>
</html>

Figure 2 shows the output of your "Hello World!" Dojo application after you click Press Me.


Figure 2. Output of "Hello World!" Dojo application
Output of Hello World

A detailed HelloWorld example is available from the Dojo wiki (see Resources).

Dojo makes integrating small snippets of Ajax code into existing Web pages easy by providing a powerful and growing widget set with which you can easily add UI effects you would expect to find in a desktop environment. Developers are protected from having to write every part of the UI by hand. For advanced users, it provides capabilities that most tools don't. For instance, a packaging and build system are included for quickly optimizing projects for deployment. Dojo is a palatable solution for Ajax developers at all levels.

The introduction of the ATF, which integrates Dojo into Eclipse, will advance these capabilities to the enterprise level by providing a graphical coding environment and access to additional Eclipse plug-ins. For an early demo of Dojo in Eclipse, see Resources.


The Zimbra Ajax Toolkit

Zimbra is contributing to the Open Ajax Initiative by providing open access to the Zimbra Ajax Toolkit (AjaxTK). Zimbra has used AjaxTK to push the envelope of what we think of as a Web page by developing a complete online Collaboration Suite, including enterprise-class e-mail, calendar, and contacts. The AjaxTK squeezes the responsiveness gap between a Web-based application and a standard desktop-based application to near zero. Figure 3 shows the mail application included in Zimbra's Collaboration Suite, developed using the AjaxTK.


Figure 3. Zimbra's mail application
Zimbra's mail application

Figure 4 shows Zimbra's calendar application, also developed with AjaxTK.


Figure 4. Zimbra's calendar application
Zimbra's calendar application

The same Ajax tool used in-house to develop this impressive Collaboration Suite is available to the public. A belief in the strength of an open and nonproprietary environment for Ajax development provided the impetus to open the powerful tool to the public.

AjaxTK is built on the following source packages:

  • config -- Configuration information and message localization files
  • core -- Base exception classes and environment information
  • debug -- Debug classes for run time application debugging
  • dwt -- DHTML Widget Toolkit:
    • config -- CSS rules, images, and localized text
    • core -- Exception handling and low-level DOM utility functions
    • dnd -- Drag-and-drop support
    • events -- Various events used by the tool kit and built on the general AjaxTK event support
    • graphics -- Points, rectangles, and CSS utilities
    • widgets -- The DWT widget set and supporting classes
    • xforms -- Provides an XForms implementation for creating complex forms
  • events -- Base event and event listener classes, as well as the event manager class responsible for event registration and dispatching
  • net -- Network communications
  • soap -- SOAP document handling
  • util -- Utility classes for such tasks as string manipulation, cookie management, data manipulation, deferred action support, and callback support
  • xml -- XML document handling

Enterprise developers can take comfort in knowing that the Zimbra Ajax Toolkit has been used to build large, robust applications deployed in the real world. Zimbra's Collaboration Suite contains more than 130,000 lines of JavaScript. AjaxTK takes aim at developers planning to build complete replacements for desktop applications. If you want to enhance existing Web pages with Ajax, perhaps Dojo is more appropriate. The choice depends on what you're trying to do.

As AjaxTK is plugged into Eclipse, components you generally need to develop a rich UI -- such as trees, buttons, and lists -- are becoming easier and quicker to implement. Integration with Eclipse adds enhanced capabilities to the table, including powerful debugging tools and drag-and-drop composition. Zimbra plans to continue to drive Ajax by collaborating with the members of the Open Ajax Initiative and supporting open, nonproprietary technologies.


The initiative goes forward

As the adoption of Ajax helps the Web reach new levels of interactivity and responsiveness, the importance of enterprise-class development tools will continue to grow. The ATF, Dojo, and Zimbra are key components to this advancement. As Web audiences continue to demand better, faster, smoother Web applications, the burden is on tool kit developers and the browser manufacturers to maintain a cooperative environment that encourages advancements in UI and cross-platform compatibility. The Open Ajax Initiative is a framework in and of itself, built for just such a purpose.

As the Open Ajax Initiative makes strides and the ATF comes to life, this series will continue, providing technical detail and tutorials for building Ajax applications in Eclipse.

Acknowledgements

Special thanks to Alex Russell (Dojo Foundation founder and president), Ross Dargahi (Zimbra co-founder and vice president of engineering), and John Robb (Zimbra vice president of marketing and product management) for taking the time to weigh in on the Open Ajax Initiative for this article.


Resources

Learn

Get products and technologies

Discuss

  • An active Zimbra forum supports the development of working examples using AjaxTK.

  • The Eclipse Platform newsgroups should be your first stop to discuss questions regarding Eclipse. (Selecting this will launch your default Usenet news reader application and open eclipse.platform.)

  • The Eclipse newsgroups has many resources for people interested in using and extending Eclipse.

  • Participate in developerWorks blogs and get involved in the developerWorks community.

About the author

Tim McIntire

Tim McIntire works as a consultant in a variety of computer science disciplines. His research has been published in Concurrency and Computation and IEEE Transactions on Geoscience and Remote Sensing. He is also the co-founder of Cluster Corp., a market leader in Rocks cluster integration and HPC consulting. Previously, he led the computer science effort at Scripps Institution of Oceanography's Digital Image Analysis Lab, and his work on the NASA-sponsored Parallel Image Processing Environment (PIPE) was featured in an article on Rocks cluster software in the computational science magazine EnVision.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source
ArticleID=109889
ArticleTitle=Two tools bring Ajax to Eclipse's Ajax Toolkit Framework
publish-date=05092006
author1-email=tim949@gmail.com
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers