interface-generics: Generics for the panel interface

interface-genericsR Documentation

Generics for the panel interface

Description

An overview of the generics for defining the user interface (UI) for each panel as well as some recommendations on their implementation.

Defining the parameter interface

.defineInterface(x, se, select_info) defines the UI for modifying all parameters for a given panel. The required arguments are:

  • x, an instance of a Panel class.

  • se, a SummarizedExperiment object containing the current dataset. This can be assumed to have been produced by running .refineParameters(x, se).

  • select_info, a list of two lists, single and multiple, each of which contains the character vectors row and column. This specifies the panels available for transmitting single/multiple selections on the rows/columns, see ?.multiSelectionDimension and ?.singleSelectionDimension for more details.

Methods for this generic are expected to return a list of collapseBox elements. Each parameter box can contain arbitrary numbers of additional UI elements, each of which is expected to modify one slot of x upon user interaction.

The ID of each interface element should follow the form of PANEL_SLOT where PANEL is the panel name (from .getEncodedName(x)) and SLOT is the name of the slot modified by the interface element, e.g., "ReducedDimensionPlot1_Type". Each interface element should have an equivalent observer in .createObservers unless they are hidden by .hideInterface (see below).

It is the developer's responsibility to call callNextMethod to obtain interface elements for parent classes. A common strategy is to combine the output of callNextMethod with additional collapseBox elements to achieve the desired UI structure.

Defining the data parameter interface

.defineDataInterface(x, se, select_info) defines the UI for data-related (i.e., non-aesthetic) parameters. The required arguments are the same as those for .defineInterface. Methods for this generic are expected to return a list of UI elements for altering data-related parameters, which are automatically placed inside the “Data parameters” collapsible box. Each element's ID should still follow the PANEL_SLOT pattern described above.

This generic aims to provide a simpler alternative to specializing .defineInterface for the most common use case. New panels can write methods for this generic to add their own interface elements for altering the contents of the panel, without needing to reimplement other UI elements in the parent class's .defineInterface method. Conversely, there is no obligation to write a method for this generic if one is planning to specialize .defineInterface.

It is the developer's responsibility to call callNextMethod to obtain interface elements for parent classes.

Hiding interface elements

.hideInterface(x, field) determines whether certain UI elements should be hidden from the user. The required arguments are:

  • x, an instance of a Panel class.

  • field, string containing the name of a slot of x.

Methods for this generic are expected to return a logical scalar indicating whether the interface element corresponding to field should be hidden from the user. This is useful for hiding UI elements that cannot be changed or have no effect, especially in highly specialized subclasses where some concepts in the parent class may no longer be relevant. (The alternative would be to reimplement all of the parent's .defineInterface method just to omit a handful of UI elements!)

It is the developer's responsibility to call callNextMethod to hide the same interface elements as parent classes. This is not strictly required if one wishes to expose previously hidden elements.

Author(s)

Aaron Lun


csoneson/SEE documentation built on Oct. 13, 2024, 10:19 a.m.