A dispatcher that emits an event whenever the internal state has changed.
The number of pages that have been fetched.
Indicates if the controller is connected to the tree backend, and can make requests.
Collapses all nodes in the tree.
Collapses a node with the given node ID.
A node ID to collapse.
Expands all nodes in the tree.
Expands a node with the given node ID.
A node ID to expand.
Invokes a network request that will expand all the parent nodes for the node mapped to the given ID.
An ID of an item.
A promise that resolves with the index of the node after expansion.
Fetches the metadata keys for the current scene view.
Fetches a page at the given index. Once the data has been fetched, the
controller will emit an onStateChange
event that contains rows with the
fetched page. If a page is invalidated before the request completes, the
response is ignored.
If the index is out of range, returns without fetching any data.
A 0 based index to fetch.
Fetches a page that contains the given row offset.
The row offset of the page to fetch.
Fetches pages that contain the given row ranges.
A start offset, inclusive.
The end offset, inclusive.
Performs a network request that will filter the nodes in the tree that match the given term and options.
The filter term.
The options to apply to the filter.
Returns a list of page indices within a range that have not been loaded.
The start page index, inclusive.
The end page index, inclusive.
A list of pages indices that have not been loaded.
Returns the page at the given index, or undefined
if one doesn't exist.
The index to return.
A Page
if found, otherwise undefined
.
Clears page data that is outside a given range. Uses a distance algorithm to removes pages that are furthest from either end of the range. This method is useful for clearing out data that is not needed anymore to keep memory pressure in the client low.
The index of the starting page in the range.
The index of the ending page in the range.
A minimum number of pages to keep. No cleanup is performed if the number of fetched pages doesn't meet this threshold.
Checks if the page at the given index is loaded.
A page index.
true
if the page is loaded. false
otherwise.
Registers an event listener that will be invoked when the state changes
The listener to add.
A disposable that can be used to remove the listener.
Sets the active rows. Active rows dictate which pages will be refetched when the tree changes.
The starting row index.
The ending row index.
A promise that resolves when the first page of data has been loaded.
The
SceneTreeController
is responsible for coordinating interactions of the view, fetching and mutating tree data on the server, maintaining state and notifying the view about state changes.