Ember
Loading...
Searching...
No Matches
Ember::Monitor::MonitorHierarchyView Class Reference

Hierarchy view with live status updates. More...

#include <MonitorNavigatorTab.h>

Inheritance diagram for Ember::Monitor::MonitorHierarchyView:
EmberUI::NavigatorHierarchyView EmberUI::TreeHierarchyTab ITab

Public Member Functions

 MonitorHierarchyView (wxWindow *parent, const EmberUI::TreeHierarchyConfig &config)
void SetStateManager (std::shared_ptr< Network::StateManager > sm)
 Assigns the state manager used for live status lookups.
void RefreshStatus ()
 Refreshes status icons and labels for visible tree nodes.
void RebuildNodeIdMap ()
 Rebuilds the node ID to tree item mapping.
void InvalidateNodeIdMap ()
 Clears the node ID map; call when tree structure changes.
Public Member Functions inherited from EmberUI::NavigatorHierarchyView
 NavigatorHierarchyView (wxWindow *parent, const EmberUI::TreeHierarchyConfig &config)
void SetContextMenuPopulator (ContextMenuPopulator cb)
 Sets callback to populate context menu for a node.
void SetContextMenuHandler (ContextMenuHandler cb)
 Sets callback to handle context menu command.
void SetNodeActivatedHandler (NodeActivatedHandler cb)
 Sets callback invoked when a node is activated (double-click).
Public Member Functions inherited from EmberUI::TreeHierarchyTab
 TreeHierarchyTab (wxWindow *parent, const TreeHierarchyConfig &config={})
 ~TreeHierarchyTab () override=default
wxWindow * GetWidget () override
 Returns the wxWidgets window used as the tab content.
wxString GetTitle () const override
 Returns the display title of the tab.
wxString GetTabType () const override
 Returns the tab type identifier.
void SetTree (std::shared_ptr< EmberCore::ITreeStructure > tree)
 Sets the tree structure to display.
void ClearTree ()
 Clears the tree and removes all items.
void RefreshTree ()
 Rebuilds the tree from the current structure.
void ExpandAll ()
 Expands all tree items.
void CollapseAll ()
 Collapses all tree items.
void SelectNodeById (size_t nodeId)
 Selects the tree item with the given node ID.
EmberCore::ITreeNodeGetSelectedNode () const
 Returns the currently selected node, or nullptr.
void SetSelectionCallback (SelectionCallback cb)
 Sets callback invoked when selection changes.
void SetLayoutInvalidationCallback (LayoutInvalidationCallback cb)
 Sets callback invoked when layout needs invalidation (e.g. canvas sync).
const TreeHierarchyConfigGetConfig () const
 Returns the current configuration.
void ApplyConfig (const TreeHierarchyConfig &config)
 Applies new configuration and refreshes the tree.
Public Member Functions inherited from ITab
virtual ~ITab ()=default
virtual wxBitmap GetIcon () const
 Returns the tab icon bitmap; defaults to null.
virtual void Initialize ()
 Called once when the tab is first created.
virtual void Refresh ()
 Refreshes the tab content.
virtual void OnActivated ()
 Called when the tab becomes active.
virtual void OnDeactivated ()
 Called when the tab becomes inactive.
virtual void OnClosed ()
 Called when the tab is closed.
virtual bool IsValid () const
 Returns true if the tab is in a valid state.
virtual bool CanClose () const
 Returns true if the tab can be closed.
virtual bool CanMove () const
 Returns true if the tab can be moved/reordered.
virtual wxString SerializeState () const
 Serializes tab state to a string for persistence.
virtual void DeserializeState (const wxString &state)
 Restores tab state from a serialized string.
virtual bool HasUnsavedChanges () const
 Returns true if the tab has unsaved changes.
virtual bool Save ()
 Saves the tab content; returns true on success.
virtual bool SupportsOperation (const wxString &operation) const
 Returns true if the tab supports the given operation.
virtual bool ExecuteOperation (const wxString &operation, const wxString &parameter="")
 Executes an operation with optional parameter; returns true on success.

