Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: for the plan.

Jump to: navigation, search

Riena/Example Applications and Code Templates


Riena ▶ Example Applications and Code Templates ▶

On this page you will get a feel of the Riena framework by building and running applications built with Riena:

  • We show you how to build your first Riena application, either using a template or starting from scratch.
  • We briefly explain what Ridgets ("Riena widgets") are; an extensive set of snippets will show you how to use them.
  • Sample applications will give you a glimpse of Riena features such as Remote Services and of Riena's UI/Navigation approach.

Build your first Riena application

The easiest way to start building a Riena application is to use a template included in the Riena Templates Feature. Of course, you can also write a Riena app from scratch.

Using the 'new project' templates

Use the Wizards that are part ot the Riena Toolbox to generate a sample Application described here

If you prefer to roll your own

Ralf Ebert has written an excellent tutorial on the first steps of how to build a Riena client application from scratch.

Try the Riena Snippets

The Riena Snippets page contains a growing collection of self-contained code examples that show you how to use ridgets ("Riena widgets") and what you can do with them.

What are ridgets?

A ridget wraps an actual UI widget but offers a higher level of abstraction and it is independent from the UI toolkit (SWT). The idea is to separate the UI (view) from the logic behind it, which is moved to a view controller. The view controller interacts with the actual UI widgets through the ridgets. It should be possible to reuse a view controller with a view that is based on a different UI toolkit (e.g. Swing).

In effect, a ridget can be considered a mini-controller for a single UI control.

A ridget offers the most commonly-used functionality (like setText(String) of a text field) along with some extra convenience functionality like markers. A textfield can be marked as error by adding an ErrorMarker. The marking itself (changing color, setting icons, etc.) is handled by the Riena framework. Another example is the bindToModel(...) method for a simple databinding with a JavaBean.

The overall intention is to reduce the complexity for the application developer and to ensure a common look & feel across the application. If the functionality offered by the ridget's interface is not sufficient the developer can always access the actual UI widget. (Then of course he loses the independence from the UI toolkit). The set of ridgets is constantly getting bigger. If necessary it should be possible for applications to add its own ridgets.

In the view you create SWT controls as always and register them with Riena (addUIControl(...)). The ridgets will be injected into the controller, where you then have access to the corresponding ridgets.

(Adapted from a discussion on riena-dev.) See also Ridget Design Principles.

Try the communication ping pong example

  1. File -> Import -> Plug-in Development -> Plug-ins and Fragments -> Next.
  2. Select "Projects with source folders" unter Import As (since it's more fun with source code) -> Next.
  3. In the Plug-ins Listbox, select the 4 plugins *.communication.sample.pingpong.* and click Add and then Finish.
  4. In the Run Dialog you can select which of the two components to run (under 'OSGi Framework').
    • Don't forget to press the 'Add required Bundles' button for both of them before you start them!
    1. First, start the Riena Sample PingPong Server.
      • The server starts at port 8080, make sure it's not taken.
    2. Then start the Riena Sample PingPong Client.
  5. On success your client will print a message on the console: PingPong::Client:: [Pong] says = Thx. I got the ping!
  6. Switch to the server console; it should show a message like this: PingPong::Server:: [Ping] says = I ping you and you pong me

Try the unit tests

  1. Import the project org.eclipse.riena.tests from the target platform (same as above).
  2. There are classes like AllTests on various levels that you can run as Junit Plugin Tests.
  3. You can also run individual tests as JUnit Plugin Tests.
Currently there are more than 2000 tests
They should all work. Some of them fail if you click or move the mouse while the tests are running (e.g. focus or UI tests).
Launch Error on starting tests
This sometimes happens when you launch a test as JUnit Plugin Test for the first time. => You will need to modify the launch configuration for this class:
  1. In the "Main" tab, change the field "Run an application" to "[No Application] - Headless Mode".
  2. In the "Plug-ins" tab:
    1. Launch with: choose "plug-ins selected below only".
    2. "Deselect All"
    3. Check/select the bundle containing the test you want to run.
    4. "Add Required Plug-ins"
  3. Apply. Run.
Classes ending with *ITest require a server.
That's the Riena App Sample Server (explained in the next step).

Install the Riena Sample App Server

Simple server with customer search web service:

  1. Stop any previously started client or server.
  2. Import the projects and from the target platform.
  3. Start Riena App Server from the Run Dialog:
    • Don't forget to press the button "Add required bundles".
    • This server starts on port 8080, make sure that port is not taken.
  4. That should bring up a relativly simple app server with just the customer search web service.

Server with many more services:

  1. Stop the server again.
  2. Bring up the Run Dialog again, select Riena App Server and select the bundles and (both found in the target platform).
  3. Press "Add required bundles".
  4. Run it.
  5. Now you can see in the console a lot more (security-related) web services.
  6. Now you can also run the *ITests from the tests bundle, e.g. SessionServiceITest.

Run the Riena Example Client

  1. File -> Import -> Plug-in Development -> Plug-ins and Fragments -> Next.
  2. Select "Projects with source folders" unter 'Import As' (since it's more fun with source code) -> Next.
  3. In the Plug-ins Listbox, select the plugin org.eclipse.riena.example.client, click 'Add' and then 'Finish'.
  4. In the Run Dialog -> Eclipse Application, there are two entries "SWT ExampleApplication" and "SWT ExampleApplication (with alternative Lnf)".
  5. You can launch them both:
    • Don't forget to click on Add Required Plug-ins in the Plug-ins Tab.
    • Both launchers start the same application based on the same code, but using two distinct Riena Themes (different colors, fonts etc.).
  6. Play with it :-)

There is also a project that you can import and start the same way. (The launcher is "Mail Sample (Riena UI)".)

Run the Riena Demo

  1. File -> Import -> Plug-in Development -> Plug-ins and Fragments -> Next.
  2. Select "Projects with source folders" unter 'Import As' (again: it's more fun with source code) -> Next.
  3. In the Plug-ins Listbox, select the 3 plugins org.eclipse.riena.demo.*, click 'Add' and then 'Finish'.
  4. Run the Riena Demo Server launcher (don't forget Add Required Plug-ins).
  • Run the Riena Demo Client launcher (don't forget Add Required Plug-ins).

Next Step

Get started with the key concepts and features of Riena.

Back to the top