Contents

Create a Handler type of stereotype RUIHandler

Consider a grid layout on the design surface:

Here is the related code:

packageclient;importorg.eclipse.edt.rui.widgets.GridLayout;
handler MyHandler type RUIhandler{// sets one or more widgets at the root of the widget tree.
initialUI =[ui],
// specifies the function that runs initially and without user interaction.
onConstructionFunction = start,
// identifies the CSS file that helps you to design the page.
cssFile ="css/MyProject.css",
// sets the title that is displayed at the top of your browser or browser tab.
title ="MyHandler"}
ui GridLayout{columns =3, rows =4, cellPadding =4, children =[]};
function start()
end
end

When you request a Rich UI handler in the IDE, the Rich UI editor includes a grid layout of 3 columns and 4 rows.

The code now includes a variable named counter, for use in the next section.

Write the on-construction function

The on-construction function is typically named start. The function might update the widgets, initialize variables, invoke a service, or schedule a job.

The example function changes a label text, initializes a counter, and schedules a job that increments the counter. The job begins when the on-construction ends. The job ends when the user clicks the button.