TreeViewProvider

Trait TreeViewProvider 

Source
pub trait TreeViewProvider:
    Environment
    + Send
    + Sync {
Show 13 methods // Required methods fn RegisterTreeDataProvider<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, OptionsValue: Value, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn UnregisterTreeDataProvider<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn RevealTreeItem<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ItemHandle: String, OptionsValue: Value, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn RefreshTreeView<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ItemsToRefreshValue: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn SetTreeViewMessage<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, Message: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn SetTreeViewTitle<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, Title: Option<String>, Description: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn SetTreeViewBadge<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, BadgeValue: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn GetChildren<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ElementHandle: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn GetTreeItem<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ElementHandle: String, ) -> Pin<Box<dyn Future<Output = Result<Value, CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn OnTreeNodeExpanded<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ElementHandle: String, IsExpanded: bool, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn OnTreeSelectionChanged<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, SelectedHandles: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn PersistTreeViewState<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ) -> Pin<Box<dyn Future<Output = Result<Value, CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn RestoreTreeViewState<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, StateValue: Value, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

An abstract service contract for an environment component that can manage the lifecycle and data flow for custom tree views.

This trait uses a hybrid model:

  • “Push” methods are called by the extension host (Cocoon) to manage the view’s state and appearance in the main host (Mountain).
  • “Pull” methods are called by the main host (Mountain) to request data from the provider in the extension host (Cocoon) on-demand (e.g., when a user expands a node).

Required Methods§

Source

fn RegisterTreeDataProvider<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, OptionsValue: Value, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Informs the host that a new tree data provider has been registered by an extension. The host should prepare to display a tree view with the given ID and options.

§Parameters
  • ViewIdentifier: A unique identifier for the tree view.
  • OptionsValue: DTO containing options like CanSelectMany.
Source

fn UnregisterTreeDataProvider<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Informs the host that a tree data provider has been disposed of.

§Parameters
  • ViewIdentifier: The ID of the tree view to unregister.
Source

fn RevealTreeItem<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ItemHandle: String, OptionsValue: Value, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Asks the host UI to reveal and/or expand a specific item in a tree view.

§Parameters
  • ViewIdentifier: The ID of the target tree view.
  • ItemHandle: The unique handle of the item to reveal.
  • OptionsValue: DTO specifying reveal options like select and focus.
Source

fn RefreshTreeView<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ItemsToRefreshValue: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Notifies the host that some or all of the data in a tree view has changed and needs to be re-fetched and re-rendered.

§Parameters
  • ViewIdentifier: The ID of the tree view to refresh.
  • ItemsToRefreshValue: Optional. If None, the entire tree is refreshed. If Some, it’s a DTO representing the specific items that have changed, allowing for targeted updates.
Source

fn SetTreeViewMessage<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, Message: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets a message to be displayed in the tree view’s empty state.

§Parameters
  • ViewIdentifier: The ID of the target tree view.
  • Message: An optional message to display. None clears the message.
Source

fn SetTreeViewTitle<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, Title: Option<String>, Description: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets the title and description of the tree view container.

§Parameters
  • ViewIdentifier: The ID of the target tree view.
  • Title: An optional new title for the view. None might reset to default.
  • Description: An optional description or sub-title. None clears it.
Source

fn SetTreeViewBadge<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, BadgeValue: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets a badge (e.g., a number) on the tree view’s container icon.

§Parameters
  • ViewIdentifier: The ID of the target tree view.
  • BadgeValue: A DTO for the badge, or None to clear it.
Source

fn GetChildren<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ElementHandle: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the children for a given tree element.

§Parameters
  • ViewIdentifier: The ID of the target tree view.
  • ElementHandle: An optional handle for the parent element. If None, the root-level items should be returned.
§Returns

A vector of TreeItemDTOs representing the children.

Source

fn GetTreeItem<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ElementHandle: String, ) -> Pin<Box<dyn Future<Output = Result<Value, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the full TreeItem DTO for a given element handle. This is used by the host to get the display properties of an item.

§Parameters
  • ViewIdentifier: The ID of the target tree view.
  • ElementHandle: The handle of the element to retrieve.
§Returns

A TreeItemDTO as a JSON value.

Source

fn OnTreeNodeExpanded<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ElementHandle: String, IsExpanded: bool, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles tree node expansion/collapse events. Called when a user expands or collapses a node in the tree view.

§Parameters
  • ViewIdentifier: The ID of the target tree view.
  • ElementHandle: The handle of the element being expanded/collapsed.
  • IsExpanded: Whether the node is being expanded (true) or collapsed (false).
Source

fn OnTreeSelectionChanged<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, SelectedHandles: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles tree selection changes. Called when the user selects or deselects items in the tree view.

§Parameters
  • ViewIdentifier: The ID of the target tree view.
  • SelectedHandles: Vector of handles currently selected.
Source

fn PersistTreeViewState<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, ) -> Pin<Box<dyn Future<Output = Result<Value, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persists the current state of a tree view. Saves the expansion and selection state for later restoration.

§Parameters
  • ViewIdentifier: The ID of the tree view to persist.
§Returns

JSON value representing the persisted state.

Source

fn RestoreTreeViewState<'life0, 'async_trait>( &'life0 self, ViewIdentifier: String, StateValue: Value, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Restores a previously persisted tree view state.

§Parameters
  • ViewIdentifier: The ID of the tree view to restore.
  • StateValue: The previously persisted state as JSON value.

Implementors§