Creating a Rich UI application with multiple handlers
You can use multiple Rich
UI handler
parts to compose a single
application. However, we do not mean to say that you embed one handler
part in another. Instead, the handler part declares variables that
are each based on another handler part. A variable based on an Rich
UI handler part is called an embedded handler, as in the following
example:
embeddedHandler AnotherHandlerPart{}; // declared Rich UI handler
(based on part AnotherHandlerPart)The embedding Rich UI handler can access the global widgets and public functions declared in an embedded Rich UI handler. In particular, the embedding handler can add widgets to its own initialUI and children arrays. Also, you can embed a handler that invokes services or otherwise handles business processing. A reasonable practice is to use one handler to present the UI and to use other handlers to oversee the backend, business processing.
You access widgets and functions with a dot syntax.
In the following
outline, the Handler part
AnotherHandlerPart is assumed
to have declared a button named itsButton, which
is attached to the DOM tree only when that button is included in the initialUI array
of the embedding handler:handler SimpleHandler type RUIHandler { initialUI = [ embeddedHandler.itsButton ] }
embeddedHandler AnotherHandlerPart{};
endSimilarly, you can add an embedded widget to a children array.
You can access a
function or property in an embedded widget by
extending the a dot syntax. For example, the following statement retrieves
the displayed text of the embedded Button itsButton:
myString STRING = embeddedHandler.itsButton.text;The initialUI array of the embedded handler has no effect at run time. That array is used only when the embedded handler is the basis of a Rich UI application and is not embedded at all.