Developer Guide

Methods to use

EnvironmentUtils.getInstance().isWeb() to see if the client is a web browser instead of a desktop app.

Methods to avoid

Display.getDefault() is not allowed

RAP is multi user framework by its nature. Every user session is associated with a display. In RAP, Display#getDefault() will not create a new display when it’s called from non-UI thread - read Display#getDefault JavaDoc. When you execute a code in a background thread, RAP needs to know for which UI session (display) it belongs. That’s why you have to provide the correct UISession/display from outside.

Display.getDefault() cannot be used in non-UI thread with RAP/RWT.

SWT.CASCADE without submenu does not work

A menuitem with SWT.CASCADE without a submenu looks and behaves differently from SWT.

SWT:

  • The menuitem does not have a right arrow on the right hand of the menu text.

  • The menuitem is clickable.

RWT:

  • The menuitem has a right arrow.

  • The menuitem is NOT clickable.

CTabFolder.setSimple() is not allowed

This method is not implemented in RAP/RWT.

Themes

Hop Web now has 2 themes implemented: "light" and "dark". They are selected with the system environment variable HOP_WEB_THEME which you can pass to a docker container using --env HOP_WEB_THEME=dark. The default theme is light

To change a theme you need to look in 2 different locations:

CSS

The colors of the various widgets, windows, the icons used and so on are defined in css files:

  • For the dark theme: rap/src/main/resources/org/apache/hop/ui/hopgui/dark-mode.css

  • For the light theme: rap/src/main/resources/org/apache/hop/ui/hopgui/light-mode.css

The Eclipse RAP theming reference is found here.

JS

When icons are moved, lassoed and so on we have a bit of JavaScript taking care of those operations. You can find the relevant files handling that over here:

  • For the dark theme: rap/src/main/resources/org/apache/hop/ui/hopgui/canvas-dark.js

  • For the light theme: rap/src/main/resources/org/apache/hop/ui/hopgui/canvas-light.js

Building the Hop Web docker container

If you have built the project using mvn clean install you can build a local hop-web docker container to test with the following script:

docker/create_hop_web_container.sh

You can also do this incrementally for the following modules:
  • core

  • engine

  • ui

  • rap

If you rebuild any of these modules after changes you can simply run docker/create_hop_web_container.sh and this script it will incorporate your changes in the container.

To then run it simply execute:

docker run -p 8080:8080 -e HOP_WEB_THEME=dark hop-web

Configuring Hop Web

The main configuration of Hop is done through a single configuration file called hop-config.json and it is found in folder ${HOP_CONFIG_FOLDER}

It is possible to set pass this standard Hop environment variable HOP_CONFIG_FOLDER to the docker container. You can point it to a mounted volume for example:

docker run -p 8080:8080 -v /host/path/to/config:/config -e HOP_CONFIG_FOLDER=/config hop-web

In the same way you can set the standard variable HOP_AUDIT_FOLDER to store GUI auditing and logging information.