Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

The Rich Get Richer: Eclipse Rich AJAX Platform Builds on RCP : Page 2

The new Eclipse Rich AJAX Platform (RAP) is a server-side platform that multiple concurrent users can access via their browsers and Eclipse RCP developers can learn in no time.


advertisement
RAP, RCP—What's the Difference?
The main difference between Eclipse RAP and Eclipse RCP is RAP's use of RWT (RAP Widget Toolkit), which is a replacement for SWT (Standard Widget Toolkit). SWT defines all the UI widget and primitives of an RCP application (buttons, labels, and so on) with native widgets of the underlying client operating system. Conversely, RWT defines all the UI elements as web primitives: HTML form elements, input texts, HTML buttons, and all the JavaScript needed to animate them appropriately.

More precisely, RWT renders the widgets by pushing instructions to the browsers, where they are are interpreted by qooxdoo, a specialized JavaScript library. By executing on the browser, qooxdoo draws the UI, responds to events, and propagates events back to the server. Figure 2 shows the technical differences between an RCP application and a RAP one.

Click to enlarge

Figure 2. The Internal Compositions of a RCP and a RAP Application:
Here's a side-by-side comparison of the technical differences between an RCP application and a RAP one.



Since the only big difference resolves to different rendering techniques (SWT vs. RWT), it follows that the same code written for an RCP application will work (almost) unchanged for a RAP application (see Sidebar 1. How RAP Works for more on their differences and similarities). Figure 3 shows one of the sample RCP application views shipped with Eclipse rendered both as an RCP and as a RAP application. Notice that the RAP one lives within a browser window.

Click to enlarge

Figure 3. View Rendered Both as an RCP and as a RAP Application:
Here's a Sample view rendered both into a RCP standalone client and in RAP within a browser window.

The view uses exactly the same code (shown in Listing 1) in both cases. (The code for the complete sample is available in the code download.)

Widgets Wanting
Exceptions apply to what RAP/RWT can do with respect to RCP/SWT. Probably the most evident difference between the two platforms is the limited set of widgets supported by RAP. Since RWT renders widgets as DHTML primitives, some of the most advanced widgets available on SWT cannot be used with RAP. This includes, for example, the StyledText widget, which is used to create text editors that allow different text colors, fonts, and attributes for different portions of text. The common use case for this widget is editors with syntax highlighting. RAP is limited to non-styled Text widgets that render as TEXTAREA HTML elements.

However, this does not imply that you are limited to basic HTML components in your RAP applications. On the contrary, RAP allows for the creation of custom widgets, via some mixed Java and DHTML code, such as the Google Maps example described in the RAP documentation.

Another thing you cannot do in RAP is direct drawing on canvas; you cannot draw circles, lines, and other graphic primitives. Therefore, high-level Eclipse frameworks such as GEF and GMF won't work on RAP because they rely on custom canvases to draw their complex graphs and figures. Check your project's graphics requirements before migrating it to RAP.

Eclipse is continually working to recreate as much of the SWT functionalities as possible. The New and Noteworthy page of the RAP project provides updates.

RAP Particularities
RAP has some very specific particularities that strongly differentiate it from RCP. First of all, since RAP applications are exposed by a web server, multiple users can navigate concurrently on a single application. This is a fundamental difference from RCP applications, which are single-user. RAP provides this feature by borrowing the concept of sessions from traditional web applications, keeping all the state information about the application (widgets' statuses, user settings, and so on) inside users' sessions. RAP also offers some specific methods that allow you to deal with session data and register to session events. They are all reachable from the class org.eclipse.rwt.RWT, as shown in the following listing:

// extract the current session id RWT.getSessionStore().getId(); // store some user-specific data in his own session RWT.getSessionStore().getHttpSession().put(key,value); // attach a session-listener to be notified whenever a session is destroyed. RWT.getSessionStore().addSessionStoreListener(myListener); // access the HttpServletRequest object RWT.getRequest();



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap