...
This the the base class for UI functionality. The salient features to note are introduced briefly below.
(1) Reference to the UiExtensionService:
Code Block | ||
---|---|---|
| ||
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected UiExtensionService uiExtensionService; |
(2) List of application view descriptors, defining which category the view appears under in the GUI navigation pane (if not a hidden view), the display text for the link, and the internal identifier for the view:
Code Block | ||
---|---|---|
| ||
// List of application views private final List<UiView> uiViews = ImmutableList.of( new UiView(UiView.Category.OTHER, "sample", "Sample") ); |
(3) Declaration of a UiMessageHandlerFactory to generate message handlers on demand. The example factory generates a single handler each time, AppUiMessageHandler, described below:
Code Block | ||
---|---|---|
| ||
// Factory for UI message handlers private final UiMessageHandlerFactory messageHandlerFactory = () -> ImmutableList.of( new AppUiMessageHandler() ); |
(4) Declaration of a UiExtension, configured with the previously declared UI view descriptors and message handler factory:
Code Block | ||
---|---|---|
| ||
// Application UI extension protected UiExtension extension = new UiExtension.Builder(getClass().getClassLoader(), uiViews) .messageHandlerFactory(messageHandlerFactory) .build(); |
(5) Activation and deactivation callbacks that register and unregister the UI extension at the appropriate times:
Code Block | ||
---|---|---|
| ||
@Activate protected void activate() { uiExtensionService.register(extension); log.info("Started"); } @Deactivate protected void deactivate() { uiExtensionService.unregister(extension); log.info("Stopped"); } |
AppUiMessageHandler
This class extends UiMessageHandler to implement code to handle events from the (client-side) sample application view.
Info |
---|
Currently we only have one GUI archetype, which is written as a Tabular View. (We need to create an additional (simpler) archetype for custom views.) So, for now, just note that the details below are subject to change... |
Salient features to note:
(1) implement createRequestHandlers() to provide request handler implementations for specific event types from our view:
Code Block | ||
---|---|---|
| ||
@Override
protected Collection<RequestHandler> createRequestHandlers() {
return ImmutableSet.of(
new SampleDataRequestHandler(),
new SampleDetailRequestHandler()
);
} |
(2) request handler implementations ...
Info |
---|
to be documented |