Ember
Loading...
Searching...
No Matches
MonitorNavigatorTab.h
Go to the documentation of this file.
1#pragma once
2
4#include "Tabs/NavigatorTab.h"
5#include <chrono>
6#include <memory>
7#include <unordered_map>
8
9namespace Ember {
10namespace Monitor {
11
14 public:
15 MonitorHierarchyView(wxWindow *parent, const EmberUI::TreeHierarchyConfig &config);
16
18 void SetStateManager(std::shared_ptr<Network::StateManager> sm) { m_stateManager = std::move(sm); }
20 void RefreshStatus();
22 void RebuildNodeIdMap();
23
26
27 protected:
29 wxString GetNodeDisplayText(EmberCore::ITreeNode *node) const override;
34
35 private:
36 void RebuildNodeIdMapRecursive(const wxTreeItemId &item);
37 void UpdateStatusIcons();
38 void UpdateChangedNodes(const std::vector<int64_t> &changedIds);
39 void UpdateSingleItem(const wxTreeItemId &item, EmberCore::ITreeNode *node);
40 wxString GetStatusLabel(int status) const;
41
42 std::shared_ptr<Network::StateManager> m_stateManager;
43 std::unordered_map<int64_t, wxTreeItemId> m_nodeIdToItem;
44 std::chrono::steady_clock::time_point m_lastRefreshTime;
45 static constexpr int64_t REFRESH_INTERVAL_MS = 300;
46};
47
50 public:
51 explicit MonitorNavigatorTab(wxWindow *parent);
52
53 wxString GetTitle() const override { return "Navigator"; }
54 wxString GetTabType() const override { return "MonitorNavigator"; }
55
57 void SetMonitorTree(std::shared_ptr<EmberCore::ITreeStructure> tree,
58 std::shared_ptr<Network::StateManager> stateManager, const std::string &treeId = "");
60 void ClearMonitorTree();
62 void RefreshStatus();
63
64 protected:
67 const EmberUI::TreeHierarchyConfig &cfg) override;
68
69 private:
71 std::shared_ptr<Network::StateManager> m_stateManager;
72};
73
74} // namespace Monitor
75} // namespace Ember
Abstract interface for tree nodes that can be visualized.
Definition ITreeNode.h:31
TreeHierarchyTab subclass with context menu and node activation hooks.
Main navigator tab with tree list, hierarchy view, search, and breadcrumb navigation.
Hierarchy view with live status updates.
std::unordered_map< int64_t, wxTreeItemId > m_nodeIdToItem
wxString GetNodeDisplayText(EmberCore::ITreeNode *node) const override
Returns display text including status for the given node.
std::shared_ptr< Network::StateManager > m_stateManager
void UpdateSingleItem(const wxTreeItemId &item, EmberCore::ITreeNode *node)
void OnNodeExpanding(EmberCore::ITreeNode *) override
Called when a node is expanded (no-op).
std::chrono::steady_clock::time_point m_lastRefreshTime
void SetStateManager(std::shared_ptr< Network::StateManager > sm)
Assigns the state manager used for live status lookups.
void InvalidateNodeIdMap()
Clears the node ID map; call when tree structure changes.
void UpdateChangedNodes(const std::vector< int64_t > &changedIds)
void OnNodeCollapsing(EmberCore::ITreeNode *) override
Called when a node is collapsed (no-op).
void RefreshStatus()
Refreshes status icons and labels for visible tree nodes.
void RebuildNodeIdMapRecursive(const wxTreeItemId &item)
MonitorHierarchyView(wxWindow *parent, const EmberUI::TreeHierarchyConfig &config)
static constexpr int64_t REFRESH_INTERVAL_MS
void RebuildNodeIdMap()
Rebuilds the node ID to tree item mapping.
wxString GetTabType() const override
Returns the tab type identifier.
void ClearMonitorTree()
Clears the current monitor tree.
EmberUI::NavigatorHierarchyView * CreateHierarchyView(wxWindow *parent, const EmberUI::TreeHierarchyConfig &cfg) override
Creates and returns a MonitorHierarchyView instance.
void RefreshStatus()
Refreshes status display for all visible nodes.
void SetMonitorTree(std::shared_ptr< EmberCore::ITreeStructure > tree, std::shared_ptr< Network::StateManager > stateManager, const std::string &treeId="")
Sets the monitor tree and state manager; optionally associates a tree ID.
std::shared_ptr< Network::StateManager > m_stateManager
wxString GetTitle() const override
Returns the display title of the tab.
Configuration for TreeHierarchyTab appearance and behavior.