Skip navigation links
org.netbeans.modules.uihandler 2.54

UI Gestures Collector Infrastructure
Under Development

See: Description

UI Gestures Collector Infrastructure 
Package Description
org.netbeans.modules.uihandler.api
Package with interfaces that other modules may implement in order to be notified about important lifecycle points during collecting the UI Gestures.

This module tracks certain UI gestures produced by user and collects a log of his actions. It is capable to display such log and also upload it to a central server for additional processing and analysis.

What is New (see all changes)?

Use Cases

Gather information about UI gestures

Primary purpose of this module is collect information about the user actions that take place in the running NetBeans based application.

The info about various UI events in the system is collected thru listening on log records send to Logger.getLogger(UI_LOGGER_NAME_VALUE) , where UI_LOGGER_NAME_VALUE is a value of UI_LOGGER_NAME resource bundle key, defining the name of the UI usage logger. Any code in the system can get instance of this logger or any child logger and send useful informations to it. At the end of the session the last few hundereds events is taken and displayed to the user for further processing. The info about various UI events in the system is collected thru listening on log records send to Logger.getLogger(METRICS_LOGGER_NAME_VALUE) , where METRICS_LOGGER_NAME_VALUE is a value of METRICS_LOGGER_NAME resource bundle key, defining the name of the metrics logger. Any code in the system can get instance of this logger or any child logger and send useful informations to it. At the end of the session the last few hundereds events is taken and displayed to the user for further processing.

Presenting usage statistics

Important part of the behaviour of this module is the ability to cooperate with information analyzing tools and present their results. This is done thru special HTTP contracts, where the module reads and understands various server responses and is able to open browser after submitting data to analysis.

There is a key in the org.netbeans.modules.uihandler.Bundle that specifies the location of the page on a server one shall query and display to the user when the module is about the submit usage data for analysis. There is a key in the org.netbeans.modules.uihandler.Bundle that specifies the location of the page on a server one shall query and display to the user when the module is about the submit metrics data for analysis. There is a key in the org.netbeans.modules.uihandler.Bundle that specifies the location of the page on a server one shall query and display to the user when the module is about the submit an error report. The page pointed by WELCOME_URL can contain any XHTML text, but it also should contain a <form/> tag that defines <input type="hidden" name="submit" value="localizedName"/>. The localizedName is then going to be used for a button for the dialog displaying the summary. When this button is invoked, the "action" URL is then feed with data from the UI logs. The server is then supposed to process the data, create some analytics pages and return them back to the client. If the returned page contains tag like <meta http-equiv='Refresh' content='3; URL=somepage'> an (external) browser is opened with the specified URL and the user can then interact directly with the server, thru pages it serves. For testing purposes one can specify different URL for upload of files, by setting org.netbeans.modules.uihandler.Submit property when invoking NetBeans.

Adding own UI gestures

The base module is in fact just an infrastructure which collects data about UI gestures, but the actual gestures need to be delivered to it somehow. Here is the description of the ways how one can extend own modules to cooperate with this UI gestures infrastructure.

To feed own data about special UI gestures one can just create own Logger.getLogger(UI_LOGGER_NAME_VALUE+".ownname") and send own log records to it. UI_LOGGER_NAME_VALUE is a value of UI_LOGGER_NAME resource bundle key, defining the name of the logger. The format of the log messages shall follow the one described by the structured logging document, e.g. the LogRecord shall have associated ResourceBundle and the record's getMessage shall point to a key in that bundle. there is an extension to the regular formatting done by the logging formatter that, in order to achieve nicer appearance to the user, allows each record to be associated with an icon. Just define MSG_KEY_ICON_BASE in the bundle associated with the LogRecord (where the MSG_KEY is the string returned by record.getMessage()) and the value is then going to be used for the Node representing the UI gesture.

Sometimes direct logging may not be possible. For example for performance data it might be meaningful to collect the information over a longer time period and only at the end output some statistics. This is supported as well. Just implement and register one of the interfaces from the API of this module and properly register them and the implementation will be called when the logger module is activated or when the user finishes the work with the application. In order to keep dependencies clean, it is strongly adviced to make modules that implement this API eager, so they get enabled as soon as the UI logger module is enabled.

These usecases are realized as described in here in provided UI specification.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of logger interfaces
Interface NameIn/OutStabilitySpecified in What Document?
UI_LOGGER_NAMEExportedUnder Development

The info about various UI events in the system is collected thru listening on log records send to Logger.getLogger(UI_LOGGER_NAME_VALUE) , where UI_LOGGER_NAME_VALUE is a value of UI_LOGGER_NAME resource bundle key, defining the name of the UI usage logger. Any code in the system can get instance of this logger or any child logger and send useful informations to it. At the end of the session the last few hundereds events is taken and displayed to the user for further processing.

