Archive for the ‘Eclipse RAP’ Category

Eclipse Nebula Picture Control

janvier 6, 2012 5 commentaires

In some business application, your model (domain) contains sometimes image byte array (ex : photo for person model, logo for project model, etc). In our XDocReport project, we need to manage photo byte array with SWT control for the person model in our Eclipse RCP/RAP XDocReport, in the resume editor :

This last screenshot is the resume editor in WEB context (Eclipse RAP). Here a screenshot in fat client context (Eclipse RCP) :

After several search, it seems that there is no project which provides a SWT picture control, which works with Eclipse RCP and RAP. So we decided to develop SWT PictureControl and give our code to Eclipse Nebula Project.Today Nebula Team are voting if the project will be accepted or not. Pictur control was accepted by Nebula and today it is stored on Eclipse Nebula Git.

If you are intersted you can read the original bug 365948.

Lire la suite…


My first steps with Eclipse RAP [step7]

août 8, 2011 13 commentaires

In [step6] we have seen how to manage UI with SWT Java code (no need to code Javascript). When I started « My first steps with Eclipse RAP » articles, I used Eclipse Helios which provides RAP 1.3. Since June 2011 Eclipse Indigo has been released and provides RAP (runtime and tooling) 1.4 which improves RAP. So, I decided to start over my articles with Eclipse Indigo to benefit from New & Noteworthy of RAP 1.4. In this article we will :

At the end of this article we will compare the two generated RAP and RCP Application code to see the differences between RCP and RAP Application. We will use this comparison in the [step8] to manage RAP (WEB Application) and RCP (Fat client) application with the same code (Single Sourcing).

Lire la suite…

Catégories :Eclipse RAP, Eclipse RCP

My first steps with Eclipse RAP [step6]

mai 31, 2011 3 commentaires

In step5, we have explained the generated code of the RAP Hello World Application. In this step we will improve our RAP Application to add basic user-interface (UI). At the end of this article, our RAP Application will look like this :

In RAP/RCP Application, UI is managed with SWT (Standard Widget Toolkit) :

SWT is an open source widget toolkit for Java designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented.

SWT is an API to manage UI. There are several implementation of SWT :

  • for RCP Application, the basic idea of SWT is to use the operating systems (OS) native widget to render UI. There is an implementation of SWT for each OS (Windows, Linux…). Swing for instance emulates the UI widgets, that’s why the look and feel of Swing Application are the same for any OS, although look and feel of SWT Application change according to the OS (a button in SWT Application use Windows button look and feel if the SWT Application runs on Windows, use Linux button look and feel if the SWT Application runs on Linux..)..
  • for RAP Application, SWT is implemented with Qooxdoo Javascript widgets. The SWT implementation in RAP Application is called RWT (Rich Widget Toolkit). We will study it in the next article.

Lire la suite…

Catégories :Eclipse RAP

My first steps with Eclipse RAP [step5]

mai 24, 2011 5 commentaires

In [step4], we have explained how OSGi container and Servlet container can work together. In this article we will explain the generated code of the RAP Hello World that we have generated in the [step1]..

Eclipse RAP Home Page describes RAP like this :

RAP is very similar to Eclipse RCP, but it has an alternative implementation of the SWT API (called RWT) which renders the widgets remotely in a web browser. The RAP application runs on a servlet container and clients can access the application with standard web browsers.

This schema shows RAP architecture. I will use this schema in my articles to explain step by step each component of the RAP architecture. RAP application (like RCP Application) is an Eclipse Plug-In based on the Workbench component. In this article we will see RAP Application and Workbench components :

  • the Workbench component is a collection of windows. Each window contains a menu bar, a toolbar, a shortcut bar and one or more perspectives. Please read Inside the Workbench for more information. For RAP Application, Workbench is managed with the org.eclipse.rap.ui.workbench bundle.
  • RAP Application is an Eclipse Plug-In based on the Workbench. It’s our org.akrogen.dynaresume.raphelloworld bundle.

I suggest you to read Rich Ajax Platform, Part 1: An introduction which explains the generated RAP application (like explained in this article) and compare it with RCP Application code.

Lire la suite…

Catégories :Eclipse RAP

My first steps with Eclipse RAP [step4]

mai 20, 2011 6 commentaires

In [step3], we have explained how to manage dependencies between bundles with Require-Bundle and Import-Package. OSGi services registry was introduced and used to publish/consume a business service UserService which provides list of Users. At this step we have explained OSGi bundle and OSGi container.

