If you are looking for Jitsi Meet, the WebRTC compatible video conferencing product click here.

previous | TOC | next

UI Service Documentation

Show application dialogs

We could imagine some application forms within the UI, like the “Add contact” form for example, that could be interesting for other bundles. It would be nice if the right button menu of the systray icon allows to add a new contact. Through the UI Service other bundles could obtain an application dialog in the form of ExportedDialog, which allows them to show, hide, resize or move it.

If you want to implement the UIService: 1.Associate a DialogID to all your ‘exportable dialogs’. 2.Implement the isDialogExported (DialogID) method to check if the dialog with the given DialogID is supported. 3.Implement the getExportedDialogs method, to return a set of all your exportable dialogs’ DialogIDs. 4.Implement the getApplicationDialog (DialogID) method to return the dialog corresponding to the given DialogID.

What is an “application dialog”?

  1. The “application dialog” is not necessarily a GUI dialog box widget, it could be a window, a panel, a frame, etc.
  2. It should be an existing component of the current UI implementation.
  3. It should have a DialogID associated with it that identifies it. The DialogID is one of the DIALOG_XXX constants defined in the UIService interface.

How to show an “application dialog”?

Before obtaining any application dialog you should check the list of exported dialogs returned by the current UI Service implementation. You could do this by invoking the getExportedDialogs method or by checking for a given DialogID with the isDialogExported(DialogID) method. You get the desired dialog by invoking getApplicationDialog(DialogID) method. The DialogID should be one of the list returned from getExportedDialogs. The returned dialog is an implementation of the ExportedDialog interface, thus you could invoke its isDialogVisible, showDialog, etc. methods.

NOTE The DialogID should be one of the ids returned by getExportedDialogs method, otherwise an IllegalArgumentException is thrown.

Example: Gets the “Add contact” application dialog and if not visible, shows it.

//Obtain the UI Service
ServiceReference uiServiceRef
    = context.getServiceReference(UIService.class.getName());
UIService uiService =
    (UIService)context.getService(uiServiceRef);

//Check if there is an "Add contact" dialog, exported from the
//current UI implementation.
boolean isDialogExported
    = uiService.isDialogExported(UIService.DIALOG_ADD_CONTACT);

if(isDialogExported) {
    //Obtains the "Add contact" dialog
    ExportedDialog configDialog = uiService
        .getApplicationDialog(UIService.DIALOG_ADD_CONTACT);

    //If the "Add contact" dialog is not currently visible, show it.
    if(!configDialog.isDialogVisible()) {
        configDialog.showDialog();
    }
}

previous | TOC | next