METRICS_LOGGER_NAMEExportedUnder Development

The info about various UI events in the system is collected thru listening on log records send to Logger.getLogger(METRICS_LOGGER_NAME_VALUE) , where METRICS_LOGGER_NAME_VALUE is a value of METRICS_LOGGER_NAME resource bundle key, defining the name of the metrics logger. Any code in the system can get instance of this logger or any child logger and send useful informations to it. At the end of the session the last few hundereds events is taken and displayed to the user for further processing.

MSG_USER_CONFIGURATIONExportedUnder Development

Before the results are submitted one more LogRecord is added. This LogRecord message is set to MSG_USER_CONFIGURATION . Four upto six parameters are added. Four common parameters are added always before sending logger info and two error parameters are added only if an exception rised.
  • Operating system name, version and architecture
  • Virtual machine name and version
  • Application version and build number
  • User name
  • Error summary
  • User's comment to an error situation

Group of property interfaces
Interface NameIn/OutStabilitySpecified in What Document?
WELCOME_URLExportedPrivate

There is a key in the org.netbeans.modules.uihandler.Bundle that specifies the location of the page on a server one shall query and display to the user when the module is about the submit usage data for analysis.

METRICS_URLExportedPrivate

There is a key in the org.netbeans.modules.uihandler.Bundle that specifies the location of the page on a server one shall query and display to the user when the module is about the submit metrics data for analysis.

ERROR_URLExportedPrivate

There is a key in the org.netbeans.modules.uihandler.Bundle that specifies the location of the page on a server one shall query and display to the user when the module is about the submit an error report.

ICON_BASEExportedUnder Development

there is an extension to the regular formatting done by the logging formatter that, in order to achieve nicer appearance to the user, allows each record to be associated with an icon. Just define MSG_KEY_ICON_BASE in the bundle associated with the LogRecord (where the MSG_KEY is the string returned by record.getMessage()) and the value is then going to be used for the Node representing the UI gesture.

REGISTRATION_URLExportedPrivate

There is a key in the org.netbeans.modules.exceptions.Bundle that specifies the location of the page on a server. This page should be display to the user when he uses a "register here" link on ReportPanel.

Group of java.io.File interfaces
Interface NameIn/OutStabilitySpecified in What Document?
WelcomePageContentExportedFriend

The page pointed by WELCOME_URL can contain any XHTML text, but it also should contain a <form/> tag that defines <input type="hidden" name="submit" value="localizedName"/>. The localizedName is then going to be used for a button for the dialog displaying the summary. When this button is invoked, the "action" URL is then feed with data from the UI logs. The server is then supposed to process the data, create some analytics pages and return them back to the client. If the returned page contains tag like <meta http-equiv='Refresh' content='3; URL=somepage'> an (external) browser is opened with the specified URL and the user can then interact directly with the server, thru pages it serves.

var-log-uigesturesExportedPrivate

The module stores its loggging information in $userdir/var/log/uigestures and $userdir/var/log/uigestures.1 files. There are written whenever a UI action happens and read when the data are send to server. Each of these files is supposed to contain at most 1000 of actions

Group of systemproperty interfaces
Interface NameIn/OutStabilitySpecified in What Document?
org.netbeans.modules.uihandler.SubmitExportedPrivate

For testing purposes one can specify different URL for upload of files, by setting org.netbeans.modules.uihandler.Submit property when invoking NetBeans.

nb.show.statistics.uiExportedPrivate

System property "nb.show.statistics.ui" controls if UI for Usage statistics is displayed in General panel. If this property is non null (for IDE) UI is shown. This property contains key of preference used to save status - true if usage statistics are collected and uploaded, false if not. Key is "usageStatisticsEnabled" and is described below.

Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
CallbackInterfacesExportedUnder Development .../modules/uihandler/api/Activated.html

interfaces from the API of this module

Group of preferences interfaces
Interface NameIn/OutStabilitySpecified in What Document?
org.netbeans.modules.uihandler.autoautoSubmitWhenFullExportedUnder Development

This property allows other parts of the system to turn on/off the automatic submission of log files to the server. This can be used for example by installer to query the user and on his confirmation create config/Preferences/org/netbeans/modules/uihandler.properties file in user dir or in nbX.Y cluster with one line saying: autoSubmitWhenFull=true. This works since version 1.30 of this module.

Implementation Details

Where are the sources for the module?

The sources for the module are in the Apache Git repositories or in the GitHub repositories.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?

Modules may use functionality of this module either by depending on its presence and registering callback interfaces provided by its API. Or the modules do not need to depend on this module at all, and just generate log records to the UI_LOGGER_NAME_VALUE+".someloggername" logger. These records are then going to be consumed by this module, if enabled.

Read more about the implementation in the answers to architecture questions.

Skip navigation links
org.netbeans.modules.uihandler 2.54