observer-generics {iSEE}R Documentation

Generic for the panel observers

Description

An overview of the generic for defining the panel observers, along with recommendations on its implementation.

Creating parameter observers

In .createObservers(x, se, input, session, pObjects, rObjects), the required arguments are:

Methods for this generic are expected to set up all observers required to respond to changes in the interface elements set up by .defineInterface. Recall that each interface element has an ID of the form of PANEL_SLOT, where PANEL is the panel name and SLOT is the name of the slot modified by the interface element; so observers should respond to those names in input. The return value of this generic is not used; only the side-effect of observer set-up is relevant.

It is the developer's responsibility to call callNextMethod to set up the observers required by the parent class. This is best done by calling callNextMethod at the top of the method before defining up additional observers. Each parent class should implement observers for its slots, so it is usually only necessary to implement observers for any newly added slots in a particular class.

Modifying the memory

Consider an observer for an interface element that modifies a slot of x. The code within this observer is expected to modify the “memory” of the app state in pObjects, via:

new_value <- input[[paste0(PANEL, "_", SLOT)]]
pObjects$memory[[PANEL]][[SLOT]] <- new_value

This enables iSEE to keep a record of the current state of the application. In fact, any changes must go through pObjects$memory before they change the output in .renderOutput; there is no direct interaction between input and output in this framework.

Triggering re-rendering

To trigger re-rendering of an output, observers should call .requestUpdate(PANEL, rObjects), where PANEL is the name of the current panel. This will request a re-rendering of the output with no additional side effects and is most useful for responding to aesthetic parameters.

In some cases, changes to some parameters may invalidate existing multiple selections, e.g., brushes and lassos are no longer valid if the variable on the axes are altered. Observers responding to such changes should instead call .requestCleanUpdate, which will destroy all existing selections in order to avoid misleading conclusions.

Author(s)

Aaron Lun


[Package iSEE version 2.0.0 Index]