Protected Member Functions

wxString GetNodeDisplayText (EmberCore::ITreeNode *node) const override
 Returns display text including status for the given node.
void OnNodeExpanding (EmberCore::ITreeNode *) override
 Called when a node is expanded (no-op).
void OnNodeCollapsing (EmberCore::ITreeNode *) override
 Called when a node is collapsed (no-op).
Protected Member Functions inherited from EmberUI::NavigatorHierarchyView
void OnPopulateContextMenu (EmberCore::ITreeNode *node, wxMenu &menu) override
 Hook to populate context menu for a node.
void OnContextMenuCommand (int id, EmberCore::ITreeNode *node) override
 Hook to handle context menu command.
void OnNodeActivated (EmberCore::ITreeNode *node) override
 Hook called when a node is double-clicked/activated.
Protected Member Functions inherited from EmberUI::TreeHierarchyTab
virtual void OnSelectionChanged (EmberCore::ITreeNode *node)
 Called when selection changes; subclasses may override.
wxTreeCtrl * GetTreeCtrl () const
 Returns the tree control widget.
wxSearchCtrl * GetSearchCtrl () const
 Returns the search control widget.
std::shared_ptr< EmberCore::ITreeStructureGetTree () const
 Returns the current tree structure.
EmberCore::ITreeNodeGetNodeFromItem (const wxTreeItemId &item) const
 Extracts ITreeNode from a tree item (or nullptr if DummyTreeItemData).
wxTreeItemId FindItemById (size_t nodeId, const wxTreeItemId &start=wxTreeItemId())
 Finds tree item by node ID, optionally starting from given item.
wxTreeItemId ExpandPathToNode (EmberCore::ITreeNode *node)
 Expands path from root to node and returns its item ID.
void ScrollToItemHorizontally (const wxTreeItemId &item)
 Scrolls horizontally so the item is visible.
void SelectRange (const wxTreeItemId &from, const wxTreeItemId &to)
 Selects a range of items from from to to.

Private Member Functions

void RebuildNodeIdMapRecursive (const wxTreeItemId &item)
void UpdateStatusIcons ()
void UpdateChangedNodes (const std::vector< int64_t > &changedIds)
void UpdateSingleItem (const wxTreeItemId &item, EmberCore::ITreeNode *node)
wxString GetStatusLabel (int status) const

Private Attributes

std::shared_ptr< Network::StateManagerm_stateManager
std::unordered_map< int64_t, wxTreeItemId > m_nodeIdToItem
std::chrono::steady_clock::time_point m_lastRefreshTime

Static Private Attributes

static constexpr int64_t REFRESH_INTERVAL_MS = 300

Additional Inherited Members

Public Types inherited from EmberUI::NavigatorHierarchyView
using ContextMenuPopulator = std::function<void(EmberCore::ITreeNode *, wxMenu &)>
using ContextMenuHandler = std::function<void(int, EmberCore::ITreeNode *)>
using NodeActivatedHandler = std::function<void(EmberCore::ITreeNode *)>
Public Types inherited from EmberUI::TreeHierarchyTab
using SelectionCallback = std::function<void(EmberCore::ITreeNode *)>
using LayoutInvalidationCallback = std::function<void()>
Protected Attributes inherited from EmberUI::TreeHierarchyTab
TreeHierarchyConfig m_config
wxTreeItemId m_lastSelectedItem

Detailed Description

Hierarchy view with live status updates.

Definition at line 13 of file MonitorNavigatorTab.h.

Constructor & Destructor Documentation

◆ MonitorHierarchyView()

Ember::Monitor::MonitorHierarchyView::MonitorHierarchyView ( wxWindow * parent,
const EmberUI::TreeHierarchyConfig & config )

Definition at line 10 of file MonitorNavigatorTab.cpp.

Member Function Documentation

◆ GetNodeDisplayText()

wxString Ember::Monitor::MonitorHierarchyView::GetNodeDisplayText ( EmberCore::ITreeNode * node) const
overrideprotectedvirtual