RAP Application (like RCP Application) needs OSGi Container, but it also needs Servlet Container, because RAP Application is a WEB Application. When URL is called, the RAP Servlet org.eclipse.rap.ui.internal.servlet.RequestHandler is called. This Servlet is a dispatcher which does the RAP treatments according to the URL request.

In this article I will explain how OSGi Container and Servlet Container can work together. OSGi provides the org.osgi.service.http.HttpService which is a service where you can register/unregister Servlet.

In this article we will create a new bundle org.akrogen.dynaresume.httposgiapplication which register in the OSGi services registry the servlet HelloWorldServlet with the path /helloworld. This servlet will be accessible with the URL http://localhost/helloworld :

Here a schema about the architecture OSGi container and Servlet container used in this article :

Lire la suite…

Catégories :Eclipse RAP

My first steps with Eclipse RAP [step3]

mai 18, 2011 6 commentaires

In [step2] we have created our first OSGi bundle org.akrogen.dynaresume.osgiapplication with PDE (Plug-in Development Environment) and we have used OSGi console to start/stop our bundle. This bundle defines an OSGi Activator which uses classes from org.osgi.framework package. This dependency use Import-Package :

Import-Package: org.osgi.framework;version="1.3.0"

OSGi dependencies can be managed with 2 means :

  • Import-Package : the bundle declares packages that it needs in the MANIFEST.MF. The bundle doesn’t know which bundles export the packages.
  • Require-Bundle : the bundle declares explicitly the required bundles in the MANIFEST.MF .

One other feature of OSGi, is the OSGi services registry where bundle can register/unregister services Publisher) and another bundles can consume services (Consumer) retrieved from the OSGi services registry.

In this article, we will create new Services bundle which will publish UserService service (which gives a list of Users) in the OSGI services registry. org.akrogen.dynaresume.osgiapplication will be modified to consume UserService and displays the list of Users in the System.out. User class will be defined in the bundle.

At first, org.akrogen.dynaresume.osgiapplication will use Require-Bundle,then Import-Package after to see the advantage of this kind of dependency.

At the end of this article we will have 3 OSGi bundles :

  • org.akrogen.dynaresume.domain : OSGi bundle which defines and export Java Bean Domain
  • : OSGi bundle which registers in the OSGi services registry (in the Activator#start) an implementation of which is able to returns the list of Users :
    import java.util.Collection;
    import org.akrogen.dynaresume.domain.User;
    public interface UserService {
    	Collection<User> findAllUsers();
  • org.akrogen.dynaresume.osgiapplication : OSGi bundle creates a thread (in the Activator#start) which get UserService from the OSGi services registry every 5 seconds then call UserService#findAllUsers() to display User in the System.out.

This schema shows you that there are dependencies between OSGi bundles. Dependencies can be managed with Require-Bundle or Import-Package.

Lire la suite…

Catégories :Eclipse RAP

My first steps with Eclipse RAP [step2]

mai 16, 2011 4 commentaires

In [step1] we have generated our first RAP Hello World Application. RAP Application is (like RCP Application) an Eclipse Plugin which is an OSGi bundle. Before explaining generated code of the RAP Hello World Application you need to understand OSGi.

I’ve decided to explain quickly OSGi by using PDE (Plug-in Development Environment) with 3 articles :

  • [step2] (this article) explains how to create OSGi bundle with PDE, how to run the OSGi container (Equinox) which manage a set of bundles (coming from Workspace + Target Platform) to start/stop bundle with OSGi console.
  • [step3] explains how to OSGi manage the dependencies between several bundles with Required-Bundle and Import-Package declared in the MANIFEST.MF and show in action the OSGi registry services which is used to share services between bundles (SOA Architecture).
  • [step4] explains how to use Servlet into OSGi context with OSGi HttpService. This article is interesting because it will explain how RAP Application works : RAP Servlet org.eclipse.rap.ui.internal.servlet.RequestHandler is called when URL is accessed.

In this article we create an OSGi bundle org.akrogen.dynaresume.osgiapplication which defines a simple OSGi Activator which displays in the System.out when the bundle is started and stopped. Here is a scheme which shows in action org.akrogen.dynaresume.osgiapplication managed with OSGi container (Equinox) :

Lire la suite…

Catégories :Eclipse RAP, Equinox