Returns display text including status for the given node.

Reimplemented from EmberUI::TreeHierarchyTab.

Definition at line 13 of file MonitorNavigatorTab.cpp.

◆ GetStatusLabel()

wxString Ember::Monitor::MonitorHierarchyView::GetStatusLabel ( int status) const
private

Definition at line 167 of file MonitorNavigatorTab.cpp.

◆ InvalidateNodeIdMap()

void Ember::Monitor::MonitorHierarchyView::InvalidateNodeIdMap ( )
inline

Clears the node ID map; call when tree structure changes.

Definition at line 25 of file MonitorNavigatorTab.h.

◆ OnNodeCollapsing()

void Ember::Monitor::MonitorHierarchyView::OnNodeCollapsing ( EmberCore::ITreeNode * )
inlineoverrideprotectedvirtual

Called when a node is collapsed (no-op).

Reimplemented from EmberUI::TreeHierarchyTab.

Definition at line 33 of file MonitorNavigatorTab.h.

◆ OnNodeExpanding()

void Ember::Monitor::MonitorHierarchyView::OnNodeExpanding ( EmberCore::ITreeNode * )
inlineoverrideprotectedvirtual

Called when a node is expanded (no-op).

Reimplemented from EmberUI::TreeHierarchyTab.

Definition at line 31 of file MonitorNavigatorTab.h.

◆ RebuildNodeIdMap()

void Ember::Monitor::MonitorHierarchyView::RebuildNodeIdMap ( )

Rebuilds the node ID to tree item mapping.

Definition at line 59 of file MonitorNavigatorTab.cpp.

◆ RebuildNodeIdMapRecursive()

void Ember::Monitor::MonitorHierarchyView::RebuildNodeIdMapRecursive ( const wxTreeItemId & item)
private

Definition at line 67 of file MonitorNavigatorTab.cpp.

◆ RefreshStatus()

void Ember::Monitor::MonitorHierarchyView::RefreshStatus ( )

Refreshes status icons and labels for visible tree nodes.

Definition at line 31 of file MonitorNavigatorTab.cpp.

◆ SetStateManager()

void Ember::Monitor::MonitorHierarchyView::SetStateManager ( std::shared_ptr< Network::StateManager > sm)
inline

Assigns the state manager used for live status lookups.

Definition at line 18 of file MonitorNavigatorTab.h.

◆ UpdateChangedNodes()

void Ember::Monitor::MonitorHierarchyView::UpdateChangedNodes ( const std::vector< int64_t > & changedIds)
private

Definition at line 85 of file MonitorNavigatorTab.cpp.

◆ UpdateSingleItem()

void Ember::Monitor::MonitorHierarchyView::UpdateSingleItem ( const wxTreeItemId & item,
EmberCore::ITreeNode * node )
private

Definition at line 113 of file MonitorNavigatorTab.cpp.

◆ UpdateStatusIcons()

void Ember::Monitor::MonitorHierarchyView::UpdateStatusIcons ( )
private

Definition at line 139 of file MonitorNavigatorTab.cpp.

Member Data Documentation

◆ m_lastRefreshTime

std::chrono::steady_clock::time_point Ember::Monitor::MonitorHierarchyView::m_lastRefreshTime
private

Definition at line 44 of file MonitorNavigatorTab.h.

◆ m_nodeIdToItem

std::unordered_map<int64_t, wxTreeItemId> Ember::Monitor::MonitorHierarchyView::m_nodeIdToItem
private

Definition at line 43 of file MonitorNavigatorTab.h.

◆ m_stateManager

std::shared_ptr<Network::StateManager> Ember::Monitor::MonitorHierarchyView::m_stateManager
private

Definition at line 42 of file MonitorNavigatorTab.h.

◆ REFRESH_INTERVAL_MS

int64_t Ember::Monitor::MonitorHierarchyView::REFRESH_INTERVAL_MS = 300
staticconstexprprivate

Definition at line 45 of file MonitorNavigatorTab.h.


The documentation for this class was generated from the following files: